VR-Engage  2.2
Loading...
Searching...
No Matches
makRadarFx::DtDelegate< Ret, Param0 > Class Template Reference

Detailed Description

template<typename Ret, typename Param0>
class makRadarFx::DtDelegate< Ret, Param0 >

Delegate class for binding and invoking callbacks.

Template Parameters
RetReturn type of the delegate function
Param0Parameter type for the delegate function
RetReturn type of the callback function
Param0Type of the single parameter passed to the callback

This class provides a lightweight mechanism for binding either static/global functions or class member functions for invocation at a later time. The delegate supports a single parameter and return value, and provides comparison operators to check if two delegates refer to the same callback.

#include <delegate.h>

Inheritance diagram for makRadarFx::DtDelegate< Ret, Param0 >:
[legend]

Public Member Functions

 DtDelegate ()
 
 DtDelegate (Ret(*func)(Param0))
 
template<typename T, typename Method>
 DtDelegate (T *object, Method method)
 
 DtDelegate (const DtDelegate &orig)
 
DtDelegateoperator= (const DtDelegate &orig)
 
virtual ~DtDelegate (void)
 
Ret operator() (Param0 param0)
 
bool operator== (const DtDelegate &rhs) const
 
bool operator!= (const DtDelegate &rhs)
 

Private Attributes

Callback< Ret, Param0 > * myCallback
 
bool myIsStatic
 

Constructor & Destructor Documentation

◆ DtDelegate() [1/4]

template<typename Ret, typename Param0>
makRadarFx::DtDelegate< Ret, Param0 >::DtDelegate ( )
inline

Default constructor.

Creates an empty delegate with no bound callback

◆ DtDelegate() [2/4]

template<typename Ret, typename Param0>
makRadarFx::DtDelegate< Ret, Param0 >::DtDelegate ( Ret(* func )(Param0))
inline

Constructor for static or global functions.

Parameters
funcPointer to the static or global function to bind

Creates a delegate bound to a static or global function

◆ DtDelegate() [3/4]

template<typename Ret, typename Param0>
template<typename T, typename Method>
makRadarFx::DtDelegate< Ret, Param0 >::DtDelegate ( T * object,
Method method )
inline

Constructor for class member functions.

Template Parameters
TType of the class containing the member function
MethodType of the member function pointer
Parameters
objectPointer to the object instance
methodPointer to the member function to bind

Creates a delegate bound to a non-static class member function

◆ DtDelegate() [4/4]

template<typename Ret, typename Param0>
makRadarFx::DtDelegate< Ret, Param0 >::DtDelegate ( const DtDelegate< Ret, Param0 > & orig)
inline

Copy constructor.

Parameters
origOriginal delegate to copy from

Creates a new delegate that is a deep copy of the original

◆ ~DtDelegate()

template<typename Ret, typename Param0>
virtual makRadarFx::DtDelegate< Ret, Param0 >::~DtDelegate ( void )
inlinevirtual

Virtual destructor.

Cleans up the underlying callback implementation

Member Function Documentation

◆ operator=()

template<typename Ret, typename Param0>
DtDelegate & makRadarFx::DtDelegate< Ret, Param0 >::operator= ( const DtDelegate< Ret, Param0 > & orig)
inline

Assignment operator.

Parameters
origOriginal delegate to assign from
Returns
Reference to this delegate after assignment

Assigns this delegate to be a deep copy of the original

◆ operator()()

template<typename Ret, typename Param0>
Ret makRadarFx::DtDelegate< Ret, Param0 >::operator() ( Param0 param0)
inline

Function call operator for invoking the delegate.

Parameters
param0The parameter to pass to the callback
Returns
Result of the callback invocation

Executes the bound callback with the provided parameter

◆ operator==()

template<typename Ret, typename Param0>
bool makRadarFx::DtDelegate< Ret, Param0 >::operator== ( const DtDelegate< Ret, Param0 > & rhs) const
inline

Equality comparison operator.

Parameters
rhsThe right-hand side delegate to compare with
Returns
True if both delegates reference the same callback

Compares two delegates to determine if they reference the same callback

◆ operator!=()

template<typename Ret, typename Param0>
bool makRadarFx::DtDelegate< Ret, Param0 >::operator!= ( const DtDelegate< Ret, Param0 > & rhs)
inline

Inequality comparison operator.

Parameters
rhsThe right-hand side delegate to compare with
Returns
True if the delegates do not reference the same callback

Member Data Documentation

◆ myCallback

template<typename Ret, typename Param0>
Callback<Ret, Param0>* makRadarFx::DtDelegate< Ret, Param0 >::myCallback
private

◆ myIsStatic

template<typename Ret, typename Param0>
bool makRadarFx::DtDelegate< Ret, Param0 >::myIsStatic
private

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