EasyDelegate  2.0
Delegate and deferred callers for C++11.
Public Types | Public Member Functions | Public Attributes | List of all members
EasyDelegate::DeferredMemberCaller< classType, returnType, parameters > Class Template Reference

A deferred caller type for class member methods. More...

#include <deferredcallers.hpp>

Inheritance diagram for EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >:
EasyDelegate::ITypedDeferredCaller< returnType > EasyDelegate::IDeferredCaller

Public Types

typedef MemberMethodPointer< classType, returnType, parameters...> MemberDelegateMethodPointer
 Helper typedef referring to a class member method pointer.
 

Public Member Functions

 DeferredMemberCaller (const MemberDelegateMethodPointer methodPointer, classType *thisPointer, parameters...params)
 Constructor accepting a this pointer and a member method. More...
 
EASYDELEGATE_INLINE returnType dispatch (void) const
 Dispatches the DeferredMemberCaller. More...
 
EASYDELEGATE_INLINE void genericDispatch (void) const
 Dispatches the DeferredMemberCaller, ignoring the return value. More...
 
EASYDELEGATE_INLINE bool callsMethod (const MemberDelegateMethodPointer methodPointer) const noexcept
 Returns whether or not this DeferredMemberCaller calls the given class member method. More...
 
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool callsMethod (const MemberMethodPointer< otherClass, otherReturn, otherParams...> methodPointer) const noexcept
 Returns whether or not this DeferredMemberCaller calls the given class member method of a differing signature. More...
 
template<typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool callsMethod (const StaticMethodPointer< otherReturn, otherParams...> methodPointer) const noexcept
 Returns whether or not this DeferredMemberCaller calls the given static method. More...
 
EASYDELEGATE_INLINE bool hasSameMethodAs (const DeferredMemberCaller< classType, returnType, parameters...> *other) const noexcept
 Returns whether or not this DeferredMemberCaller calls the same method as another DeferredMemberCaller. More...
 
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool hasSameMethodAs (const DeferredMemberCaller< otherClass, otherReturn, otherParams...> *other) const noexcept
 Returns whether or not this DeferredMemberCaller calls the same method as another DeferredMemberCaller of a differing signature. More...
 
template<typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool hasSameMethodAs (const DeferredStaticCaller< otherReturn, otherParams...> *other) const noexcept
 Returns whether or not this DeferredMemberCaller calls the same method as DeferredStaticCaller. More...
 
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool hasSameThisPointerAs (const DeferredMemberCaller< otherClass, otherReturn, otherParams...> *other) const noexcept
 Returns whether or not this DeferredMemberCaller calls against the same this pointer as another. More...
 
template<typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool hasSameThisPointerAs (const DeferredStaticCaller< otherReturn, otherParams...> *other) const noexcept
 Returns whether or not this DeferredMemberCaller calls against the same this pointer of the DeferredStaticCaller. More...
 
EASYDELEGATE_INLINE bool hasThisPointer (const void *thisPointer) const noexcept
 Returns whether or not this DeferredMemberCaller calls against the given this pointer. More...
 

Public Attributes

classType * mThisPointer
 A pointer to the this object to invoke against.
 

Detailed Description

template<typename classType, typename returnType, typename... parameters>
class EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >

A deferred caller type for class member methods.

The DeferredMemberCaller class works by storing the information required to make a call against a class member method in its data structure when constructed. The parameters are stored in an std::tuple and are later unpacked when the DeferredMemberCaller is dispatched.

Warning
The DeferredMemberCaller is only valid while the given this pointer remains valid.
Examples:
example.cpp.

Constructor & Destructor Documentation

template<typename classType, typename returnType, typename... parameters>
EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::DeferredMemberCaller ( const MemberDelegateMethodPointer  methodPointer,
classType *  thisPointer,
parameters...  params 
)
inline

Constructor accepting a this pointer and a member method.

Parameters
methodPointerA pointer to the class member method to be invoked upon the this pointer.
thisPointerA pointer to the object instance to be considered this during invocation.
paramsWhatever parameters are required to later dispatch this DeferredMemberCaller.
Warning
The DeferredMemberCaller invocation code has no way of knowing if the this pointer at any time has been deallocated. The DeferredMemberCaller will cause undefined behavior and/or segfault upon invocation in that case.

Member Function Documentation

template<typename classType, typename returnType, typename... parameters>
EASYDELEGATE_INLINE bool EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::callsMethod ( const MemberDelegateMethodPointer  methodPointer) const
inlinenoexcept

Returns whether or not this DeferredMemberCaller calls the given class member method.

Parameters
methodPointerA pointer to a class member method to be checked against.
Returns
A boolean representing whether or not this DeferredMemberCaller calls the given method pointer.
template<typename classType, typename returnType, typename... parameters>
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::callsMethod ( const MemberMethodPointer< otherClass, otherReturn, otherParams...>  methodPointer) const
inlinenoexcept

Returns whether or not this DeferredMemberCaller calls the given class member method of a differing signature.

Parameters
methodPointerA pointer to a class member method to be checked against.
Returns
A boolean representing whether or not this DeferredMemberCaller calls the given method pointer.
Note
Always returns false because methods of differing signatures should reside at different addresses.
template<typename classType, typename returnType, typename... parameters>
template<typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::callsMethod ( const StaticMethodPointer< otherReturn, otherParams...>  methodPointer) const
inlinenoexcept

Returns whether or not this DeferredMemberCaller calls the given static method.

Parameters
methodPointerA pointer to a static method to be checked against.
Returns
A boolean representing whether or not this DeferredMemberCaller calls the given static method pointer.
Note
Always returns false because DeferredMemberCaller types cannot call static methods.
template<typename classType, typename returnType, typename... parameters>
EASYDELEGATE_INLINE returnType EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::dispatch ( void  ) const
inlinevirtual

Dispatches the DeferredMemberCaller.

This is equivalent to the invoke() method on all other delegate types except the parameters were cached at creation. Said cached parameters will be passed in automatically upon calling this, so it is completely safe to store.

Returns
Anything; it depends on the function signature defined in the template.

Implements EasyDelegate::ITypedDeferredCaller< returnType >.

template<typename classType, typename returnType, typename... parameters>
EASYDELEGATE_INLINE void EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::genericDispatch ( void  ) const
inlinevirtual

Dispatches the DeferredMemberCaller, ignoring the return value.

This behaves exactly as the dispatch method above except it does not care about the return of the called function. This method is also callable on the IDeferredCaller type, unlike the normal dispatch method.

Implements EasyDelegate::IDeferredCaller.

template<typename classType, typename returnType, typename... parameters>
EASYDELEGATE_INLINE bool EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::hasSameMethodAs ( const DeferredMemberCaller< classType, returnType, parameters...> *  other) const
inlinenoexcept

Returns whether or not this DeferredMemberCaller calls the same method as another DeferredMemberCaller.

Parameters
otherA pointer to the DeferredMemberCaller to check against.
Returns
A boolean representing whether or not this DeferredMemberCaller calls the same method as the other DeferredMemberCaller.
template<typename classType, typename returnType, typename... parameters>
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::hasSameMethodAs ( const DeferredMemberCaller< otherClass, otherReturn, otherParams...> *  other) const
inlinenoexcept

Returns whether or not this DeferredMemberCaller calls the same method as another DeferredMemberCaller of a differing signature.

Parameters
otherA pointer to the DeferredMemberCaller to check against.
Returns
A boolean representing whether or not this DeferredMemberCaller calls the same method as the other DeferredMemberCaller of differing signature.
Note
Always returns false because methods of differing signatures should reside at different addresses.
template<typename classType, typename returnType, typename... parameters>
template<typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::hasSameMethodAs ( const DeferredStaticCaller< otherReturn, otherParams...> *  other) const
inlinenoexcept

Returns whether or not this DeferredMemberCaller calls the same method as DeferredStaticCaller.

Parameters
otherA pointer to the DeferredStaticCaller to check against.
Returns
A boolean representing whether or not this DeferredMemberCaller calls the same method as the DeferredStaticCaller.
Note
Always returns false because DeferredMemberCaller types cannot call static methods.
template<typename classType, typename returnType, typename... parameters>
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::hasSameThisPointerAs ( const DeferredMemberCaller< otherClass, otherReturn, otherParams...> *  other) const
inlinenoexcept

Returns whether or not this DeferredMemberCaller calls against the same this pointer as another.

Returns
A boolean representing whether or not this DeferredMemberCaller calls against the same this pointer of the other.
template<typename classType, typename returnType, typename... parameters>
template<typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::hasSameThisPointerAs ( const DeferredStaticCaller< otherReturn, otherParams...> *  other) const
inlinenoexcept

Returns whether or not this DeferredMemberCaller calls against the same this pointer of the DeferredStaticCaller.

Returns
A boolean representing whether or not this DeferredMemberCaller calls against the same this pointer of the other.
Note
Always returns false because DeferredStaticCaller types do not use a this pointer.
template<typename classType, typename returnType, typename... parameters>
EASYDELEGATE_INLINE bool EasyDelegate::DeferredMemberCaller< classType, returnType, parameters >::hasThisPointer ( const void *  thisPointer) const
inlinevirtualnoexcept

Returns whether or not this DeferredMemberCaller calls against the given this pointer.

Parameters
thisPointerA pointer referring to the object of interest.
Returns
A boolean representing whether or not this DeferredMemberCaller calls a class member method against the given this pointer.

Reimplemented from EasyDelegate::IDeferredCaller.


The documentation for this class was generated from the following file: