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

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

#include <BoolCondition.h>

Inheritance diagram for BehaviorTree::BoolCondition< T >:
Inheritance graph
[legend]
Collaboration diagram for BehaviorTree::BoolCondition< 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...
 
 BoolCondition (bool(T::*_func)(), bool _check)
 
 BoolCondition (bool(*_func)(), bool _check)
 
 BoolCondition (bool(T::*const _func)() const, bool _check)
 
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

bool(T::*const func )()
 
bool(*const func2 )()
 
bool check
 

Detailed Description

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

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

To wrap a function pointer or static class member that takes no arguments and returns a boolean, instantiate BoolCondition without a type argument. For example, to wrap the function "func", with the signature "bool func()", one would do this: BoolCondition<> condition(&func,true);

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

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

Constructor & Destructor Documentation

template<class T = NoClass>
BehaviorTree::BoolCondition< T >::BoolCondition ( bool(T::*)()  _func,
bool  _check 
)
inline
Parameters
_functhe address of the (non-static) class member
_checkthe value that is being tested for
template<class T = NoClass>
BehaviorTree::BoolCondition< T >::BoolCondition ( bool(*)()  _func,
bool  _check 
)
inline
Parameters
_functhe address of the function or the static class member
_checkthe value that is being tested for
template<class T = NoClass>
BehaviorTree::BoolCondition< T >::BoolCondition ( bool(T::*)() const  _func,
bool  _check 
)
inline
Parameters
_functhe address of the const non-static class member
_checkthe value that is being tested for

Member Function Documentation

template<class T = NoClass>
BEHAVIOR_STATUS BehaviorTree::BoolCondition< 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::BoolCondition< 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::BoolCondition< 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>
bool BehaviorTree::BoolCondition< T >::check
private
template<class T = NoClass>
bool(T::* const BehaviorTree::BoolCondition< T >::func)()
private
template<class T = NoClass>
bool(* const BehaviorTree::BoolCondition< T >::func2)()
private

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