Version: 8.3.0
YACS::ENGINE::sampleParser Class Reference

#include <LoadState.hxx>

Inheritance diagram for YACS::ENGINE::sampleParser:
Collaboration diagram for YACS::ENGINE::sampleParser:

Public Member Functions

 sampleParser (loopPortParser *father)
 
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)
 
virtual void charData (std::string data)
 

Private Attributes

loopPortParser_sampleFather
 

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 xmlParserBase
void getAttributes (const xmlChar **p)
 
virtual void onStart (const XML_Char *elem, const xmlChar **p)
 
virtual void onEnd (const XML_Char *name)
 
virtual void incrCount (const XML_Char *elem)
 
virtual void end ()
 
virtual void stopParse (std::string what)
 
- 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 203 of file LoadState.hxx.

Constructor & Destructor Documentation

sampleParser::sampleParser ( loopPortParser father)

Definition at line 854 of file LoadState.cxx.

855 : stateParser(),
856  _sampleFather(father)
857 {
858 }

Member Function Documentation

void sampleParser::charData ( std::string  data)
virtual

to be specialized following the kind of xml tag

Reimplemented from YACS::ENGINE::stateParser.

Definition at line 903 of file LoadState.cxx.

References xmlParserBase::_data.

904 {
905  _data = _data + data;
906 }
void sampleParser::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 860 of file LoadState.cxx.

References xmlParserBase::_father, YACS::ENGINE::stateParser::_stackState, YACS::ENGINE::stateParser::_state, DEBTRACE, and xmlParserBase::getAttributes().

861 {
862  DEBTRACE("sampleParser::init()");
863  //_state = XMLINPORT;
864  _father = father;
865  _stackState.push(_state);
866  if (p) getAttributes(p);
867 }
void sampleParser::onEnd ( const XML_Char name)
virtual

Reimplemented from YACS::ENGINE::stateParser.

Definition at line 890 of file LoadState.cxx.

References xmlParserBase::_data, xmlParserBase::_mapAttrib, _sampleFather, YACS::ENGINE::stateParser::_state, YACS::ENGINE::stateParser::_what, YACS::ENGINE::loopPortParser::addSample(), YACS::ENGINE::stateParser::onEnd(), xmlParserBase::stopParse(), and YACS::ENGINE::XMLFATALERROR.

891 {
892  if (_mapAttrib.find("index") == _mapAttrib.end())
893  {
894  _what = "no attribute index in sample ";
896  stopParse(_what);
897  }
898  int index = atoi(_mapAttrib["index"].c_str());
899  _sampleFather->addSample(index, _data);
900  stateParser::onEnd(name);
901 }
void sampleParser::onStart ( const XML_Char elem,
const xmlChar **  p 
)
virtual

Reimplemented from YACS::ENGINE::stateParser.

Definition at line 869 of file LoadState.cxx.

References xmlParserBase::_stackParser, YACS::ENGINE::stateParser::_state, YACS::ENGINE::stateParser::_what, xmlParserBase::_xmlParser, DEBTRACE, YACS::ENGINE::stateParser::init(), xmlParserBase::stopParse(), xmlParserBase::XML_SetUserData(), and YACS::ENGINE::XMLFATALERROR.

870 {
871  DEBTRACE("sampleParser::onStart" << elem);
872  string element(elem);
873  stateParser *parser = 0;
874  if (element == "index") parser = new attrParser();
875  else if (element == "value") parser = new valueParser();
876  else
877  {
878  _what = "expected index or value, got <" + element + ">";
880  stopParse(_what);
881  }
882  if (parser)
883  {
884  _stackParser.push(parser);
885  XML_SetUserData(_xmlParser, parser);
886  parser->init(p, this);
887  }
888 }

Member Data Documentation

loopPortParser* YACS::ENGINE::sampleParser::_sampleFather
private

Definition at line 214 of file LoadState.hxx.

Referenced by onEnd().


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