COPASI API  4.16.103
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
CMiaseParser Class Reference

#include <CMiaseParser.h>

Collaboration diagram for CMiaseParser:
Collaboration graph
[legend]

Public Member Functions

 CMiaseParser ()
 
void load (std::string filename)
 
void testDataStructure ()
 
 ~CMiaseParser ()
 

Static Public Member Functions

static void XMLCALL charhndl (void *userData, const XML_Char *s, int len)
 
static void XMLCALL end (void *data, const char *el)
 
static void XMLCALL start (void *data, const char *el, const char **attr)
 
static void XMLCALL xmldecl_handler (void *userData, const XML_Char *version, const XML_Char *encoding, int standalone)
 

Static Public Attributes

static char mEncoding [] = {'u', 't', 'f', '-', 8}
 
static char mNameSpace [] = "http://www.miase.org/"
 
static XML_Char mVersion_1_0 [] = {'1', '.', '0', 0}
 

Private Types

enum  States {
  STATE_READY_TO_READ, STATE_LIST_OF_MODELS, STATE_LIST_OF_TASKS, STATE_LIST_OF_OUTPUTS,
  STATE_NOTES, STATE_ANNOTATION, STATE_STOPPED, STATE_MIASE,
  STATE_SED, STATE_LIST_OF_SIMULATIONS, STATE_MODEL, STATE_LIST_OF_CHANGES,
  STATE_TASK, STATE_LIST_OF_MEASUREMENT, STATE_OUTPUT, STATE_LAST
}
 

Private Member Functions

void addContent (const char *el, const char **attr)
 
void createAllowedStateTags ()
 
void endElement (const char *el)
 
void error (std::string errorString)
 
CMiaseBasegetLastObj ()
 
bool isValid (const char *el)
 
void newAnnotation (const char **attr)
 
void newChange (const char *el, const char **attr)
 
void newContent (const XML_Char *s, int len)
 
void newMeasurementData (const char **attr)
 
void newMiase (const char **attr)
 
void newModel (const char **attr)
 
void newNotes (const char **attr)
 
void newOutput (const char **attr)
 
void newSimulation (const char *el, const char **attr)
 
void newState (States newState)
 
void newTask (const char **attr)
 
void startElement (const char *el, const char **attr)
 
void xmlDecl (const XML_Char *version, const XML_Char *encoding)
 
void xmlNameSpace (void *, const XML_Char *prefix, const XML_Char *uri)
 

Private Attributes

States mActState
 
std::vector< std::vector
< std::string > > 
mAllowedStateTags
 
char mBuff [8192]
 
std::string mContent
 
int mDepth
 
States mLastState
 
CMiaseMLmMiase
 
std::istream * mpIstream
 
int mTmpDepth
 
XML_Parser mXmlParser
 

Detailed Description

Definition at line 39 of file CMiaseParser.h.

Member Enumeration Documentation

enum CMiaseParser::States
private
Enumerator
STATE_READY_TO_READ 
STATE_LIST_OF_MODELS 
STATE_LIST_OF_TASKS 
STATE_LIST_OF_OUTPUTS 
STATE_NOTES 
STATE_ANNOTATION 
STATE_STOPPED 
STATE_MIASE 
STATE_SED 
STATE_LIST_OF_SIMULATIONS 
STATE_MODEL 
STATE_LIST_OF_CHANGES 
STATE_TASK 
STATE_LIST_OF_MEASUREMENT 
STATE_OUTPUT 
STATE_LAST 

Definition at line 69 of file CMiaseParser.h.

Constructor & Destructor Documentation

CMiaseParser::CMiaseParser ( )

Definition at line 28 of file CMiaseParser.cpp.

References charhndl(), createAllowedStateTags(), end(), mActState, mContent, mDepth, mLastState, mMiase, mTmpDepth, mXmlParser, myParser, start(), STATE_READY_TO_READ, and xmldecl_handler().

29 {
30  myParser = this;
31  this->mXmlParser = XML_ParserCreate(NULL);
34  this->mMiase = NULL;
35  this->mContent = "";
36  this->createAllowedStateTags();
37  this->mTmpDepth = 0;
38  this->mDepth = 0;
39 
40  XML_SetXmlDeclHandler(myParser->mXmlParser, myParser->xmldecl_handler);
41  XML_SetElementHandler(myParser->mXmlParser, myParser->start, myParser->end);
42  XML_SetCharacterDataHandler(myParser->mXmlParser, myParser->charhndl);
43 }
static void XMLCALL start(void *data, const char *el, const char **attr)
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
static void XMLCALL xmldecl_handler(void *userData, const XML_Char *version, const XML_Char *encoding, int standalone)
States mActState
Definition: CMiaseParser.h:96
States mLastState
Definition: CMiaseParser.h:97
static void XMLCALL charhndl(void *userData, const XML_Char *s, int len)
std::string mContent
Definition: CMiaseParser.h:102
XML_Parser mXmlParser
Definition: CMiaseParser.h:100
CMiaseML * mMiase
Definition: CMiaseParser.h:95
static void XMLCALL end(void *data, const char *el)
void createAllowedStateTags()
CMiaseParser::~CMiaseParser ( )

Definition at line 45 of file CMiaseParser.cpp.

References mXmlParser, and myParser.

46 {
47  XML_ParserFree(myParser->mXmlParser);
48  // delete *myParser;
49 }
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
XML_Parser mXmlParser
Definition: CMiaseParser.h:100

Member Function Documentation

void CMiaseParser::addContent ( const char *  el,
const char **  attr 
)
private

Definition at line 593 of file CMiaseParser.cpp.

References mContent, mTmpDepth, and myParser.

Referenced by startElement().

594 {
595  //myParser->mContent += "\n";
596  int i;
597 
598  for (i = 0; i < myParser->mTmpDepth; i++)
599  myParser->mContent += " ";
600 
601  myParser->mContent += "<";
602  myParser->mContent += el /*c_str()*/;
603 
604  for (i = 0; attr[i]; i += 2)
605  {
606  myParser->mContent += " "; // + attr[i] + " " + attr[i + 1];
607  myParser->mContent += attr[i];
608  myParser->mContent += " ";
609  myParser->mContent += attr[i + 1];
610  }
611 
612  myParser->mContent += ">\n";
613 }
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
std::string mContent
Definition: CMiaseParser.h:102
void XMLCALL CMiaseParser::charhndl ( void userData,
const XML_Char *  s,
int  len 
)
static

Definition at line 109 of file CMiaseParser.cpp.

References myParser, and newContent().

Referenced by CMiaseParser().

110 {myParser->newContent(s, len);}
void newContent(const XML_Char *s, int len)
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
void CMiaseParser::createAllowedStateTags ( )
private

Definition at line 51 of file CMiaseParser.cpp.

References mAllowedStateTags, STATE_LAST, STATE_LIST_OF_CHANGES, STATE_LIST_OF_MEASUREMENT, STATE_LIST_OF_MODELS, STATE_LIST_OF_OUTPUTS, STATE_LIST_OF_SIMULATIONS, STATE_LIST_OF_TASKS, STATE_MIASE, STATE_MODEL, STATE_READY_TO_READ, STATE_SED, STATE_STOPPED, and STATE_TASK.

Referenced by CMiaseParser().

52 {
53  std::vector<std::string> tmpAllowedTags;
54  int i;
55 
56  for (i = 0; i <= (int)STATE_STOPPED; i++)
57  {this->mAllowedStateTags.push_back(tmpAllowedTags);}
58 
59  tmpAllowedTags.push_back("Notes");
60  tmpAllowedTags.push_back("Annotation");
61 
62  for (i = (int)STATE_MIASE; i < (int)STATE_LAST; i++)
63  {this->mAllowedStateTags.push_back(tmpAllowedTags);}
64 
65  this->mAllowedStateTags[STATE_READY_TO_READ].push_back("MiaseML");
66 
67  this->mAllowedStateTags[STATE_MIASE].push_back("Sed");
68 
69  this->mAllowedStateTags[STATE_SED].push_back("listOfSimulations");
70  this->mAllowedStateTags[STATE_SED].push_back("listOfModels");
71  this->mAllowedStateTags[STATE_SED].push_back("listOfTasks");
72  this->mAllowedStateTags[STATE_SED].push_back("listOfOutputs");
73 
74  this->mAllowedStateTags[STATE_LIST_OF_SIMULATIONS].push_back("UniformTimeCourse");
75  this->mAllowedStateTags[STATE_LIST_OF_SIMULATIONS].push_back("SteadyStateAnalysis");
76  this->mAllowedStateTags[STATE_LIST_OF_SIMULATIONS].push_back("AnySimulationType");
77 
78  this->mAllowedStateTags[STATE_LIST_OF_MODELS].push_back("Model");
79 
80  this->mAllowedStateTags[STATE_MODEL].push_back("listOfChanges");
81 
82  this->mAllowedStateTags[STATE_LIST_OF_CHANGES].push_back("ChangeAttribute");
83  this->mAllowedStateTags[STATE_LIST_OF_CHANGES].push_back("ChangeMath");
84 
85  this->mAllowedStateTags[STATE_LIST_OF_TASKS].push_back("Task");
86 
87  this->mAllowedStateTags[STATE_TASK].push_back("listOfMeasurement");
88 
89  this->mAllowedStateTags[STATE_LIST_OF_MEASUREMENT].push_back("MeasurementData");
90 
91  this->mAllowedStateTags[STATE_LIST_OF_OUTPUTS].push_back("Output");
92 
93  tmpAllowedTags.clear();
94  this->mAllowedStateTags.push_back(tmpAllowedTags);
95  /*Only for testing
96  int k, l, size;
97  for (k=0;k<=(int)LAST;k++)
98  {
99  size = myParser->mAllowedStateTags[k].size();
100  for (l=0;l<size;l++)
101  {
102  printf("%s\n", this->mAllowedStateTags[k][l].c_str());
103  }
104  printf("\n");
105  } */
106 }
std::vector< std::vector< std::string > > mAllowedStateTags
Definition: CMiaseParser.h:103
void XMLCALL CMiaseParser::end ( void data,
const char *  el 
)
static

Definition at line 117 of file CMiaseParser.cpp.

References endElement(), and myParser.

Referenced by CMiaseParser().

118 {myParser->endElement(el);}
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
void endElement(const char *el)
void CMiaseParser::endElement ( const char *  el)
private

Definition at line 615 of file CMiaseParser.cpp.

References CMiaseBase::getAnnotation(), getLastObj(), CMiaseSed::getLastOutput(), CMiaseBase::getNotes(), CMiaseML::getSed(), mActState, mContent, mDepth, mLastState, mMiase, mTmpDepth, myParser, newState(), CMiaseOutput::saveWholeOutput(), CMiaseAnnotation::setAnyNote(), CMiaseNotes::setNotes(), STATE_ANNOTATION, STATE_LAST, STATE_LIST_OF_MODELS, STATE_LIST_OF_OUTPUTS, STATE_LIST_OF_TASKS, STATE_MODEL, STATE_NOTES, STATE_OUTPUT, STATE_SED, and STATE_TASK.

Referenced by end().

616 {
617  int i;
618  CMiaseBase *tmpObj;
619 
620  myParser->mDepth--;
621  myParser->mTmpDepth--;
622 
623  if ((strcmp(el, "Notes") == 0) && (myParser->mTmpDepth == 0))
624  {
625  tmpObj = myParser->getLastObj();
626  tmpObj->getNotes()->setNotes(myParser->mContent);
628  }
629  else if (((myParser->mActState == STATE_NOTES)
632  && (myParser->mTmpDepth != 0))
633  {
634  for (i = 0; i < myParser->mTmpDepth; i++)
635  myParser->mContent += " ";
636 
637  myParser->mContent += "</";
638  myParser->mContent += el;
639  myParser->mContent += ">\n";
640  }
641  else if ((strcmp(el, "Annotation") == 0) && (myParser->mTmpDepth == 0))
642  {
643  tmpObj = myParser->getLastObj();
646  }
647  else if (strcmp(el, "Model") == 0)
649  else if (strcmp(el, "listOfChanges") == 0)
651  else if (strcmp(el, "listOfMeasurement") == 0)
653  else if ((strcmp(el, "listOfSimulations") == 0)
654  || (strcmp(el, "listOfTasks") == 0)
655  || (strcmp(el, "listOfModels") == 0)
656  || (strcmp(el, "listOfOutputs") == 0))
658  else if (strcmp(el, "Task") == 0)
660  else if (strcmp(el, "Output") == 0)
661  {
663 
664  //TODO: addContent to Output
666  }
667  else if ((strcmp(el, "Sed") == 0) || (strcmp(el, "Miase") == 0))
669 }
CMiaseNotes * getNotes()
Definition: CMiaseBase.cpp:104
void setAnyNote(std::string anyAnnotation)
Definition: CMiaseBase.cpp:61
CMiaseOutput * getLastOutput()
Definition: CMiaseML.cpp:145
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
void setNotes(std::string notes)
Definition: CMiaseBase.cpp:28
CMiaseSed * getSed()
Definition: CMiaseML.cpp:168
States mActState
Definition: CMiaseParser.h:96
States mLastState
Definition: CMiaseParser.h:97
CMiaseAnnotation * getAnnotation()
Definition: CMiaseBase.cpp:94
void saveWholeOutput(std::string output)
void newState(States newState)
std::string mContent
Definition: CMiaseParser.h:102
CMiaseML * mMiase
Definition: CMiaseParser.h:95
CMiaseBase * getLastObj()
void CMiaseParser::error ( std::string  errorString)
private

Definition at line 782 of file CMiaseParser.cpp.

References myParser, newState(), and STATE_STOPPED.

Referenced by getLastObj(), isValid(), newAnnotation(), and newNotes().

783 {
785 }
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
void newState(States newState)
CMiaseBase * CMiaseParser::getLastObj ( )
private

Definition at line 671 of file CMiaseParser.cpp.

References error(), CMiaseModel::getLastChange(), CMiaseTask::getLastMeasurement(), CMiaseSed::getLastModel(), CMiaseSed::getLastOutput(), CMiaseSed::getLastSimulation(), CMiaseSed::getLastTask(), CMiaseML::getSed(), mLastState, mMiase, myParser, STATE_LIST_OF_CHANGES, STATE_LIST_OF_MEASUREMENT, STATE_LIST_OF_SIMULATIONS, STATE_MIASE, STATE_MODEL, STATE_OUTPUT, STATE_SED, and STATE_TASK.

Referenced by endElement().

672 {
673  switch (myParser->mLastState)
674  {
675  case STATE_OUTPUT:
676  return myParser->mMiase->getSed()->getLastOutput();
677  break;
680  break;
681  case STATE_TASK:
682  return myParser->mMiase->getSed()->getLastTask();
683  break;
686  break;
687  case STATE_MODEL:
688  return myParser->mMiase->getSed()->getLastModel();
689  break;
691  return myParser->mMiase->getSed()->getLastSimulation();
692  break;
693  case STATE_SED:
694  return myParser->mMiase->getSed();
695  break;
696  case STATE_MIASE:
697  return myParser->mMiase;
698  break;
699  default:
700  break;
701  }
702 
703  myParser->error("Last Obj is NULL");
704  return NULL;
705 }
CMiaseModel * getLastModel()
Definition: CMiaseML.cpp:118
CMiaseTask * getLastTask()
Definition: CMiaseML.cpp:91
CMiaseOutput * getLastOutput()
Definition: CMiaseML.cpp:145
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
CMiaseMeasurementData * getLastMeasurement()
Definition: CMiaseTask.cpp:68
CMiaseSed * getSed()
Definition: CMiaseML.cpp:168
void error(std::string errorString)
States mLastState
Definition: CMiaseParser.h:97
CMiaseSimulation * getLastSimulation()
Definition: CMiaseML.cpp:64
CMiaseML * mMiase
Definition: CMiaseParser.h:95
CMiaseChange * getLastChange()
bool CMiaseParser::isValid ( const char *  el)
private

Definition at line 787 of file CMiaseParser.cpp.

References error(), mActState, mAllowedStateTags, myParser, STATE_ANNOTATION, STATE_NOTES, STATE_OUTPUT, and STATE_STOPPED.

Referenced by startElement().

788 {
789  unsigned int i;
790 
794  {return true;}
795  else if (myParser->mActState == STATE_STOPPED)
796  {
797  myParser->error("PARSE ERROR");
798  return false;
799  }
800 
801  std::vector<std::string> tmpAllowedStateTags =
803 
804  for (i = 0; i < tmpAllowedStateTags.size(); i++)
805  {
806  if (strcmp(el, tmpAllowedStateTags[i].c_str()) == 0)
807  {return true;}
808  }
809 
810  myParser->error("PARSE ERROR");
811  return false;
812 }
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
States mActState
Definition: CMiaseParser.h:96
void error(std::string errorString)
std::vector< std::vector< std::string > > mAllowedStateTags
Definition: CMiaseParser.h:103
void CMiaseParser::load ( std::string  filename)

Definition at line 740 of file CMiaseParser.cpp.

References BUFFSIZE, mBuff, mXmlParser, myParser, and XML_FMT_INT_MOD.

741 {
742  FILE * file = fopen(filename.c_str(), "r");
743 
744  if (! myParser->mXmlParser)
745  {
746  fprintf(stderr, "Couldn't allocate memory for parser\n");
747  exit(-1);
748  }
749 
750  for (;;)
751  {
752 
753  int done;
754  int len;
755 
756  len = (int)fread(myParser->mBuff, 1, BUFFSIZE, file);
757 
758  if (ferror(file))
759  {
760  fprintf(stderr, "Read error\n");
761  exit(-1);
762  }
763 
764  done = feof(file);
765 
766  if (XML_Parse(myParser->mXmlParser, myParser->mBuff, len, done)
767  == XML_STATUS_ERROR)
768  {
769  fprintf(stderr, "Parse error at line %" XML_FMT_INT_MOD "u:\n%s\n",
770  XML_GetCurrentLineNumber(myParser->mXmlParser),
771  XML_ErrorString(XML_GetErrorCode(myParser->mXmlParser)));
772  exit(-1);
773  }
774 
775  if (done)
776  break;
777  }
778 
779  XML_ParserFree(myParser->mXmlParser);
780 }
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
#define XML_FMT_INT_MOD
Definition: CMiaseParser.h:34
XML_Parser mXmlParser
Definition: CMiaseParser.h:100
#define BUFFSIZE
Definition: CMiaseParser.h:37
char mBuff[8192]
Definition: CMiaseParser.h:101
void CMiaseParser::newAnnotation ( const char **  attr)
private

Definition at line 205 of file CMiaseParser.cpp.

References CMiaseBase::addAnnotation(), error(), CMiaseModel::getLastChange(), CMiaseTask::getLastMeasurement(), CMiaseSed::getLastModel(), CMiaseSed::getLastOutput(), CMiaseSed::getLastSimulation(), CMiaseSed::getLastTask(), CMiaseML::getSed(), mActState, mContent, mMiase, mTmpDepth, myParser, newState(), CMiaseAnnotation::setXmlNs(), STATE_ANNOTATION, STATE_LIST_OF_CHANGES, STATE_LIST_OF_MEASUREMENT, STATE_LIST_OF_SIMULATIONS, STATE_MIASE, STATE_MODEL, STATE_OUTPUT, STATE_SED, and STATE_TASK.

Referenced by startElement().

206 {
207  int i;
208  myParser->mContent = "";
209  myParser->mTmpDepth = 0;
210  CMiaseBase * tmpMiaseObj;
211 
213 
214  for (i = 0; attr[i]; i += 2)
215  {
216  if (strcmp(attr[i], "xmlns") == 0)
217  {newAnnotation->setXmlNs(attr[i + 1]);}
218  }
219 
220  switch (myParser->mActState)
221  {
222  case STATE_MIASE:
223  myParser->mMiase->addAnnotation(newAnnotation);
224  break;
225  case STATE_SED:
226  myParser->mMiase->getSed()->addAnnotation(newAnnotation);
227  break;
229  tmpMiaseObj = myParser->mMiase->getSed()->getLastSimulation();
230 
231  if (tmpMiaseObj != NULL)
232  {tmpMiaseObj->addAnnotation(newAnnotation);}
233  else
234  {myParser->error("invalid Annotation before Change");}
235 
236  break;
237  case STATE_MODEL:
238  myParser->mMiase->getSed()->getLastModel()->addAnnotation(newAnnotation);
239  break;
241  tmpMiaseObj = myParser->mMiase->getSed()->getLastModel()->getLastChange();
242 
243  if (tmpMiaseObj != NULL)
244  {tmpMiaseObj->addAnnotation(newAnnotation);}
245  else
246  {myParser->error("invalid Annotation before Change");}
247 
248  break;
249  case STATE_TASK:
250  myParser->mMiase->getSed()->getLastTask()->addAnnotation(newAnnotation);
251  break;
253  tmpMiaseObj = myParser->mMiase->getSed()->getLastTask()->getLastMeasurement();
254 
255  if (tmpMiaseObj != NULL)
256  {tmpMiaseObj->addAnnotation(newAnnotation);}
257  else
258  {myParser->error("invalid Annotation before Measurement");}
259 
260  break;
261  case STATE_OUTPUT:
262  myParser->mMiase->getSed()->getLastOutput()->addAnnotation(newAnnotation);
263  break;
264  default:
265  break;
266  }
267 
269 }
CMiaseModel * getLastModel()
Definition: CMiaseML.cpp:118
CMiaseTask * getLastTask()
Definition: CMiaseML.cpp:91
CMiaseOutput * getLastOutput()
Definition: CMiaseML.cpp:145
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
CMiaseMeasurementData * getLastMeasurement()
Definition: CMiaseTask.cpp:68
CMiaseSed * getSed()
Definition: CMiaseML.cpp:168
States mActState
Definition: CMiaseParser.h:96
void error(std::string errorString)
void setXmlNs(std::string xmlNs)
Definition: CMiaseBase.cpp:66
void newState(States newState)
std::string mContent
Definition: CMiaseParser.h:102
CMiaseSimulation * getLastSimulation()
Definition: CMiaseML.cpp:64
CMiaseML * mMiase
Definition: CMiaseParser.h:95
CMiaseChange * getLastChange()
void addAnnotation(CMiaseAnnotation *ann)
Definition: CMiaseBase.cpp:89
void newAnnotation(const char **attr)
void CMiaseParser::newChange ( const char *  el,
const char **  attr 
)
private

Definition at line 343 of file CMiaseParser.cpp.

References CMiaseModel::addChange(), CMiaseModel::getLastChange(), CMiaseSed::getLastModel(), CMiaseML::getSed(), mMiase, and myParser.

Referenced by startElement().

344 {
345  int i;
346 
347  if (strcmp(el, "ChangeAttribute") == 0)
348  {
351 
352  for (i = 0; attr[i]; i += 2)
353  {
354  if (strcmp(attr[i], "newValue") == 0)
355  {
357  ->getLastChange())->setNewValue(attr[i + 1]);
358  }
359  else if (strcmp(attr[i], "target") == 0)
360  {
362  ->getLastChange())->setTarget(attr[i + 1]);
363  }
364  }
365  }
366  else if (strcmp(el, "ChangeMath") == 0)
367  {
369  ->addChange(new CMiaseChangeMath());
370 
371  for (i = 0; attr[i]; i += 2)
372  {
373  if (strcmp(attr[i], "newMath") == 0)
374  {
376  ->getLastChange())->setNewMath(attr[i + 1]);
377  }
378  else if (strcmp(attr[i], "target") == 0)
379  {
381  ->getLastChange())->setTarget(attr[i + 1]);
382  }
383  }
384  }
385 }
CMiaseModel * getLastModel()
Definition: CMiaseML.cpp:118
void addChange(CMiaseChange *chnage)
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
CMiaseSed * getSed()
Definition: CMiaseML.cpp:168
CMiaseML * mMiase
Definition: CMiaseParser.h:95
CMiaseChange * getLastChange()
void CMiaseParser::newContent ( const XML_Char *  s,
int  len 
)
private

Definition at line 125 of file CMiaseParser.cpp.

References mActState, mContent, myParser, STATE_ANNOTATION, STATE_NOTES, and STATE_OUTPUT.

Referenced by charhndl().

126 {
127  std::string tmpContent;
128 
129  if ((myParser->mActState == STATE_NOTES)
132  {
133  tmpContent = s;
134  tmpContent = tmpContent.substr(0, len);
135  myParser->mContent += tmpContent;
136  }
137 }
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
States mActState
Definition: CMiaseParser.h:96
std::string mContent
Definition: CMiaseParser.h:102
void CMiaseParser::newMeasurementData ( const char **  attr)
private

Definition at line 417 of file CMiaseParser.cpp.

References CMiaseTask::addMeasurement(), CMiaseTask::getLastMeasurement(), CMiaseSed::getLastTask(), CMiaseML::getSed(), mMiase, myParser, CMiaseMeasurementData::setName(), and CMiaseMeasurementData::setSource().

Referenced by startElement().

418 {
419  int i;
422 
423  for (i = 0; attr[i]; i += 2)
424  {
425  if (strcmp(attr[i], "name") == 0)
426  {
428  ->getLastMeasurement()->setName(attr[i + 1]);
429  }
430  else if (strcmp(attr[i], "source") == 0)
431  {
433  ->getLastMeasurement()->setSource(attr[i + 1]);
434  }
435  }
436 }
void setName(std::string name)
Definition: CMiaseTask.cpp:37
CMiaseTask * getLastTask()
Definition: CMiaseML.cpp:91
void setSource(std::string source)
Definition: CMiaseTask.cpp:32
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
CMiaseMeasurementData * getLastMeasurement()
Definition: CMiaseTask.cpp:68
void addMeasurement(CMiaseMeasurementData *measurement)
Definition: CMiaseTask.cpp:53
CMiaseSed * getSed()
Definition: CMiaseML.cpp:168
CMiaseML * mMiase
Definition: CMiaseParser.h:95
void CMiaseParser::newMiase ( const char **  attr)
private

Definition at line 456 of file CMiaseParser.cpp.

References mMiase, myParser, newState(), CMiaseML::setVersion(), CMiaseML::setXmlns(), and STATE_MIASE.

Referenced by startElement().

457 {
458  int i;
460 
461  myParser->mMiase = new CMiaseML();
462 
463  for (i = 0; attr[i]; i += 2)
464  {
465  if (strcmp(attr[i], "xmlns") == 0)
466  {myParser->mMiase->setXmlns(attr[i + 1]);}
467  else if (strcmp(attr[i], "version") == 0)
468  {myParser->mMiase->setVersion(attr[i + 1]);}
469  }
470 }
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
void setXmlns(std::string xmlns)
Definition: CMiaseML.cpp:183
void setVersion(std::string version)
Definition: CMiaseML.cpp:188
void newState(States newState)
CMiaseML * mMiase
Definition: CMiaseParser.h:95
void CMiaseParser::newModel ( const char **  attr)
private

Definition at line 271 of file CMiaseParser.cpp.

References CMiaseSed::addModel(), CMiaseSed::getLastModel(), CMiaseML::getSed(), mMiase, myParser, newState(), CMiaseBaseEnhanced::setId(), CMiaseBaseEnhanced::setName(), CMiaseModel::setSource(), CMiaseModel::setType(), and STATE_MODEL.

Referenced by startElement().

272 {
273  int i;
275 
277 
278  for (i = 0; attr[i]; i += 2)
279  {
280  if (strcmp(attr[i], "id") == 0)
281  {myParser->mMiase->getSed()->getLastModel()->setId(attr[i + 1]);}
282  else if (strcmp(attr[i], "name") == 0)
283  {myParser->mMiase->getSed()->getLastModel()->setName(attr[i + 1]);}
284  else if (strcmp(attr[i], "type") == 0)
285  {myParser->mMiase->getSed()->getLastModel()->setType(attr[i + 1]);}
286  else if (strcmp(attr[i], "source") == 0)
287  {myParser->mMiase->getSed()->getLastModel()->setSource(attr[i + 1]);}
288  }
289 }
CMiaseModel * getLastModel()
Definition: CMiaseML.cpp:118
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
void setId(std::string id)
Definition: CMiaseBase.cpp:127
CMiaseSed * getSed()
Definition: CMiaseML.cpp:168
void setName(std::string name)
Definition: CMiaseBase.cpp:132
void addModel(CMiaseModel *model)
Definition: CMiaseML.cpp:37
void newState(States newState)
CMiaseML * mMiase
Definition: CMiaseParser.h:95
void setType(std::string type)
void setSource(std::string source)
void CMiaseParser::newNotes ( const char **  attr)
private

Definition at line 139 of file CMiaseParser.cpp.

References CMiaseBase::addNotes(), error(), CMiaseModel::getLastChange(), CMiaseTask::getLastMeasurement(), CMiaseSed::getLastModel(), CMiaseSed::getLastOutput(), CMiaseSed::getLastSimulation(), CMiaseSed::getLastTask(), CMiaseML::getSed(), mActState, mContent, mMiase, mTmpDepth, myParser, newState(), CMiaseNotes::setXmlNs(), STATE_LIST_OF_CHANGES, STATE_LIST_OF_MEASUREMENT, STATE_LIST_OF_SIMULATIONS, STATE_MIASE, STATE_MODEL, STATE_NOTES, STATE_OUTPUT, STATE_SED, and STATE_TASK.

Referenced by startElement().

140 {
141  int i;
142  myParser->mContent = "";
143  myParser->mTmpDepth = 0;
144  CMiaseBase * tmpMiaseObj;
145 
147 
148  for (i = 0; attr[i]; i += 2)
149  {
150  if (strcmp(attr[i], "xmlns") == 0)
151  {newNotes->setXmlNs(attr[i + 1]);}
152  }
153 
154  switch (myParser->mActState)
155  {
156  case STATE_MIASE:
157  myParser->mMiase->addNotes(newNotes);
158  break;
159  case STATE_SED:
160  myParser->mMiase->getSed()->addNotes(newNotes);
161  break;
163  tmpMiaseObj = myParser->mMiase->getSed()->getLastSimulation();
164 
165  if (tmpMiaseObj != NULL)
166  {tmpMiaseObj->addNotes(new CMiaseNotes());}
167  else
168  {myParser->error("invalid Notes before Change");}
169 
170  break;
171  case STATE_MODEL:
172  myParser->mMiase->getSed()->getLastModel()->addNotes(newNotes);
173  break;
175  tmpMiaseObj = myParser->mMiase->getSed()->getLastModel()->getLastChange();
176 
177  if (tmpMiaseObj != NULL)
178  {tmpMiaseObj->addNotes(newNotes);}
179  else
180  {myParser->error("invalid Notes before Change");}
181 
182  break;
183  case STATE_TASK:
184  myParser->mMiase->getSed()->getLastTask()->addNotes(newNotes);
185  break;
187  tmpMiaseObj = myParser->mMiase->getSed()->getLastTask()->getLastMeasurement();
188 
189  if (tmpMiaseObj != NULL)
190  {tmpMiaseObj->addNotes(newNotes);}
191  else
192  {myParser->error("invalid Notes before Measurement");}
193 
194  break;
195  case STATE_OUTPUT:
196  myParser->mMiase->getSed()->getLastOutput()->addNotes(newNotes);
197  break;
198  default:
199  break;
200  }
201 
203 }
CMiaseModel * getLastModel()
Definition: CMiaseML.cpp:118
void setXmlNs(std::string xmlNs)
Definition: CMiaseBase.cpp:38
CMiaseTask * getLastTask()
Definition: CMiaseML.cpp:91
CMiaseOutput * getLastOutput()
Definition: CMiaseML.cpp:145
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
CMiaseMeasurementData * getLastMeasurement()
Definition: CMiaseTask.cpp:68
void addNotes(CMiaseNotes *notes)
Definition: CMiaseBase.cpp:99
CMiaseSed * getSed()
Definition: CMiaseML.cpp:168
States mActState
Definition: CMiaseParser.h:96
void error(std::string errorString)
void newState(States newState)
std::string mContent
Definition: CMiaseParser.h:102
CMiaseSimulation * getLastSimulation()
Definition: CMiaseML.cpp:64
CMiaseML * mMiase
Definition: CMiaseParser.h:95
CMiaseChange * getLastChange()
void newNotes(const char **attr)
void CMiaseParser::newOutput ( const char **  attr)
private

Definition at line 438 of file CMiaseParser.cpp.

References CMiaseSed::addOutput(), CMiaseSed::getLastOutput(), CMiaseML::getSed(), mContent, mMiase, mTmpDepth, myParser, newState(), CMiaseBaseEnhanced::setId(), CMiaseBaseEnhanced::setName(), and STATE_OUTPUT.

Referenced by startElement().

439 {
440  myParser->mContent = "";
441  myParser->mTmpDepth = 0;
442  int i;
444 
446 
447  for (i = 0; attr[i]; i += 2)
448  {
449  if (strcmp(attr[i], "id") == 0)
450  {myParser->mMiase->getSed()->getLastOutput()->setId(attr[i + 1]);}
451  else if (strcmp(attr[i], "name") == 0)
452  {myParser->mMiase->getSed()->getLastOutput()->setName(attr[i + 1]);}
453  }
454 }
CMiaseOutput * getLastOutput()
Definition: CMiaseML.cpp:145
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
void setId(std::string id)
Definition: CMiaseBase.cpp:127
CMiaseSed * getSed()
Definition: CMiaseML.cpp:168
void setName(std::string name)
Definition: CMiaseBase.cpp:132
void newState(States newState)
void addOutput(CMiaseOutput *output)
Definition: CMiaseML.cpp:42
std::string mContent
Definition: CMiaseParser.h:102
CMiaseML * mMiase
Definition: CMiaseParser.h:95
void CMiaseParser::newSimulation ( const char *  el,
const char **  attr 
)
private

Definition at line 291 of file CMiaseParser.cpp.

References CMiaseSed::addSimulation(), CMiaseSed::getLastSimulation(), CMiaseML::getSed(), mMiase, myParser, and strToDouble().

Referenced by startElement().

292 {
293  int i;
294 
295  if (strcmp(el, "UniformTimeCourse") == 0)
296  {
298 
299  for (i = 0; attr[i]; i += 2)
300  {
301  if (strcmp(attr[i], "id") == 0)
302  {
304  ->getLastSimulation())->setId(attr[i + 1]);
305  }
306  else if (strcmp(attr[i], "name") == 0)
307  {
309  ->getLastSimulation())->setName(attr[i + 1]);
310  }
311  else if (strcmp(attr[i], "initialTime") == 0)
312  {
314  ->getLastSimulation())->setInitialTime(strToDouble(attr[i + 1], 0));
315  }
316  else if (strcmp(attr[i], "outputStartTime") == 0)
317  {
319  ->getLastSimulation())->setOutputStartTime(strToDouble(attr[i + 1], 0));
320  }
321  else if (strcmp(attr[i], "outputEndTime") == 0)
322  {
324  ->getLastSimulation())->setOutputEndTime(strToDouble(attr[i + 1], 0));
325  }
326  else if (strcmp(attr[i], "numberOfPoints") == 0)
327  {
329  ->getLastSimulation())->setNumberOfPoints(strToDouble(attr[i + 1], 0));
330  }
331  }
332  }
333  else if (strcmp(el, "SteadyStateAnalysis") == 0)
334  {
335  //TODO
336  }
337  else if (strcmp(el, "AnySimulationType") == 0)
338  {
339  //TODO
340  }
341 }
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
CMiaseSed * getSed()
Definition: CMiaseML.cpp:168
double strToDouble(const char *str, char const **pTail)
Definition: utility.cpp:325
CMiaseSimulation * getLastSimulation()
Definition: CMiaseML.cpp:64
CMiaseML * mMiase
Definition: CMiaseParser.h:95
void addSimulation(CMiaseSimulation *simulation)
Definition: CMiaseML.cpp:27
void CMiaseParser::newState ( States  newState)
private

Definition at line 707 of file CMiaseParser.cpp.

References mActState, mLastState, and myParser.

Referenced by endElement(), error(), newAnnotation(), newMiase(), newModel(), newNotes(), newOutput(), newTask(), and startElement().

708 {
709  //myParser->mContent = "";
712 }
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
States mActState
Definition: CMiaseParser.h:96
States mLastState
Definition: CMiaseParser.h:97
void newState(States newState)
void CMiaseParser::newTask ( const char **  attr)
private

Definition at line 387 of file CMiaseParser.cpp.

References CMiaseSed::addTask(), CMiaseSed::getLastTask(), CMiaseML::getSed(), mMiase, myParser, newState(), CMiaseBaseEnhanced::setId(), CMiaseTask::setModelReference(), CMiaseBaseEnhanced::setName(), CMiaseTask::setSimulationReference(), and STATE_TASK.

Referenced by startElement().

388 {
389  int i;
391 
393 
394  for (i = 0; attr[i]; i += 2)
395  {
396  if (strcmp(attr[i], "id") == 0)
397  {
398  myParser->mMiase->getSed()->getLastTask()->setId(attr[i + 1]);
399  }
400  else if (strcmp(attr[i], "name") == 0)
401  {
402  myParser->mMiase->getSed()->getLastTask()->setName(attr[i + 1]);
403  }
404  else if (strcmp(attr[i], "modelReference") == 0)
405  {
407  attr[i + 1]);
408  }
409  else if (strcmp(attr[i], "simulationReference") == 0)
410  {
412  attr[i + 1]);
413  }
414  }
415 }
void addTask(CMiaseTask *task)
Definition: CMiaseML.cpp:32
CMiaseTask * getLastTask()
Definition: CMiaseML.cpp:91
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
void setId(std::string id)
Definition: CMiaseBase.cpp:127
void setSimulationReference(std::string simulation)
Definition: CMiaseTask.cpp:78
CMiaseSed * getSed()
Definition: CMiaseML.cpp:168
void setName(std::string name)
Definition: CMiaseBase.cpp:132
void newState(States newState)
void setModelReference(std::string model)
Definition: CMiaseTask.cpp:73
CMiaseML * mMiase
Definition: CMiaseParser.h:95
void XMLCALL CMiaseParser::start ( void data,
const char *  el,
const char **  attr 
)
static

Definition at line 113 of file CMiaseParser.cpp.

References myParser, and startElement().

Referenced by CMiaseParser().

114 {myParser->startElement(el, attr);}
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
void startElement(const char *el, const char **attr)
void CMiaseParser::startElement ( const char *  el,
const char **  attr 
)
private

Definition at line 472 of file CMiaseParser.cpp.

References addContent(), isValid(), mActState, mDepth, mMiase, mTmpDepth, myParser, newAnnotation(), newChange(), newMeasurementData(), newMiase(), newModel(), newNotes(), newOutput(), newSimulation(), newState(), newTask(), CMiaseML::setMiaseSed(), STATE_ANNOTATION, STATE_LIST_OF_CHANGES, STATE_LIST_OF_MEASUREMENT, STATE_LIST_OF_MODELS, STATE_LIST_OF_OUTPUTS, STATE_LIST_OF_SIMULATIONS, STATE_LIST_OF_TASKS, STATE_MIASE, STATE_MODEL, STATE_NOTES, STATE_OUTPUT, STATE_READY_TO_READ, STATE_SED, and STATE_TASK.

Referenced by start().

473 {
474  if (myParser->isValid(el))
475  {
476  if ((strcmp(el, "Notes") == 0) && (myParser->mActState != STATE_NOTES))
477  {myParser->newNotes(attr);}
478  else if ((strcmp(el, "Annotation") == 0)
480  {myParser->newAnnotation(attr);}
481  else
482  {
483  switch (myParser->mActState)
484  {
486 
487  if (strcmp(el, "Model") == 0)
488  {myParser->newModel(attr);}
489 
490  break;
491  case STATE_MODEL:
492 
493  if (strcmp(el, "listOfChanges") == 0)
495 
496  break;
498 
499  if ((strcmp(el, "ChangeAttribute") == 0)
500  || (strcmp(el, "ChangeMath") == 0))
501  {myParser->newChange(el, attr);}
502 
503  break;
505 
506  if ((strcmp(el, "UniformTimeCourse") == 0)
507  || (strcmp(el, "SteadyStateAnalysis") == 0)
508  || (strcmp(el, "AnySimulationType") == 0))
509  {myParser->newSimulation(el, attr);}
510 
511  break;
512  case STATE_LIST_OF_TASKS:
513 
514  if (strcmp(el, "Task") == 0)
515  {myParser->newTask(attr);}
516 
517  break;
518  case STATE_TASK:
519 
520  if (strcmp(el, "listOfMeasurement") == 0)
522 
523  break;
525 
526  if (strcmp(el, "MeasurementData") == 0)
527  {myParser->newMeasurementData(attr);}
528 
529  break;
531 
532  if (strcmp(el, "Output") == 0)
533  {myParser->newOutput(attr);}
534 
535  break;
536  case STATE_SED:
537 
538  if (strcmp(el, "listOfSimulations") == 0)
540  else if (strcmp(el, "listOfOutputs") == 0)
542  else if (strcmp(el, "listOfTasks") == 0)
544  else if (strcmp(el, "listOfModels") == 0)
546 
547  break;
548  case STATE_MIASE:
549 
550  if (strcmp(el, "Sed") == 0)
551  {
554  }
555 
556  break;
557  case STATE_READY_TO_READ:
558 
559  if (strcmp(el, "MiaseML") == 0)
560  {myParser->newMiase(attr);}
561 
562  break;
563  case STATE_NOTES:
564  myParser->addContent(el, attr);
565  break;
566  case STATE_ANNOTATION:
567  myParser->addContent(el, attr);
568  break;
569  case STATE_OUTPUT:
570  myParser->addContent(el, attr);
571  break;
572  default:
573  break;
574  }
575  }
576 
577  /* int i;
578  for (i = 0; i < myParser->mDepth; i++)
579  printf(" ");
580 
581  printf("%s", el);
582  for (i = 0; attr[i]; i += 2)
583  printf(" %s='%s'", attr[i], attr[i + 1]);
584 
585  printf("\n");
586  */
587  }
588 
589  myParser->mDepth++;
590  myParser->mTmpDepth++;
591 }
void newMiase(const char **attr)
void setMiaseSed(CMiaseSed *sed)
Definition: CMiaseML.cpp:163
void addContent(const char *el, const char **attr)
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
void newTask(const char **attr)
void newOutput(const char **attr)
States mActState
Definition: CMiaseParser.h:96
void newMeasurementData(const char **attr)
void newChange(const char *el, const char **attr)
void newState(States newState)
bool isValid(const char *el)
CMiaseML * mMiase
Definition: CMiaseParser.h:95
void newModel(const char **attr)
void newNotes(const char **attr)
void newSimulation(const char *el, const char **attr)
void newAnnotation(const char **attr)
void CMiaseParser::testDataStructure ( )

Definition at line 814 of file CMiaseParser.cpp.

References CMiaseChange::ATTRIBUTE, CMiaseModel::getChange(), CMiaseBaseEnhanced::getId(), CMiaseTask::getMeasurement(), CMiaseSed::getModel(), CMiaseMeasurementData::getName(), CMiaseBaseEnhanced::getName(), CMiaseNotes::getNotes(), CMiaseBase::getNotes(), CMiaseTask::getNumberOfMeasurements(), CMiaseModel::getNumOfChanges(), CMiaseSed::getNumOfModels(), CMiaseSed::getNumOfOutputs(), CMiaseSed::getNumOfSimulations(), CMiaseSed::getNumOfTasks(), CMiaseSed::getOutput(), CMiaseML::getSed(), CMiaseSed::getSimulation(), CMiaseMeasurementData::getSource(), CMiaseModel::getSource(), CMiaseSed::getTask(), CMiaseModel::getType(), CMiaseOutput::getWholeOutput(), CMiaseChange::MATH, mMiase, CMiaseChange::mType, and myParser.

815 {
816  int i;
817  int j;
818  //testing whether structure was loaded
819  std::cout << "-------------------------DataStructure------------------------------- " << std::endl << std::endl << std::endl;
820 
821  if (myParser->mMiase)
822  {
823  std::cout <<
824  myParser->mMiase->getSed()->getNotes()->getNotes() << std::endl;
825 
826  if (myParser->mMiase->getSed()->getNumOfSimulations() > 0)
827  {
828  std::cout << "NumOfSimulations: " <<
829  myParser->mMiase->getSed()->getNumOfSimulations() << std::endl << std::endl;
830 
831  for (i = 0 ; i < myParser->mMiase->getSed()->getNumOfSimulations() ; i++)
832  {
833  std::cout << " Simulation nr. :" << i << std::endl;
834 
835  std::cout << " id: " <<
836  ((CMiaseUniformTimeCourse*)myParser->mMiase->getSed()->getSimulation(i))->getId() << std::endl;
837  std::cout << " name: " <<
838  ((CMiaseUniformTimeCourse*)myParser->mMiase->getSed()->getSimulation(i))->getName() << std::endl;
839 
840  std::cout << " InitialTime: " <<
841  ((CMiaseUniformTimeCourse*)myParser->mMiase->getSed()->getSimulation(i))->getInitialTime() << std::endl;
842  std::cout << " OutputStartTime: " <<
843  ((CMiaseUniformTimeCourse*)myParser->mMiase->getSed()->getSimulation(i))->getOutputStartTime() << std::endl;
844  std::cout << " OutputEndTime: " <<
845  ((CMiaseUniformTimeCourse*)myParser->mMiase->getSed()->getSimulation(i))->getOutputEndTime() << std::endl;
846  std::cout << " NumberOfPoints: " <<
847  ((CMiaseUniformTimeCourse*)myParser->mMiase->getSed()->getSimulation(i))->getNumberOfPoints() << std::endl;
848  }
849  }
850 
851  std::cout << std::endl << std::endl;
852 
853  if (myParser->mMiase->getSed()->getNumOfModels() > 0)
854  {
855  std::cout << "NumOfModels: " <<
856  myParser->mMiase->getSed()->getNumOfModels() << std::endl << std::endl;
857 
858  for (i = 0 ; i < myParser->mMiase->getSed()->getNumOfModels() ; i++)
859  {
860  std::cout << " Model nr. :" << i << std::endl;
861 
862  std::cout << " id: " <<
863  myParser->mMiase->getSed()->getModel(i)->getId() << std::endl;
864  std::cout << " name: " <<
865  myParser->mMiase->getSed()->getModel(i)->getName() << std::endl;
866 
867  std::cout << " type: " <<
868  myParser->mMiase->getSed()->getModel(i)->getType() << std::endl;
869  std::cout << " source: " <<
870  myParser->mMiase->getSed()->getModel(i)->getSource() << std::endl;
871 
872  if (myParser->mMiase->getSed()->getModel(i)->getNumOfChanges() > 0)
873  {
874  std::cout << " NumOfChanges: " <<
875  myParser->mMiase->getSed()->getModel(i)->getNumOfChanges() << std::endl << std::endl;
876 
877  for (j = 0 ; j < myParser->mMiase->getSed()->getModel(i)->getNumOfChanges() ; j++)
878  {
879  std::cout << " Change nr. :" << j << std::endl;
880 
882  {
883  std::cout << " Change the ATTRIBUTE: " << std::endl;
884  std::cout << " NewValue: " <<
885  ((CMiaseChangeAttribute*)myParser->mMiase->getSed()->getModel(i)->getChange(j))->getNewValue() << std::endl;
886  std::cout << " Target: " <<
887  ((CMiaseChangeAttribute*)myParser->mMiase->getSed()->getModel(i)->getChange(j))->getTarget() << std::endl;
888  }
889 
891  {
892  std::cout << " Change the MATH: " << std::endl;
893  std::cout << " NewMath: " <<
894  ((CMiaseChangeMath*)myParser->mMiase->getSed()->getModel(i)->getChange(j))->getNewMath() << std::endl;
895  std::cout << " Target: " <<
896  ((CMiaseChangeMath*)myParser->mMiase->getSed()->getModel(i)->getChange(j))->getTarget() << std::endl;
897  }
898  }
899  }
900  }
901  }
902 
903  std::cout << std::endl << std::endl;
904 
905  if (myParser->mMiase->getSed()->getNumOfTasks() > 0)
906  {
907  std::cout << "NumOfTasks: " <<
908  myParser->mMiase->getSed()->getNumOfTasks() << std::endl << std::endl;
909 
910  for (i = 0 ; i < myParser->mMiase->getSed()->getNumOfTasks() ; i++)
911  {
912  std::cout << " Task nr. :" << i << std::endl;
913 
914  std::cout << " id: " <<
915  ((CMiaseUniformTimeCourse*)myParser->mMiase->getSed()->getTask(i))->getId() << std::endl;
916  std::cout << " name: " <<
917  ((CMiaseUniformTimeCourse*)myParser->mMiase->getSed()->getTask(i))->getName() << std::endl;
918 
919  std::cout << " notes: " <<
920  myParser->mMiase->getSed()->getTask(i)->getNotes()->getNotes() << std::endl;
921 
923  {
924  std::cout << " NumberOfMeasurements: " <<
925  myParser->mMiase->getSed()->getTask(i) << std::endl << std::endl;
926 
927  for (j = 0 ; j < myParser->mMiase->getSed()->getTask(i)->
928  getNumberOfMeasurements() ; j++)
929  {
930  std::cout << " Measurement nr. :" << j << std::endl;
931 
932  std::cout << " source: " <<
933  myParser->mMiase->getSed()->getTask(i)->getMeasurement(j)->getSource() << std::endl;
934  std::cout << " name: " <<
935  myParser->mMiase->getSed()->getTask(i)->getMeasurement(j)->getName() << std::endl;
936  }
937  }
938  }
939  }
940 
941  std::cout << std::endl << std::endl;
942 
943  if (myParser->mMiase->getSed()->getNumOfOutputs() > 0)
944  {
945  std::cout << "NumOfOutputs: " <<
946  myParser->mMiase->getSed()->getNumOfOutputs() << std::endl << std::endl;
947 
948  for (i = 0 ; i < myParser->mMiase->getSed()->getNumOfOutputs() ; i++)
949  {
950  std::cout << "output nr: " << i << std::endl;
951  std::cout << myParser->mMiase->getSed()->getOutput(i)->getWholeOutput() << std::endl;
952  }
953  }
954  }
955 }
std::string getId()
Definition: CMiaseBase.cpp:117
CMiaseTask * getTask(int num)
Definition: CMiaseML.cpp:74
CMiaseNotes * getNotes()
Definition: CMiaseBase.cpp:104
CMiaseOutput * getOutput(int num)
Definition: CMiaseML.cpp:128
CMiaseMeasurementData * getMeasurement(int num)
Definition: CMiaseTask.cpp:58
int getNumOfChanges()
int getNumOfOutputs()
Definition: CMiaseML.cpp:150
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
CMiaseChange * getChange(int num)
int getNumberOfMeasurements()
Definition: CMiaseTask.cpp:63
CMiaseSimulation * getSimulation(int num)
Definition: CMiaseML.cpp:47
CMiaseSed * getSed()
Definition: CMiaseML.cpp:168
CMiaseModel * getModel(int num)
Definition: CMiaseML.cpp:101
std::string getWholeOutput()
int getNumOfModels()
Definition: CMiaseML.cpp:123
int getNumOfSimulations()
Definition: CMiaseML.cpp:69
std::string getSource()
Definition: CMiaseTask.cpp:22
std::string getType()
Definition: CMiaseModel.cpp:93
CMiaseML * mMiase
Definition: CMiaseParser.h:95
std::string getSource()
Definition: CMiaseModel.cpp:98
std::string getName()
Definition: CMiaseTask.cpp:27
int getNumOfTasks()
Definition: CMiaseML.cpp:96
std::string getNotes()
Definition: CMiaseBase.cpp:23
std::string getName()
Definition: CMiaseBase.cpp:122
void CMiaseParser::xmlDecl ( const XML_Char *  version,
const XML_Char *  encoding 
)
private

Definition at line 714 of file CMiaseParser.cpp.

References mEncoding, min, mVersion_1_0, mXmlParser, and myParser.

Referenced by xmldecl_handler().

716 {
717 
718  unsigned int i;
719 
720  for (i = 0; i < (sizeof(myParser->mVersion_1_0) /
721  sizeof(myParser->mVersion_1_0[0])); ++i)
722  {
723  if (version[i] != myParser->mVersion_1_0[i])
724  {
725  XML_StopParser(myParser->mXmlParser, false);
726  fprintf(stderr, "Read error\n");
727  }
728  }
729 
730  for (i = 0; i < std::min(sizeof(myParser->mEncoding), sizeof(encoding)); i++)
731  {
732  if (encoding[i] != myParser->mEncoding[i])
733  {
734  XML_StopParser(myParser->mXmlParser, false);
735  fprintf(stderr, "Read error\n");
736  }
737  }
738 }
static XML_Char mVersion_1_0[]
Definition: CMiaseParser.h:44
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
XML_Parser mXmlParser
Definition: CMiaseParser.h:100
static char mEncoding[]
Definition: CMiaseParser.h:46
#define min(a, b)
Definition: f2c.h:175
void XMLCALL CMiaseParser::xmldecl_handler ( void userData,
const XML_Char *  version,
const XML_Char *  encoding,
int  standalone 
)
static

Definition at line 121 of file CMiaseParser.cpp.

References myParser, and xmlDecl().

Referenced by CMiaseParser().

123 {myParser->xmlDecl(version, encoding);}
static CMiaseParser * myParser
Definition: CMiaseParser.h:148
void xmlDecl(const XML_Char *version, const XML_Char *encoding)
void CMiaseParser::xmlNameSpace ( void ,
const XML_Char *  prefix,
const XML_Char *  uri 
)
private

Member Data Documentation

States CMiaseParser::mActState
private
std::vector< std::vector<std::string> > CMiaseParser::mAllowedStateTags
private

Definition at line 103 of file CMiaseParser.h.

Referenced by createAllowedStateTags(), and isValid().

char CMiaseParser::mBuff[8192]
private

Definition at line 101 of file CMiaseParser.h.

Referenced by load().

std::string CMiaseParser::mContent
private
int CMiaseParser::mDepth
private

Definition at line 99 of file CMiaseParser.h.

Referenced by CMiaseParser(), endElement(), and startElement().

XML_Char CMiaseParser::mEncoding = {'u', 't', 'f', '-', 8}
static

Definition at line 46 of file CMiaseParser.h.

Referenced by xmlDecl().

States CMiaseParser::mLastState
private

Definition at line 97 of file CMiaseParser.h.

Referenced by CMiaseParser(), endElement(), getLastObj(), and newState().

CMiaseML* CMiaseParser::mMiase
private
XML_Char CMiaseParser::mNameSpace = "http://www.miase.org/"
static

Definition at line 45 of file CMiaseParser.h.

std::istream* CMiaseParser::mpIstream
private

A pointer to the input stream

Definition at line 93 of file CMiaseParser.h.

int CMiaseParser::mTmpDepth
private
XML_Char CMiaseParser::mVersion_1_0 = {'1', '.', '0', 0}
static

Definition at line 44 of file CMiaseParser.h.

Referenced by xmlDecl().

XML_Parser CMiaseParser::mXmlParser
private

Definition at line 100 of file CMiaseParser.h.

Referenced by CMiaseParser(), load(), xmlDecl(), and ~CMiaseParser().


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