• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cobjectinterface::ContainerList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cobjectinterface::ContainerList的典型用法代码示例。如果您正苦于以下问题:C++ ContainerList类的具体用法?C++ ContainerList怎么用?C++ ContainerList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: enterProtected

bool CQModelValue::enterProtected()
{
  mpModelValue = NULL;

  if (mObjectCNToCopy != "")
    {
      CObjectInterface::ContainerList List;
      List.push_back(mpDataModel);

      // This will check the current data model and the root container for the object;
      mpModelValue = dynamic_cast<CModelValue *>(const_cast< CDataObject * >(CObjectInterface::DataObject(CObjectInterface::GetObjectFromCN(List, mObjectCNToCopy))));
      mObjectCNToCopy.clear();
    }
  else
    {
      mpModelValue = dynamic_cast<CModelValue *>(mpObject);
    }

  if (!mpModelValue)
    {
      mpListView->switchToOtherWidget(ListViews::WidgetType::GlobalQuantities, std::string());
      return false;
    }

  load();

  mpModelValue = dynamic_cast<CModelValue *>(mpObject);

  return true;
}
开发者ID:copasi,项目名称:COPASI,代码行数:30,代码来源:CQModelValue.cpp


示例2: process

// virtual
bool CMoietiesTask::process(const bool & /* useInitialValues */)
{
  bool success = true;

  output(COutputInterface::BEFORE);

  success = static_cast< CMoietiesMethod * >(mpMethod)->process();

  // The call to process may modify some object pointers. We therefore
  // have to recompile the output.

  if (mpOutputHandler != NULL)
    {
      CObjectInterface::ContainerList ListOfContainer;
      ListOfContainer.push_back(this);
      ListOfContainer.push_back(mpContainer);

      size_t Size = CCopasiMessage::size();

      mpOutputHandler->compile(ListOfContainer);

      // Remove error messages created by setExpression as this may fail
      // due to incomplete model specification at this time.
      while (CCopasiMessage::size() > Size)
        CCopasiMessage::getLastMessage();
    }

  output(COutputInterface::DURING);
  output(COutputInterface::AFTER);

  return success;
}
开发者ID:copasi,项目名称:COPASI,代码行数:33,代码来源:CMoietiesTask.cpp


示例3:

C_FLOAT64 CExperimentObjectMap::CDataColumn::getDefaultScale() const
{
  if (mpObjectCN == NULL)
    return std::numeric_limits<C_FLOAT64>::quiet_NaN();

  CCopasiParameterGroup *pGroup =
    dynamic_cast< CCopasiParameterGroup * >(getObjectParent());

  if (pGroup == NULL)
    return std::numeric_limits<C_FLOAT64>::quiet_NaN();

  const CExperiment *pExperiment =
    dynamic_cast<const CExperiment * >(pGroup->getObjectParent());

  if (pExperiment == NULL)
    return std::numeric_limits<C_FLOAT64>::quiet_NaN();

  CObjectInterface::ContainerList ListOfContainer;
  ListOfContainer.push_back(getObjectDataModel());

  const CCopasiObject * pObject = CObjectInterface::DataObject(CObjectInterface::GetObjectFromCN(ListOfContainer, *mpObjectCN));

  if (pObject == NULL)
    return std::numeric_limits<C_FLOAT64>::quiet_NaN();

  return pExperiment->getDefaultScale(pObject);
}
开发者ID:jonasfoe,项目名称:COPASI,代码行数:27,代码来源:CExperimentObjectMap.cpp


示例4: setPriorityExpressionPtr

bool CEvent::setPriorityExpressionPtr(CExpression* pExpression)
{
  if (pExpression == mpPriorityExpression) return true;

  if (pExpression == NULL) return false;

  if (mpModel != NULL)
    {
      mpModel->setCompileFlag(true);
    }

  CExpression * pOld = mpPriorityExpression;
  mpPriorityExpression = pExpression;

  mpPriorityExpression->setObjectName("PriorityExpression");
  add(mpPriorityExpression, true);
  CObjectInterface::ContainerList listOfContainer;
  listOfContainer.push_back(mpModel);

  if (mpPriorityExpression->compile(listOfContainer))
    {
      pdelete(pOld);
      return true;
    }

  // If compile fails we do not take ownership
  // and we remove the object from the container
  remove(mpPriorityExpression);
  mpPriorityExpression->setObjectParent(NULL);
  mpPriorityExpression = pOld;
  return false;
}
开发者ID:jonasfoe,项目名称:COPASI,代码行数:32,代码来源:CEvent.cpp


示例5:

void test000052::test_bug988()
{
  CDataModel* pDataModel = pCOPASIDATAMODEL;
  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(MODEL_STRING));
  CModel* pModel = pDataModel->getModel();
  CPPUNIT_ASSERT(pModel != NULL);
  CPPUNIT_ASSERT(pModel->getQuantityUnitEnum() == CUnit::mMol);
  CPPUNIT_ASSERT(pModel->getVolumeUnitEnum() == CUnit::ml);
  CPPUNIT_ASSERT(pModel->getTimeUnitEnum() == CUnit::s);
  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
  const CCompartment* pCompartment = pModel->getCompartments()[0];
  CPPUNIT_ASSERT(pCompartment != NULL);
  CPPUNIT_ASSERT(pCompartment->getStatus() == CModelEntity::Status::FIXED);
  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 1);
  CMetab* pA = pModel->getMetabolites()[0];
  CPPUNIT_ASSERT(pA != NULL);
  CPPUNIT_ASSERT(pA->getStatus() == CModelEntity::Status::ASSIGNMENT);
  const CExpression* pExpr = pA->getExpressionPtr();
  // check the expression
  const CEvaluationNode* pNode = pExpr->getRoot();
  CPPUNIT_ASSERT(pNode != NULL);
  const CEvaluationNodeChoice* pChoiceNode = dynamic_cast<const CEvaluationNodeChoice*>(pNode);
  CPPUNIT_ASSERT(pChoiceNode != NULL);
  pNode = dynamic_cast<const CEvaluationNode*>(pChoiceNode->getChild());
  CPPUNIT_ASSERT(pNode != NULL);
  const CEvaluationNodeLogical* pLogicalNode = dynamic_cast<const CEvaluationNodeLogical*>(pNode);
  CPPUNIT_ASSERT(pLogicalNode != NULL);
  CPPUNIT_ASSERT((pLogicalNode->subType()) == CEvaluationNode::SubType::LT);
  const CEvaluationNodeObject* pObjectNode = dynamic_cast<const CEvaluationNodeObject*>(pLogicalNode->getChild());
  CPPUNIT_ASSERT(pObjectNode != NULL);
  CCommonName objectCN = pObjectNode->getObjectCN();
  CPPUNIT_ASSERT(!objectCN.empty());
  CObjectInterface::ContainerList listOfContainers;
  listOfContainers.push_back(pModel);
  const CDataObject* pObject = CObjectInterface::DataModel(pCOPASIDATAMODEL->getObjectFromCN(listOfContainers, objectCN));
  CPPUNIT_ASSERT(pObject != NULL);
  CPPUNIT_ASSERT(pObject->hasFlag(CDataObject::Reference) == true);
  CPPUNIT_ASSERT(pObject->getObjectName() == std::string("Time"));
  CPPUNIT_ASSERT(pObject->getObjectParent() == pModel);
  const CEvaluationNodeNumber* pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pObjectNode->getSibling());
  CPPUNIT_ASSERT(pNumberNode != NULL);
  CPPUNIT_ASSERT((pNumberNode->subType()) == CEvaluationNode::SubType::DOUBLE);
  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 5.0) / 5.0) < 1e-3);
  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pLogicalNode->getSibling());
  CPPUNIT_ASSERT(pNumberNode != NULL);
  CPPUNIT_ASSERT((pNumberNode->subType()) == CEvaluationNode::SubType::DOUBLE);
  CPPUNIT_ASSERT(pNumberNode->getValue() < 1e-3);
  pNumberNode = dynamic_cast<const CEvaluationNodeNumber*>(pNumberNode->getSibling());
  CPPUNIT_ASSERT(pNumberNode != NULL);
  CPPUNIT_ASSERT((pNumberNode->subType()) == CEvaluationNode::SubType::DOUBLE);
  CPPUNIT_ASSERT(fabs((pNumberNode->getValue() - 10.0) / 10.0) < 1e-3);

  CPPUNIT_ASSERT(pModel->getModelValues().size() == 0);
  CPPUNIT_ASSERT(pModel->getReactions().size() == 0);
}
开发者ID:copasi,项目名称:COPASI,代码行数:55,代码来源:test000052.cpp


示例6: modifySelectCNs

void CQParameterGroupView::modifySelectCNs(CCopasiParameterGroup & group, const CCopasiParameter & cnTemplate)
{
  // OpenSelectionDialog
  std::vector< const CDataObject * > Selection;
  CObjectInterface::ContainerList ContainerList;
  ContainerList.push_back(group.getObjectDataModel());

  // Create the current selection
  CCopasiParameterGroup::elements::iterator it = group.beginIndex();
  CCopasiParameterGroup::elements::iterator end = group.endIndex();

  for (; it != end; ++it)
    {
      const CDataObject * pObject = CObjectInterface::DataObject(CObjectInterface::GetObjectFromCN(ContainerList, (*it)->getValue< CCommonName >()));

      if (pObject != NULL)
        {
          Selection.push_back(pObject);
        }
    }

  CModel * pModel = group.getObjectDataModel()->getModel();

  std::vector<const CDataObject * > ValidObjects;

  const std::vector< std::pair < CCommonName, CCommonName > > & ValidValues = cnTemplate.getValidValues< CCommonName >();
  std::vector< std::pair < CCommonName, CCommonName > >::const_iterator itValidValues = ValidValues.begin();
  std::vector< std::pair < CCommonName, CCommonName > >::const_iterator endValidValues = ValidValues.end();

  for (; itValidValues != endValidValues; ++itValidValues)
    {
      CObjectLists::ListType ListType = toEnum(itValidValues->first, CObjectLists::ListTypeName, CObjectLists::EMPTY_LIST);
      std::vector<const CDataObject * > Tmp = CObjectLists::getListOfConstObjects(ListType, pModel);
      ValidObjects.insert(ValidObjects.end(), Tmp.begin(), Tmp.end());
    }

  std::vector< const CDataObject * > NewSelection = CCopasiSelectionDialog::getObjectVector(this, ValidObjects, &Selection);

  // Modify group parameters;
  mpParameterGroupDM->beginResetModel();
  group.clear();

  std::vector< const CDataObject * >::const_iterator itNew = NewSelection.begin();
  std::vector< const CDataObject * >::const_iterator endNew = NewSelection.end();

  for (; itNew != endNew; ++itNew)
    {
      group.addParameter("Reaction", CCopasiParameter::Type::CN, (*itNew)->getCN());
    }

  mpParameterGroupDM->endResetModel();
}
开发者ID:copasi,项目名称:COPASI,代码行数:52,代码来源:CQParameterGroupView.cpp


示例7: update

bool CopasiWidget::update(ListViews::ObjectType objectType, ListViews::Action action, const CCommonName & cn)
{
  // Assure that the object still exists
  CObjectInterface::ContainerList List;
  List.push_back(mpDataModel);

  // This will check the current data model and the root container for the object;
  mpObject = const_cast< CDataObject * >(CObjectInterface::DataObject(CObjectInterface::GetObjectFromCN(List, mObjectCN)));

  bool success = updateProtected(objectType, action, cn != mOldCN ? cn : mObjectCN);
  mOldCN = mObjectCN;

  return success;
}
开发者ID:copasi,项目名称:COPASI,代码行数:14,代码来源:copasiWidget.cpp


示例8: compile

// virtual
void CModelParameterReactionParameter::compile()
{
  CModelParameter::compile();

  mGlobalQuantityCN = std::string();

  std::string Infix = getInitialExpression();

  if (Infix.length() > 2)
    {
      // Infix: <CN,Reference=InitialValue> or <CN,Reference=Value>
      CCopasiObjectName Tmp = Infix.substr(1, Infix.length() - 2);
      std::string Separator = "";

      for (; Tmp != ""; Tmp = Tmp.getRemainder())
        {
          CCopasiObjectName Primary = Tmp.getPrimary();

          if (Primary.getObjectType() == "Reference")
            {
              break;
            }

          mGlobalQuantityCN += Separator + Primary;
          Separator = ",";
        }

      setSimulationType(CModelEntity::ASSIGNMENT);
    }
  else
    {
      setSimulationType(CModelEntity::FIXED);
    }

  mpGlobalQuantity = this->getSet()->getModelParameter(mGlobalQuantityCN);

  if (mpGlobalQuantity != NULL)
    {
      mValue = mpGlobalQuantity->getValue(ParticleNumbers);
    }

  CObjectInterface::ContainerList ListOfContainer;

  CModel * pModel = getModel();
  ListOfContainer.push_back(pModel);

  mpReaction = static_cast< CReaction * >(const_cast< CCopasiObject * >(CObjectInterface::DataObject(CObjectInterface::GetObjectFromCN(ListOfContainer, mpParent->getCN()))));
}
开发者ID:jonasfoe,项目名称:COPASI,代码行数:49,代码来源:CModelParameter.cpp


示例9: setExpression

bool CMathObject::setExpression(const std::string & infix,
                                const bool & isBoolean,
                                CMathContainer & container)
{
  bool success = true;
  CExpression Expression;
  Expression.setIsBoolean(isBoolean);

  success &= Expression.setInfix(infix);
  CObjectInterface::ContainerList ListOfContainer;
  ListOfContainer.push_back(&container);
  success &= Expression.compile(ListOfContainer);
  success &= setExpression(Expression, container);

  return success;
}
开发者ID:jonasfoe,项目名称:COPASI,代码行数:16,代码来源:CMathObject.cpp


示例10: leave

bool CopasiWidget::leave()
{
  CObjectInterface::ContainerList List;
  List.push_back(mpDataModel);

  // This will check the current data model and the root container for the object;
  mpObject = const_cast< CDataObject * >(CObjectInterface::DataObject(CObjectInterface::GetObjectFromCN(List, mObjectCN)));

  if (mpObject != NULL)
    {
      bool success = leaveProtected();
      mOldCN = mObjectCN;

      return success;
    }

  return true;
}
开发者ID:copasi,项目名称:COPASI,代码行数:18,代码来源:copasiWidget.cpp


示例11: enter

bool CopasiWidget::enter(const CCommonName & cn)
{
  if (mpListView == NULL)
    {
      initContext();
    }

  mObjectCN = cn;
  mOldCN = cn;

  CObjectInterface::ContainerList List;
  List.push_back(mpDataModel);

  // This will check the current data model and the root container for the object;
  mpObject = const_cast< CDataObject * >(CObjectInterface::DataObject(CObjectInterface::GetObjectFromCN(List, mObjectCN)));
  mObjectType = mpObject != NULL ? ListViews::DataObjectType.toEnum(mpObject->getObjectType(), ListViews::ObjectType::RESULT) : ListViews::ObjectType::RESULT;

  return enterProtected();
}
开发者ID:copasi,项目名称:COPASI,代码行数:19,代码来源:copasiWidget.cpp


示例12: compile

bool COutputHandler::compile(CObjectInterface::ContainerList listOfContainer)
{
    CObjectInterface::ContainerList::const_iterator itContainer = listOfContainer.begin();
    CObjectInterface::ContainerList::const_iterator endContainer = listOfContainer.end();

    for (mpContainer = NULL; itContainer != endContainer && mpContainer == NULL; ++itContainer)
    {
        mpContainer = dynamic_cast< const CMathContainer * >(*itContainer);
    }

    assert(mpContainer != NULL);

    bool success = true;
    mObjects.clear();

    std::set< COutputInterface *>::iterator it = mInterfaces.begin();
    std::set< COutputInterface *>::iterator end = mInterfaces.end();

    CObjectInterface::ObjectSet::const_iterator itObj;
    CObjectInterface::ObjectSet::const_iterator endObj;

    for (; it != end; ++it)
    {
        success &= (*it)->compile(listOfContainer);

        // Assure that this is the only one master.
        COutputHandler * pHandler = dynamic_cast< COutputHandler * >(*it);

        if (pHandler != NULL) pHandler->setMaster(this);

        // Collect the list of objects
        const CObjectInterface::ObjectSet & Objects = (*it)->getObjects();

        for (itObj = Objects.begin(), endObj = Objects.end(); itObj != endObj; ++itObj)
            mObjects.insert(*itObj);
    }

    if (mpMaster == NULL)
        success &= compileUpdateSequence(listOfContainer);

    return success;
}
开发者ID:jonasfoe,项目名称:COPASI,代码行数:42,代码来源:COutputHandler.cpp


示例13:

void test000027::test_hasOnlySubstanceUnits()
{
  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(MODEL_STRING));
  CModel* pModel = pDataModel->getModel();
  CPPUNIT_ASSERT(pModel != NULL);
  CPPUNIT_ASSERT(pModel->getQuantityUnitEnum() == CUnit::mMol);
  CPPUNIT_ASSERT(pModel->getVolumeUnitEnum() == CUnit::ml);
  CPPUNIT_ASSERT(pModel->getTimeUnitEnum() == CUnit::s);
  CPPUNIT_ASSERT(pModel->getCompartments().size() == 1);
  const CCompartment* pCompartment = pModel->getCompartments()[0];
  CPPUNIT_ASSERT(pCompartment != NULL);
  CPPUNIT_ASSERT(pCompartment->getStatus() == CModelEntity::FIXED);
  CPPUNIT_ASSERT(pModel->getMetabolites().size() == 2);
  CMetab* pA = pModel->getMetabolites()[0];
  CPPUNIT_ASSERT(pA != NULL);
  CPPUNIT_ASSERT(pA->getStatus() == CModelEntity::REACTIONS);
  const CMetab* pB = pModel->getMetabolites()[1];
  CPPUNIT_ASSERT(pB != NULL);
  CPPUNIT_ASSERT(pB->getStatus() == CModelEntity::REACTIONS);
  CPPUNIT_ASSERT(pModel->getModelValues().size() == 2);
  // check the kinetic law
  const CModelValue* pFactor = pModel->getModelValues()[1];
  CPPUNIT_ASSERT(pFactor != NULL);
  CPPUNIT_ASSERT(pFactor->getStatus() == CModelEntity::FIXED);
  CPPUNIT_ASSERT(fabs((pFactor->getInitialValue() - pModel->getQuantity2NumberFactor()) / pModel->getQuantity2NumberFactor()) < 1e-3);
  const CModelValue* pModelValue = pModel->getModelValues()[0];
  CPPUNIT_ASSERT(pModelValue != NULL);
  CPPUNIT_ASSERT(pModelValue->getStatus() == CModelEntity::ASSIGNMENT);
  const CExpression* pExpr = pModelValue->getExpressionPtr();
  // check the expression
  const CEvaluationNode* pNode = pExpr->getRoot();
  CPPUNIT_ASSERT(pNode != NULL);
  const CEvaluationNodeObject* pObjectNode = dynamic_cast<const CEvaluationNodeObject*>(pNode);
  CPPUNIT_ASSERT(pObjectNode != NULL);
  CCopasiObjectName objectCN = pObjectNode->getObjectCN();
  CPPUNIT_ASSERT(!objectCN.empty());
  CObjectInterface::ContainerList listOfContainers;
  listOfContainers.push_back(pModel);
  const CCopasiObject* pObject = CObjectInterface::DataModel(pCOPASIDATAMODEL->getObjectFromCN(listOfContainers, objectCN));
  CPPUNIT_ASSERT(pObject != NULL);
  CPPUNIT_ASSERT(pObject->isReference() == true);
  CPPUNIT_ASSERT(pObject->getObjectName() == std::string("ParticleNumber"));
  CPPUNIT_ASSERT(pObject->getObjectParent() == pA);

  CPPUNIT_ASSERT(pModel->getReactions().size() == 2);
  const CReaction* pReaction1 = pModel->getReactions()[0];
  CPPUNIT_ASSERT(pReaction1 != NULL);
  CPPUNIT_ASSERT(pReaction1->isReversible() == false);
  const CFunction* pKineticFunction = pReaction1->getFunction();
  CPPUNIT_ASSERT(pKineticFunction != NULL);
  const CMassAction* pMassAction = dynamic_cast<const CMassAction*>(pKineticFunction);
  //FTB: this no longer is recognized as mass action reaction because of the
  //     special case of a species with hOSU
  CPPUNIT_ASSERT(pMassAction == NULL);
  const CChemEq* pChemEq = &pReaction1->getChemEq();
  CPPUNIT_ASSERT(pChemEq != NULL);
  CPPUNIT_ASSERT(pChemEq->getCompartmentNumber() == 1);
  CPPUNIT_ASSERT(pChemEq->getSubstrates().size() == 1);
  const CChemEqElement* pElement = pChemEq->getSubstrates()[0];
  CPPUNIT_ASSERT(pElement != NULL);
  CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
  CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
  CPPUNIT_ASSERT(pChemEq->getProducts().size() == 0);
  CPPUNIT_ASSERT(pChemEq->getModifiers().size() == 0);

  const CReaction* pReaction2 = pModel->getReactions()[1];
  CPPUNIT_ASSERT(pReaction2 != NULL);
  CPPUNIT_ASSERT(pReaction2->isReversible() == false);
  // check the kinetic law
  pKineticFunction = pReaction2->getFunction();
  CPPUNIT_ASSERT(pKineticFunction != NULL);
  CPPUNIT_ASSERT(pKineticFunction->getObjectName() == std::string("Henri-Michaelis-Menten (irreversible)"));
  // check the function parameters one should be the reference to the substrate
  pChemEq = &pReaction2->getChemEq();
  CPPUNIT_ASSERT(pChemEq != NULL);
  CPPUNIT_ASSERT(pChemEq->getCompartmentNumber() == 1);
  CPPUNIT_ASSERT(pChemEq->getSubstrates().size() == 1);
  pElement = pChemEq->getSubstrates()[0];
  CPPUNIT_ASSERT(pElement != NULL);
  CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
  CPPUNIT_ASSERT(pElement->getMetabolite() == pA);
  CPPUNIT_ASSERT(pChemEq->getProducts().size() == 1);
  pElement = pChemEq->getProducts()[0];
  CPPUNIT_ASSERT(pElement != NULL);
  CPPUNIT_ASSERT(fabs(pElement->getMultiplicity() - 1.0) < 1e-3);
  CPPUNIT_ASSERT(pElement->getMetabolite() == pB);
  CPPUNIT_ASSERT(pChemEq->getModifiers().size() == 0);
  const std::vector<std::vector<std::string> > parameterMappings = pReaction2->getParameterMappings();
  CPPUNIT_ASSERT(parameterMappings.size() == 3);
  CPPUNIT_ASSERT(parameterMappings[0].size() == 1);
  const std::string parameterKey = parameterMappings[0][0];
  CPPUNIT_ASSERT(parameterKey == pA->getKey());
}
开发者ID:jonasfoe,项目名称:COPASI,代码行数:94,代码来源:test000027.cpp


示例14: setExpression

void CQExpressionWidget::setExpression(const std::string & expression)
{
  if (mpValidatorExpression == NULL)
    {
      mpValidatorExpression = new CQValidatorExpression(this, "");
      mpValidatorExpression->revalidate();
    }

  // Reset the parse list.
  mParseList.clear();

  mCursor = textCursor();

  CFunctionDB* pFunDB = CCopasiRootContainer::getFunctionList();
  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
  CCopasiDataModel* pDataModel = &CCopasiRootContainer::getDatamodelList()->operator[](0);
  assert(pDataModel != NULL);
  CObjectInterface::ContainerList containers;
  containers.push_back(pDataModel);
  containers.push_back(pFunDB);

  const QString Infix(FROM_UTF8(expression));
  QString Display;

  QRegExp InfixObjectPattern(CQExpressionWidget::InfixPattern);

  int Index = 0;
  QString::const_iterator it = Infix.begin();
  QString::const_iterator end;

  while (true)
    {
      Index = InfixObjectPattern.indexIn(Infix, Index);

      if (Index < 0)
        {
          end = Infix.end();
        }
      else
        {
          end = Infix.begin() + Index;
        }

      // Copy the non-object part
      for (; it != end; ++it)
        {
          Display.append(*it);
        }

      if (InfixObjectPattern.matchedLength() < 0)
        break;

      Index += InfixObjectPattern.matchedLength();
      it += InfixObjectPattern.matchedLength();

      CCopasiObjectName InfixName(TO_UTF8(InfixObjectPattern.cap(1)));
      const CCopasiObject * pObject = CObjectInterface::DataObject(CObjectInterface::GetObjectFromCN(containers, InfixName));

      if (pObject != NULL)
        {
          std::string DisplayName = pObject->getObjectDisplayName();

          // We need to escape '\' and '}'
          std::string::size_type pos = DisplayName.find_first_of("\\}");

          while (pos != std::string::npos)
            {
              DisplayName.insert(pos, "\\");
              pos += 2;
              pos = DisplayName.find_first_of("\\}", pos);
            }

          mParseList[DisplayName] = pObject;

          Display += '{' + FROM_UTF8(DisplayName) + '}';
        }
      else
        {
          std::string DisplayName = InfixName;

          // We need to escape '\' and '}'
          std::string::size_type pos = DisplayName.find_first_of("\\}");

          while (pos != std::string::npos)
            {
              DisplayName.insert(pos, "\\");
              pos += 2;
              pos = DisplayName.find_first_of("\\}", pos);
            }

          Display += '{' + FROM_UTF8(DisplayName) + '}';
        }
    }

  setText(Display);
  mpValidatorExpression->saved();

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


示例15: initialize

bool CCopasiTask::initialize(const OutputFlag & of,
                             COutputHandler * pOutputHandler,
                             std::ostream * pOstream)
{
    bool success = true;

    if (mpProblem == NULL)
    {
        CCopasiMessage(CCopasiMessage::ERROR, MCCopasiTask + 1, getObjectName().c_str());
        return false;
    }

    if (mpContainer == NULL)
    {
        CCopasiMessage(CCopasiMessage::ERROR, MCCopasiTask + 2, getObjectName().c_str());
        return false;
    }

    if (mpMethod == NULL)
    {
        CCopasiMessage(CCopasiMessage::ERROR, MCCopasiTask + 3, getObjectName().c_str());
        return false;
    }

    if (mpContainer != NULL)
    {
        mInitialState = mpContainer->getInitialState();
    }
    else
    {
        mInitialState.resize(0);
    }

    mDoOutput = of;
    mpOutputHandler = pOutputHandler;

    if (mDoOutput == NO_OUTPUT ||
            mpOutputHandler == NULL) return true;

    mOutputCounter = 0;

    if (mDoOutput & REPORT)
    {
        if (mReport.open(getObjectDataModel(), pOstream) &&
                mReport.getTarget() != "")
            mpOutputHandler->addInterface(&mReport);
        else if (pOstream == NULL)
            CCopasiMessage(CCopasiMessage::COMMANDLINE, MCCopasiTask + 5, getObjectName().c_str());
    }

    CObjectInterface::ContainerList ListOfContainer;
    ListOfContainer.push_back(this);

    if (mpContainer != NULL)
    {
        ListOfContainer.push_back(mpContainer);
    }

    if (!mpOutputHandler->compile(ListOfContainer))
    {
        // Warning
        CCopasiMessage(CCopasiMessage::WARNING, MCCopasiTask + 7);
        success = false;
    }

    return success;
}
开发者ID:copasi,项目名称:COPASI,代码行数:67,代码来源:CCopasiTask.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cocos2d::PhysicsContact类代码示例发布时间:2022-05-31
下一篇:
C++ co::ICommand类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap