20 #ifndef CO_COMMANDFUNC_H 21 #define CO_COMMANDFUNC_H 24 #include <lunchbox/debug.h> 58 : _object(_convertThis<O>(from._object))
59 , _func(static_cast<bool (T::*)(
ICommand&)>(from._func))
68 return (_object->*_func)(command);
80 bool isValid()
const {
return _object && _func; }
91 T* _convertThis(F* ptr)
95 return reinterpret_cast<T*
>(ptr);
103 template <
typename T>
104 inline std::ostream& operator<<(std::ostream& os, const CommandFunc<T>& func)
107 os <<
"CommandFunc of " << lunchbox::className(func._object);
109 os <<
"NULL CommandFunc";
114 #endif // CO_COMMANDFUNC_H Object-oriented network library.
A class managing received commands.
A wrapper to register a function callback on an object instance.
CommandFunc(const CommandFunc< O > &from)
Create a copy of a callback to a different base class.
CommandFunc(T *object, bool(T::*func)(ICommand &))
Create a new callback to the method on the given object.