bool CExperimentObjectMap::compile(const std::vector< CCopasiContainer * > listOfContainer)
{
  size_t i, imax = size();
  size_t Column;

  // We need to find out the size of the object map
  if (imax == 0)
    mLastColumn = C_INVALID_INDEX;
  else
    {
      mLastColumn = strtoul(getName(0).c_str(), NULL, 0);

      for (i = 1; i < imax; i++)
        {
          Column = strtoul(getName(i).c_str(), NULL, 0);

          if (mLastColumn < Column)
            mLastColumn = Column;
        }
    }

  mObjects.resize(mLastColumn + 1);
  mObjects = NULL;

  CCopasiObject * pObject = NULL;
  std::string CN;

  for (i = 0; i < imax; i++)
    {
      if ((CN = getObjectCN(i)) == "") continue;

      if ((pObject =
             getObjectDataModel()->ObjectFromName(listOfContainer, CN)) != NULL &&
          pObject->isValueDbl())
        {
          Column = strtoul(getName(i).c_str(), NULL, 0);
          mObjects[Column] = pObject;
        }
      else
        return false;
    }

  return true;
}
Exemple #2
0
std::vector<CCopasiObject*> CSensItem::getVariablesPointerList(CCopasiDataModel* pDataModel)
{
  std::vector<CCopasiObject*> ret;

  if (isSingleObject())
    {
      CCopasiObject * tmpObject = const_cast<CCopasiObject *>(pDataModel->getObject(getSingleObjectCN()));

      if (!tmpObject) {return ret;}  //return empty list

      if (!tmpObject->isValueDbl()) {return ret;}  //return empty list

      ret.push_back(tmpObject);
    }
  else
    {
      ret = CObjectLists::getListOfObjects(getListType(), pDataModel->getModel());
    }

  return ret;
}