Base module

PolymorphicDelegate

Polymorphic function delegate.

PolymorphicDelegate

#include <icy/delegate.h>

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.

Public Attributes

ReturnNameDescription
Class *instance
RT(Class::*method

instance

Class * instance

method

RT(Class::* method

Public Methods

ReturnNameDescription
PolymorphicDelegate inline#### Parameters
RToperator() virtual const inlineAttempts 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#### Parameters

PolymorphicDelegate

inline

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

Parameters

  • instance Object on which to invoke the member function.

  • method Pointer to the member function accepting a derived PT&.


operator()

virtual const inline

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

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

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

Parameters

  • that Other delegate to compare.

Returns

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