20 #ifndef _LOOPPARSER_HXX_
21 #define _LOOPPARSER_HXX_
47 template <
class T=ENGINE::Loop*>
54 virtual void name (
const std::string&
name);
55 virtual void state (
const std::string& name);
82 static std::string
t3[]={
"inline",
"sinline",
"service",
"server",
"remote",
"node",
"forloop",
"foreach",
"optimizer",
"while",
"switch",
"bloc",
""};
89 this->required(
"name",attr);
90 for (
int i = 0; attr[
i];
i += 2)
92 if(std::string(attr[
i]) ==
"name")name(attr[i+1]);
93 if(std::string(attr[i]) ==
"state")
state(attr[i+1]);
123 _cnode->edSetNode(n);
132 _cnode->edSetNode(n);
141 _cnode->edSetNode(n);
150 _cnode->edSetNode(n);
160 _cnode->edSetNode(n);
170 _cnode->edSetNode(n);
179 _cnode->edSetNode(b);
187 _cnode->edSetNode(b);
190 fullname +=
".splitter";
197 _cnode->edSetNode(b);
207 _cnode->edSetNode(b);
215 _cnode->edSetNode(b);
223 _cnode->edSetNode(b);
238 msg=
"from node " + l.
fromnode() +
" does not exist in data link: ";
252 msg=
"to node " + l.
tonode() +
" does not exist in data link: ";
271 this->logError(e.
what());
283 template <
class T=ENGINE::WhileLoop*>
287 virtual void name (
const std::string&
name);
300 this->_cnodes.push_back(this->_cnode);
307 DEBTRACE(
"while_post" << this->_cnode->getName() )
311 this->_cnodes.pop_back();
313 this->_cnode=this->_cnodes.empty() ? 0 : this->_cnodes.back();
325 template <
class T=ENGINE::ForLoop*>
330 virtual void name (
const std::string&
name);
331 virtual void nsteps (
const int&
n);
343 this->required(
"name",attr);
344 for (
int i = 0; attr[
i];
i += 2)
346 if(std::string(attr[
i]) ==
"name")name(attr[i+1]);
347 if(std::string(attr[i]) ==
"state")this->
state(attr[i+1]);
348 if(std::string(attr[i]) ==
"nsteps")nsteps(atoi(attr[i+1]));
355 DEBTRACE(
"forloop_name: " << name );
359 this->_cnodes.push_back(this->_cnode);
369 throw Exception(
"Node name must be defined before nsteps");
379 this->_cnodes.pop_back();
381 this->_cnode=this->_cnodes.empty() ? 0 : this->_cnodes.back();
405 template <
class T=PseudoComposedNode*>
418 DEBTRACE(
"pseudocomposednode_post" << this->
_cnode->getNode()->getName())
427 throw YACS::Exception(
"Unexpected datalink element in DynParaLoop init or finalize node");
432 template <
class T> pseudocomposednodetypeParser<T> pseudocomposednodetypeParser<T>::pseudocomposednodeParser;
440 template <
class T=ENGINE::DynParaLoop*>
445 DEBTRACE(
"dynparalooptypeParser::onStart: " << el )
446 std::string element(el);
447 this->
maxcount(
"initnode",1,element);
448 this->
maxcount(
"finalizenode",1,element);
449 if (element ==
"initnode" || element ==
"finalizenode")
465 DEBTRACE(
"dynparalooptypeParser::onEnd: " << el )
466 std::string element(el);
493 template <
class T=ENGINE::ForEachLoop*>
504 for (
int i = 0; attr[
i];
i += 2)
506 if(std::string(attr[
i]) ==
"name")
name(attr[i+1]);
507 if(std::string(attr[i]) ==
"state")this->
state(attr[i+1]);
508 if(std::string(attr[i]) ==
"nbranch")
nbranch(atoi(attr[i+1]));
509 if(std::string(attr[i]) ==
"type")
datatype(attr[i+1]);
531 DEBTRACE(
"foreach_datatype: "<< type)
542 std::stringstream msg;
543 msg <<
"Type "<<
_datatype <<
" does not exist"<<
" ("<<__FILE__<<
":"<<__LINE__<<
")";
581 template <
class T=ENGINE::OptimizerLoop*>
593 for (
int i = 0; attr[
i];
i += 2)
595 if(std::string(attr[
i]) ==
"name")
name(attr[i+1]);
596 if(std::string(attr[i]) ==
"state")this->
state(attr[i+1]);
597 if(std::string(attr[i]) ==
"nbranch")
nbranch(atoi(attr[i+1]));
598 if(std::string(attr[i]) ==
"lib")
lib(attr[i+1]);
599 if(std::string(attr[i]) ==
"entry")
entry(attr[i+1]);
600 if(std::string(attr[i]) ==
"kind")
kind(attr[i+1]);
611 DEBTRACE(
"optimizer_name: " << name)
625 DEBTRACE(
"optimizer_nbranch: " << n )
672 DEBTRACE(
"looptypeParser::onStart: " << el )
673 std::string element(el);
674 this->maxcount(
"inline",1,element);
675 this->maxcount(
"sinline",1,element);
676 this->maxcount(
"service",1,element);
677 this->maxcount(
"server",1,element);
678 this->maxcount(
"remote",1,element);
679 this->maxcount(
"node",1,element);
680 this->maxcount(
"forloop",1,element);
681 this->maxcount(
"foreach",1,element);
682 this->maxcount(
"optimizer",1,element);
683 this->maxcount(
"while",1,element);
684 this->maxcount(
"switch",1,element);
685 this->maxcount(
"bloc",1,element);
686 this->maxchoice(
t3,1,element);
703 this->SetUserDataAndPush(pp);
712 DEBTRACE(
"looptypeParser::onEnd: " << el )
713 std::string element(el);
729 else if(element ==
"datalink") datalink(((
linktypeParser<>*)child)->post());