Base module

PolymorphicDelegate

Polymorphic function delegate.

#include <icy/delegate.h>

template<class Class, typename RT, class PT, class IT>
struct PolymorphicDelegate

Defined in src/base/include/icy/delegate.h:154

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

NameKindOwner
instancevariableDeclared here
methodvariableDeclared here
PolymorphicDelegatefunctionDeclared here
operator()functionDeclared here
operator==functionDeclared here
~AbstractDelegatefunctionInherited from AbstractDelegate
operator()functionInherited from AbstractDelegate
operator==functionInherited from AbstractDelegate

Inherited from AbstractDelegate

KindNameDescription
function~AbstractDelegate virtual inline
functionoperator() virtual constInvokes the underlying callable with the supplied arguments.
functionoperator== virtual constCompares two delegates for equality (same target function and instance).

Public Attributes

ReturnNameDescription
Class *instance
RT(Class::*method

instance

Class * instance

Defined in src/base/include/icy/delegate.h:156


method

RT(Class::* method)(PT &)

Defined in src/base/include/icy/delegate.h:157

Public Methods

ReturnNameDescription
PolymorphicDelegate inline
RToperator() virtual const inline overrideAttempts to cast object to PT; invokes the method if successful. Returns a default-constructed RT if the cast fails (packet type mismatch).
booloperator== virtual const inline override

PolymorphicDelegate

inline

inline PolymorphicDelegate(Class * instance, RT(Class::*)(PT &) method)

Defined in src/base/include/icy/delegate.h:161

Parameters

ParameterTypeDescription
instanceClass *Object on which to invoke the member function.
methodRT(Class::*)(PT &)Pointer to the member function accepting a derived PT&.

operator()

virtual const inline override

virtual inline RT operator()(IT & object) const override

Defined 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

ParameterTypeDescription
objectIT &Base-type reference; cast to PT before dispatch.

operator==

virtual const inline override

virtual inline bool operator==(const AbstractDelegate< RT, IT & > & that) const override

Defined in src/base/include/icy/delegate.h:181

Returns

True if both delegates wrap the same instance/method pair.

Parameters

ParameterTypeDescription
thatconst AbstractDelegate< RT, IT & > &Other delegate to compare.