Version: 9.16.0
YACS::looptypeParser< T > Struct Template Reference

#include <loopParsers.hxx>

Inheritance diagram for YACS::looptypeParser< T >:
Collaboration diagram for YACS::looptypeParser< T >:

Public Member Functions

virtual void onStart (const XML_Char *el, const XML_Char **attr)
 
virtual void onEnd (const char *el, parser *child)
 
virtual void buildAttr (const XML_Char **attr)
 
virtual void pre ()
 
virtual void name (const std::string &name)
 
virtual void state (const std::string &name)
 
virtual void property (const myprop &prop)
 
virtual void inline_ (ENGINE::InlineNode *const &n)
 
virtual void sinline (ENGINE::ServiceInlineNode *const &n)
 
virtual void service (ENGINE::ServiceNode *const &n)
 
virtual void server (ENGINE::ServerNode *const &n)
 
virtual void remote (ENGINE::InlineNode *const &n)
 
virtual void node (ENGINE::InlineNode *const &n)
 
virtual void forloop (ENGINE::ForLoop *const &b)
 
virtual void foreach (ENGINE::ForEachLoopGen *const &b)
 
virtual void optimizer (ENGINE::OptimizerLoop *const &b)
 
virtual void while_ (ENGINE::WhileLoop *const &b)
 
virtual void switch_ (ENGINE::Switch *const &b)
 
virtual void bloc (ENGINE::Bloc *const &b)
 
virtual void datalink (const mylink &l)
 
- Public Member Functions inherited from YACS::parser
 parser ()
 
virtual ~parser ()
 
virtual void SetUserDataAndPush (parser *pp)
 
virtual void onStart (const XML_Char *el, const XML_Char **attr)
 
virtual void onEnd (const XML_Char *el, parser *child)
 
virtual void charData (const XML_Char *s, int len)
 
virtual void endParser ()
 
virtual void init ()
 
virtual void incrCount (const XML_Char *elem)
 
virtual void checkOrder (std::string &el)
 
virtual void maxcount (std::string name, int max, std::string &el)
 
virtual void mincount (std::string name, int min)
 
virtual void maxchoice (std::string *names, int max, std::string &el)
 
virtual void minchoice (std::string *names, int min)
 
virtual void pre ()
 
virtual void required (const std::string &name, const XML_Char **attr)
 
virtual void buildAttr (const XML_Char **attr)
 
std::stack< parser * > & getStack ()
 
template<class T >
T post ()
 
void logError (const std::string &reason)
 

Public Attributes

std::string _state
 
T _cnode
 
std::vector< T_cnodes
 
- Public Attributes inherited from YACS::parser
std::string _file
 
std::string _content
 
std::map< std::string, int > * _counts
 
std::map< std::string, int > _orders
 
int _orderState
 
int _level
 
std::stack< std::map< std::string, int > * > _stackCount
 
std::stack< int > _stackOrder
 
std::map< std::string, parser * > * _defaultParsersMap
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::parser
static void XMLCALL start_document (void *data)
 
static void XMLCALL end_document (void *data)
 
static void XMLCALL start_element (void *data, const xmlChar *name, const xmlChar **p)
 
static void XMLCALL end_element (void *data, const xmlChar *name)
 
static void XMLCALL characters (void *data, const xmlChar *ch, int len)
 
static void XMLCALL comment (void *data, const xmlChar *value)
 
static void XMLCALL cdata_block (void *data, const xmlChar *value, int len)
 
static void XMLCALL warning (void *data, const char *fmt,...)
 
static void XMLCALL error (void *data, const char *fmt,...)
 
static void XMLCALL fatal_error (void *data, const char *fmt,...)
 
static void XML_SetUserData (_xmlParserCtxt *ctxt, parser *par)
 
- Static Public Attributes inherited from YACS::parser
static parser main_parser
 
static std::stack< parser * > _stackParser
 

Detailed Description

template<class T = ENGINE::Loop*>
struct YACS::looptypeParser< T >

Definition at line 48 of file loopParsers.hxx.

Member Function Documentation

◆ bloc()

template<class T >
void YACS::looptypeParser< T >::bloc ( ENGINE::Bloc *const &  b)
virtual

Definition at line 220 of file loopParsers.hxx.

221 {
222 DEBTRACE( "loop_bloc " << b->getName() )
223 _cnode->edSetNode(b);
224 std::string fullname=currentProc->names.back()+ b->getName();
225 currentProc->nodeMap[fullname]=b;
226 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
YACS::ENGINE::Proc * currentProc
Definition: parserBase.cxx:30

References gui.CONNECTOR::b, currentProc, DEBTRACE, YACS::ENGINE::Proc::names, and YACS::ENGINE::Proc::nodeMap.

◆ buildAttr()

template<class T >
void YACS::looptypeParser< T >::buildAttr ( const XML_Char **  attr)
virtual

Reimplemented from YACS::parser.

Reimplemented in YACS::forlooptypeParser< T >, YACS::pseudocomposednodetypeParser< T >, YACS::foreachlooptypeParser< T >, and YACS::optimizerlooptypeParser< T >.

Definition at line 85 of file loopParsers.hxx.

86 {
87 if (!attr)
88 return;
89 this->required("name",attr);
90 for (int i = 0; attr[i]; i += 2)
91 {
92 if(std::string(attr[i]) == "name")name(attr[i+1]);
93 if(std::string(attr[i]) == "state")state(attr[i+1]);
94 }
95 }
virtual void state(const std::string &name)
virtual void name(const std::string &name)
virtual void required(const std::string &name, const XML_Char **attr)
Definition: parserBase.cxx:186

References yacsorb.CORBAEngineTest::i, and yacsorb.CORBAEngineTest::state.

◆ datalink()

template<class T >
void YACS::looptypeParser< T >::datalink ( const mylink l)
virtual

Reimplemented in YACS::pseudocomposednodetypeParser< T >.

Definition at line 229 of file loopParsers.hxx.

230 {
231 DEBTRACE( "loop_datalink: " << l.fromnode() << l.fromport() << l.tonode() << l.toport())
232 std::string msg;
233
234 //Try only relative name for from node
235 std::string fromname = currentProc->names.back()+l.fromnode();
236 if(currentProc->nodeMap.count(fromname) == 0)
237 {
238 msg="from node " + l.fromnode() + " does not exist in data link: ";
239 msg=msg+l.fromnode()+"("+l.fromport()+")->"+l.tonode()+"("+l.toport()+")";
240 this->logError(msg);
241 return;
242 }
243 //Try relative name for to node and then absolute one
244 std::string toname = currentProc->names.back()+l.tonode();
245 if(currentProc->nodeMap.count(toname) == 0)
246 {
247 //It's not a relative name. Try an absolute one (I think it's not possible)
248 toname=l.tonode();
249 if(currentProc->nodeMap.count(toname) == 0)
250 {
251 // The TO node does not exist -> error
252 msg="to node " + l.tonode() + " does not exist in data link: ";
253 msg=msg+l.fromnode()+"("+l.fromport()+")->"+l.tonode()+"("+l.toport()+")";
254 this->logError(msg);
255 return;
256 }
257 }
258 // We only link local node and other nodes (relative or absolute name in this order)
259 DEBTRACE(fromname <<":"<<l.fromport()<<toname<<":"<<l.toport());
260 try
261 {
262 if (l.withControl())
263 _cnode->edAddDFLink(currentProc->nodeMap[fromname]->getOutputPort(l.fromport()),
264 currentProc->nodeMap[toname]->getInputPort(l.toport()));
265 else
266 _cnode->edAddLink(currentProc->nodeMap[fromname]->getOutputPort(l.fromport()),
267 currentProc->nodeMap[toname]->getInputPort(l.toport()));
268 }
269 catch(Exception& e)
270 {
271 this->logError(e.what());
272 }
273 }
std::map< std::string, Node * > nodeMap
Definition: Proc.hxx:87
std::vector< std::string > names
Definition: Proc.hxx:93
void logError(const std::string &reason)
Definition: parserBase.cxx:214

References currentProc, DEBTRACE, testCppPluginInvokation::l, YACS::ENGINE::Proc::names, YACS::ENGINE::Proc::nodeMap, and YACS::Exception::what().

◆ foreach()

template<class T >
void YACS::looptypeParser< T >::foreach ( ENGINE::ForEachLoopGen *const &  b)
virtual

Definition at line 184 of file loopParsers.hxx.

185 {
186 DEBTRACE("loop_foreach" << b->getName())
187 _cnode->edSetNode(b);
188 std::string fullname=currentProc->names.back()+ b->getName();
189 currentProc->nodeMap[fullname]=b;
190 fullname += ".splitter";
191 currentProc->nodeMap[fullname]=b->getChildByShortName("splitter");
192 }

References gui.CONNECTOR::b, currentProc, DEBTRACE, YACS::ENGINE::Proc::names, and YACS::ENGINE::Proc::nodeMap.

◆ forloop()

template<class T >
void YACS::looptypeParser< T >::forloop ( ENGINE::ForLoop *const &  b)
virtual

Definition at line 176 of file loopParsers.hxx.

177 {
178 DEBTRACE( "loop_forloop" << b->getName() )
179 _cnode->edSetNode(b);
180 std::string fullname=currentProc->names.back()+ b->getName();
181 currentProc->nodeMap[fullname]=b;
182 }

References gui.CONNECTOR::b, currentProc, DEBTRACE, YACS::ENGINE::Proc::names, and YACS::ENGINE::Proc::nodeMap.

◆ inline_()

template<class T >
void YACS::looptypeParser< T >::inline_ ( ENGINE::InlineNode *const &  n)
virtual

Definition at line 120 of file loopParsers.hxx.

121 {
122 DEBTRACE( "loop_inline" << n->getName() );
123 _cnode->edSetNode(n);
124 std::string fullname=currentProc->names.back()+ n->getName();
125 currentProc->nodeMap[fullname]=n;
126 currentProc->inlineMap[fullname]=n;
127 }
std::map< std::string, InlineNode * > inlineMap
Definition: Proc.hxx:89

References currentProc, DEBTRACE, YACS::ENGINE::Proc::inlineMap, gui.Appli::n, YACS::ENGINE::Proc::names, and YACS::ENGINE::Proc::nodeMap.

◆ name()

template<class T >
void YACS::looptypeParser< T >::name ( const std::string &  name)
virtual

Reimplemented in YACS::whilelooptypeParser< T >, YACS::forlooptypeParser< T >, YACS::foreachlooptypeParser< T >, and YACS::optimizerlooptypeParser< T >.

Definition at line 103 of file loopParsers.hxx.

104 {
105 DEBTRACE( "bloc_name: " << name );
106 }

References DEBTRACE.

◆ node()

◆ onEnd()

template<class T >
void YACS::looptypeParser< T >::onEnd ( const char *  el,
parser child 
)
virtual

Reimplemented from YACS::parser.

Reimplemented in YACS::dynparalooptypeParser< T >, YACS::dynparalooptypeParser< T >, and YACS::dynparalooptypeParser< ENGINE::OptimizerLoop * >.

Definition at line 741 of file loopParsers.hxx.

742{
743 DEBTRACE( "looptypeParser::onEnd: " << el )
744 std::string element(el);
745 if(element == "property")property(((propertytypeParser*)child)->post());
746 else if(element == "inline")inline_(((inlinetypeParser<>*)child)->post());
747 else if(element == "sinline")sinline(((sinlinetypeParser<>*)child)->post());
748 else if(element == "service")service(((servicetypeParser<>*)child)->post());
749 else if(element == "server")server(((servertypeParser<>*)child)->post());
750 else if(element == "remote")remote(((remotetypeParser<>*)child)->post());
751 else if(element == "node")node(((nodetypeParser<>*)child)->post());
752
753 else if(element == "forloop")forloop(((forlooptypeParser<>*)child)->post());
754 else if(element == "foreach")foreach(((foreachlooptypeParser<ENGINE::ForEachLoop *>*)child)->post());
755 else if(element == "foreachdyn")foreach(((foreachlooptypeParser<ENGINE::ForEachLoopDyn *>*)child)->post());
756 else if(element == "optimizer")optimizer(((optimizerlooptypeParser<>*)child)->post());
757 else if(element == "while")while_(((whilelooptypeParser<>*)child)->post());
758 else if(element == "switch")switch_(((switchtypeParser*)child)->post());
759 else if(element == "bloc")bloc(((bloctypeParser<>*)child)->post());
760
761 else if(element == "datalink") datalink(((linktypeParser<>*)child)->post());
762}
virtual void server(ENGINE::ServerNode *const &n)
virtual void forloop(ENGINE::ForLoop *const &b)
virtual void while_(ENGINE::WhileLoop *const &b)
virtual void bloc(ENGINE::Bloc *const &b)
virtual void datalink(const mylink &l)
virtual void service(ENGINE::ServiceNode *const &n)
virtual void property(const myprop &prop)
virtual void optimizer(ENGINE::OptimizerLoop *const &b)
virtual void remote(ENGINE::InlineNode *const &n)
virtual void node(ENGINE::InlineNode *const &n)
virtual void inline_(ENGINE::InlineNode *const &n)
virtual void sinline(ENGINE::ServiceInlineNode *const &n)
virtual void switch_(ENGINE::Switch *const &b)

References DEBTRACE.

Referenced by YACS::dynparalooptypeParser< T >::onEnd().

◆ onStart()

template<class T >
void YACS::looptypeParser< T >::onStart ( const XML_Char el,
const XML_Char **  attr 
)
virtual

Reimplemented from YACS::parser.

Reimplemented in YACS::dynparalooptypeParser< T >, YACS::dynparalooptypeParser< T >, and YACS::dynparalooptypeParser< ENGINE::OptimizerLoop * >.

Definition at line 699 of file loopParsers.hxx.

700{
701 DEBTRACE( "looptypeParser::onStart: " << el )
702 std::string element(el);
703 this->maxcount("inline",1,element);
704 this->maxcount("sinline",1,element);
705 this->maxcount("service",1,element);
706 this->maxcount("server",1,element);
707 this->maxcount("remote",1,element);
708 this->maxcount("node",1,element);
709 this->maxcount("forloop",1,element);
710 this->maxcount("foreach",1,element);
711 this->maxcount("foreachdyn",1,element);
712 this->maxcount("optimizer",1,element);
713 this->maxcount("while",1,element);
714 this->maxcount("switch",1,element);
715 this->maxcount("bloc",1,element);
716 this->maxchoice(t3,1,element);
718 if(element == "property")pp=&propertytypeParser::propertyParser;
719 else if(element == "inline")pp=&inlinetypeParser<>::inlineParser;
720 else if(element == "sinline")pp=&sinlinetypeParser<>::sinlineParser;
721 else if(element == "service")pp=&servicetypeParser<>::serviceParser;
722 else if(element == "server")pp=&servertypeParser<>::serverParser;
723 else if(element == "remote")pp=&remotetypeParser<>::remoteParser;
724 else if(element == "node")pp=&nodetypeParser<>::nodeParser;
725
726 else if(element == "forloop")pp=&forlooptypeParser<>::forloopParser;
729 else if(element == "optimizer")pp=&optimizerlooptypeParser<>::optimizerloopParser;
730 else if(element == "while")pp=&whilelooptypeParser<>::whileloopParser;
731 else if(element == "switch")pp=&switchtypeParser::switchParser;
732 else if(element == "bloc")pp=&bloctypeParser<>::blocParser;
733 else if(element == "datalink")pp=&linktypeParser<>::linkParser;
734 this->SetUserDataAndPush(pp);
735 pp->init();
736 pp->pre();
737 pp->buildAttr(attr);
738}
static std::string t3[]
Definition: loopParsers.hxx:82
static bloctypeParser< T > blocParser
Definition: blocParsers.hxx:62
static foreachlooptypeParser< T > foreachloopParser
static forlooptypeParser< T > forloopParser
static inlinetypeParser< T > inlineParser
static linktypeParser< T > linkParser
Definition: linkParsers.hxx:84
static nodetypeParser< T > nodeParser
Definition: nodeParsers.hxx:55
static optimizerlooptypeParser< T > optimizerloopParser
virtual void maxcount(std::string name, int max, std::string &el)
Definition: parserBase.cxx:122
virtual void SetUserDataAndPush(parser *pp)
Definition: parserBase.cxx:55
static parser main_parser
Definition: parserBase.hxx:41
virtual void maxchoice(std::string *names, int max, std::string &el)
Definition: parserBase.cxx:145
static propertytypeParser propertyParser
static remotetypeParser< T > remoteParser
static servertypeParser< T > serverParser
static servicetypeParser< T > serviceParser
static sinlinetypeParser< T > sinlineParser
static switchtypeParser switchParser
static whilelooptypeParser< T > whileloopParser

References YACS::parser::buildAttr(), DEBTRACE, YACS::parser::init(), YACS::parser::pre(), and YACS::t3.

Referenced by YACS::dynparalooptypeParser< T >::onStart().

◆ optimizer()

template<class T >
void YACS::looptypeParser< T >::optimizer ( ENGINE::OptimizerLoop *const &  b)
virtual

Definition at line 194 of file loopParsers.hxx.

195 {
196 DEBTRACE( "loop_optimizer: " << b->getName() );
197 _cnode->edSetNode(b);
198 std::string fullname = currentProc->names.back()+b->getName();
199 currentProc->nodeMap[fullname]=b;
200 //fullname += ".splitter";
201 //currentProc->nodeMap[fullname]=b->getChildByShortName("splitter");
202 }

References gui.CONNECTOR::b, currentProc, DEBTRACE, YACS::ENGINE::Proc::names, and YACS::ENGINE::Proc::nodeMap.

◆ pre()

template<class T >
void YACS::looptypeParser< T >::pre
virtual

Reimplemented from YACS::parser.

Reimplemented in YACS::foreachlooptypeParser< T >, and YACS::optimizerlooptypeParser< T >.

Definition at line 97 of file loopParsers.hxx.

98 {
99 _state="";
100 _cnode=0;
101 }

Referenced by YACS::foreachlooptypeParser< T >::pre(), and YACS::optimizerlooptypeParser< T >::pre().

◆ property()

template<class T >
void YACS::looptypeParser< T >::property ( const myprop prop)
virtual

Definition at line 114 of file loopParsers.hxx.

115 {
116 DEBTRACE( "property_set" << prop._name << prop._value );
117 }
std::string _name
Definition: factory.hxx:96
std::string _value
Definition: factory.hxx:97

References myprop::_name, myprop::_value, and DEBTRACE.

◆ remote()

template<class T >
void YACS::looptypeParser< T >::remote ( ENGINE::InlineNode *const &  n)
virtual

Definition at line 157 of file loopParsers.hxx.

158 {
159 DEBTRACE( "loop_remote: " << n->getName() )
160 _cnode->edSetNode(n);
161 std::string fullname = currentProc->names.back()+n->getName();
162 currentProc->nodeMap[fullname]=n;
163 currentProc->inlineMap[fullname]=n;
164 }

References currentProc, DEBTRACE, YACS::ENGINE::Proc::inlineMap, gui.Appli::n, YACS::ENGINE::Proc::names, and YACS::ENGINE::Proc::nodeMap.

◆ server()

template<class T >
void YACS::looptypeParser< T >::server ( ENGINE::ServerNode *const &  n)
virtual

Definition at line 147 of file loopParsers.hxx.

148 {
149 DEBTRACE( "loop_server" << n->getName() )
150 _cnode->edSetNode(n);
151 std::string fullname=currentProc->names.back()+ n->getName();
152 currentProc->nodeMap[fullname]=n;
153 currentProc->inlineMap[fullname]=n;
154 }

References currentProc, DEBTRACE, YACS::ENGINE::Proc::inlineMap, gui.Appli::n, YACS::ENGINE::Proc::names, and YACS::ENGINE::Proc::nodeMap.

◆ service()

template<class T >
void YACS::looptypeParser< T >::service ( ENGINE::ServiceNode *const &  n)
virtual

Definition at line 138 of file loopParsers.hxx.

139 {
140 DEBTRACE( "loop_service" << n->getName() )
141 _cnode->edSetNode(n);
142 std::string fullname=currentProc->names.back()+ n->getName();
143 currentProc->nodeMap[fullname]=n;
144 currentProc->serviceMap[fullname]=n;
145 }

References currentProc, DEBTRACE, gui.Appli::n, YACS::ENGINE::Proc::names, YACS::ENGINE::Proc::nodeMap, and YACS::ENGINE::Proc::serviceMap.

Referenced by gui.cataitems.ItemService::addNode(), and gui.cataitems.ItemService::getChildren().

◆ sinline()

template<class T >
void YACS::looptypeParser< T >::sinline ( ENGINE::ServiceInlineNode *const &  n)
virtual

Definition at line 129 of file loopParsers.hxx.

130 {
131 DEBTRACE( "loop_sinline" << n->getName() )
132 _cnode->edSetNode(n);
133 std::string fullname=currentProc->names.back()+ n->getName();
134 currentProc->nodeMap[fullname]=n;
135 currentProc->serviceMap[fullname]=n;
136 }

References currentProc, DEBTRACE, gui.Appli::n, YACS::ENGINE::Proc::names, YACS::ENGINE::Proc::nodeMap, and YACS::ENGINE::Proc::serviceMap.

◆ state()

template<class T >
void YACS::looptypeParser< T >::state ( const std::string &  name)
virtual

Definition at line 108 of file loopParsers.hxx.

109 {
110 DEBTRACE( "bloc_state: " << name );
111 _state=name;
112 }

References DEBTRACE.

◆ switch_()

template<class T >
void YACS::looptypeParser< T >::switch_ ( ENGINE::Switch *const &  b)
virtual

Definition at line 212 of file loopParsers.hxx.

213 {
214 DEBTRACE( "loop_switch: " << b->getName() )
215 _cnode->edSetNode(b);
216 std::string fullname=currentProc->names.back()+ b->getName();
217 currentProc->nodeMap[fullname]=b;
218 }

References gui.CONNECTOR::b, currentProc, DEBTRACE, YACS::ENGINE::Proc::names, and YACS::ENGINE::Proc::nodeMap.

◆ while_()

template<class T >
void YACS::looptypeParser< T >::while_ ( ENGINE::WhileLoop *const &  b)
virtual

Definition at line 204 of file loopParsers.hxx.

205 {
206 DEBTRACE( "loop_while: " << b->getName() )
207 _cnode->edSetNode(b);
208 std::string fullname=currentProc->names.back()+ b->getName();
209 currentProc->nodeMap[fullname]=b;
210 }

References gui.CONNECTOR::b, currentProc, DEBTRACE, YACS::ENGINE::Proc::names, and YACS::ENGINE::Proc::nodeMap.

Member Data Documentation

◆ _cnode

template<class T = ENGINE::Loop*>
T YACS::looptypeParser< T >::_cnode

Definition at line 71 of file loopParsers.hxx.

◆ _cnodes

template<class T = ENGINE::Loop*>
std::vector<T> YACS::looptypeParser< T >::_cnodes

Definition at line 72 of file loopParsers.hxx.

◆ _state

template<class T = ENGINE::Loop*>
std::string YACS::looptypeParser< T >::_state

Definition at line 70 of file loopParsers.hxx.


The documentation for this struct was generated from the following file: