Version: 8.3.0
YACS::ENGINE::graphParser Class Reference

#include <LoadState.hxx>

Inheritance diagram for YACS::ENGINE::graphParser:
Collaboration diagram for YACS::ENGINE::graphParser:

Public Member Functions

virtual void init (const xmlChar **p, xmlParserBase *father=0)
 
virtual void onStart (const XML_Char *elem, const xmlChar **p)
 
virtual void onEnd (const XML_Char *name)
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::stateParser
static void setProc (Proc *p)
 
static void setRuntime (Runtime *runtime)
 
- Public Attributes inherited from xmlParserBase
std::map< std::string, int > counts
 
- Static Public Attributes inherited from YACS::ENGINE::stateParser
static XMLReadState _state
 
static std::string _what
 
- Protected Member Functions inherited from YACS::ENGINE::stateParser
virtual void charData (std::string data)
 
- Protected Attributes inherited from xmlParserBase
std::map< std::string,
std::string > 
_mapAttrib
 
std::string _data
 
xmlParserBase_father
 
- Static Protected Attributes inherited from YACS::ENGINE::stateParser
static std::stack< XMLReadState_stackState
 
static Proc_p
 
static Runtime_runtime
 
static std::map< std::string,
YACS::StatesForNode
_nodeStateValue
 
static std::map< std::string,
YACS::StatesForNode
_nodeStates
 

Detailed Description

Definition at line 106 of file LoadState.hxx.

Member Function Documentation

void graphParser::init ( const xmlChar **  p,
xmlParserBase father = 0 
)
virtual

all parsers must know their father parser (father tag), in order to set values or attributes in father.

Reimplemented from YACS::ENGINE::stateParser.

Definition at line 126 of file LoadState.cxx.

References YACS::ENGINE::XMLINGRAPH.

127 {
128  // DEBTRACE("graphParser::init()");
129  _state = XMLINGRAPH;
130  _father = father;
131  _stackState.push(_state);
132  if (p) getAttributes(p);
133 }
void graphParser::onEnd ( const XML_Char name)
virtual

Reimplemented from YACS::ENGINE::stateParser.

Definition at line 155 of file LoadState.cxx.

References DEBTRACE, YACS::DONE, YACS::ENGINE::InGate::getBackLinks(), YACS::ENGINE::Node::getChildByName(), YACS::ENGINE::Node::getInGate(), YACS::ENGINE::Node::getName(), YACS::ENGINE::stateParser::onEnd(), and YACS::ENGINE::InGate::setPrecursorDone().

156 {
157  std::map<std::string, YACS::StatesForNode>::const_iterator it;
158  for (it = _nodeStates.begin(); it != _nodeStates.end(); it++)
159  {
160  Node *node =0;
161  string nodeName = it->first;
162  DEBTRACE("nodeName = " << nodeName);
163  if(_p->getName() == nodeName)
164  node = _p;
165  else
166  node = _p->getChildByName(nodeName);
167 
168  InGate* inGate = node->getInGate();
169  list<OutGate*> backlinks = inGate->getBackLinks();
170  for (list<OutGate*>::iterator io = backlinks.begin(); io != backlinks.end(); io++)
171  {
172  Node* fromNode = (*io)->getNode();
173  string fromName;
174  if (fromNode == _p) fromName = fromNode->getName();
175  else fromName = _p->getChildName(fromNode);
176  if (_nodeStates[fromName] == YACS::DONE)
177  {
178  DEBTRACE(" fromNode = " << fromName);
179  inGate->setPrecursorDone(*io);
180  }
181  }
182  }
183  stateParser::onEnd(name);
184 }
void graphParser::onStart ( const XML_Char elem,
const xmlChar **  p 
)
virtual

Reimplemented from YACS::ENGINE::stateParser.

Definition at line 135 of file LoadState.cxx.

References YACS::ENGINE::stateParser::init(), and YACS::ENGINE::XMLFATALERROR.

136 {
137  string element(elem);
138  stateParser *parser = 0;
139  if (element == "node") parser = new nodeParser();
140  else
141  {
142  _what = "expected <node>, got <" + element + ">";
144  stopParse(_what);
145  }
146  if (parser)
147  {
148  _stackParser.push(parser);
149  XML_SetUserData(_xmlParser, parser);
150  parser->init(p, this);
151  }
152 }

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