|
VR-Engage
2.2
|
Delegate class for binding and invoking callbacks.
| Ret | Return type of the delegate function |
| Param0 | Parameter type for the delegate function |
| Ret | Return type of the callback function |
| Param0 | Type of the single parameter passed to the callback |
This class provides a lightweight mechanism for binding either static/global functions or class member functions for invocation at a later time. The delegate supports a single parameter and return value, and provides comparison operators to check if two delegates refer to the same callback.
#include <delegate.h>
Public Member Functions | |
| DtDelegate () | |
| DtDelegate (Ret(*func)(Param0)) | |
| template<typename T, typename Method> | |
| DtDelegate (T *object, Method method) | |
| DtDelegate (const DtDelegate &orig) | |
| DtDelegate & | operator= (const DtDelegate &orig) |
| virtual | ~DtDelegate (void) |
| Ret | operator() (Param0 param0) |
| bool | operator== (const DtDelegate &rhs) const |
| bool | operator!= (const DtDelegate &rhs) |
Private Attributes | |
| Callback< Ret, Param0 > * | myCallback |
| bool | myIsStatic |
|
inline |
Default constructor.
Creates an empty delegate with no bound callback
|
inline |
Constructor for static or global functions.
| func | Pointer to the static or global function to bind |
Creates a delegate bound to a static or global function
|
inline |
Constructor for class member functions.
| T | Type of the class containing the member function |
| Method | Type of the member function pointer |
| object | Pointer to the object instance |
| method | Pointer to the member function to bind |
Creates a delegate bound to a non-static class member function
|
inline |
Copy constructor.
| orig | Original delegate to copy from |
Creates a new delegate that is a deep copy of the original
|
inlinevirtual |
Virtual destructor.
Cleans up the underlying callback implementation
|
inline |
Assignment operator.
| orig | Original delegate to assign from |
Assigns this delegate to be a deep copy of the original
|
inline |
Function call operator for invoking the delegate.
| param0 | The parameter to pass to the callback |
Executes the bound callback with the provided parameter
|
inline |
Equality comparison operator.
| rhs | The right-hand side delegate to compare with |
Compares two delegates to determine if they reference the same callback
|
inline |
Inequality comparison operator.
| rhs | The right-hand side delegate to compare with |
|
private |
Pointer to the underlying callback implementation.
Referenced by makRadarFx::DtDelegate< void, DtRadarFxConnector * >::DtDelegate(), makRadarFx::DtDelegate< void, DtRadarFxConnector * >::operator=(), and makRadarFx::DtDelegate< void, DtRadarFxConnector * >::operator==().
|
private |
Flag indicating if this is a static/global function callback.
Referenced by makRadarFx::DtDelegate< void, DtRadarFxConnector * >::DtDelegate(), makRadarFx::DtDelegate< void, DtRadarFxConnector * >::operator=(), and makRadarFx::DtDelegate< void, DtRadarFxConnector * >::operator==().