示例#1
0
/**
 * Writes the given Sed document to an in-memory string and returns a
 * pointer to it.  The string is owned by the caller and should be freed
 * (with free()) when no longer needed.  This convenience function is
 * functionally equivalent to:
 *
 *   SedWriter_writeSedMLToString(SedWriter_create(), d);
 *
 * @return the string on success and NULL if one of the underlying parser
 * components fail (rare).
 */
LIBSEDML_EXTERN
char *
writeSedMLToString (const SedDocument_t *d)
{
  SedWriter sw;
  if (d == NULL)
    return NULL;
  else
    return sw.writeToString(d);
}
示例#2
0
const std::string CSEDMLExporter::exportModelAndTasksToString(CCopasiDataModel& dataModel,
    std::string &sbmlModelSource,
    unsigned int sedmlLevel,
    unsigned int sedmlVersion)
{
  this->mSEDMLLevel = sedmlLevel;
  this->mSEDMLVersion = sedmlVersion;
  this->createSEDMLDocument(dataModel, sbmlModelSource);

  CSBMLExporter exporter;
  SedWriter* writer = new SedWriter();

  writer->setProgramName("COPASI");
  writer->setProgramVersion(CVersion::VERSION.getVersion().c_str());

  char* d = writer->writeToString(this->mpSEDMLDocument);
  std::string returnValue = d;

  if (d) free(d);

  pdelete(writer);

  return returnValue;
}