X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fyacsloader%2FinlineParsers.hxx;h=063a3c727f0002b46041780122ec9693e32d4fc8;hb=c9208a8ef7f32a620d9650908588320ff159a167;hp=0a6cedb5a036756bdfef5ba77fd207368f2533d5;hpb=e3255204c864201f5bc1aa040d4273ed2f44e8cd;p=modules%2Fyacs.git diff --git a/src/yacsloader/inlineParsers.hxx b/src/yacsloader/inlineParsers.hxx index 0a6cedb5a..063a3c727 100644 --- a/src/yacsloader/inlineParsers.hxx +++ b/src/yacsloader/inlineParsers.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2016 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 @@ -72,6 +72,7 @@ struct inlinetypeParser:public nodetypeParser 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]); } } @@ -81,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) { @@ -154,6 +161,7 @@ struct inlinetypeParser:public nodetypeParser return this->_node; } std::string _kind; + double _weight; }; template inlinetypeParser inlinetypeParser::inlineParser; @@ -164,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 <> @@ -174,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; }