@@ -639,6 +639,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
639639 const auto element_name = element->Name ();
640640 const auto element_ID = element->Attribute (" ID" );
641641
642+ // TODO: Pull out this node type logic
642643 auto node_type = convertFromString<NodeType>(element_name);
643644 // name used by the factory
644645 std::string type_ID;
@@ -683,6 +684,8 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
683684
684685 PortsRemapping port_remap;
685686 NonPortAttributes other_attributes;
687+ // Only relevant for subtrees
688+ bool do_autoremap = false ;
686689
687690 // Parse ports and validate them where we can.
688691 for (const XMLAttribute* att = element->FirstAttribute (); att; att = att->Next ())
@@ -730,6 +733,10 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
730733
731734 port_remap[port_name] = port_value;
732735 }
736+ else if (node_type == NodeType::SUBTREE && port_name == " _autoremap" )
737+ {
738+ do_autoremap = convertFromString<bool >(port_value);
739+ }
733740 else if (!IsReservedAttribute (port_name))
734741 {
735742 other_attributes[port_name] = port_value;
@@ -781,6 +788,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
781788 // ---------------------------------------------
782789 TreeNode::Ptr new_node;
783790
791+ // TODO: in order to set the config at this point, we need the subtree model, which is parsed after this function call in recursivelyCreateSubtree
784792 if (node_type == NodeType::SUBTREE)
785793 {
786794 // check if this subtree has a model. If it does,
@@ -814,7 +822,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
814822 // populate the node config
815823 for (const auto & [port_name, port_value] : port_remap)
816824 {
817- auto direction = PortDirection::INPUT;
825+ PortDirection direction = PortDirection::INPUT;
818826 if (subtree_model_it != subtree_models.end ())
819827 {
820828 const PortsList& subtree_model_ports = subtree_model_it->second .ports ;
@@ -1015,7 +1023,7 @@ void BT::XMLParser::PImpl::recursivelyCreateSubtree(const std::string& tree_ID,
10151023
10161024 // Populate the subtree's blackboard with it's port values.
10171025 PortsRemapping subtree_remapping = const_node->config ().input_ports ;
1018- const PortsRemapping& output_ports = const_node->config ().output_ports ;
1026+ const PortsRemapping output_ports = const_node->config ().output_ports ;
10191027 subtree_remapping.insert (output_ports.begin (), output_ports.end ());
10201028 for (const auto & [port_name, port_value] : subtree_remapping)
10211029 {
0 commit comments