Qualia  0.2
FunctionCall.h
Go to the documentation of this file.
1 #include "Common.h"
2 namespace BehaviorTree
3 {
4  template <class T = NoClass>
6 
18  {
19  public:
20  BEHAVIOR_STATUS execute(void* agent)
21  {
22  T* obj = (T*) agent;
23  (obj->*func)(arg);
24  return BT_SUCCESS;
25  };
26 
27  void init(void* agent){};
28 
32  FunctionCall(void(T::*_func)(void* _arg),void* _arg = (void*)NULL) : func(_func), func2(NULL),arg(_arg){}
33 
37  FunctionCall(void(*_func)(void* _arg),void* _arg = (void*)NULL) : func2(_func), func(NULL),arg(_arg){}
38 
42  FunctionCall(void(T::* const _func)(void* _arg) const,void* _arg = (void*)NULL) : func(reinterpret_cast<void(T::* const)()>(_func)), func2(NULL),arg(_arg){}
43 
44  private:
45  void (T::* const func)(void* _arg);
46  void (* const func2)(void* _arg);
47  void* arg;
48  };
49 
50 }