7#ifndef __HDI_CORE_CALLBACK__
8#define __HDI_CORE_CALLBACK__
30#define HDI_CORE_CALLBACK_T(__HDI_C__) hdi::core::__Callback<__HDI_C__>
49#define HDI_CORE_CALLBACK(__HDI_C__, __HDI_O__, __HDI_M__) \
50 hdi::core::__Callback<__HDI_C__>(__HDI_O__, &__HDI_C__::__HDI_M__)
57#define HDI_CORE_CALLBACK_NONE HDI_CORE_CALLBACK(hdi::core::__Dummy, NULL, nothing)
108 typedef std::unique_ptr<Callback> CallbackUP;
109 typedef std::shared_ptr<Callback> CallbackSP;
110 typedef std::weak_ptr<Callback> CallbackWP;
119 template <
class hdiTargetType>
126 typedef hdiTargetType TargetType;
131 typedef void (TargetType::*ActionType)(void);
136 typedef void (TargetType::*ConstActionType)(void)
const;
141 TargetType* __target;
151 ConstActionType __constAction;
166 explicit __Callback(TargetType* target_, ActionType action_) :
178 explicit __Callback(TargetType* target_, ConstActionType action_) :
182 __constAction(action_)
201 __target(cb_.__target),
202 __action(cb_.__action),
203 __constAction(cb_.__constAction)
247 (this->__target->*this->__action)();
249 else if(this->__constAction)
251 (this->__target->*this->__constAction)();
295 __Dummy(
const __Dummy&);
309 __Dummy& operator=(
const __Dummy&);
Class to describe a target object and a method of it, to be called at a later time.
Definition hdicoreCallback.h:121
virtual void execute() const
Executes the callback.
Definition hdicoreCallback.h:240
virtual __Callback< TargetType > * clone() const
Convenience method to clone a __Callback object.
Definition hdicoreCallback.h:229
__Callback(const __Callback< TargetType > &cb_)
__Callback copy constructor
Definition hdicoreCallback.h:199
virtual ~__Callback()
__Callback destructor; no-op at this time
Definition hdicoreCallback.h:213
__Callback(TargetType *target_, ActionType action_)
__Callback constructor
Definition hdicoreCallback.h:166
void nothing()
__Dummy no-op
Base class for templated __Callback class.
Definition hdicoreCallback.h:68
virtual void execute() const =0
Pure virtual callback execution method, so __Callback objects can be stored as Callback*.
virtual ~Callback()
Callback destructor, no-op at this time.
Definition hdicoreCallback.h:87
virtual Callback * clone() const =0
Pure virtual callback cloning method, so __Callback objects can be stored as Callback*.
Callback()
Callback constructor, no-op at this time.
Definition hdicoreCallback.h:102
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.