SimpleAI
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
Classes | Macros | Enumerations
TreeNode.h File Reference
#include "common/Types.h"
#include "common/MemoryAllocator.h"
#include "conditions/ICondition.h"
#include "conditions/True.h"
#include <vector>
#include <string>
#include <memory>
#include <algorithm>
Include dependency graph for TreeNode.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ai::TreeNode
 The base class for all behaviour tree actions. More...
 

Macros

#define NODE_FACTORY(NodeName)
 A node factory macro to ease and unify the registration at AIRegistry. More...
 
#define NODE_CLASS(NodeName)
 A node class macro that also defines a factory. More...
 

Enumerations

enum  TreeNodeStatus {
  UNKNOWN, ai::CANNOTEXECUTE, ai::RUNNING, ai::FINISHED,
  ai::FAILED, ai::EXCEPTION, MAX_TREENODESTATUS
}
 Execution states of a TreeNode::execute() call.
 

Macro Definition Documentation

#define NODE_CLASS (   NodeName)
Value:
NodeName(const std::string& name, const std::string& parameters, const ::ai::ConditionPtr& condition) : \
::ai::TreeNode(name, parameters, condition) { \
_type = AI_STRINGIFY(NodeName); \
} \
virtual ~NodeName() { \
} \
NODE_FACTORY(NodeName)
#define NODE_FACTORY(NodeName)
A node factory macro to ease and unify the registration at AIRegistry.
Definition: TreeNode.h:54

A node class macro that also defines a factory.

#define NODE_FACTORY (   NodeName)
Value:
class Factory: public ::ai::ITreeNodeFactory { \
public: \
::ai::TreeNodePtr create (const ::ai::TreeNodeFactoryContext *ctx) const override { \
return std::make_shared<NodeName>(ctx->name, ctx->parameters, ctx->condition); \
} \
}; \
static const Factory& getFactory() { \
static Factory FACTORY; \
return FACTORY; \
}
This factory will create tree nodes. It uses the TreeNodeFactoryContext to collect all the needed dat...
Definition: AIFactories.h:68

A node factory macro to ease and unify the registration at AIRegistry.