Salome HOME
projects
/
modules
/
yacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
WIP
[modules/yacs.git]
/
src
/
yacsloader
/
inlineParsers.hxx
diff --git
a/src/yacsloader/inlineParsers.hxx
b/src/yacsloader/inlineParsers.hxx
index 0f6112e7e8dfa3ad17b19907bcfe32638fa5db1c..063a3c727f0002b46041780122ec9693e32d4fc8 100644
(file)
--- a/
src/yacsloader/inlineParsers.hxx
+++ b/
src/yacsloader/inlineParsers.hxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2006-201
4
CEA/DEN, EDF R&D
+// Copyright (C) 2006-201
9
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
//
// 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<T>
}
virtual void buildAttr(const XML_Char** attr)
{
}
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]);
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]);
}
}
if(std::string(attr[i]) == "state")this->state(attr[i+1]);
}
}
@@
-79,6
+82,12
@@
struct inlinetypeParser:public nodetypeParser<T>
_kind="";
this->_state="";
this->_container="";
_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)
{
}
virtual void kind (const std::string& name)
{
@@
-152,6
+161,7
@@
struct inlinetypeParser:public nodetypeParser<T>
return this->_node;
}
std::string _kind;
return this->_node;
}
std::string _kind;
+ double _weight;
};
template <class T> inlinetypeParser<T> inlinetypeParser<T>::inlineParser;
};
template <class T> inlinetypeParser<T> inlinetypeParser<T>::inlineParser;
@@
-162,6
+172,7
@@
void inlinetypeParser<YACS::ENGINE::InlineNode*>::script (const myfunc& f)
DEBTRACE( "inline_script: " << f._code )
_node=theRuntime->createScriptNode(_kind,_name);
_node->setScript(f._code);
DEBTRACE( "inline_script: " << f._code )
_node=theRuntime->createScriptNode(_kind,_name);
_node->setScript(f._code);
+ if(_weight>0)_node->setWeight(_weight);
}
template <>
}
template <>
@@
-172,6
+183,7
@@
void inlinetypeParser<YACS::ENGINE::InlineNode*>::function (const myfunc& f)
fnode=theRuntime->createFuncNode(_kind,_name);
fnode->setScript(f._code);
fnode->setFname(f._name);
fnode=theRuntime->createFuncNode(_kind,_name);
fnode->setScript(f._code);
fnode->setFname(f._name);
+ if(_weight>0)fnode->setWeight(_weight);
_node=fnode;
}
_node=fnode;
}