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

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

#include <FloatCondition.h>

Inheritance diagram for BehaviorTree::FloatCondition< T >:
Inheritance graph
[legend]
Collaboration diagram for BehaviorTree::FloatCondition< 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...
 
 FloatCondition (float(T::*const _func)() const, FLOAT_TEST _test, float _val, int _ulps=2^22)
 
 FloatCondition (float(T::*_func)(), FLOAT_TEST _test, float _val, int _ulps=2^22)
 
 FloatCondition (float(*_func)(), FLOAT_TEST _test, float _val, int _ulps=2^22)
 
- Public Member Functions inherited from BehaviorTree::BehaviorTreeNode
virtual ~BehaviorTreeNode ()
 

Private Member Functions

float getObjVal (void *agent)
 
template<>
float getObjVal (void *agent)
 

Private Attributes

float(T::*const func )()
 
float(*const func2 )()
 
FLOAT_TEST test
 
float val
 
int ulps
 

Detailed Description

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

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

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

For example, to wrap the function "func", with the signature "float func()", one would do this: FloatCondition<> condition(&func,CLOSE,5.0f);

To wrap the static method "sMethod" of the class "Class", one would do this: FloatCondition<> condition(&Class::sMethod,CLOSE,5.0f);

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

Constructor & Destructor Documentation

template<class T = NoClass>
BehaviorTree::FloatCondition< T >::FloatCondition ( float(T::*)() const  _func,
FLOAT_TEST  _test,
float  _val,
int  _ulps = 2^22 
)
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
_ulpsthe number of "units in the last place" two floating point numbers can differ by and still be considered 'close' The default value of 2^25 will consider 5.000000000 and 5.000001 to be 'close'. However, the number of digits the numbers can differ by will vary depending on their size, due to how they are stored on the computer.
template<class T = NoClass>
BehaviorTree::FloatCondition< T >::FloatCondition ( float(T::*)()  _func,
FLOAT_TEST  _test,
float  _val,
int  _ulps = 2^22 
)
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
_ulpsthe number of "units in the last place" two floating point numbers can differ by and still be considered 'close' The default value of 2^25 will consider 5.000000000 and 5.000001 to be 'close'. However, the number of digits the numbers can differ by will vary depending on their size, due to how they are stored on the computer.
template<class T = NoClass>
BehaviorTree::FloatCondition< T >::FloatCondition ( float(*)()  _func,
FLOAT_TEST  _test,
float  _val,
int  _ulps = 2^22 
)
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
_ulpsthe number of "units in the last place" two floating point numbers can differ by and still be considered 'close' The default value of 2^25 will consider 5.000000000 and 5.000001 to be 'close'. However, the number of digits the numbers can differ by will vary depending on their size, due to how they are stored on the computer.

Member Function Documentation

template<class T = NoClass>
BEHAVIOR_STATUS BehaviorTree::FloatCondition< 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<>
float BehaviorTree::FloatCondition< NoClass >::getObjVal ( void *  agent)
private
template<class T = NoClass>
float BehaviorTree::FloatCondition< T >::getObjVal ( void *  agent)
inlineprivate
template<class T = NoClass>
void BehaviorTree::FloatCondition< 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>
float(T::* const BehaviorTree::FloatCondition< T >::func)()
private
template<class T = NoClass>
float(* const BehaviorTree::FloatCondition< T >::func2)()
private
template<class T = NoClass>
FLOAT_TEST BehaviorTree::FloatCondition< T >::test
private
template<class T = NoClass>
int BehaviorTree::FloatCondition< T >::ulps
private
template<class T = NoClass>
float BehaviorTree::FloatCondition< T >::val
private

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