20 #ifndef _INLINEPARSERS_HXX_
21 #define _INLINEPARSERS_HXX_
48 static std::string
t1[]={
"script",
"function",
""};
50 template <
class T=YACS::ENGINE::InlineNode*>
58 DEBTRACE(
"inlinetypeParser::onEnd: " << el )
59 std::string element(el);
62 else if(element ==
"function")
function(((
functypeParser*)child)->post());
72 for (
int i = 0; attr[
i];
i += 2)
74 if(std::string(attr[
i]) ==
"name")this->
name(attr[
i+1]);
75 if(std::string(attr[
i]) ==
"elementaryWeight")this->
weight(atof(attr[
i+1]));
76 if(std::string(attr[
i]) ==
"state")this->
state(attr[
i+1]);
87 virtual void weight (
const double& x)
89 DEBTRACE(
"elementary_weight: " << x )
99 virtual void function (
const myfunc&
f) {}
103 DEBTRACE(
"inline_inport: " <<
p._name <<
":"<<
p._type)
105 throw YACS::Exception(
"Node must be completely defined before defining its ports");
113 std::string msg=
"Unknown InPort Type: ";
127 DEBTRACE(
"inline_outport: " <<
p._name <<
":"<<
p._type)
129 throw YACS::Exception(
"Node must be completely defined before defining its ports");
136 std::string msg=
"Unknown OutPort Type: ";
175 if(_weight>0)_node->setWeight(_weight);
181 DEBTRACE(
"inline_function: " <<
f._code )
194 DEBTRACE(
"inlinetypeParser::onStart: " << el )
195 std::string element(el);
196 parser* pp=&parser::main_parser;
197 this->maxcount(
"kind",1,element);
198 this->maxcount(
"script",1,element);
199 this->maxcount(
"function",1,element);
200 this->maxchoice(
t1,1,element);
201 if(element ==
"kind")pp=&stringtypeParser::stringParser;
202 else if(element ==
"script")pp=&codetypeParser::codeParser;
203 else if(element ==
"function")pp=&functypeParser::funcParser;
204 else if(element ==
"property")pp=&propertytypeParser::propertyParser;
207 this->SetUserDataAndPush(pp);
virtual InputPort * edAddInputPort(const std::string &inputPortName, TypeCode *type)
void setWeight(double elementaryWeight)
virtual OutputPort * edAddOutputPort(const std::string &outputPortName, TypeCode *type)
Class for calculation node (function) inlined (and executed) in the schema.
virtual void setFname(const std::string &fname)
Set the function name to use in node execution.
virtual void setScript(const std::string &script)
Set the script (as a string) to execute.
virtual void exDisabledState()
Notify this node that it has been disabled.
const std::string & getName() const
Base class for all schema objects.
std::map< std::string, TypeCode * > typeMap
virtual InlineFuncNode * createFuncNode(const std::string &kind, const std::string &name)
virtual InlineNode * createScriptNode(const std::string &kind, const std::string &name)
virtual TypeCode * getTypeCode(const std::string &name)
Get a typecode by its name from runtime catalogs.
Base class for all type objects.
YACS::ENGINE::Runtime * theRuntime
YACS::ENGINE::Proc * currentProc
Class for code parser in inline nodes.
Class for function parser in inline nodes.
virtual void weight(const double &x)
virtual void onStart(const XML_Char *el, const XML_Char **attr)
virtual void script(const myfunc &f)
virtual void buildAttr(const XML_Char **attr)
virtual void outport(const myoutport &p)
virtual void onEnd(const char *el, parser *child)
virtual void kind(const std::string &name)
static inlinetypeParser< T > inlineParser
virtual void inport(const myinport &p)
virtual void property(const myprop &prop)
virtual void state(const std::string &name)
virtual void name(const std::string &name)
YACS::ENGINE::InlineNode * _node
Class for Outport parser.
virtual void required(const std::string &name, const XML_Char **attr)
virtual void buildAttr(const XML_Char **attr)
Class for property parser.