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

Base delegate type. More...

#include <delegates.hpp>

Inheritance diagram for EasyDelegate::ITypedDelegate< returnType, parameters >:
EasyDelegate::IDelegate

Public Types

typedef returnType ReturnType
 Helper typedef referring to the return type of this delegate.
 
typedef StaticDelegate< returnType, parameters...> StaticDelegateType
 Helper typedef for when building static delegates.
 
template<typename classType >
using MemberDelegateType = MemberDelegate< classType, returnType, parameters...>
 Helper typedef for when building member delegates.
 
typedef StaticMethodPointer< returnType, parameters...> StaticMethodPointerType
 Helper typedef referring to a static function pointer.
 
template<typename classType >
using MemberDelegateFuncPtr = returnType(classType::*)(parameters...)
 Helper typedef referring to a class member method pointer.
 

Public Member Functions

 ITypedDelegate (const bool &isMemberDelegate) noexcept
 Constructor accepting a boolean. More...
 
virtual bool callsMethod (const StaticMethodPointerType methodPointer) const noexcept=0
 Returns whether or not this delegate calls the given static method. More...
 
template<typename className >
bool callsMethod (const MemberDelegateFuncPtr< className > methodPointer) const noexcept
 Returns whether or not this delegate calls the given class member method address. More...
 
virtual bool hasThisPointer (const void *thisPointer) const noexcept=0
 Returns whether or not this delegate calls against the given this pointer. More...
 
virtual returnType invoke (parameters...params)=0
 Invoke the delegate with the given arguments and return a value, if any. More...
 

Additional Inherited Members

- Public Attributes inherited from EasyDelegate::IDelegate
const bool mIsMemberDelegate
 A boolean representing whether or not this delegate is a member delegate.
 
- Protected Member Functions inherited from EasyDelegate::IDelegate
 IDelegate (const bool &isMemberDelegate) noexcept
 Constructor accepting a boolean. More...
 

Detailed Description

template<typename returnType, typename... parameters>
class EasyDelegate::ITypedDelegate< returnType, parameters >

Base delegate type.

Inheritance from this type allows for both the StaticDelegate and MemberDelegate instances to be used in the DelegateSet type as it specifies a common interface for the two types to be sharing.

Constructor & Destructor Documentation

template<typename returnType, typename... parameters>
EasyDelegate::ITypedDelegate< returnType, parameters >::ITypedDelegate ( const bool &  isMemberDelegate)
inlinenoexcept

Constructor accepting a boolean.

Parameters
isMemberDelegateA boolean representing whether or not this delegate is a member delegate.

Member Function Documentation

template<typename returnType, typename... parameters>
virtual bool EasyDelegate::ITypedDelegate< returnType, parameters >::callsMethod ( const StaticMethodPointerType  methodPointer) const
pure virtualnoexcept

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

Parameters
methodPointerA pointer to the static method to be checked against.
Returns
A boolean representing whether or not this delegate calls the given proc address.
Note
Always returns false for MemeberDelegate types because a MemberDelegate cannot invoke static functions.

Implemented in EasyDelegate::StaticDelegate< returnType, parameters >.

template<typename returnType, typename... parameters>
template<typename className >
bool EasyDelegate::ITypedDelegate< returnType, parameters >::callsMethod ( const MemberDelegateFuncPtr< className >  methodPointer) const
inlinenoexcept

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

Parameters
methodPointerA pointer to a member function to be checked against.
Returns
A boolean representing whether or not this delegate calls the given class member method address.

This is not declared as a wholly virtual function because a templated function cannot be virtual.

Note
Always returns false for StaticDelegate types because a StaticDelegate cannot call member functions.
template<typename returnType, typename... parameters>
virtual bool EasyDelegate::ITypedDelegate< returnType, parameters >::hasThisPointer ( const void *  thisPointer) const
pure virtualnoexcept

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

Parameters
thisPointerA pointer referring to the object of interest.
Returns
A boolean representing whether or not this delegate calls a member function against the given this pointer.
Note
Always returns false for StaticDelegate types because they do not use a this pointer.

Implemented in EasyDelegate::MemberDelegate< classType, returnType, parameters >, and EasyDelegate::StaticDelegate< returnType, parameters >.

template<typename returnType, typename... parameters>
virtual returnType EasyDelegate::ITypedDelegate< returnType, parameters >::invoke ( parameters...  params)
pure virtual

Invoke the delegate with the given arguments and return a value, if any.

Parameters
paramsAnything; It depends on the function signature specified in the template.
Returns
Anything; It depends on the function signature specified in the template.
Exceptions
InvalidMethodPointerExceptionThrown when assertions are disabled and either a MemberDelegate or StaticDelegate type have a NULL function to call.
InvalidThisPointerExceptionThrown when assertions are disabled and this is a MemberDelegate attempting to call against a NULL this pointer.
std::exceptionAny exception can be potentially thrown by the function to be called.
Note
The call will not throw an exception in any of the std::runtime_error cases but rather assert if assertions are enabled.

Implemented in EasyDelegate::MemberDelegate< classType, returnType, parameters >, and EasyDelegate::StaticDelegate< returnType, parameters >.


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