@@ -558,8 +558,8 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
558
558
const std::string& prefix_path,
559
559
Tree& output_tree)
560
560
{
561
- auto element_name = element->Name ();
562
- auto element_ID = element->Attribute (" ID" );
561
+ const auto element_name = element->Name ();
562
+ const auto element_ID = element->Attribute (" ID" );
563
563
564
564
auto node_type = convertFromString<NodeType>(element_name);
565
565
// name used by the factory
@@ -593,7 +593,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
593
593
// By default, the instance name is equal to ID, unless the
594
594
// attribute [name] is present.
595
595
const char * attr_name = element->Attribute (" name" );
596
- std::string instance_name = attr_name ? attr_name : type_ID;
596
+ const std::string instance_name = ( attr_name != nullptr ) ? attr_name : type_ID;
597
597
598
598
const TreeNodeManifest* manifest = nullptr ;
599
599
@@ -663,13 +663,13 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
663
663
}
664
664
665
665
// Check that name in remapping can be found in the manifest
666
- for (const auto & remap_it : port_remap)
666
+ for (const auto & [name_in_subtree, _] : port_remap)
667
667
{
668
- if (manifest->ports .count (remap_it. first ) == 0 )
668
+ if (manifest->ports .count (name_in_subtree ) == 0 )
669
669
{
670
670
throw RuntimeError (" Possible typo? In the XML, you tried to remap port \" " ,
671
- remap_it. first , " \" in node [" , type_ID , " / " , instance_name ,
672
- " ], but the manifest of this node does not contain a port "
671
+ name_in_subtree , " \" in node [" , config. path , " (type " , type_ID ,
672
+ " ) ], but the manifest of this node does not contain a port "
673
673
" with this name." );
674
674
}
675
675
}
@@ -760,13 +760,13 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
760
760
}
761
761
762
762
// add the pointer of this node to the parent
763
- if (node_parent)
763
+ if (node_parent != nullptr )
764
764
{
765
765
if (auto control_parent = dynamic_cast <ControlNode*>(node_parent.get ()))
766
766
{
767
767
control_parent->addChild (new_node.get ());
768
768
}
769
- if (auto decorator_parent = dynamic_cast <DecoratorNode*>(node_parent.get ()))
769
+ else if (auto decorator_parent = dynamic_cast <DecoratorNode*>(node_parent.get ()))
770
770
{
771
771
decorator_parent->setChild (new_node.get ());
772
772
}
0 commit comments