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

Wraps a function or member pointer that returns an integer value into a conditional node. More...

#include <IntCondition.h>

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

Public Member Functions

BEHAVIOR_STATUS execute (void *agent)
 Runs the test given in the constructor, and returns BT_SUCCESS if the test passes, or BT_FAILURE if the test fails. More...
 
void init (void *agent)
 This method will be invoked before the node is executed for the first time. More...
 
 IntCondition (int(T::*const _func)(), INT_TEST _test, int _val)
 
 IntCondition (int(*const _func)(), INT_TEST _test, int _val)
 
 IntCondition (int(T::*const _func)() const, INT_TEST _test, int _val)
 
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

int(T::*const func )()
 
int(*const func2 )()
 
INT_TEST test
 
int val
 

Detailed Description

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

Wraps a function or member pointer that returns an integer value into a conditional node.

To wrap a function pointer or static class member that takes no arguments and returns an int, instantiate IntCondition without a type argument.

For example, to wrap the function "func", with the signature "int func()", one would do this: IntCondition<> condition(&func,EQUAL,5);

To wrap the static method "sMethod" of the class "Class", one would do this: IntCondition<> condition(&Class::sMethod,EQUAL,5);

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

Constructor & Destructor Documentation

template<class T = NoClass>
BehaviorTree::IntCondition< T >::IntCondition ( int(T::*)()  _func,
INT_TEST  _test,
int  _val 
)
inline
Parameters
_functhe address of the class member
_testthe mathematical operation to perform on the return value of _func
_valthe 'right side' of the mathematical expression the node performs
template<class T = NoClass>
BehaviorTree::IntCondition< T >::IntCondition ( int(*)()  _func,
INT_TEST  _test,
int  _val 
)
inline
Parameters
_functhe address of the function or static class member
_testthe mathematical operation to perform on the return value of _func
_valthe 'right side' of the mathematical expression the node performs
template<class T = NoClass>
BehaviorTree::IntCondition< T >::IntCondition ( int(T::*)() const  _func,
INT_TEST  _test,
int  _val 
)
inline
Parameters
_functhe address of the const class member
_testthe mathematical operation to perform on the return value of _func
_valthe 'right side' of the mathematical expression the node performs

Member Function Documentation

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

Runs the test given in the constructor, and returns BT_SUCCESS if the test passes, or BT_FAILURE if the test fails.

Implements BehaviorTree::BehaviorTreeNode.

template<>
BEHAVIOR_STATUS BehaviorTree::IntCondition< 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::IntCondition< 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>
int(T::* const BehaviorTree::IntCondition< T >::func)()
private
template<class T = NoClass>
int(* const BehaviorTree::IntCondition< T >::func2)()
private
template<class T = NoClass>
INT_TEST BehaviorTree::IntCondition< T >::test
private
template<class T = NoClass>
int BehaviorTree::IntCondition< T >::val
private

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