SimpleAI
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ai::ITreeLoader Class Reference

This class must be extended to load behaviour trees. The contract here is that the parsing only happens once (of course) and then ITreeLoader::getTrees and ITreeLoader::load will just access the cached data. More...

#include <ITreeLoader.h>

Inheritance diagram for ai::ITreeLoader:
[legend]
Collaboration diagram for ai::ITreeLoader:
[legend]

Public Member Functions

 ITreeLoader (const IAIFactory &aiFactory)
 
void shutdown ()
 
const IAIFactorygetAIFactory () const
 
void getTrees (std::vector< std::string > &trees) const
 Fill the given vector with the loaded behaviour tree names.
 
bool addTree (const std::string &name, const TreeNodePtr &root)
 Register a new TreeNode as behaviour tree with the specified name. More...
 
TreeNodePtr load (const std::string &name)
 Loads on particular behaviour tree.
 
void setError (const char *msg,...) __attribute__((format(printf
 
void std::string getError () const
 Gives access to the last error state of the ITreeLoader.
 

Protected Types

typedef std::map< std::string,
TreeNodePtr > 
TreeMap
 

Protected Member Functions

void resetError ()
 

Protected Attributes

const IAIFactory_aiFactory
 
TreeMap _treeMap
 
ReadWriteLock _lock = {"treeloader"}
 

Detailed Description

This class must be extended to load behaviour trees. The contract here is that the parsing only happens once (of course) and then ITreeLoader::getTrees and ITreeLoader::load will just access the cached data.

Member Function Documentation

bool ai::ITreeLoader::addTree ( const std::string &  name,
const TreeNodePtr &  root 
)
inline

Register a new TreeNode as behaviour tree with the specified name.

Parameters
nameThe name to register the given root node under
rootThe TreeNode that will act as behaviour tree root node
Returns
true if the registration process went fine, false otherwise (there is already a behaviour tree registered with the same name or the given root node is invalid.

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