53 std::vector<std::string> tmpAllowedTags;
59 tmpAllowedTags.push_back(
"Notes");
60 tmpAllowedTags.push_back(
"Annotation");
93 tmpAllowedTags.clear();
122 const XML_Char *encoding,
int standalone)
127 std::string tmpContent;
134 tmpContent = tmpContent.substr(0, len);
148 for (i = 0; attr[i]; i += 2)
150 if (strcmp(attr[i],
"xmlns") == 0)
165 if (tmpMiaseObj != NULL)
177 if (tmpMiaseObj != NULL)
189 if (tmpMiaseObj != NULL)
214 for (i = 0; attr[i]; i += 2)
216 if (strcmp(attr[i],
"xmlns") == 0)
217 {newAnnotation->
setXmlNs(attr[i + 1]);}
231 if (tmpMiaseObj != NULL)
243 if (tmpMiaseObj != NULL)
255 if (tmpMiaseObj != NULL)
278 for (i = 0; attr[i]; i += 2)
280 if (strcmp(attr[i],
"id") == 0)
282 else if (strcmp(attr[i],
"name") == 0)
284 else if (strcmp(attr[i],
"type") == 0)
286 else if (strcmp(attr[i],
"source") == 0)
295 if (strcmp(el,
"UniformTimeCourse") == 0)
299 for (i = 0; attr[i]; i += 2)
301 if (strcmp(attr[i],
"id") == 0)
306 else if (strcmp(attr[i],
"name") == 0)
311 else if (strcmp(attr[i],
"initialTime") == 0)
316 else if (strcmp(attr[i],
"outputStartTime") == 0)
321 else if (strcmp(attr[i],
"outputEndTime") == 0)
326 else if (strcmp(attr[i],
"numberOfPoints") == 0)
333 else if (strcmp(el,
"SteadyStateAnalysis") == 0)
337 else if (strcmp(el,
"AnySimulationType") == 0)
347 if (strcmp(el,
"ChangeAttribute") == 0)
352 for (i = 0; attr[i]; i += 2)
354 if (strcmp(attr[i],
"newValue") == 0)
359 else if (strcmp(attr[i],
"target") == 0)
366 else if (strcmp(el,
"ChangeMath") == 0)
371 for (i = 0; attr[i]; i += 2)
373 if (strcmp(attr[i],
"newMath") == 0)
378 else if (strcmp(attr[i],
"target") == 0)
394 for (i = 0; attr[i]; i += 2)
396 if (strcmp(attr[i],
"id") == 0)
400 else if (strcmp(attr[i],
"name") == 0)
404 else if (strcmp(attr[i],
"modelReference") == 0)
409 else if (strcmp(attr[i],
"simulationReference") == 0)
423 for (i = 0; attr[i]; i += 2)
425 if (strcmp(attr[i],
"name") == 0)
430 else if (strcmp(attr[i],
"source") == 0)
447 for (i = 0; attr[i]; i += 2)
449 if (strcmp(attr[i],
"id") == 0)
451 else if (strcmp(attr[i],
"name") == 0)
463 for (i = 0; attr[i]; i += 2)
465 if (strcmp(attr[i],
"xmlns") == 0)
467 else if (strcmp(attr[i],
"version") == 0)
478 else if ((strcmp(el,
"Annotation") == 0)
487 if (strcmp(el,
"Model") == 0)
493 if (strcmp(el,
"listOfChanges") == 0)
499 if ((strcmp(el,
"ChangeAttribute") == 0)
500 || (strcmp(el,
"ChangeMath") == 0))
506 if ((strcmp(el,
"UniformTimeCourse") == 0)
507 || (strcmp(el,
"SteadyStateAnalysis") == 0)
508 || (strcmp(el,
"AnySimulationType") == 0))
514 if (strcmp(el,
"Task") == 0)
520 if (strcmp(el,
"listOfMeasurement") == 0)
526 if (strcmp(el,
"MeasurementData") == 0)
532 if (strcmp(el,
"Output") == 0)
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)
550 if (strcmp(el,
"Sed") == 0)
559 if (strcmp(el,
"MiaseML") == 0)
604 for (i = 0; attr[i]; i += 2)
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)
667 else if ((strcmp(el,
"Sed") == 0) || (strcmp(el,
"Miase") == 0))
715 const XML_Char *encoding)
726 fprintf(stderr,
"Read error\n");
735 fprintf(stderr,
"Read error\n");
742 FILE * file = fopen(filename.c_str(),
"r");
746 fprintf(stderr,
"Couldn't allocate memory for parser\n");
760 fprintf(stderr,
"Read error\n");
801 std::vector<std::string> tmpAllowedStateTags =
804 for (i = 0; i < tmpAllowedStateTags.size(); i++)
806 if (strcmp(el, tmpAllowedStateTags[i].c_str()) == 0)
819 std::cout <<
"-------------------------DataStructure------------------------------- " << std::endl << std::endl << std::endl;
828 std::cout <<
"NumOfSimulations: " <<
833 std::cout <<
" Simulation nr. :" << i << std::endl;
835 std::cout <<
" id: " <<
837 std::cout <<
" name: " <<
840 std::cout <<
" InitialTime: " <<
842 std::cout <<
" OutputStartTime: " <<
844 std::cout <<
" OutputEndTime: " <<
846 std::cout <<
" NumberOfPoints: " <<
851 std::cout << std::endl << std::endl;
855 std::cout <<
"NumOfModels: " <<
860 std::cout <<
" Model nr. :" << i << std::endl;
862 std::cout <<
" id: " <<
864 std::cout <<
" name: " <<
867 std::cout <<
" type: " <<
869 std::cout <<
" source: " <<
874 std::cout <<
" NumOfChanges: " <<
879 std::cout <<
" Change nr. :" << j << std::endl;
883 std::cout <<
" Change the ATTRIBUTE: " << std::endl;
884 std::cout <<
" NewValue: " <<
886 std::cout <<
" Target: " <<
892 std::cout <<
" Change the MATH: " << std::endl;
893 std::cout <<
" NewMath: " <<
895 std::cout <<
" Target: " <<
903 std::cout << std::endl << std::endl;
907 std::cout <<
"NumOfTasks: " <<
912 std::cout <<
" Task nr. :" << i << std::endl;
914 std::cout <<
" id: " <<
916 std::cout <<
" name: " <<
919 std::cout <<
" notes: " <<
924 std::cout <<
" NumberOfMeasurements: " <<
928 getNumberOfMeasurements() ; j++)
930 std::cout <<
" Measurement nr. :" << j << std::endl;
932 std::cout <<
" source: " <<
934 std::cout <<
" name: " <<
941 std::cout << std::endl << std::endl;
945 std::cout <<
"NumOfOutputs: " <<
950 std::cout <<
"output nr: " << i << std::endl;
CMiaseModel * getLastModel()
CMiaseTask * getTask(int num)
void newContent(const XML_Char *s, int len)
void setXmlNs(std::string xmlNs)
void addTask(CMiaseTask *task)
CMiaseOutput * getOutput(int num)
void setAnyNote(std::string anyAnnotation)
CMiaseMeasurementData * getMeasurement(int num)
static void XMLCALL start(void *data, const char *el, const char **attr)
void addChange(CMiaseChange *chnage)
void setName(std::string name)
CMiaseTask * getLastTask()
void newMiase(const char **attr)
CMiaseOutput * getLastOutput()
void load(std::string filename)
void setSource(std::string source)
static XML_Char mVersion_1_0[]
void setMiaseSed(CMiaseSed *sed)
void addContent(const char *el, const char **attr)
static CMiaseParser * myParser
CMiaseMeasurementData * getLastMeasurement()
static void XMLCALL xmldecl_handler(void *userData, const XML_Char *version, const XML_Char *encoding, int standalone)
void addNotes(CMiaseNotes *notes)
void setId(std::string id)
void setNotes(std::string notes)
CMiaseChange * getChange(int num)
int getNumberOfMeasurements()
void setSimulationReference(std::string simulation)
void addMeasurement(CMiaseMeasurementData *measurement)
void newTask(const char **attr)
void newOutput(const char **attr)
CMiaseSimulation * getSimulation(int num)
void setXmlns(std::string xmlns)
CMiaseModel * getModel(int num)
void error(std::string errorString)
void setName(std::string name)
void newMeasurementData(const char **attr)
std::string getWholeOutput()
void addModel(CMiaseModel *model)
void xmlDecl(const XML_Char *version, const XML_Char *encoding)
CMiaseAnnotation * getAnnotation()
void newChange(const char *el, const char **attr)
void setXmlNs(std::string xmlNs)
void setVersion(std::string version)
static void XMLCALL charhndl(void *userData, const XML_Char *s, int len)
void saveWholeOutput(std::string output)
int getNumOfSimulations()
void startElement(const char *el, const char **attr)
void newState(States newState)
void endElement(const char *el)
void setModelReference(std::string model)
void addOutput(CMiaseOutput *output)
bool isValid(const char *el)
double strToDouble(const char *str, char const **pTail)
CMiaseSimulation * getLastSimulation()
void newModel(const char **attr)
static void XMLCALL end(void *data, const char *el)
void createAllowedStateTags()
CMiaseChange * getLastChange()
void newNotes(const char **attr)
void newSimulation(const char *el, const char **attr)
void addAnnotation(CMiaseAnnotation *ann)
void setType(std::string type)
CMiaseBase * getLastObj()
void newAnnotation(const char **attr)
std::vector< std::vector< std::string > > mAllowedStateTags
void addSimulation(CMiaseSimulation *simulation)
void setSource(std::string source)