Version: 9.15.0
YACS::casetypeParser Struct Reference

#include <switchParsers.hxx>

Inheritance diagram for YACS::casetypeParser:
Collaboration diagram for YACS::casetypeParser:

Public Member Functions

void onStart (const XML_Char *el, const XML_Char **attr)
 
void onEnd (const char *el, parser *child)
 
virtual void buildAttr (const XML_Char **attr)
 
virtual void pre ()
 
virtual void id (const int &n)
 
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 &n)
 
virtual void foreach (ENGINE::ForEachLoopGen *const &n)
 
virtual void optimizer (ENGINE::OptimizerLoop *const &n)
 
virtual void while_ (ENGINE::WhileLoop *const &n)
 
virtual void switch_ (ENGINE::Switch *const &n)
 
virtual void bloc (ENGINE::Bloc *const &n)
 
virtual std::pair< int, ENGINE::Node * > post ()
 
- Public Member Functions inherited from YACS::parser
 parser ()
 
virtual ~parser ()
 
virtual void SetUserDataAndPush (parser *pp)
 
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 required (const std::string &name, const XML_Char **attr)
 
std::stack< parser * > & getStack ()
 
template<class T >
post ()
 
void logError (const std::string &reason)
 

Public Attributes

ENGINE::Node_cnode
 
int _id
 
std::vector< int > _idStack
 
- 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
 

Static Public Attributes

static casetypeParser caseParser
 
- Static Public Attributes inherited from YACS::parser
static parser main_parser
 
static std::stack< parser * > _stackParser
 

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)
 

Detailed Description

Definition at line 52 of file switchParsers.hxx.

Member Function Documentation

◆ bloc()

void YACS::casetypeParser::bloc ( ENGINE::Bloc *const &  n)
virtual

Definition at line 222 of file switchParsers.hxx.

223  {
224  _cnode=n;
225  std::string fullname=currentProc->names.back()+ n->getName();
226  currentProc->nodeMap[fullname]=n;
227  }
std::map< std::string, Node * > nodeMap
Definition: Proc.hxx:87
std::vector< std::string > names
Definition: Proc.hxx:93
ENGINE::Node * _cnode
YACS::ENGINE::Proc * currentProc
Definition: parserBase.cxx:30

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

Referenced by onEnd().

◆ buildAttr()

void YACS::casetypeParser::buildAttr ( const XML_Char **  attr)
virtual

Reimplemented from YACS::parser.

Reimplemented in YACS::defaultcasetypeParser.

Definition at line 113 of file switchParsers.hxx.

114  {
115  if (!attr)
116  return;
117  this->required("id",attr);
118  for (int i = 0; attr[i]; i += 2)
119  {
120  if(std::string(attr[i]) == "id")id(atoi(attr[i+1]));
121  }
122  }
virtual void id(const int &n)
virtual void required(const std::string &name, const XML_Char **attr)
Definition: parserBase.cxx:186

References yacsorb.CORBAEngineTest::i, id(), and YACS::parser::required().

◆ foreach()

void YACS::casetypeParser::foreach ( ENGINE::ForEachLoopGen *const &  n)
virtual

Definition at line 194 of file switchParsers.hxx.

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

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

◆ forloop()

void YACS::casetypeParser::forloop ( ENGINE::ForLoop *const &  n)
virtual

Definition at line 188 of file switchParsers.hxx.

189  {
190  _cnode=n;
191  std::string fullname=currentProc->names.back()+ n->getName();
192  currentProc->nodeMap[fullname]=n;
193  }

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

Referenced by onEnd().

◆ id()

void YACS::casetypeParser::id ( const int &  n)
virtual

Definition at line 128 of file switchParsers.hxx.

129  {
130  DEBTRACE( "case_id: " << n )
131  _id=n;
132  //store this level id
133  _idStack.push_back(_id);
134  //store this level name
135  std::stringstream temp;
136  if (_id <0) temp << "m" << -_id << "_";
137  else temp << "p" << _id << "_";
138  std::string fullname=currentProc->names.back()+temp.str();
139  DEBTRACE( "case_fullname: " << fullname )
140  currentProc->names.push_back(fullname);
141  }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::vector< int > _idStack

References _id, _idStack, currentProc, DEBTRACE, gui.Appli::n, and YACS::ENGINE::Proc::names.

Referenced by buildAttr().

◆ inline_()

void YACS::casetypeParser::inline_ ( ENGINE::InlineNode *const &  n)
virtual

Definition at line 146 of file switchParsers.hxx.

147  {
148  _cnode=n;
149  std::string fullname=currentProc->names.back()+ n->getName();
150  currentProc->nodeMap[fullname]=n;
151  currentProc->inlineMap[fullname]=n;
152  }
std::map< std::string, InlineNode * > inlineMap
Definition: Proc.hxx:89

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

Referenced by onEnd().

◆ node()

◆ onEnd()

void YACS::casetypeParser::onEnd ( const char *  el,
parser child 
)
virtual

Reimplemented from YACS::parser.

Definition at line 381 of file switchParsers.hxx.

382 {
383  DEBTRACE( "casetypeParser::onEnd: " << el )
384  std::string element(el);
385  if(element == "property")property(((propertytypeParser*)child)->post());
386  else if(element == "inline")inline_(((inlinetypeParser<>*)child)->post());
387  else if(element == "sinline")sinline(((sinlinetypeParser<>*)child)->post());
388  else if(element == "service")service(((servicetypeParser<>*)child)->post());
389  else if(element == "server")server(((servertypeParser<>*)child)->post());
390  else if(element == "remote")remote(((remotetypeParser<>*)child)->post());
391  else if(element == "node")node(((nodetypeParser<>*)child)->post());
392  else if(element == "forloop")forloop(((forlooptypeParser<>*)child)->post());
393  else if(element == "foreach")foreach(((foreachlooptypeParser<ENGINE::ForEachLoop *>*)child)->post());
394  else if(element == "foreachdyn")foreach(((foreachlooptypeParser<ENGINE::ForEachLoopDyn *>*)child)->post());
395  else if(element == "optimizer")optimizer(((optimizerlooptypeParser<>*)child)->post());
396  else if(element == "while")while_(((whilelooptypeParser<>*)child)->post());
397  else if(element == "switch")switch_(((switchtypeParser*)child)->post());
398  else if(element == "bloc")bloc(((bloctypeParser<>*)child)->post());
399 }
virtual std::pair< int, ENGINE::Node * > post()
virtual void remote(ENGINE::InlineNode *const &n)
virtual void bloc(ENGINE::Bloc *const &n)
virtual void optimizer(ENGINE::OptimizerLoop *const &n)
virtual void service(ENGINE::ServiceNode *const &n)
virtual void property(const myprop &prop)
virtual void forloop(ENGINE::ForLoop *const &n)
virtual void switch_(ENGINE::Switch *const &n)
virtual void inline_(ENGINE::InlineNode *const &n)
virtual void while_(ENGINE::WhileLoop *const &n)
virtual void server(ENGINE::ServerNode *const &n)
virtual void node(ENGINE::InlineNode *const &n)
virtual void sinline(ENGINE::ServiceInlineNode *const &n)

References bloc(), DEBTRACE, forloop(), inline_(), node(), optimizer(), post(), property(), remote(), server(), service(), sinline(), switch_(), and while_().

◆ onStart()

void YACS::casetypeParser::onStart ( const XML_Char el,
const XML_Char **  attr 
)
virtual

Reimplemented from YACS::parser.

Definition at line 343 of file switchParsers.hxx.

344 {
345  DEBTRACE( "casetypeParser::onStart: " << el )
346  std::string element(el);
347  this->maxcount("inline",1,element);
348  this->maxcount("sinline",1,element);
349  this->maxcount("service",1,element);
350  this->maxcount("server",1,element);
351  this->maxcount("remote",1,element);
352  this->maxcount("node",1,element);
353  this->maxcount("forloop",1,element);
354  this->maxcount("foreach",1,element);
355  this->maxcount("optimizer",1,element);
356  this->maxcount("while",1,element);
357  this->maxcount("switch",1,element);
358  this->maxcount("bloc",1,element);
359  this->maxchoice(switch_t3,1,element);
361  if(element == "property")pp=&propertytypeParser::propertyParser;
362  else if(element == "inline")pp=&inlinetypeParser<>::inlineParser;
363  else if(element == "sinline")pp=&sinlinetypeParser<>::sinlineParser;
364  else if(element == "service")pp=&servicetypeParser<>::serviceParser;
365  else if(element == "server")pp=&servertypeParser<>::serverParser;
366  else if(element == "remote")pp=&remotetypeParser<>::remoteParser;
367  else if(element == "node")pp=&nodetypeParser<>::nodeParser;
368  else if(element == "forloop")pp=&forlooptypeParser<>::forloopParser;
370  else if(element == "foreachdyn")pp=&foreachlooptypeParser<ENGINE::ForEachLoopDyn *>::foreachloopParser;
371  else if(element == "optimizer")pp=&optimizerlooptypeParser<>::optimizerloopParser;
372  else if(element == "while")pp=&whilelooptypeParser<>::whileloopParser;
373  else if(element == "switch")pp=&switchtypeParser::switchParser;
374  else if(element == "bloc")pp=&bloctypeParser<>::blocParser;
375  SetUserDataAndPush(pp);
376  pp->init();
377  pp->pre();
378  pp->buildAttr(attr);
379 }
static std::string switch_t3[]
static bloctypeParser< T > blocParser
Definition: blocParsers.hxx:62
static foreachlooptypeParser< T > foreachloopParser
static forlooptypeParser< T > forloopParser
static inlinetypeParser< T > inlineParser
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::main_parser, YACS::parser::maxchoice(), YACS::parser::maxcount(), YACS::parser::pre(), YACS::propertytypeParser::propertyParser, YACS::parser::SetUserDataAndPush(), and YACS::switchtypeParser::switchParser.

◆ optimizer()

void YACS::casetypeParser::optimizer ( ENGINE::OptimizerLoop *const &  n)
virtual

Definition at line 202 of file switchParsers.hxx.

203  {
204  _cnode=n;
205  std::string fullname=currentProc->names.back()+ n->getName();
206  currentProc->nodeMap[fullname]=n;
207  //fullname += ".splitter";
208  //currentProc->nodeMap[fullname]=n->getChildByShortName("splitter");
209  }

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

Referenced by onEnd().

◆ post()

std::pair< int, ENGINE::Node * > YACS::casetypeParser::post ( )
virtual

Definition at line 228 of file switchParsers.hxx.

229  {
230  DEBTRACE( "case_post" )
231  minchoice(switch_t3,1);
232  //get back this level id
233  _id=_idStack.back();
234  _idStack.pop_back();
235  //pop back this level name
236  currentProc->names.pop_back();
237  return std::pair<int,ENGINE::Node*>(_id,_cnode);
238  }
virtual void minchoice(std::string *names, int min)
Definition: parserBase.cxx:162

References _cnode, _id, _idStack, currentProc, DEBTRACE, YACS::parser::minchoice(), YACS::ENGINE::Proc::names, and YACS::switch_t3.

Referenced by onEnd().

◆ pre()

void YACS::casetypeParser::pre ( )
virtual

Reimplemented from YACS::parser.

Reimplemented in YACS::defaultcasetypeParser.

Definition at line 123 of file switchParsers.hxx.

124  {
125  _cnode=0;
126  _id=0;
127  }

References _cnode, and _id.

◆ property()

void YACS::casetypeParser::property ( const myprop prop)
virtual

Definition at line 142 of file switchParsers.hxx.

143  {
144  DEBTRACE( "property_set: " << prop._name << prop._value )
145  }
std::string _name
Definition: factory.hxx:96
std::string _value
Definition: factory.hxx:97

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

Referenced by onEnd().

◆ remote()

void YACS::casetypeParser::remote ( ENGINE::InlineNode *const &  n)
virtual

Definition at line 174 of file switchParsers.hxx.

175  {
176  _cnode=n;
177  std::string fullname=currentProc->names.back()+ n->getName();
178  currentProc->nodeMap[fullname]=n;
179  currentProc->inlineMap[fullname]=n;
180  }

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

Referenced by onEnd().

◆ server()

void YACS::casetypeParser::server ( ENGINE::ServerNode *const &  n)
virtual

Definition at line 167 of file switchParsers.hxx.

168  {
169  _cnode=n;
170  std::string fullname=currentProc->names.back()+ n->getName();
171  currentProc->nodeMap[fullname]=n;
172  currentProc->inlineMap[fullname]=n;
173  }

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

Referenced by onEnd().

◆ service()

void YACS::casetypeParser::service ( ENGINE::ServiceNode *const &  n)
virtual

Definition at line 160 of file switchParsers.hxx.

161  {
162  _cnode=n;
163  std::string fullname=currentProc->names.back()+ n->getName();
164  currentProc->nodeMap[fullname]=n;
165  currentProc->serviceMap[fullname]=n;
166  }
std::map< std::string, ServiceNode * > serviceMap
Definition: Proc.hxx:88

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

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

◆ sinline()

void YACS::casetypeParser::sinline ( ENGINE::ServiceInlineNode *const &  n)
virtual

Definition at line 153 of file switchParsers.hxx.

154  {
155  _cnode=n;
156  std::string fullname=currentProc->names.back()+ n->getName();
157  currentProc->nodeMap[fullname]=n;
158  currentProc->serviceMap[fullname]=n;
159  }

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

Referenced by onEnd().

◆ switch_()

void YACS::casetypeParser::switch_ ( ENGINE::Switch *const &  n)
virtual

Definition at line 216 of file switchParsers.hxx.

217  {
218  _cnode=n;
219  std::string fullname=currentProc->names.back()+ n->getName();
220  currentProc->nodeMap[fullname]=n;
221  }

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

Referenced by onEnd().

◆ while_()

void YACS::casetypeParser::while_ ( ENGINE::WhileLoop *const &  n)
virtual

Definition at line 210 of file switchParsers.hxx.

211  {
212  _cnode=n;
213  std::string fullname=currentProc->names.back()+ n->getName();
214  currentProc->nodeMap[fullname]=n;
215  }

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

Referenced by onEnd().

Member Data Documentation

◆ _cnode

◆ _id

int YACS::casetypeParser::_id

Definition at line 75 of file switchParsers.hxx.

Referenced by id(), post(), pre(), and YACS::defaultcasetypeParser::pre().

◆ _idStack

std::vector<int> YACS::casetypeParser::_idStack

Definition at line 76 of file switchParsers.hxx.

Referenced by id(), post(), and YACS::defaultcasetypeParser::pre().

◆ caseParser

casetypeParser YACS::casetypeParser::caseParser
static

Definition at line 54 of file switchParsers.hxx.

Referenced by YACS::switchtypeParser::onStart().


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