@@ -558,8 +558,8 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
558558 const std::string& prefix_path,
559559 Tree& output_tree)
560560{
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" );
563563
564564 auto node_type = convertFromString<NodeType>(element_name);
565565 // name used by the factory
@@ -593,7 +593,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
593593 // By default, the instance name is equal to ID, unless the
594594 // attribute [name] is present.
595595 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;
597597
598598 const TreeNodeManifest* manifest = nullptr ;
599599
@@ -663,13 +663,13 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
663663 }
664664
665665 // 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)
667667 {
668- if (manifest->ports .count (remap_it. first ) == 0 )
668+ if (manifest->ports .count (name_in_subtree ) == 0 )
669669 {
670670 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 "
673673 " with this name." );
674674 }
675675 }
@@ -760,13 +760,13 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
760760 }
761761
762762 // add the pointer of this node to the parent
763- if (node_parent)
763+ if (node_parent != nullptr )
764764 {
765765 if (auto control_parent = dynamic_cast <ControlNode*>(node_parent.get ()))
766766 {
767767 control_parent->addChild (new_node.get ());
768768 }
769- if (auto decorator_parent = dynamic_cast <DecoratorNode*>(node_parent.get ()))
769+ else if (auto decorator_parent = dynamic_cast <DecoratorNode*>(node_parent.get ()))
770770 {
771771 decorator_parent->setChild (new_node.get ());
772772 }
0 commit comments