@@ -56,7 +56,7 @@ struct XMLParser::PImpl
5656 Tree& output_tree);
5757
5858 void recursivelyCreateSubtree (const std::string& tree_ID,
59- const std::string &tree_name ,
59+ const std::string &tree_path ,
6060 const std::string &prefix_path,
6161 Tree& output_tree,
6262 Blackboard::Ptr blackboard,
@@ -718,7 +718,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
718718
719719void BT::XMLParser::PImpl::recursivelyCreateSubtree (
720720 const std::string& tree_ID,
721- const std::string& tree_name ,
721+ const std::string& tree_path ,
722722 const std::string& prefix_path,
723723 Tree& output_tree,
724724 Blackboard::Ptr blackboard,
@@ -748,8 +748,7 @@ void BT::XMLParser::PImpl::recursivelyCreateSubtree(
748748 else // special case: SubTreeNode
749749 {
750750 auto new_bb = Blackboard::create (blackboard);
751-
752- std::set<StringView> mapped_keys;
751+ const std::string subtree_ID = element->Attribute (" ID" );
753752
754753 for (auto attr = element->FirstAttribute (); attr != nullptr ; attr = attr->Next ())
755754 {
@@ -772,31 +771,28 @@ void BT::XMLParser::PImpl::recursivelyCreateSubtree(
772771 // do remapping
773772 StringView port_name = TreeNode::stripBlackboardPointer (attr_value);
774773 new_bb->addSubtreeRemapping (attr_name, port_name);
775- mapped_keys.insert (attr_name);
776774 }
777775 else
778776 {
779777 // constant string: just set that constant value into the BB
780778 new_bb->set (attr_name, static_cast <std::string>(attr_value));
781- mapped_keys.insert (attr_name);
782779 }
783780 }
784781
785- std::string subtree_ID = element->Attribute (" ID" );
786- std::string subtree_name = subtree->instance_name ;
787- if (!subtree_name.empty ()) {
788- subtree_name += " /" ;
782+ std::string subtree_path = subtree->instance_name ;
783+ if (!subtree_path.empty ()) {
784+ subtree_path += " /" ;
789785 }
790786 if (auto name = element->Attribute (" name" ) ) {
791- subtree_name += name;
787+ subtree_path += name;
792788 }
793789 else {
794- subtree_name += subtree_ID + " ::" + std::to_string (node->UID ());
790+ subtree_path += subtree_ID + " ::" + std::to_string (node->UID ());
795791 }
796792
797793 recursivelyCreateSubtree (subtree_ID,
798- subtree_name , // name
799- subtree_name + " /" , // prefix
794+ subtree_path , // name
795+ subtree_path + " /" , // prefix
800796 output_tree, new_bb, node);
801797 }
802798 };
@@ -814,7 +810,7 @@ void BT::XMLParser::PImpl::recursivelyCreateSubtree(
814810 // Append a new subtree to the list
815811 auto new_tree = std::make_shared<Tree::Subtree>();
816812 new_tree->blackboard = blackboard;
817- new_tree->instance_name = tree_name ;
813+ new_tree->instance_name = tree_path ;
818814 new_tree->tree_ID = tree_ID;
819815 output_tree.subtrees .push_back (new_tree);
820816
0 commit comments