@@ -639,6 +639,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
639
639
const auto element_name = element->Name ();
640
640
const auto element_ID = element->Attribute (" ID" );
641
641
642
+ // TODO: Pull out this node type logic
642
643
auto node_type = convertFromString<NodeType>(element_name);
643
644
// name used by the factory
644
645
std::string type_ID;
@@ -683,6 +684,8 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
683
684
684
685
PortsRemapping port_remap;
685
686
NonPortAttributes other_attributes;
687
+ // Only relevant for subtrees
688
+ bool do_autoremap = false ;
686
689
687
690
// Parse ports and validate them where we can.
688
691
for (const XMLAttribute* att = element->FirstAttribute (); att; att = att->Next ())
@@ -730,6 +733,10 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
730
733
731
734
port_remap[port_name] = port_value;
732
735
}
736
+ else if (node_type == NodeType::SUBTREE && port_name == " _autoremap" )
737
+ {
738
+ do_autoremap = convertFromString<bool >(port_value);
739
+ }
733
740
else if (!IsReservedAttribute (port_name))
734
741
{
735
742
other_attributes[port_name] = port_value;
@@ -781,6 +788,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
781
788
// ---------------------------------------------
782
789
TreeNode::Ptr new_node;
783
790
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
784
792
if (node_type == NodeType::SUBTREE)
785
793
{
786
794
// check if this subtree has a model. If it does,
@@ -814,7 +822,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
814
822
// populate the node config
815
823
for (const auto & [port_name, port_value] : port_remap)
816
824
{
817
- auto direction = PortDirection::INPUT;
825
+ PortDirection direction = PortDirection::INPUT;
818
826
if (subtree_model_it != subtree_models.end ())
819
827
{
820
828
const PortsList& subtree_model_ports = subtree_model_it->second .ports ;
@@ -1015,7 +1023,7 @@ void BT::XMLParser::PImpl::recursivelyCreateSubtree(const std::string& tree_ID,
1015
1023
1016
1024
// Populate the subtree's blackboard with it's port values.
1017
1025
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 ;
1019
1027
subtree_remapping.insert (output_ports.begin (), output_ports.end ());
1020
1028
for (const auto & [port_name, port_value] : subtree_remapping)
1021
1029
{
0 commit comments