decorator_node.h
Go to the documentation of this file.
1 #ifndef DECORATORNODE_H
2 #define DECORATORNODE_H
3 
5 
6 namespace BT
7 {
8 class DecoratorNode : public TreeNode
9 {
10  protected:
12 
13  public:
14  // Constructor
15  DecoratorNode(const std::string& name, const NodeParameters& parameters);
16 
17  virtual ~DecoratorNode() override = default;
18 
19  // The method used to fill the child vector
20  void setChild(TreeNode* child);
21 
22  const TreeNode* child() const;
23  TreeNode* child();
24 
25  // The method used to interrupt the execution of the node
26  virtual void halt() override;
27 
28  void haltChild();
29 
30  virtual NodeType type() const override
31  {
32  return NodeType::DECORATOR;
33  }
34 
35  NodeStatus executeTick() override;
36 };
37 
50 {
51  public:
52  typedef std::function<NodeStatus(NodeStatus, TreeNode&)> TickFunctor;
53 
54  // Constructor: you must provide the function to call when tick() is invoked
55  SimpleDecoratorNode(const std::string& name, TickFunctor tick_functor,
56  const NodeParameters& params = NodeParameters());
57 
58  ~SimpleDecoratorNode() override = default;
59 
60  protected:
61  virtual NodeStatus tick() override;
62 
63  TickFunctor tick_functor_;
64 };
65 }
66 
67 #endif
const TreeNode * child() const
const std::string & name() const
Definition: tree_node.cpp:92
std::function< NodeStatus(NodeStatus, TreeNode &)> TickFunctor
virtual void halt() override
The method used to interrupt the execution of a RUNNING node.
The SimpleDecoratorNode provides an easy to use DecoratorNode. The user should simply provide a callb...
TreeNode * child_node_
std::unordered_map< std::string, std::string > NodeParameters
Definition: tree_node.h:33
void setChild(TreeNode *child)
DecoratorNode(const std::string &name, const NodeParameters &parameters)
NodeStatus executeTick() override
The method that will be executed to invoke tick(); and setStatus();.
virtual NodeType type() const override
virtual ~DecoratorNode() override=default
NodeStatus
Definition: basic_types.h:28
NodeType
Definition: basic_types.h:16
virtual BT::NodeStatus tick()=0
Method to be implemented by the user.


behaviortree_cpp
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Sat Feb 2 2019 04:01:53