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


C++ Species::isSetNotes方法代码示例

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


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

示例1: notes

int 
  CobraToFbcConverter::convert()
{  
  int result = LIBSBML_OPERATION_FAILED;

  if (mDocument == NULL) 
  {
    return LIBSBML_INVALID_OBJECT;
  }

  Model* mModel = mDocument->getModel();
  if (mModel == NULL) 
  {
    return LIBSBML_INVALID_OBJECT;
  }

  FbcModelPlugin *plugin =
    (FbcModelPlugin*)(mDocument->getModel()->getPlugin("fbc"));

  // if we have a fbc model we are done already
  if (plugin != NULL || mDocument->getLevel() == 3)
  {
    return LIBSBML_OPERATION_SUCCESS;
  }
  
  std::map<const string, int> chargeMap;
  std::map<const string, string> formulaMap;
  Model* model = mDocument->getModel();

  for (unsigned int i = 0; i < model->getNumSpecies();++i)
  {
    Species* current = model->getSpecies(i);
    bool haveCharge = current->isSetCharge();
    if (haveCharge)
    {
      chargeMap[current->getId()] = current->getCharge();
      // need to unset the charge here, as it the call will 
      // not work once this is an L3 model
      current->unsetCharge();
    }
    if (current->isSetNotes())
    {
      string originalNotes = current->getNotesString();
	  string notes(originalNotes);
      std::transform(notes.begin(), notes.end(), notes.begin(), ::toupper);
      size_t pos = notes.find("FORMULA:");
      if (pos != string::npos)
      {
        size_t end = notes.find("</", pos+9);
        if (end != string::npos)
        {
          string formula = originalNotes.substr(pos + 9, end-(pos+9));
          if (formula[0] != '<' &&  formula[0] != '/' )
          {
            size_t pos = formula.find_first_not_of(" \n\t\r");
            if (pos != std::string::npos)
            formulaMap[current->getId()] = formula;
          }
        }
      } // added chemical formula if present 
	 
      pos = notes.find("CHARGE:");
      if (pos != string::npos && !haveCharge)
      {
        size_t end = notes.find("</", pos+8);
        if (end != string::npos)
        {
          string formula = originalNotes.substr(pos + 8, end-(pos+8));
          if (formula[0] != '<' &&  formula[0] != '/' )
          {
            size_t pos = formula.find_first_not_of(" \n\t\r");
            if (pos != std::string::npos)
		  {
			int charge; 
			stringstream str; 
			str << formula; 
			str >> charge;
			if (charge != 0)
			  chargeMap[current->getId()] = charge;
		  }
          }
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:81,代码来源:CobraToFbcConverter.cpp


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