xml_parsing.h
Go to the documentation of this file.
1 #ifndef XML_PARSING_BT_H
2 #define XML_PARSING_BT_H
3 
5 
6 namespace BT
7 {
8 class XMLParser
9 {
10  public:
11  XMLParser(const BehaviorTreeFactory& factory);
12 
13  ~XMLParser();
14 
15  XMLParser(const XMLParser& other) = delete;
16  XMLParser& operator=(const XMLParser& other) = delete;
17 
18  void loadFromFile(const std::string& filename);
19 
20  void loadFromText(const std::string& xml_text);
21 
22  TreeNode::Ptr instantiateTree(std::vector<TreeNode::Ptr>& nodes, const Blackboard::Ptr &blackboard);
23 
24  private:
25 
26  struct Pimpl;
27  Pimpl* _p;
28 
29 };
30 
31 struct Tree
32 {
34  std::vector<TreeNode::Ptr> nodes;
35 
36  Tree() : root_node(nullptr)
37  {
38 
39  }
40 
41  Tree(TreeNode* root_node, std::vector<TreeNode::Ptr> nodes)
42  : root_node(root_node), nodes(nodes)
43  {
44 
45  }
46 
48  {
49  if (root_node) {
50  haltAllActions(root_node);
51  }
52  }
53 };
54 
63  const std::string& text,
64  const Blackboard::Ptr& blackboard = Blackboard::Ptr());
65 
74  const std::string& filename,
75  const Blackboard::Ptr& blackboard = Blackboard::Ptr());
76 
77 std::string writeXML(const BehaviorTreeFactory& factory, const TreeNode* root_node,
78  bool compact_representation = false);
79 }
80 
81 #endif // XML_PARSING_BT_H
Pimpl * _p
Definition: xml_parsing.h:26
Tree(TreeNode *root_node, std::vector< TreeNode::Ptr > nodes)
Definition: xml_parsing.h:41
const std::string xml_text
std::shared_ptr< Blackboard > Ptr
Definition: blackboard.h:40
TreeNode * root_node
Definition: xml_parsing.h:33
std::string writeXML(const BehaviorTreeFactory &factory, const TreeNode *root_node, bool compact_representation=false)
void haltAllActions(TreeNode *root_node)
void loadFromFile(const std::string &filename)
Definition: xml_parsing.cpp:83
Tree buildTreeFromFile(const BehaviorTreeFactory &factory, const std::string &filename, const Blackboard::Ptr &blackboard=Blackboard::Ptr())
TreeNode::Ptr instantiateTree(std::vector< TreeNode::Ptr > &nodes, const Blackboard::Ptr &blackboard)
void loadFromText(const std::string &xml_text)
Definition: xml_parsing.cpp:97
std::vector< TreeNode::Ptr > nodes
Definition: xml_parsing.h:34
XMLParser(const BehaviorTreeFactory &factory)
Definition: xml_parsing.cpp:74
std::shared_ptr< TreeNode > Ptr
Definition: tree_node.h:63
Tree buildTreeFromText(const BehaviorTreeFactory &factory, const std::string &text, const Blackboard::Ptr &blackboard=Blackboard::Ptr())
XMLParser & operator=(const XMLParser &other)=delete


behaviortree_cpp
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Sun Feb 3 2019 03:14:32