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)
106 typedef std::unique_ptr<Callback> CallbackUP;
107 typedef std::shared_ptr<Callback> CallbackSP;
108 typedef std::weak_ptr<Callback> CallbackWP;
117 template <
class hdiTargetType>
124 typedef hdiTargetType TargetType;
129 typedef void (TargetType::*ActionType)(void);
134 typedef void (TargetType::*ConstActionType)(void)
const;
139 TargetType* __target;
149 ConstActionType __constAction;
164 explicit __Callback(TargetType* target_, ActionType action_) :
176 explicit __Callback(TargetType* target_, ConstActionType action_) :
180 __constAction(action_)
199 __target(cb_.__target),
200 __action(cb_.__action),
201 __constAction(cb_.__constAction)
245 (this->__target->*this->__action)();
247 else if(this->__constAction)
249 (this->__target->*this->__constAction)();
Class to describe a target object and a method of it, to be called at a later time.
Definition: hdicoreCallback.h:119
virtual void execute() const
Executes the callback.
Definition: hdicoreCallback.h:238
virtual __Callback< TargetType > * clone() const
Convenience method to clone a __Callback object.
Definition: hdicoreCallback.h:227
__Callback(const __Callback< TargetType > &cb_)
__Callback copy constructor
Definition: hdicoreCallback.h:197
virtual ~__Callback()
__Callback destructor; no-op at this time
Definition: hdicoreCallback.h:211
__Callback(TargetType *target_, ActionType action_)
__Callback constructor
Definition: hdicoreCallback.h:164
Just a simple "dummy" class to allow for creation of "empty" callbacks.
Definition: hdicoreCallback.h:270
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:85
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:100
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.