Skip to content

Commit c72b58a

Browse files
committed
address comments
1 parent 2a0f48f commit c72b58a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/xml_parsing.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,6 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
645645
const auto element_name = element->Name();
646646
const auto element_ID = element->Attribute("ID");
647647

648-
// TODO: Pull out this node type logic
649648
auto node_type = convertFromString<NodeType>(element_name);
650649
// name used by the factory
651650
std::string type_ID;
@@ -690,8 +689,6 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
690689

691690
PortsRemapping port_remap;
692691
NonPortAttributes other_attributes;
693-
// Only relevant for subtrees
694-
bool do_autoremap = false;
695692

696693
// Parse ports and validate them where we can.
697694
for(const XMLAttribute* att = element->FirstAttribute(); att; att = att->Next())
@@ -739,16 +736,22 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
739736

740737
port_remap[port_name] = port_value;
741738
}
742-
else if(node_type == NodeType::SUBTREE && port_name == "_autoremap")
743-
{
744-
do_autoremap = convertFromString<bool>(port_value);
745-
}
746739
else if(!IsReservedAttribute(port_name))
747740
{
748741
other_attributes[port_name] = port_value;
749742
}
750743
}
751744

745+
bool do_autoremap = false;
746+
if(node_type == NodeType::SUBTREE)
747+
{
748+
const XMLAttribute* auto_remap_ptr = element->FindAttribute("_autoremap");
749+
if(auto_remap_ptr != nullptr)
750+
{
751+
do_autoremap = convertFromString<bool>(auto_remap_ptr->Value());
752+
}
753+
}
754+
752755
NodeConfig config;
753756
config.blackboard = blackboard;
754757
config.path = prefix_path + instance_name;
@@ -784,7 +787,6 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
784787
//---------------------------------------------
785788
TreeNode::Ptr new_node;
786789

787-
// TODO: in order to set the config at this point, we need the subtree model, which is parsed after this function call in recursivelyCreateSubtree
788790
if(node_type == NodeType::SUBTREE)
789791
{
790792
// check if this subtree has a model. If it does,
@@ -818,7 +820,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
818820
// populate the node config
819821
for(const auto& [port_name, port_value] : port_remap)
820822
{
821-
PortDirection direction = PortDirection::INPUT;
823+
auto direction = PortDirection::INPUT;
822824
if(subtree_model_it != subtree_models.end())
823825
{
824826
const PortsList& subtree_model_ports = subtree_model_it->second.ports;

0 commit comments

Comments
 (0)