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


C++ ListOf::get方法代码示例

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


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

示例1: containsOnlyGivenUnits

/*
 * The functions determins wether the given UnitDefinition contains only
 * units from the list given as the second argument.
 * @param const UnitDefinition& uDef
 * @param const ListOf& unitList
 * @return bool containsOnlyGivenUnits
 */
LIBSBML_EXTERN
bool UnitConversionFactory::containsOnlyGivenUnits(const UnitDefinition& uDef, const ListOf& unitList)
{
    bool result = true;
    UnitDefinition* pTmpUdef = UnitConversionFactory::convertToSI(uDef);

    if (pTmpUdef)
    {
        unsigned int i;
        unsigned int maxUnits = pTmpUdef->getNumUnits();

        for (i = 0; i < maxUnits; ++i)
        {
            Unit* pU = pTmpUdef->getUnit(i);
            UnitKind_t kind = pU->getKind();
            unsigned int j;
            unsigned int maxUnits2 = unitList.size();
            bool found = false;

            for (j = 0; j < maxUnits2; ++j)
            {
                const Unit* pU2 = dynamic_cast<const Unit*>(unitList.get(j));

                if (!pU2) break;

                if (pU2->getKind() == kind)
                {
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                result = false;
                break;
            }
        }

        delete pTmpUdef;
    }
    else
    {
        result = false;
    }

    return result;
}
开发者ID:jonasfoe,项目名称:COPASI,代码行数:55,代码来源:UnitConversionFactory.cpp

示例2: readListOfLayouts

//static
void SBMLDocumentLoader::readListOfLayouts(CListOfLayouts & lol,
    const ListOf & sbmlList,
    const std::map<CCopasiObject*, SBase*> & copasimodelmap)
{
  unsigned C_INT32 i, iMax;
#ifdef USE_CRENDER_EXTENSION
  // read the global render information
  const ListOfLayouts* pLoL = dynamic_cast<const ListOfLayouts*>(&sbmlList);
  assert(pLoL != NULL);
  RenderListOfLayoutsPlugin* rlolPlugin = (RenderListOfLayoutsPlugin*) pLoL ->getPlugin("render");

  if (rlolPlugin == NULL)
    {
      const_cast<SBMLDocument *>(pLoL->getSBMLDocument())->enablePackage(RenderExtension::getXmlnsL3V1V1(), "render", true);
      rlolPlugin = (RenderListOfLayoutsPlugin*) pLoL ->getPlugin("render");
    }

  iMax = rlolPlugin->getNumGlobalRenderInformationObjects();
  std::map<std::string, std::string> idToKeyMap;
  CLGlobalRenderInformation* pGRI = NULL;

  /*
  std::map<std::string,std::string> colorIdToKeyMap;
  std::map<std::string,std::string> gradientIdToKeyMap;
  std::map<std::string,std::string> lineEndingIdToKeyMap;
  std::map<std::string,std::map<std::string,std::string> > colorIdToKeyMapMap;
  std::map<std::string,std::map<std::string,std::string> > gradientIdToKeyMapMap;
  std::map<std::string,std::map<std::string,std::string> > lineEndingIdToKeyMapMap;
  */
  for (i = 0; i < iMax; ++i)
    {
      //colorIdToKeyMap.clear();
      //gradientIdToKeyMap.clear();
      //lineEndingIdToKeyMap.clear();
      //pGRI=new CLGlobalRenderInformation(*pLoL->getRenderInformation(i),colorIdToKeyMap,gradientIdToKeyMap,lineEndingIdToKeyMap,&lol);
      pGRI = new CLGlobalRenderInformation(*rlolPlugin->getRenderInformation(i), &lol);

      if (rlolPlugin->getRenderInformation(i)->isSetId())
        idToKeyMap.insert(std::pair<std::string, std::string>(rlolPlugin->getRenderInformation(i)->getId(), pGRI->getKey()));
      else
        idToKeyMap.insert(std::pair<std::string, std::string>(pGRI->getKey(), pGRI->getKey()));

      //colorIdToKeyMapMap.insert(std::pair<std::string,std::map<std::string,std::string> >(pGRI->getKey(),colorIdToKeyMap));
      //gradientIdToKeyMapMap.insert(std::pair<std::string,std::map<std::string,std::string> >(pGRI->getKey(),gradientIdToKeyMap));
      //lineEndingIdToKeyMapMap.insert(std::pair<std::string,std::map<std::string,std::string> >(pGRI->getKey(),lineEndingIdToKeyMap));
      lol.addGlobalRenderInformation(pGRI);
    }

  // fix the references
  SBMLDocumentLoader::convertRenderInformationReferencesIds<CLGlobalRenderInformation>(lol.getListOfGlobalRenderInformationObjects(), idToKeyMap);
  // fix the color ids, gradient ids and line ending ids.
  /*
  std::map<std::string,std::map<std::string,std::string> >::const_iterator mapPos;
  std::map<std::string,std::map<std::string,std::string> > expandedColorIdToKeyMapMap, expandedGradientIdToKeyMapMap, expandedLineEndingIdToKeyMapMap;
  std::map<std::string,std::map<std::string,std::string> > tmpMap1,tmpMap2,tmpMap3;
  for(i=0;i < iMax; ++i)
  {
      pGRI=dynamic_cast<CLGlobalRenderInformation*>(lol.getRenderInformation(i));
      assert(pGRI != NULL);

      std::set<std::string> chain;
      SBMLDocumentLoader::expandIdToKeyMaps<CLGlobalRenderInformation>(pGRI,
                         lol.getListOfGlobalRenderInformationObjects(),
                         expandedColorIdToKeyMapMap,
                         expandedGradientIdToKeyMapMap,
                         expandedLineEndingIdToKeyMapMap,
                         colorIdToKeyMapMap,
                         gradientIdToKeyMapMap,
                         lineEndingIdToKeyMapMap,
                         chain,
                         tmpMap1,
                         tmpMap2,
                         tmpMap3
                  );
      SBMLDocumentLoader::convertPropertyKeys<CLGlobalRenderInformation>(pGRI,expandedColorIdToKeyMapMap[pGRI->getKey()],expandedGradientIdToKeyMapMap[pGRI->getKey()],expandedLineEndingIdToKeyMapMap[pGRI->getKey()]);
  }
      */
#endif /* USE_CRENDER_EXTENSION */
  //convert the map as used by the CLxxx constructors
  std::map<std::string, std::string> modelmap;

  std::string s1, s2;
  std::map<CCopasiObject*, SBase*>::const_iterator it;
  std::map<CCopasiObject*, SBase*>::const_iterator itEnd = copasimodelmap.end();

  for (it = copasimodelmap.begin(); it != itEnd; ++it)
    {
      s1 = SBMLUtils::getIdFromSBase(it->second);

      if (it->first)
        s2 = it->first->getKey();
      else
        s2 = "";

      if ((s1 != "") && (s2 != ""))
        modelmap[s1] = s2;
    }

  //iterate through list of layouts
//.........这里部分代码省略.........
开发者ID:sachiinb,项目名称:COPASI,代码行数:101,代码来源:SBMLDocumentLoader.cpp

示例3: collectIds

//static
void SBMLUtils::collectIds(Model* pModel, std::map<std::string, const SBase*>& ids, std::map<std::string, const SBase*>& metaIds)
{
  if (pModel != NULL)
    {
      // the model itself
      SBase* pSBase = NULL;
      std::string id;

      if (pModel->isSetId())
        {
          id = pModel->getId();

          if (ids.find(id) == ids.end())
            {
              ids.insert(std::pair<const std::string, const SBase*>(id, pModel));
            }
          else
            {
              CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str());
            }
        }

      if (pModel->isSetMetaId())
        {
          id = pModel->getMetaId();

          if (metaIds.find(id) == metaIds.end())
            {
              metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel));
            }
          else
            {
              CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str());
            }
        }

      // ListOfFunctionDefinitions
      pSBase = pModel->getListOfFunctionDefinitions();

      if (pSBase != NULL)
        {
          if (pSBase->isSetId())
            {
              id = pSBase->getId();

              if (ids.find(id) == ids.end())
                {
                  ids.insert(std::pair<const std::string, const SBase*>(id, pModel));
                }
              else
                {
                  CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str());
                }
            }

          if (pSBase->isSetMetaId())
            {
              id = pSBase->getMetaId();

              if (metaIds.find(id) == metaIds.end())
                {
                  metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel));
                }
              else
                {
                  CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str());
                }
            }

          // all FunctionDefinitions
          unsigned int i, iMax = pModel->getListOfFunctionDefinitions()->size();

          for (i = 0; i < iMax; ++i)
            {
              pSBase = pModel->getListOfFunctionDefinitions()->get(i);

              if (pSBase->isSetId())
                {
                  id = pSBase->getId();

                  if (ids.find(id) == ids.end())
                    {
                      ids.insert(std::pair<const std::string, const SBase*>(id, pSBase));
                    }
                  else
                    {
                      CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str());
                    }
                }

              if (pSBase->isSetMetaId())
                {
                  id = pSBase->getMetaId();

                  if (metaIds.find(id) == metaIds.end())
                    {
                      metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase));
                    }
                  else
//.........这里部分代码省略.........
开发者ID:ShuoLearner,项目名称:COPASI,代码行数:101,代码来源:SBMLUtils.cpp


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