<commit_before>/* Begin CVS Header
   $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/sbml/Attic/SBMLExporter.cpp,v $
   $Revision: 1.23 $
   $Name:  $
   $Author: shoops $ 
   $Date: 2004/12/02 23:50:10 $
   End CVS Header */

#include "copasi.h"

#include "utilities/CGlobals.h"

#include "SBMLExporter.h"

#include "sbml/Unit.hpp"
#include "sbml/UnitKind.h"
#include "sbml/SBMLDocument.h"
#include "sbml/SBMLWriter.h"

#include "sbml/ModifierSpeciesReference.h"
#include "xml/CCopasiXMLInterface.h"

const char* SBMLExporter::HTML_HEADER = "<body xmlns=\"http://www.w3.org/1999/xhtml\">";

const char* SBMLExporter::HTML_FOOTER = "</body>";

/**
 ** Constructor for the exporter.
 */
SBMLExporter::SBMLExporter(): sbmlDocument(NULL)
{
  /* nothing to do */
}

/**
 ** Destructor for the exporter.
 */
SBMLExporter::~SBMLExporter()
{
  /* delete the SBMLDocument created if it is not NULL */
  if (this->sbmlDocument != NULL)
    {
      delete this->sbmlDocument;
    }
}

/**
 ** This method takes a copasi CModel object, crerates an SBMLDocument from
 ** it and writes it to a file. The filename is given as the second
 ** argument to the function. The function return "true" on success and
 ** "false" on failure.
 */
bool SBMLExporter::exportSBML(const CModel* copasiModel, std::string sbmlFilename, int sbmlLevel, int sbmlVersion) throw (StdException)
{
  /* create the SBMLDocument from the copasi model */
  this->sbmlDocument = this->createSBMLDocumentFromCModel(copasiModel, sbmlLevel, sbmlVersion);
  if (this->sbmlDocument->getModel() != NULL)
    {
      SBMLWriter_t* writer = SBMLWriter_create();

#ifdef XXXX // :TODO: This needs to be enabled with the next libsbml release
      SBMLWriter_setProgramName(writer, "COPASI");
      SBMLWriter_setProgramVersion(writer, Copasi->ProgramVersion.getVersion().c_str());
#endif // XXXX

      /* write the document to a file */
      int returnValue = SBMLWriter_writeSBML(writer, (SBMLDocument_t*)sbmlDocument, sbmlFilename.c_str());
      SBMLWriter_free(writer);
      if (returnValue == 1)<commit_msg>Fixed comment related to Bug 178 so it can easily be found.<commit_after>/* Begin CVS Header
   $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/sbml/Attic/SBMLExporter.cpp,v $
   $Revision: 1.24 $
   $Name:  $
   $Author: shoops $ 
   $Date: 2004/12/03 16:36:40 $
   End CVS Header */

#include "copasi.h"

#include "utilities/CGlobals.h"

#include "SBMLExporter.h"

#include "sbml/Unit.hpp"
#include "sbml/UnitKind.h"
#include "sbml/SBMLDocument.h"
#include "sbml/SBMLWriter.h"

#include "sbml/ModifierSpeciesReference.h"
#include "xml/CCopasiXMLInterface.h"

const char* SBMLExporter::HTML_HEADER = "<body xmlns=\"http://www.w3.org/1999/xhtml\">";

const char* SBMLExporter::HTML_FOOTER = "</body>";

/**
 ** Constructor for the exporter.
 */
SBMLExporter::SBMLExporter(): sbmlDocument(NULL)
{
  /* nothing to do */
}

/**
 ** Destructor for the exporter.
 */
SBMLExporter::~SBMLExporter()
{
  /* delete the SBMLDocument created if it is not NULL */
  if (this->sbmlDocument != NULL)
    {
      delete this->sbmlDocument;
    }
}

/**
 ** This method takes a copasi CModel object, crerates an SBMLDocument from
 ** it and writes it to a file. The filename is given as the second
 ** argument to the function. The function return "true" on success and
 ** "false" on failure.
 */
bool SBMLExporter::exportSBML(const CModel* copasiModel, std::string sbmlFilename, int sbmlLevel, int sbmlVersion) throw (StdException)
{
  /* create the SBMLDocument from the copasi model */
  this->sbmlDocument = this->createSBMLDocumentFromCModel(copasiModel, sbmlLevel, sbmlVersion);
  if (this->sbmlDocument->getModel() != NULL)
    {
      SBMLWriter_t* writer = SBMLWriter_create();

#ifdef XXXX // :TODO: Bug 178 This needs to be enabled with the next libsbml release
      SBMLWriter_setProgramName(writer, "COPASI");
      SBMLWriter_setProgramVersion(writer, Copasi->ProgramVersion.getVersion().c_str());
#endif // XXXX

      /* write the document to a file */
      int returnValue = SBMLWriter_writeSBML(writer, (SBMLDocument_t*)sbmlDocument, sbmlFilename.c_str());
      SBMLWriter_free(writer);
      if (returnValue == 1)
{'fraction_non_alphanumeric': 0.13195435092724678, 'fraction_numerical': 0.012363290537327628, 'mean_word_length': 4.111786148238153, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7030622', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1430, 'n_words': 360}