X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fyacsloader%2FinlineParsers.hxx;h=063a3c727f0002b46041780122ec9693e32d4fc8;hb=c9208a8ef7f32a620d9650908588320ff159a167;hp=0f6112e7e8dfa3ad17b19907bcfe32638fa5db1c;hpb=14ddeddd588b20887c99de78c95d402527062012;p=modules%2Fyacs.git diff --git a/src/yacsloader/inlineParsers.hxx b/src/yacsloader/inlineParsers.hxx index 0f6112e7e..063a3c727 100644 --- a/src/yacsloader/inlineParsers.hxx +++ b/src/yacsloader/inlineParsers.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2014 CEA/DEN, EDF R&D +// Copyright (C) 2006-2019 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -66,10 +66,13 @@ struct inlinetypeParser:public nodetypeParser } virtual void buildAttr(const XML_Char** attr) { + if (!attr) + return; this->required("name",attr); for (int i = 0; attr[i]; i += 2) { if(std::string(attr[i]) == "name")this->name(attr[i+1]); + if(std::string(attr[i]) == "elementaryWeight")this->weight(atof(attr[i+1])); if(std::string(attr[i]) == "state")this->state(attr[i+1]); } } @@ -79,6 +82,12 @@ struct inlinetypeParser:public nodetypeParser _kind=""; this->_state=""; this->_container=""; + this->_weight=-1.; + } + virtual void weight (const double& x) + { + DEBTRACE("elementary_weight: " << x ) + _weight=x; } virtual void kind (const std::string& name) { @@ -152,6 +161,7 @@ struct inlinetypeParser:public nodetypeParser return this->_node; } std::string _kind; + double _weight; }; template inlinetypeParser inlinetypeParser::inlineParser; @@ -162,6 +172,7 @@ void inlinetypeParser::script (const myfunc& f) DEBTRACE( "inline_script: " << f._code ) _node=theRuntime->createScriptNode(_kind,_name); _node->setScript(f._code); + if(_weight>0)_node->setWeight(_weight); } template <> @@ -172,6 +183,7 @@ void inlinetypeParser::function (const myfunc& f) fnode=theRuntime->createFuncNode(_kind,_name); fnode->setScript(f._code); fnode->setFname(f._name); + if(_weight>0)fnode->setWeight(_weight); _node=fnode; }