Base module
PolymorphicDelegate
Polymorphic function delegate.
#include <icy/delegate.h>
template<class Class, typename RT, class PT, class IT>
struct PolymorphicDelegateDefined in src/base/include/icy/delegate.h:154
- Inherits
AbstractDelegate< RT, IT & >
Theis class contains a pointer to a class member that receices a derived subclass (PT) of the base type specified by the IT param.
List of all members
| Name | Kind | Owner |
|---|---|---|
instance | variable | Declared here |
method | variable | Declared here |
PolymorphicDelegate | function | Declared here |
operator() | function | Declared here |
operator== | function | Declared here |
~AbstractDelegate | function | Inherited from AbstractDelegate |
operator() | function | Inherited from AbstractDelegate |
operator== | function | Inherited from AbstractDelegate |
Inherited from AbstractDelegate
| Kind | Name | Description |
|---|---|---|
function | ~AbstractDelegate virtual inline | |
function | operator() virtual const | Invokes the underlying callable with the supplied arguments. |
function | operator== virtual const | Compares two delegates for equality (same target function and instance). |
Public Attributes
instance
Class * instanceDefined in src/base/include/icy/delegate.h:156
method
RT(Class::* method)(PT &)Defined in src/base/include/icy/delegate.h:157
Public Methods
| Return | Name | Description |
|---|---|---|
PolymorphicDelegate inline | ||
RT | operator() virtual const inline override | Attempts to cast object to PT; invokes the method if successful. Returns a default-constructed RT if the cast fails (packet type mismatch). |
bool | operator== virtual const inline override |
PolymorphicDelegate
inline
inline PolymorphicDelegate(Class * instance, RT(Class::*)(PT &) method)Defined in src/base/include/icy/delegate.h:161
Parameters
| Parameter | Type | Description |
|---|---|---|
instance | Class * | Object on which to invoke the member function. |
method | RT(Class::*)(PT &) | Pointer to the member function accepting a derived PT&. |
operator()
virtual const inline override
virtual inline RT operator()(IT & object) const overrideDefined in src/base/include/icy/delegate.h:171
Attempts to cast object to PT; invokes the method if successful. Returns a default-constructed RT if the cast fails (packet type mismatch).
Returns
Method result, or default RT on cast failure.
Parameters
| Parameter | Type | Description |
|---|---|---|
object | IT & | Base-type reference; cast to PT before dispatch. |
operator==
virtual const inline override
virtual inline bool operator==(const AbstractDelegate< RT, IT & > & that) const overrideDefined in src/base/include/icy/delegate.h:181
Returns
True if both delegates wrap the same instance/method pair.
Parameters
| Parameter | Type | Description |
|---|---|---|
that | const AbstractDelegate< RT, IT & > & | Other delegate to compare. |
