Qualia  0.2
Public Member Functions | Private Attributes | List of all members
BehaviorTree::FunctionCall< T > Class Template Reference

Wraps a function or member pointer into a Behavior Tree Node. More...

#include <FunctionCall.h>

Inheritance diagram for BehaviorTree::FunctionCall< T >:
Inheritance graph
[legend]
Collaboration diagram for BehaviorTree::FunctionCall< T >:
Collaboration graph
[legend]

Public Member Functions

BEHAVIOR_STATUS execute (void *agent)
 This method is invoked by the node's parent when the node should be run. More...
 
void init (void *agent)
 This method will be invoked before the node is executed for the first time. More...
 
 FunctionCall (void(T::*_func)(void *_arg), void *_arg=(void *) NULL)
 
 FunctionCall (void(*_func)(void *_arg), void *_arg=(void *) NULL)
 
 FunctionCall (void(T::*const _func)(void *_arg) const, void *_arg=(void *) NULL)
 
template<>
BEHAVIOR_STATUS execute (void *agent)
 This method is invoked by the node's parent when the node should be run. More...
 
- Public Member Functions inherited from BehaviorTree::BehaviorTreeNode
virtual ~BehaviorTreeNode ()
 

Private Attributes

void(T::*const func )(void *_arg)
 
void(*const func2 )(void *_arg)
 
void * arg
 

Detailed Description

template<class T = NoClass>
class BehaviorTree::FunctionCall< T >

Wraps a function or member pointer into a Behavior Tree Node.

To wrap a void function pointer or static class member that takes a generic void* argument , instantiate FunctionCall without a type argument. For example, to wrap the function "func", with the signature "void func(void*)" and the argument "arg", one would do this: FunctionCall<> functionNode(&func,arg);

To wrap the static method "sMethod" of the class "Class", one would do this: FunctionCall<> staticMethodNode(&Class::sMethod,arg);

To wrap a non-static class member, FunctionCall must be parameterized with the class's type. For example, to wrap the method "method" of class "Class", one would do this: FunctionCall<Class> classMethodNode(&Class:method,arg);

Constructor & Destructor Documentation

template<class T = NoClass>
BehaviorTree::FunctionCall< T >::FunctionCall ( void(T::*)(void *_arg)  _func,
void *  _arg = (void*)NULL 
)
inline
Parameters
_functhe address of the (non-static) class member
_argthe genericized argument to the function
template<class T = NoClass>
BehaviorTree::FunctionCall< T >::FunctionCall ( void(*)(void *_arg)  _func,
void *  _arg = (void*)NULL 
)
inline
Parameters
_functhe address of the function or the static class member
_argthe genericized argument to the function
template<class T = NoClass>
BehaviorTree::FunctionCall< T >::FunctionCall ( void(T::*)(void *_arg) const  _func,
void *  _arg = (void*)NULL 
)
inline
Parameters
_functhe address of the const non-static class member
_argthe genericized argument to the function

Member Function Documentation

template<class T = NoClass>
BEHAVIOR_STATUS BehaviorTree::FunctionCall< T >::execute ( void *  agent)
inlinevirtual

This method is invoked by the node's parent when the node should be run.

Implements BehaviorTree::BehaviorTreeNode.

template<>
BEHAVIOR_STATUS BehaviorTree::FunctionCall< NoClass >::execute ( void *  agent)
virtual

This method is invoked by the node's parent when the node should be run.

Implements BehaviorTree::BehaviorTreeNode.

template<class T = NoClass>
void BehaviorTree::FunctionCall< T >::init ( void *  agent)
inlinevirtual

This method will be invoked before the node is executed for the first time.

Implements BehaviorTree::BehaviorTreeNode.

Member Data Documentation

template<class T = NoClass>
void* BehaviorTree::FunctionCall< T >::arg
private
template<class T = NoClass>
void(T::* const BehaviorTree::FunctionCall< T >::func)(void *_arg)
private
template<class T = NoClass>
void(* const BehaviorTree::FunctionCall< T >::func2)(void *_arg)
private

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