COPASI API  4.16.103
Functions
CODEExporterC.cpp File Reference
#include <sstream>
#include <locale>
#include <cmath>
#include "copasi.h"
#include "CopasiDataModel/CCopasiDataModel.h"
#include "report/CCopasiRootContainer.h"
#include "CODEExporterC.h"
#include "model/CModel.h"
#include "model/CMetab.h"
#include "model/CMetabNameInterface.h"
#include "utilities/CCopasiVector.h"
#include "model/CReaction.h"
#include "model/CMoiety.h"
#include "model/CChemEqElement.h"
#include "function/CExpression.h"
#include "function/CFunction.h"
#include "function/CFunctionDB.h"
#include "report/CKeyFactory.h"
#include "function/CEvaluationTree.h"
#include "function/CEvaluationNode.h"
#include "function/CEvaluationNodeObject.h"
#include "function/CEvaluationNodeOperator.h"
#include "function/CEvaluationNodeFunction.h"
#include "utilities/CCopasiTree.h"
#include "trajectory/CTrajectoryTask.h"
#include "trajectory/CTrajectoryProblem.h"
#include <sbml/util/util.h>
#include <iostream>
#include <fstream>
#include <ctype.h>
Include dependency graph for CODEExporterC.cpp:

Go to the source code of this file.

Functions

void printNameForKey (std::ostringstream &stream, CKeyFactory *kf, const std::string &key, const std::string prefix="")
 
bool startsWith (const std::string &str, const std::string &sub)
 

Function Documentation

void printNameForKey ( std::ostringstream &  stream,
CKeyFactory kf,
const std::string &  key,
const std::string  prefix = "" 
)

Definition at line 76 of file CODEExporterC.cpp.

References CKeyFactory::get(), CCopasiObject::getObjectName(), and startsWith().

Referenced by CODEExporterC::exportTitleData().

77 {
78  CCopasiObject* obj = kf->get(key);
79 
80  if (obj != NULL)
81  {
82  stream << "\"" << prefix << obj->getObjectName() << "\", ";
83  }
84  else if (startsWith(key, "sm_"))
85  {
86  printNameForKey(stream, kf, key.substr(3), "");
87  }
88  else if (startsWith(key, "ode_"))
89  {
90  printNameForKey(stream, kf, key.substr(4), "ODE ");
91  }
92  else
93  {
94  stream << "\"" << prefix << key << "\", ";
95  }
96 }
bool startsWith(const std::string &str, const std::string &sub)
const std::string & getObjectName() const
CCopasiObject * get(const std::string &key)
void printNameForKey(std::ostringstream &stream, CKeyFactory *kf, const std::string &key, const std::string prefix="")
bool startsWith ( const std::string &  str,
const std::string &  sub 
)

Definition at line 64 of file CODEExporterC.cpp.

Referenced by CODEExporterC::exportTitleData(), and printNameForKey().

65 {
66  if (str.length() < sub.length()) return false;
67 
68  if (sub.empty()) return true;
69 
70  for (size_t i = 0; i < sub.length(); ++i)
71  if (str[i] != sub[i]) return false;
72 
73  return true;
74 }