Home
Base module

PolymorphicDelegate

Polymorphic function delegate.

PolymorphicDelegate

#include <icy/delegate.h>
template<class Class, typename RT, class PT, class IT>
struct PolymorphicDelegate

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

Inherits: AbstractDelegate< RT, IT & >

Polymorphic function delegate.

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

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

  • instance Object on which to invoke the member function.

  • method 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).

Parameters

  • object Base-type reference; cast to PT before dispatch.

Returns

Method result, or default RT on cast failure.


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

Parameters

  • that Other delegate to compare.

Returns

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