COPASI API  4.16.103
Functions
CSEDMLExporter.cpp File Reference
#include <sbml/math/FormulaParser.h>
#include <sedml/SedTypes.h>
#include <sbml/SBMLTypes.h>
#include "SEDMLUtils.h"
#include "sbml/CSBMLExporter.h"
#include "CSEDMLExporter.h"
#include "trajectory/CTrajectoryTask.h"
#include "trajectory/CTrajectoryProblem.h"
#include "scan/CScanTask.h"
#include "scan/CScanProblem.h"
#include "utilities/CCopasiException.h"
#include "utilities/CVersion.h"
#include "utilities/CCopasiMessage.h"
#include "utilities/CDirEntry.h"
#include "CopasiDataModel/CCopasiDataModel.h"
#include "plot/COutputDefinitionVector.h"
#include "plot/CPlotSpecification.h"
#include "report/CReportDefinition.h"
#include "model/CModel.h"
#include "model/CCompartment.h"
#include "model/CModelValue.h"
#include "commandline/CLocaleString.h"
Include dependency graph for CSEDMLExporter.cpp:

Go to the source code of this file.

Functions

SedDataGenerator * createDataGenerator (SedDocument *mpSEDMLDocument, const std::string &sbmlId, const std::string &targetXPathString, const std::string &taskId, size_t i, size_t j)
 
std::string createUniqueModelFileName (const std::string &dir, const std::string &baseName, const std::string &extension=".xml")
 

Function Documentation

SedDataGenerator* createDataGenerator ( SedDocument *  mpSEDMLDocument,
const std::string &  sbmlId,
const std::string &  targetXPathString,
const std::string &  taskId,
size_t  i,
size_t  j 
)

Definition at line 387 of file CSEDMLExporter.cpp.

References SEDML_TIME_URN.

Referenced by CSEDMLExporter::createDataGenerators().

394 {
395  SedDataGenerator *pPDGen = mpSEDMLDocument->createDataGenerator();
396  std::ostringstream idStrStream;
397  idStrStream << sbmlId;
398  idStrStream << "_";
399  idStrStream << j + 1;
400  pPDGen->setId(idStrStream.str());
401 
402  pPDGen->setName(sbmlId);
403 
404  SedVariable * pPVar = pPDGen->createVariable();
405  std::ostringstream idVarStrStream;
406  idVarStrStream << "p";
407  idVarStrStream << i + 1;
408  idVarStrStream << "_";
409  idVarStrStream << pPDGen->getName();
410  pPVar->setId(idVarStrStream.str());
411  pPVar->setTaskReference(taskId);
412  pPVar->setName(pPDGen->getName());
413 
414  pPDGen->setMath(SBML_parseFormula(pPVar->getId().c_str()));
415 
416  if (targetXPathString == SEDML_TIME_URN)
417  {
418  pPVar->setSymbol(targetXPathString);
419  }
420  else
421  {
422  pPVar->setTarget(targetXPathString);
423  }
424 
425  return pPDGen;
426 }
#define SEDML_TIME_URN
Definition: SEDMLUtils.h:21
std::string createUniqueModelFileName ( const std::string &  dir,
const std::string &  baseName,
const std::string &  extension = ".xml" 
)

Definition at line 71 of file CSEDMLExporter.cpp.

References CDirEntry::exist(), and CDirEntry::Separator.

Referenced by CSEDMLExporter::exportModelAndTasks().

72 {
73  int count = 1;
74  std::string current = baseName + extension;
75 
76  while (CDirEntry::exist(dir + CDirEntry::Separator + current))
77  {
78  std::stringstream temp;
79  temp << baseName << count << extension;
80  current = temp.str();
81  ++count;
82  }
83 
84  return current;
85 }
static bool exist(const std::string &path)
Definition: CDirEntry.cpp:78
static const std::string Separator
Definition: CDirEntry.h:34