AGX Dynamics 2.41.3.0
Loading...
Searching...
No Matches
agx::Callback Class Reference

Generalized callback, using std::function. More...

#include <Callback.h>

+ Inheritance diagram for agx::Callback:

Public Types

typedef std::function< void()> CallbackFunction
 

Public Member Functions

 Callback ()
 
 Callback (const CallbackFunction &func, bool repeatEnable=true)
 
template<class ClassT >
 Callback (void(ClassT::*fun)(), ClassT *obj, bool repeatEnable=true)
 
const CallbackFunctionimplementation () const
 Return the std representation.
 
bool isRepeating () const
 
bool isValid () const
 
 operator bool () const
 
 operator const CallbackFunction & () const
 
void operator() () const
 Execute the callback.
 
void run () const
 

Detailed Description

Generalized callback, using std::function.

Example:

class Foo { public: void Foo() { Callback callback(&Foo::bar, this); callback(); // Will print 'bar called' }

void bar() { printf("bar called\n"); } };

Definition at line 53 of file Callback.h.

Member Typedef Documentation

◆ CallbackFunction

typedef std::function<void ()> agx::Callback::CallbackFunction

Definition at line 56 of file Callback.h.

Constructor & Destructor Documentation

◆ Callback() [1/3]

agx::Callback::Callback ( )

Definition at line 268 of file Callback.h.

◆ Callback() [2/3]

agx::Callback::Callback ( const CallbackFunction func,
bool  repeatEnable = true 
)
Parameters
func- Callback function
repeatEnable- Is repeat enabled or not.

Definition at line 269 of file Callback.h.

◆ Callback() [3/3]

template<class ClassT >
agx::Callback::Callback ( void(ClassT::*)()  fun,
ClassT *  obj,
bool  repeatEnable = true 
)
Parameters
obj-
repeatEnable- Is repeat enabled or not.

Definition at line 264 of file Callback.h.

Member Function Documentation

◆ implementation()

const Callback::CallbackFunction & agx::Callback::implementation ( ) const

Return the std representation.

Definition at line 271 of file Callback.h.

◆ isRepeating()

bool agx::Callback::isRepeating ( ) const
Returns
True if the callback is repeating (when added to an agx::Event)

Definition at line 272 of file Callback.h.

Referenced by agx::Event::trigger().

◆ isValid()

bool agx::Callback::isValid ( ) const
Returns
True if the callback is non-void

Definition at line 283 of file Callback.h.

◆ operator bool()

agx::Callback::operator bool ( ) const

Definition at line 284 of file Callback.h.

◆ operator const CallbackFunction &()

agx::Callback::operator const Callback::CallbackFunction & ( ) const

Definition at line 282 of file Callback.h.

◆ operator()()

void agx::Callback::operator() ( ) const

Execute the callback.

Definition at line 275 of file Callback.h.

References run().

◆ run()

void agx::Callback::run ( ) const

Definition at line 276 of file Callback.h.

References agxAssert.

Referenced by operator()(), and agx::Event::trigger().


The documentation for this class was generated from the following file: