当前位置: 首页>>代码示例>>C++>>正文


C++ ConversionProperties::addOption方法代码示例

本文整理汇总了C++中ConversionProperties::addOption方法的典型用法代码示例。如果您正苦于以下问题:C++ ConversionProperties::addOption方法的具体用法?C++ ConversionProperties::addOption怎么用?C++ ConversionProperties::addOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConversionProperties的用法示例。


在下文中一共展示了ConversionProperties::addOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SBMLNamespaces

ConversionProperties
SBMLLevel1Version1Converter::getDefaultProperties() const
{
  static ConversionProperties prop;
  static bool init = false;

  if (init) 
  {
    return prop;
  }
  else
  {
    SBMLNamespaces * sbmlns = new SBMLNamespaces(1,1); // default namespaces
    prop.setTargetNamespaces(sbmlns); // this gets cloned
    prop.addOption("convertToL1V1", true,
      "convert the document to SBML Level 1 Version 1");
    prop.addOption("changePow", false, 
      "change pow expressions to the (^) hat notation");
    prop.addOption("inlineCompartmentSizes", false, 
      "if true, occurrances of compartment ids in expressions will be replaced with their initial size");



    delete sbmlns;
    init = true;
    return prop;
  }
}
开发者ID:sbmlteam,项目名称:python-libsbml,代码行数:28,代码来源:SBMLLevel1Version1Converter.cpp

示例2: readSBMLFromString

END_TEST

START_TEST(test_strip_unknown_1)
{
  const std::string model =
    "<?xml version='1.0' encoding='UTF-8'?>\n"
    "<sbml xmlns='http://www.sbml.org/sbml/level3/version1/core' level='3' version='1' "
    "xmlns:pkg1='http://www.sbml.org/sbml/level3/version1/pkg1/version1' pkg1:required='true' "
    "xmlns:pkg2='http://www.sbml.org/sbml/level3/version1/pkg2/version1' pkg2:required='true' "
    "xmlns:pkg3='http://www.sbml.org/sbml/level3/version1/pkg3/version1' pkg3:required='false' "
    ">\n\t<model/>\n"
    "</sbml>";

  SBMLDocument* doc = readSBMLFromString(model.c_str());
  fail_unless(doc->getNumUnknownPackages() == 3);

  ConversionProperties props;
  props.addOption("stripPackage", true);

  fail_unless(doc->convert(props) == LIBSBML_OPERATION_SUCCESS);

  fail_unless(doc->getNumUnknownPackages() == 3);

  props.addOption("package", "pkg1,pkg3");
  fail_unless(doc->convert(props) == LIBSBML_OPERATION_SUCCESS);

  fail_unless(doc->getNumUnknownPackages() == 1);

  delete doc;
}
开发者ID:copasi,项目名称:copasi-dependencies,代码行数:30,代码来源:TestStripPackageConverter.cpp

示例3: SBMLNamespaces

ConversionProperties
SBMLLevelVersionConverter::getDefaultProperties() const
{
  static ConversionProperties prop;
  static bool init = false;

  if (init) 
  {
    return prop;
  }
  else
  {
    SBMLNamespaces * sbmlns = new SBMLNamespaces(); // default namespaces
    prop.setTargetNamespaces(sbmlns); // this gets cloned
    prop.addOption("strict", true,
                   "Whether validity should be strictly preserved");
    prop.addOption("setLevelAndVersion", true, 
                   "Convert the model to a given Level and Version of SBML");
    prop.addOption("addDefaultUnits", true,
                   "Whether default units should be added when converting to L3");
    delete sbmlns;
    init = true;
    return prop;
  }
}
开发者ID:copasi,项目名称:copasi-dependencies,代码行数:25,代码来源:SBMLLevelVersionConverter.cpp

示例4:

ConversionProperties
SBMLFunctionDefinitionConverter::getDefaultProperties() const
{
  static ConversionProperties prop;
  prop.addOption("expandFunctionDefinitions", true,
                 "Expand all function definitions in the model");
  prop.addOption("skipIds", "",
                 "Comma separated list of ids to skip during expansion");
  return prop;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:10,代码来源:SBMLFunctionDefinitionConverter.cpp

示例5: TestFlattenedUnknownAbortNone

SBMLDocument* TestFlattenedUnknownAbortNone(string file1, string file2)
{
  string filename(TestDataDirectory);
  //string filename("C:\\Development\\libsbml\\src\\sbml\\packages\\comp\\util\\test\\test-data\\");
  
  ConversionProperties props;
  
  props.addOption("flatten comp");
  props.addOption("basePath", filename);
  props.addOption("performValidation", false);
  props.addOption("abortIfUnflattenable", "none");

  SBMLConverter* converter = SBMLConverterRegistry::getInstance().getConverterFor(props);
  
  // load document
  string cfile = filename + file1;  
  SBMLDocument* doc = readSBMLFromFile(cfile.c_str());

  // fail if there is no model (readSBMLFromFile always returns a valid document)
  fail_unless(doc->getModel() != NULL);

  converter->setDocument(doc);
  int result = converter->convert();

  // fail if conversion was not valid
  fail_unless(result == LIBSBML_OPERATION_SUCCESS);

  //For use in debugging the above statement.
  /*
  SBMLErrorLog* errors = doc->getErrorLog();
  if (errors->getNumFailsWithSeverity(LIBSBML_SEV_ERROR) != 0) {
    fail_unless(false);
    for (unsigned long e=0; e<errors->getNumErrors(); e++) {
      const SBMLError* error = errors->getError(e);
      if (error->getSeverity() == LIBSBML_SEV_ERROR) {
        cout << error->getMessage() << endl;
      }
    }
  }
  */

  string newModel = writeSBMLToStdString(doc);
  //string outfile = filename + "unknown_flat.xml";
  //writeSBMLToFile(doc, outfile.c_str());
  string ffile = filename + file2;
  SBMLDocument* fdoc = readSBMLFromFile(ffile.c_str());
  string flatModel = writeSBMLToStdString(fdoc);
  fail_unless(flatModel == newModel);

  delete fdoc;
  delete converter;

  return doc;
}
开发者ID:copasi,项目名称:copasi-dependencies,代码行数:54,代码来源:TestCompFlatteningUnknownPackageRefs.cpp

示例6: filename

END_TEST
  
START_TEST (test_comp_flatten_exchange5)
{ 
  string filename(TestDataDirectory);
  //string filename("C:\\Development\\libsbml\\src\\sbml\\packages\\comp\\util\\test\\test-data\\");
  
  // load document
  string cfile = filename + "CompTest_A.xml";  
  SBMLDocument* doc = readSBMLFromFile(cfile.c_str());

  Model* model = doc->getModel();
  // fail if there is no model (readSBMLFromFile always returns a valid document)
  fail_unless(model != NULL);

  // SK - since I made the flattenModel package protected
  // this will no longer work
  // ===========
  //CompModelPlugin* cmp = static_cast<CompModelPlugin*>(model->getPlugin("comp"));

  //Model* flatmod = cmp->flattenModel();
  //fail_unless(flatmod != NULL);
  //CompPkgNamespaces csbmlns(3,1,1,"comp");
  //SBMLDocument flatdoc(&csbmlns);
  //flatdoc.setPackageRequired("comp", true);
  //flatdoc.setModel(flatmod);
  //writeSBMLToFile(&flatdoc, "CompTest_flat_ports.xml");

  //string newModel = writeSBMLToString(&flatdoc);
  //===========
  // replace with

  ConversionProperties* props = new ConversionProperties();
  
  props->addOption("flatten comp");
  props->addOption("leavePorts", true);

  SBMLConverter* converter = SBMLConverterRegistry::getInstance().getConverterFor(*props);
  converter->setDocument(doc);
  int result = converter->convert();

  // fail if conversion was not valid
  fail_unless(result == LIBSBML_OPERATION_SUCCESS);

  string newModel = writeSBMLToString(doc);

  string ffile = filename + "CompTest_flat_ports.xml";
  SBMLDocument* fdoc = readSBMLFromFile(ffile.c_str());
  string flatModel = writeSBMLToString(fdoc);
  fail_unless(flatModel == newModel);

  delete doc;
  delete fdoc;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:54,代码来源:TestExtensionObjects.cpp

示例7: SBMLNamespaces

ConversionProperties
SBMLLevelVersionConverter::getDefaultProperties() const
{
  static ConversionProperties prop;
  prop.setTargetNamespaces(new SBMLNamespaces()); // default namespaces
  prop.addOption("strict", true,
                 "Whether validity should be strictly preserved");
  prop.addOption("setLevelAndVersion", true, 
                 "Convert the model to a given Level and Version of SBML");
  return prop;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:11,代码来源:SBMLLevelVersionConverter.cpp

示例8:

ConversionProperties
SBMLIdConverter::getDefaultProperties() const
{
  static ConversionProperties prop;
  prop.addOption("renameSIds", true,
                 "Rename all SIds specified in the 'currentIds' option to the ones specified in 'newIds'");
  prop.addOption("currentIds", "",
                 "Comma separated list of ids to rename");
  prop.addOption("newIds", "",
                 "Comma separated list of the new ids");
  return prop;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:12,代码来源:SBMLIdConverter.cpp

示例9: filename

END_TEST


START_TEST (test_strip_comp)
{
  std::string filename(TestDataDirectory);
  std::string fileIn = filename + "package1.xml";

  SBMLDocument* d = readSBMLFromFile(fileIn.c_str());

  fail_unless(d != NULL);

  ConversionProperties props;
  props.addOption("package", "comp");

  SBMLConverter* converter = new SBMLStripPackageConverter();
  converter->setProperties(&props);
  converter->setDocument(d);

  fail_unless (converter->convert() == LIBSBML_OPERATION_SUCCESS);

  std::string newModel = writeSBMLToStdString(d);
  
  
  std::string fileOut = filename + "package1-comp_stripped.xml";
  SBMLDocument* fdoc = readSBMLFromFile(fileOut.c_str());
  string stripped = writeSBMLToStdString(fdoc);
  
  fail_unless(stripped == newModel);

  delete converter;
  delete fdoc;
  delete d;
}
开发者ID:kirichoi,项目名称:roadrunner,代码行数:34,代码来源:TestStripPackageConverter.cpp

示例10:

ConversionProperties
  CobraToFbcConverter::getDefaultProperties() const
{
  static ConversionProperties prop;
  prop.addOption("convert cobra", true, "convert cobra sbml to fbc");
  return prop;
}
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:7,代码来源:CobraToFbcConverter.cpp

示例11:

END_TEST

START_TEST (test_conversion_properties_write)
{
  ConversionProperties props;

  props.addOption("key", "test", "test option");

  fail_unless(props.getValue("key") == "test");
  fail_unless(props.getType("key") == CNV_TYPE_STRING);
  fail_unless(props.getDescription("key") == "test option");
  

  props.setBoolValue("key", true);
  fail_unless(props.getBoolValue("key") == true);
  fail_unless(props.getType("key") == CNV_TYPE_BOOL);
  
  props.setIntValue("key", 2);
  fail_unless(props.getIntValue("key") == 2);
  fail_unless(props.getType("key") == CNV_TYPE_INT);
  
  props.setFloatValue("key", 1.1f);
  fail_unless(props.getFloatValue("key") == 1.1f);
  fail_unless(props.getType("key") == CNV_TYPE_SINGLE);
  
  props.setDoubleValue("key", 2.1);
  fail_unless(props.getDoubleValue("key") == 2.1);
  fail_unless(props.getType("key") == CNV_TYPE_DOUBLE);
  
}
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:30,代码来源:TestConversionProperties.cpp

示例12: hasActualErrors

bool hasActualErrors(SBMLDocument* document)
{
  document->checkConsistency();
  for (unsigned int e=0; e<document->getNumErrors(); e++) {
    if (document->getError(e)->getSeverity() >= LIBSBML_SEV_ERROR) return true;
  }
#ifdef USE_COMP
  CompModelPlugin* compmod = static_cast<CompModelPlugin*>(document->getModel()->getPlugin("comp"));
  if (compmod != NULL && compmod->getNumSubmodels() > 0) {
    SBMLDocument flat(*document);
    ConversionProperties* props = new ConversionProperties();
    props->addOption("flatten comp");
    SBMLConverter* converter = 
      SBMLConverterRegistry::getInstance().getConverterFor(*props);
    converter->setDocument(&flat);
    int result = converter->convert();
    flat.checkConsistency();
    bool flaterrors = false;
    SBMLErrorLog* errlog = document->getErrorLog();
    for (unsigned int e=0; e<flat.getNumErrors(); e++) {
      if (flat.getError(e)->getSeverity() >= LIBSBML_SEV_ERROR) {
        flaterrors = true;
        errlog->add(*(flat.getError(e)));
      }
    }
    if (flaterrors) return true;
 }
#endif
  return false;
}
开发者ID:sbmlteam,项目名称:test-suite,代码行数:30,代码来源:testSuiteUtil.cpp

示例13:

ConversionProperties
  FbcToCobraConverter::getDefaultProperties() const
{
  static ConversionProperties prop;
  prop.addOption("convert fbc to cobra", true, "convert FBC L3V1 to SBML L2V4 with COBRA annotation");
  return prop;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:7,代码来源:FbcToCobraConverter.cpp

示例14: filename

END_TEST


START_TEST (test_comp_flatten_unknown_21)
{ 
  string filename(TestDataDirectory);
  //string filename("C:\\Development\\libsbml\\src\\sbml\\packages\\comp\\util\\test\\test-data\\");
  
  ConversionProperties props;
  
  props.addOption("flatten comp");
  props.addOption("basePath", filename);
  props.addOption("performValidation", false);

  SBMLConverter* converter = SBMLConverterRegistry::getInstance().getConverterFor(props);
  
  // load document
  string cfile = filename + "flatten_fail_unknown.xml";  
  SBMLDocument* doc = readSBMLFromFile(cfile.c_str());

  // fail if there is no model (readSBMLFromFile always returns a valid document)
  fail_unless(doc->getModel() != NULL);

  // write the doc before we attempt conversion
  string newModel = writeSBMLToStdString(doc);

  converter->setDocument(doc);
  int result = converter->convert();

  // we should fail because we are testing the restoreNamespaces function
  fail_unless(result == LIBSBML_OPERATION_FAILED);


  string flatModel = writeSBMLToStdString(doc);
  fail_unless(flatModel == newModel);

  delete converter; 

  SBMLErrorLog* errors = doc->getErrorLog();
  fail_unless(errors->getNumErrors() == 2);
  fail_unless(errors->contains(RequiredPackagePresent) == true);
  fail_unless(errors->contains(CompFlatteningNotRecognisedReqd) == true);
  //fail_unless(errors->contains(CompModelFlatteningFailed) == true);
  //fail_unless(errors->contains(CompSubmodelMustReferenceModel) == true);

  delete doc;  
}
开发者ID:copasi,项目名称:copasi-dependencies,代码行数:47,代码来源:TestCompFlatteningUnknownPackageRefs.cpp

示例15: readSBML

LIBSBML_CPP_NAMESPACE_USE

int
main (int argc, char *argv[])
{
 
  if (argc != 3)
  {
    cout 
	     << endl
		 << "Usage: inlineFunctionDefintions input-filename output-filename" << endl
	     << endl
	     << "This program will attempt to inline all function definitions" << endl
	     << "contained in the source model, and write a new SBML file."
	     << endl
	     << endl;
    return 1;
  }

  const char* inputFile   = argv[1];
  const char* outputFile  = argv[2];

  // read document 
  SBMLDocument* document  = readSBML(inputFile);
  unsigned int  errors    = document->getNumErrors(LIBSBML_SEV_ERROR);

  // stop in case of errors
  if (errors > 0)
  {
    cerr << "Encountered the following SBML errors:" << endl;
    document->printErrors(cerr);
    cerr << "Conversion skipped.  Please correct the problems above first."
	 << endl;
    return errors;
  }

  // create conversion object that identifies the function definition converter
  ConversionProperties props;
  props.addOption("expandFunctionDefinitions", true,
                 "Expand all function definitions in the model");
  
  // convert
  int success = document->convert(props);

  if (success != LIBSBML_OPERATION_SUCCESS)
  {
    cerr << "Unable to perform conversion due to the following:" << endl;
    document->printErrors(cerr);
    return errors;
  }   
  else
  {
    cout << "Conversion completed." << endl;
    writeSBML(document, outputFile);
  }

  return 0;
}
开发者ID:copasi,项目名称:copasi-dependencies,代码行数:58,代码来源:inlineFunctionDefintions.cpp


注:本文中的ConversionProperties::addOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。