コード例 #1
0
END_TEST

START_TEST (test_GetMultipleObjects_noLocalParameters)
{
  SBMLReader        reader;
  SBMLDocument*     d;

  std::string filename(TestDataDirectory);
  filename += "multiple-ids.xml";


  d = reader.readSBML(filename);

 if (d == NULL)
  {
    fail("readSBML(\"multiple-ids.xml\") returned a NULL pointer.");
  }

  SBase* rxn = d->getElementBySId("J0");
  fail_unless(rxn != NULL);
  SBase* obj = rxn->getElementBySId("x");
  fail_unless(obj == NULL);
  obj = rxn->getElementByMetaId("meta28");
  fail_unless(obj != NULL);
  fail_unless(obj->getTypeCode() == SBML_LOCAL_PARAMETER);


  delete d;
}
コード例 #2
0
SBase*
ListOfInitialAssignments::getElementBySId(const std::string& id)
{
    for (unsigned int i = 0; i < size(); i++)
    {
        SBase* obj = get(i);
        //Initial assignments are not in the SId namespace, so don't check 'getId'.  However, their children (through plugins) may have the element we are looking for, so we still need to check all of them.
        obj = obj->getElementBySId(id);
        if (obj != NULL) return obj;
    }

    return getElementFromPluginsBySId(id);
}
コード例 #3
0
ファイル: ListOf.cpp プロジェクト: kirichoi/roadrunner
SBase*
ListOf::getElementBySId(const std::string& id)
{
  if (id.empty()) return NULL;
  for (unsigned int i = 0; i < size(); i++)
  {
    SBase* obj = get(i);
    if (obj->isSetId() && obj->getId() == id)
    {
      return obj;
    }
    obj = obj->getElementBySId(id);
    if (obj != NULL) return obj;
  }

  return getElementFromPluginsBySId(id);
}