#include <delegate.h>
Delegate base class which can be used for DataType.
|
| DelegateBase () |
|
| ~DelegateBase () |
|
template<typename STUBPTR > |
| DelegateBase (void *objectPtr, STUBPTR stubPtr, Callback callback) |
|
template<typename FN , typename STUBPTR > |
| DelegateBase (FN &&fn, STUBPTR stub, Callback callback) |
|
| DelegateBase (const DelegateBase &)=delete |
|
| DelegateBase (DelegateBase &&src) |
|
| MAXON_OPERATOR_MOVE_ASSIGNMENT (DelegateBase) |
|
void | Reset () |
|
ResultMem | CopyFrom (const DelegateBase &src) |
|
template<typename FN , typename STUBPTR > |
ResultMem | CopyFrom (FN &&f, STUBPTR stub, Callback callback) |
|
template<typename OBJ , typename STUBPTR > |
ResultMem | CopyFrom (OBJ &&object, STUBPTR stub) |
|
Bool | IsEmpty () const |
|
Bool | IsPopulated () const |
|
Bool | IsStaticFunctionPointer () const |
|
template<typename FUNCTIONPTR > |
FUNCTIONPTR | GetStaticFunctionPointer () const |
|
template<typename STUBPTR > |
STUBPTR | GetStubPointer () const |
|
◆ Callback
◆ Stub
◆ CALLBACKMODE
Enumerator |
---|
ALLOC | Allocates memory for an object.
|
DESTRUCT_AND_RELEASE | Destructs the object to which dst points and releases the memory.
|
COPY | Copies the object from src to dst and returns the size on success (0 on failure).
|
MOVE_AND_DESTRUCT | Moves the object from src to dst and returns the size (only used for internal storage, cannot fail).
|
◆ DelegateBase() [1/5]
◆ ~DelegateBase()
◆ DelegateBase() [2/5]
Constructs a delegate using object, stub and utility callback pointer.
- Template Parameters
-
STUBPTR | The stub pointer type. |
- Parameters
-
[in] | objectPtr | Self pointer of the object. Might be nullptr if the method has been inlined into the stub. |
[in] | stubPtr | Stub method pointer (which forward the call to the callable). |
[in] | callback | Utility callback which handles copy, move and destruction of the object. Nullptr for a static function. |
◆ DelegateBase() [3/5]
Assign when T is not a Delegate, but a function pointer, ptmf or a PTMFWrapper<OBJECT*, RESULT (OBJECT::*)(ARGS...)>.
◆ DelegateBase() [4/5]
◆ DelegateBase() [5/5]
◆ MAXON_ENUM_ORDERED_LIST_CLASS()
◆ MAXON_OPERATOR_MOVE_ASSIGNMENT()
◆ Reset()
◆ CopyFrom() [1/3]
- Parameters
-
- Returns
- OK on success.
◆ CopyFrom() [2/3]
Assign when T is not a Delegate, but a function pointer, ptmf or a PTMFWrapper<OBJECT*, RESULT (OBJECT::*)(ARGS...)>.
◆ CopyFrom() [3/3]
ResultMem CopyFrom |
( |
OBJ && |
object, |
|
|
STUBPTR |
stub |
|
) |
| |
Copies or moves object into the Delegate and sets #stub as the handler for delegate calls. #stub will receive a pointer to the object held by the Delegate in its first parameter.
- Parameters
-
[in] | object | The object to move or copy. |
[in] | stub | The call handler. |
- Returns
- OK on success.
◆ IsEmpty()
◆ IsPopulated()
Bool IsPopulated |
( |
void |
| ) |
const |
◆ IsStaticFunctionPointer()
Bool IsStaticFunctionPointer |
( |
| ) |
const |
◆ GetStaticFunctionPointer()
FUNCTIONPTR GetStaticFunctionPointer |
( |
| ) |
const |
◆ GetStubPointer()
STUBPTR GetStubPointer |
( |
| ) |
const |
◆ GetReferenceUtilityStub() [1/2]
static Callback GetReferenceUtilityStub |
( |
void * |
| ) |
|
|
staticprotected |
◆ GetReferenceUtilityStub() [2/2]
◆ PTMFUtilityStub()
A dummy stub for inlined PTMF which does nothing.
◆ UtilityStub()
Destructs, copies or moves an object with operator ()().
◆ ReferenceUtilityStub()
Destructs, copies or moves a reference with operator ()(). This treats _storage[0] as if it was not just a pointer, but a REFERENCE.
◆ _storage
◆ _objectPtr
◆ _stubPtr
◆ _callback