COPASI API  4.16.103
Functions
utilities.cpp File Reference
#include "copasi/CopasiDataModel/CCopasiDataModel.h"
#include "report/CCopasiRootContainer.h"
#include "copasi/utilities/CCopasiMessage.h"
#include "copasi/xml/CCopasiXML.h"
#include "copasi/function/CFunctionDB.h"
#include "copasi/report/CReportDefinitionVector.h"
#include "copasi/model/CModel.h"
#include "copasi/plot/COutputDefinitionVector.h"
#include "copasi/layout/CListOfLayouts.h"
Include dependency graph for utilities.cpp:

Go to the source code of this file.

Functions

bool load_cps_model_from_stream (std::istream &is, CCopasiDataModel &dataModel)
 
bool save_cps_model_to_stream (std::ostream &os, CCopasiDataModel *pDataModel)
 

Function Documentation

bool load_cps_model_from_stream ( std::istream &  is,
CCopasiDataModel dataModel 
)

Definition at line 21 of file utilities.cpp.

References CCopasiDataModel::loadModel().

Referenced by test000054::test_bug1002(), test000058::test_bug1025_10(), test000058::test_bug1025_6(), test000058::test_bug1025_7(), test000058::test_bug1025_8(), test000058::test_bug1025_9(), test000076::test_bug1035_1(), test000076::test_bug1035_2(), test000076::test_bug1035_3(), test000067::test_bug1060(), test000069::test_bug1069(), test000071::test_bug1085(), test000081::test_bug1205(), test000089::test_bug1412(), test000093::test_bug1503_1(), test000093::test_bug1503_2(), test000100::test_bug1692_1(), test000100::test_bug1692_2(), test000049::test_bug894(), test000050::test_bug894(), test000048::test_bug919(), test000051::test_bug988(), test000061::test_bug_1044(), test_compare_utilities::test_copasi_function_expansion(), test000082::test_export_delayAssignment_1(), test000082::test_export_delayAssignment_2(), test000082::test_export_delayAssignment_3(), test000082::test_export_delayAssignment_4(), test000082::test_export_delayAssignment_5(), test000082::test_export_delayAssignment_6(), test000077::test_export_dimensionless(), test000064::test_export_event_assignment_expression_and_hasOnlySubstanceUnits_1(), test000064::test_export_event_assignment_expression_and_hasOnlySubstanceUnits_2(), test000064::test_export_event_assignment_expression_and_hasOnlySubstanceUnits_3(), test000064::test_export_event_assignment_expression_and_hasOnlySubstanceUnits_4(), test000064::test_export_event_assignment_expression_and_hasOnlySubstanceUnits_5(), test000064::test_export_event_assignment_expression_and_hasOnlySubstanceUnits_6(), test000064::test_export_event_assignment_expression_and_hasOnlySubstanceUnits_7(), test000064::test_export_event_assignment_expression_and_hasOnlySubstanceUnits_8(), test000098::test_export_notes(), test000087::test_export_reaction_flux_reference_1(), test000087::test_export_reaction_flux_reference_2(), test000064::test_export_rule_expression_and_hasOnlySubstanceUnits_1(), test000064::test_export_rule_expression_and_hasOnlySubstanceUnits_2(), test000064::test_export_rule_expression_and_hasOnlySubstanceUnits_3(), test000064::test_export_rule_expression_and_hasOnlySubstanceUnits_4(), test000064::test_export_rule_expression_and_hasOnlySubstanceUnits_5(), test000064::test_export_rule_expression_and_hasOnlySubstanceUnits_6(), test000064::test_export_rule_expression_and_hasOnlySubstanceUnits_7(), test000064::test_export_rule_expression_and_hasOnlySubstanceUnits_8(), test000092::test_miriam_export_1(), test000092::test_miriam_export_2(), test000092::test_miriam_export_3(), test000092::test_miriam_export_4(), test000092::test_miriam_export_5(), test000092::test_miriam_export_6(), test000097::test_read_global_render_information(), test000097::test_read_local_render_information(), test000097::test_readexport_global_render_information(), test000097::test_readexport_local_render_information(), test000097::test_readwrite_global_render_information(), test000097::test_readwrite_local_render_information(), test000059::test_unique_id_11(), test000059::test_unique_id_12(), test000059::test_unique_id_13(), test000059::test_unique_id_14(), test000059::test_unique_id_15(), test000059::test_unique_id_16(), test000059::test_unique_id_21(), test000059::test_unique_id_21_2(), and test000059::test_unique_id_22().

22 {
23  return dataModel.loadModel(is, std::string(""), NULL);
24 }
bool loadModel(std::istream &in, const std::string &pwd, CProcessReport *pProcessReport, const bool &deleteOldData=true)
bool save_cps_model_to_stream ( std::ostream &  os,
CCopasiDataModel pDataModel 
)

Definition at line 26 of file utilities.cpp.

References CCopasiDataModel::getGUI(), CCopasiDataModel::getListOfLayouts(), CCopasiDataModel::getModel(), CCopasiDataModel::getPlotDefinitionList(), CCopasiDataModel::getReportDefinitionList(), CCopasiDataModel::getTaskList(), CCopasiXML::save(), CCopasiXML::setDatamodel(), CCopasiXML::setGUI(), CCopasiXML::setLayoutList(), CCopasiXML::setModel(), CCopasiXML::setPlotList(), CCopasiXML::setReportList(), and CCopasiXML::setTaskList().

Referenced by test000097::test_importwrite_global_render_information(), test000097::test_importwrite_local_render_information(), test000097::test_readwrite_global_render_information(), test000097::test_readwrite_local_render_information(), test000097::test_save_global_render_information(), and test000097::test_save_local_render_information().

27 {
28  bool success = true;
29 
30  if (pDataModel != NULL &&
31  pDataModel->getModel() != NULL)
32  {
33  CCopasiXML XML;
34 
35  XML.setModel(pDataModel->getModel());
36  XML.setTaskList(pDataModel->getTaskList());
37  XML.setReportList(pDataModel->getReportDefinitionList());
38  XML.setPlotList(pDataModel->getPlotDefinitionList());
39  XML.setGUI(pDataModel->getGUI());
40  XML.setLayoutList(*pDataModel->getListOfLayouts());
41  XML.setDatamodel(pDataModel);
42 
43  try
44  {
45  success = XML.save(os, "");
46  }
47  catch (...)
48  {
49  return false;
50  }
51  }
52  else
53  {
54  success = false;
55  }
56 
57  return success;
58 }
SCopasiXMLGUI * getGUI()
bool setModel(CModel *pModel)
Definition: CCopasiXML.cpp:254
const CReportDefinitionVector * getReportDefinitionList() const
bool setDatamodel(CCopasiDataModel *pDataModel)
Definition: CCopasiXML.cpp:299
bool setTaskList(CCopasiVectorN< CCopasiTask > *pTaskList)
Definition: CCopasiXML.cpp:288
CCopasiVectorN< CCopasiTask > * getTaskList()
bool setPlotList(COutputDefinitionVector *pPlotList)
Definition: CCopasiXML.cpp:319
CListOfLayouts * getListOfLayouts()
bool setLayoutList(const CListOfLayouts &reportList)
Definition: CCopasiXML.cpp:377
bool setGUI(SCopasiXMLGUI *pGUI)
Definition: CCopasiXML.cpp:359
const COutputDefinitionVector * getPlotDefinitionList() const
bool setReportList(CReportDefinitionVector *pReportList)
Definition: CCopasiXML.cpp:339
virtual bool save(std::ostream &os, const std::string &relativeTo)
Definition: CCopasiXML.cpp:102