Classes | Public Member Functions | Private Member Functions | Private Attributes
BT::BehaviorTreeFactory Class Reference

#include <bt_factory.h>

List of all members.

Classes

struct  has_static_method_requiredParams
struct  has_static_method_requiredParams< T, typename std::enable_if< std::is_same< decltype(T::requiredNodeParameters()), const NodeParameters & >::value >::type >

Public Member Functions

 BehaviorTreeFactory ()
const std::map< std::string,
NodeBuilder > & 
builders () const
 All the builders. Made available mostly for debug purposes.
const std::set< std::string > & builtinNodes () const
std::unique_ptr< TreeNodeinstantiateTreeNode (const std::string &ID, const std::string &name, const NodeParameters &params, const Blackboard::Ptr &blackboard) const
 instantiateTreeNode creates a TreeNode
const std::vector
< TreeNodeManifest > & 
manifests () const
 Manifests of all the registered TreeNodes.
void registerBuilder (const TreeNodeManifest &manifest, NodeBuilder builder)
void registerFromPlugin (const std::string file_path)
 registerFromPlugin load a shared library and execute the function BT_REGISTER_NODES (see macro).
template<typename T >
void registerNodeType (const std::string &ID)
void registerSimpleAction (const std::string &ID, const SimpleActionNode::TickFunctor &tick_functor)
 Register a SimpleActionNode.
void registerSimpleCondition (const std::string &ID, const SimpleConditionNode::TickFunctor &tick_functor)
 Register a SimpleConditionNode.
void registerSimpleDecorator (const std::string &ID, const SimpleDecoratorNode::TickFunctor &tick_functor)
 Register a SimpleDecoratorNode.
bool unregisterBuilder (const std::string &ID)

Private Member Functions

template<typename T >
NodeBuilder getBuilderImpl (typename std::enable_if< !has_params_constructor< T >::value >::type *=nullptr)
template<typename T >
NodeBuilder getBuilderImpl (typename std::enable_if< has_default_constructor< T >::value &&has_params_constructor< T >::value >::type *=nullptr)
template<typename T >
NodeBuilder getBuilderImpl (typename std::enable_if<!has_default_constructor< T >::value &&has_params_constructor< T >::value >::type *=nullptr)
template<typename T >
NodeParameters getRequiredParamsImpl (typename std::enable_if< has_static_method_requiredParams< T >::value >::type *=nullptr)
template<typename T >
NodeParameters getRequiredParamsImpl (typename std::enable_if< !has_static_method_requiredParams< T >::value >::type *=nullptr)
template<typename T >
void registerNodeTypeImpl (const std::string &ID)
void sortTreeNodeManifests ()

Private Attributes

std::map< std::string,
NodeBuilder
builders_
std::set< std::string > builtin_IDs_
std::vector< TreeNodeManifestmanifests_

Detailed Description

Definition at line 45 of file bt_factory.h.


Constructor & Destructor Documentation

Definition at line 18 of file bt_factory.cpp.


Member Function Documentation

const std::map< std::string, NodeBuilder > & BT::BehaviorTreeFactory::builders ( ) const

All the builders. Made available mostly for debug purposes.

Definition at line 148 of file bt_factory.cpp.

const std::set< std::string > & BT::BehaviorTreeFactory::builtinNodes ( ) const

Definition at line 158 of file bt_factory.cpp.

template<typename T >
NodeBuilder BT::BehaviorTreeFactory::getBuilderImpl ( typename std::enable_if< !has_params_constructor< T >::value >::type *  = nullptr) [inline, private]

Definition at line 174 of file bt_factory.h.

template<typename T >
NodeBuilder BT::BehaviorTreeFactory::getBuilderImpl ( typename std::enable_if< has_default_constructor< T >::value &&has_params_constructor< T >::value >::type *  = nullptr) [inline, private]

Definition at line 183 of file bt_factory.h.

template<typename T >
NodeBuilder BT::BehaviorTreeFactory::getBuilderImpl ( typename std::enable_if<!has_default_constructor< T >::value &&has_params_constructor< T >::value >::type *  = nullptr) [inline, private]

Definition at line 197 of file bt_factory.h.

template<typename T >
NodeParameters BT::BehaviorTreeFactory::getRequiredParamsImpl ( typename std::enable_if< has_static_method_requiredParams< T >::value >::type *  = nullptr) [inline, private]

Definition at line 206 of file bt_factory.h.

template<typename T >
NodeParameters BT::BehaviorTreeFactory::getRequiredParamsImpl ( typename std::enable_if< !has_static_method_requiredParams< T >::value >::type *  = nullptr) [inline, private]

Definition at line 212 of file bt_factory.h.

std::unique_ptr< TreeNode > BT::BehaviorTreeFactory::instantiateTreeNode ( const std::string &  ID,
const std::string &  name,
const NodeParameters params,
const Blackboard::Ptr blackboard 
) const

instantiateTreeNode creates a TreeNode

Parameters:
IDunique ID used to register the node type
namename of this particular instance
paramsparameters (usually read from the XML definition)
Returns:
new node.

Definition at line 125 of file bt_factory.cpp.

const std::vector< TreeNodeManifest > & BT::BehaviorTreeFactory::manifests ( ) const

Manifests of all the registered TreeNodes.

Definition at line 153 of file bt_factory.cpp.

void BT::BehaviorTreeFactory::registerBuilder ( const TreeNodeManifest manifest,
NodeBuilder  builder 
)

More generic way to register your own builder. Most of the time you should use registerSimple???? or registerNodeType<> instead.

Definition at line 61 of file bt_factory.cpp.

void BT::BehaviorTreeFactory::registerFromPlugin ( const std::string  file_path)

registerFromPlugin load a shared library and execute the function BT_REGISTER_NODES (see macro).

This method may throw.

Parameters:
file_pathpath of the file

Definition at line 107 of file bt_factory.cpp.

template<typename T >
void BT::BehaviorTreeFactory::registerNodeType ( const std::string &  ID) [inline]

registerNodeType is the method to use to register your custom TreeNode.

It accepts only classed derived from either ActionNodeBase, DecoratorNode, ControlNode or ConditionNode.

REMINDER: If you want your derived class to

Definition at line 98 of file bt_factory.h.

template<typename T >
void BT::BehaviorTreeFactory::registerNodeTypeImpl ( const std::string &  ID) [inline, private]

Definition at line 165 of file bt_factory.h.

void BT::BehaviorTreeFactory::registerSimpleAction ( const std::string &  ID,
const SimpleActionNode::TickFunctor tick_functor 
)

Register a SimpleActionNode.

Definition at line 85 of file bt_factory.cpp.

void BT::BehaviorTreeFactory::registerSimpleCondition ( const std::string &  ID,
const SimpleConditionNode::TickFunctor tick_functor 
)

Register a SimpleConditionNode.

Definition at line 74 of file bt_factory.cpp.

void BT::BehaviorTreeFactory::registerSimpleDecorator ( const std::string &  ID,
const SimpleDecoratorNode::TickFunctor tick_functor 
)

Register a SimpleDecoratorNode.

Definition at line 96 of file bt_factory.cpp.

Definition at line 163 of file bt_factory.cpp.

bool BT::BehaviorTreeFactory::unregisterBuilder ( const std::string &  ID)

Definition at line 50 of file bt_factory.cpp.


Member Data Documentation

std::map<std::string, NodeBuilder> BT::BehaviorTreeFactory::builders_ [private]

Definition at line 143 of file bt_factory.h.

std::set<std::string> BT::BehaviorTreeFactory::builtin_IDs_ [private]

Definition at line 145 of file bt_factory.h.

Definition at line 144 of file bt_factory.h.


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


behaviortree_cpp
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Sat Feb 2 2019 03:50:10