COPASI API  4.16.103
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
CCopasiContainer Class Reference

#include <CCopasiContainer.h>

Inherits CCopasiObject.

Inherited by CArrayAnnotation, CBiologicalDescription, CChemEq, CChemEqElement, CCopasiDataModel, CCopasiParameter, CCopasiRootContainer, CCopasiTask, CCopasiVector< T >, CCopasiVector< CBiologicalDescription >, CCopasiVector< CChemEqElement >, CCopasiVector< CCopasiDataModel >, CCopasiVector< CCopasiObject >, CCopasiVector< CCreator >, CCopasiVector< CEvent >, CCopasiVector< CEventAssignment >, CCopasiVector< CFittingPoint >, CCopasiVector< CLayout >, CCopasiVector< CLColorDefinition >, CCopasiVector< CLCompartmentGlyph >, CCopasiVector< CLGeneralGlyph >, CCopasiVector< CLGlobalRenderInformation >, CCopasiVector< CLGlobalStyle >, CCopasiVector< CLGradientBase >, CCopasiVector< CLGradientStop >, CCopasiVector< CLGraphicalObject >, CCopasiVector< CLLineEnding >, CCopasiVector< CLLocalRenderInformation >, CCopasiVector< CLLocalStyle >, CCopasiVector< CLMetabGlyph >, CCopasiVector< CLMetabReferenceGlyph >, CCopasiVector< CLReactionGlyph >, CCopasiVector< CLReferenceGlyph >, CCopasiVector< CLTextGlyph >, CCopasiVector< CMathEvent >, CCopasiVector< CMathEvent::CAssignment >, CCopasiVector< CMathTrigger::CRootFinder >, CCopasiVector< CMetab >, CCopasiVector< CMetabOld >, CCopasiVector< CModification >, CCopasiVector< CMoiety >, CCopasiVector< CPlotItem >, CCopasiVector< CReference >, CCopasiVector< CSlider >, CCopasiVector< CType >, CCreator, CEigen, CEvaluationTree, CEvent, CEventAssignment, CFittingPoint, CFunctionDB, CFunctionParameter, CFunctionParameters, CLayout, CLGradientBase, CLGraphicalObject, CLGroup, CLLineEnding, CLRenderInformationBase, CLStyle, CMathContainer, CMathEvent, CMathEvent::CAssignment, CMathModel, CMathTrigger, CMathTrigger::CRootFinder, CMetabOld, CMIRIAMInfo, CModelEntity, CModelParameterSet, CModification, CMoiety, CReaction, CReference, CSlider, and SCopasiXMLGUI.

Collaboration diagram for CCopasiContainer:
Collaboration graph
[legend]

Public Types

typedef std::multimap
< std::string, CCopasiObject * > 
objectMap
 
- Public Types inherited from CCopasiObject
typedef std::set< const
CCopasiObject * > 
DataObjectSet
 
typedef std::vector< Refresh * > DataUpdateSequence
 
- Public Types inherited from CObjectInterface
typedef std::set< const
CObjectInterface * > 
ObjectSet
 
typedef std::vector
< CObjectInterface * > 
UpdateSequence
 

Public Member Functions

virtual bool add (CCopasiObject *pObject, const bool &adopt=true)
 
 CCopasiContainer (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=CCopasiObject::Container)
 
 CCopasiContainer (const CCopasiContainer &src, const CCopasiContainer *pParent=NULL)
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual bool remove (CCopasiObject *pObject)
 
virtual ~CCopasiContainer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual CCopasiObjectName getCN () const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
virtual const std::string & getKey () const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () const
 
virtual voidgetValuePointer () const
 
bool hasCircularDependencies (DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
 
bool hasUpdateMethod () const
 
bool isArray () const
 
bool isContainer () const
 
bool isDataModel () const
 
bool isMatrix () const
 
bool isNameVector () const
 
bool isNonUniqueName () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
bool isReference () const
 
bool isRoot () const
 
bool isSeparator () const
 
bool isStaticString () const
 
bool isValueBool () const
 
bool isValueDbl () const
 
bool isValueInt () const
 
bool isValueInt64 () const
 
bool isValueString () const
 
bool isVector () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
virtual void print (std::ostream *ostream) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Static Public Attributes

static const std::vector
< CCopasiContainer * > 
EmptyList
 

Protected Member Functions

template<class CType >
CCopasiObjectaddMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
void initObjects ()
 
- Protected Member Functions inherited from CCopasiObject
 CCopasiObject ()
 
 CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0)
 

Protected Attributes

objectMap mObjects
 

Private Member Functions

 CCopasiContainer ()
 

Additional Inherited Members

- Static Public Member Functions inherited from CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 
- Protected Types inherited from CCopasiObject
enum  Flag {
  Container = 0x1, Vector = 0x2, Matrix = 0x4, NameVector = 0x8,
  Reference = 0x10, ValueBool = 0x20, ValueInt = 0x40, ValueInt64 = 0x80,
  ValueDbl = 0x100, NonUniqueName = 0x200, StaticString = 0x400, ValueString = 0x800,
  Separator = 0x1000, ModelEntity = 0x2000, Array = 0x4000, DataModel = 0x8000,
  Root = 0x10000, Gui = 0x20000
}
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Class CCopasiContainer

This class is the is used to group CCopasiObjects logically. It inself is an object. Contained objects are still globally accessible.

Copyright Stefan Hoops 2002

Definition at line 37 of file CCopasiContainer.h.

Member Typedef Documentation

typedef std::multimap<std::string, CCopasiObject * > CCopasiContainer::objectMap

Definition at line 44 of file CCopasiContainer.h.

Constructor & Destructor Documentation

CCopasiContainer::CCopasiContainer ( )
private

Definition at line 41 of file CCopasiContainer.cpp.

References addObjectReference(), and CCopasiObject::getObjectName().

41  :
42  CCopasiObject(),
43  mObjects()
44 {addObjectReference("Name", *const_cast<std::string *>(&getObjectName()));}
const std::string & getObjectName() const
CCopasiObject * addObjectReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
CCopasiContainer::CCopasiContainer ( const std::string &  name,
const CCopasiContainer pParent = NULL,
const std::string &  type = "CN",
const unsigned C_INT32 flag = CCopasiObject::Container 
)

Definition at line 46 of file CCopasiContainer.cpp.

References addObjectReference(), and CCopasiObject::getObjectName().

49  :
50  CCopasiObject(name, pParent, type, flag | CCopasiObject::Container),
51  mObjects()
52 {addObjectReference("Name", *const_cast<std::string *>(&getObjectName()));}
const std::string & getObjectName() const
long int flag
Definition: f2c.h:52
CCopasiObject * addObjectReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
CCopasiContainer::CCopasiContainer ( const CCopasiContainer src,
const CCopasiContainer pParent = NULL 
)

Definition at line 54 of file CCopasiContainer.cpp.

References addObjectReference(), and CCopasiObject::getObjectName().

55  :
56  CCopasiObject(src, pParent),
57  mObjects()
58 {addObjectReference("Name", *const_cast<std::string *>(&getObjectName()));}
const std::string & getObjectName() const
CCopasiObject * addObjectReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
CCopasiContainer::~CCopasiContainer ( )
virtual

Definition at line 60 of file CCopasiContainer.cpp.

References mObjects, and pdelete.

61 {
62  objectMap::iterator it = mObjects.begin();
63  objectMap::iterator end = mObjects.end();
64 
65  for (; it != end; it++)
66  if (it->second != NULL &&
67  it->second->getObjectParent() == this)
68  {
69  it->second->setObjectParent(NULL);
70  pdelete(it->second);
71  }
72 }
#define pdelete(p)
Definition: copasi.h:215

Member Function Documentation

bool CCopasiContainer::add ( CCopasiObject pObject,
const bool &  adopt = true 
)
virtual

Definition at line 212 of file CCopasiContainer.cpp.

References CCopasiObject::getObjectName(), mObjects, and CCopasiObject::setObjectParent().

Referenced by CCopasiVector< CLGeneralGlyph >::add(), CCopasiVectorN< CReportDefinition >::add(), CCopasiParameterGroup::addParameter(), CCopasiObject::CCopasiObject(), CCrossSectionTask::CCrossSectionTask(), CEFMTask::CEFMTask(), CFitTask::CFitTask(), CLNATask::CLNATask(), CLyapTask::CLyapTask(), CMCATask::CMCATask(), CMoietiesTask::CMoietiesTask(), CModelEntity::compile(), COptTask::COptTask(), COscillationTask::COscillationTask(), CScanTask::CScanTask(), CSensTask::CSensTask(), CSteadyStateTask::CSteadyStateTask(), CTrajectoryTask::CTrajectoryTask(), CTSSATask::CTSSATask(), CCopasiDataModel::importSBML(), CCopasiDataModel::importSBMLFromString(), CTrajectoryTask::load(), CCopasiDataModel::loadModel(), CEvent::setDelayExpressionPtr(), CEventAssignment::setExpressionPtr(), CModelEntity::setExpressionPtr(), CModelEntity::setInitialExpressionPtr(), CFitTask::setMethodType(), CMoietiesTask::setMethodType(), COscillationTask::setMethodType(), COptTask::setMethodType(), CEFMTask::setMethodType(), CTSSATask::setMethodType(), CLyapTask::setMethodType(), CTrajectoryTask::setMethodType(), CCrossSectionTask::setMethodType(), CEvent::setPriorityExpressionPtr(), CModelEntity::setStatus(), and CEvent::setTriggerExpressionPtr().

214 {
215  /* We check whether we are already containing that object. */
216  std::pair< objectMap::iterator, objectMap::iterator > range =
217  mObjects.equal_range(pObject->getObjectName());
218  objectMap::iterator it;
219 
220  for (it = range.first; it != range.second; ++it)
221  if (it->second == pObject) break;
222 
223  if (it != range.second) return false;
224 
225  /* This object is not contained, so we can add it. */
226  mObjects.insert
227  (std::pair<const std::string, CCopasiObject * >(pObject->getObjectName(),
228  pObject));
229 
230  if (adopt) pObject->setObjectParent(this);
231 
232  return true;
233 }
virtual bool setObjectParent(const CCopasiContainer *pParent)
const std::string & getObjectName() const
template<class CType >
CCopasiObject* CCopasiContainer::addMatrixReference ( const std::string &  name,
CType &  reference,
const unsigned C_INT32 flag = 0 
)
inlineprotected

Definition at line 99 of file CCopasiContainer.h.

References createMatrixReference().

Referenced by CILDMMethod::initializeParameter(), CILDMModifiedMethod::initializeParameter(), and CModel::initObjects().

102  {return createMatrixReference(name, this, reference, flag);}
CCopasiMatrixReference< CType > * createMatrixReference(const std::string &name, const CCopasiContainer *pParent, CType &reference, const unsigned C_INT32 &flag=0)
long int flag
Definition: f2c.h:52
template<class CType >
CCopasiObject* CCopasiContainer::addObjectReference ( const std::string &  name,
CType &  reference,
const unsigned C_INT32 flag = 0 
)
inlineprotected

Definition at line 89 of file CCopasiContainer.h.

References createReference().

Referenced by CCopasiContainer(), CCopasiParameter::createValue(), CILDMMethod::initializeParameter(), CILDMModifiedMethod::initializeParameter(), CFittingPoint::initObjects(), CRandomSearch::initObjects(), COptMethodDE::initObjects(), COptMethodEP::initObjects(), COptMethodSRES::initObjects(), COptMethodGA::initObjects(), COptMethodPS::initObjects(), COptMethodGASR::initObjects(), COptMethodHookeJeeves::initObjects(), COptMethodCoranaWalk::initObjects(), COptMethodLevenbergMarquardt::initObjects(), COptMethodNelderMead::initObjects(), COptMethodSA::initObjects(), COptMethodTruncatedNewton::initObjects(), COptMethodPraxis::initObjects(), CFunctionDB::initObjects(), COptMethodSteepestDescent::initObjects(), CEFMAlgorithm::initObjects(), COptMethodSS::initObjects(), CChemEqElement::initObjects(), CBitPatternMethod::initObjects(), CBitPatternTreeMethod::initObjects(), CLyapTask::initObjects(), CCrossSectionTask::initObjects(), CEvaluationTree::initObjects(), CFitProblem::initObjects(), CMoiety::initObjects(), CEigen::initObjects(), CModelEntity::initObjects(), COptProblem::initObjects(), CCopasiTask::initObjects(), CMetab::initObjects(), CReaction::initObjects(), and CModel::initObjects().

92  {return createReference(name, this, reference, flag);}
long int flag
Definition: f2c.h:52
CCopasiObjectReference< CType > * createReference(const std::string &name, const CCopasiContainer *pParent, CType &reference, const unsigned C_INT32 &flag=0)
template<class CType >
CCopasiObject* CCopasiContainer::addVectorReference ( const std::string &  name,
CType &  reference,
const unsigned C_INT32 flag = 0 
)
inlineprotected

Definition at line 94 of file CCopasiContainer.h.

References createVectorReference().

Referenced by CLyapTask::initObjects(), CEigen::initObjects(), and COptProblem::initObjects().

97  {return createVectorReference(name, this, reference, flag);}
long int flag
Definition: f2c.h:52
CCopasiVectorReference< CType > * createVectorReference(const std::string &name, const CCopasiContainer *pParent, CType &reference, const unsigned C_INT32 &flag=0)
std::string CCopasiContainer::getChildObjectUnits ( const CCopasiObject pObject) const
virtual

Retrieve the units of the child object.

Returns
std::string units

Reimplemented in CMetab, CModel, CReaction, and CCompartment.

Definition at line 260 of file CCopasiContainer.cpp.

Referenced by CCopasiObject::getUnits().

261 {return "";}
const CObjectInterface * CCopasiContainer::getObject ( const CCopasiObjectName cn) const
virtual

Retrieve a descendant object by its CN.

Parameters
constCCopasiObjectName & cn
Returns
const CObjectInterface * pObject

Reimplemented from CCopasiObject.

Reimplemented in CCopasiVectorN< CType >, CCopasiVectorN< CReaction >, CCopasiVectorN< CEventAssignment >, CCopasiVectorN< CFunctionParameter >, CCopasiVectorN< CCopasiTask >, CCopasiVectorN< CPlotSpecification >, CCopasiVectorN< CCompartment >, CCopasiVectorN< CModelParameterSet >, CCopasiVectorN< CEvent >, CCopasiVectorN< CMetab >, CCopasiVectorN< CFunction >, CCopasiVectorN< CModelValue >, CCopasiVectorN< CReportDefinition >, CCopasiVector< T >, CCopasiVector< CLGlobalRenderInformation >, CCopasiVector< CModification >, CCopasiVector< CLMetabGlyph >, CCopasiVector< CLCompartmentGlyph >, CCopasiVector< CLReferenceGlyph >, CCopasiVector< CSlider >, CCopasiVector< CBiologicalDescription >, CCopasiVector< CLGlobalStyle >, CCopasiVector< CEventAssignment >, CCopasiVector< CReference >, CCopasiVector< CMathEvent::CAssignment >, CCopasiVector< CLayout >, CCopasiVector< CLGradientStop >, CCopasiVector< CLMetabReferenceGlyph >, CCopasiVector< CMoiety >, CCopasiVector< CType >, CCopasiVector< CChemEqElement >, CCopasiVector< CLColorDefinition >, CCopasiVector< CLReactionGlyph >, CCopasiVector< CEvent >, CCopasiVector< CMathEvent >, CCopasiVector< CLGradientBase >, CCopasiVector< CLLocalRenderInformation >, CCopasiVector< CMetab >, CCopasiVector< CPlotItem >, CCopasiVector< CCopasiDataModel >, CCopasiVector< CLLineEnding >, CCopasiVector< CFittingPoint >, CCopasiVector< CLTextGlyph >, CCopasiVector< CCopasiObject >, CCopasiVector< CMathTrigger::CRootFinder >, CCopasiVector< CLLocalStyle >, CCopasiVector< CCreator >, CCopasiVector< CLGraphicalObject >, CCopasiVector< CMetabOld >, CCopasiVector< CLGeneralGlyph >, CReaction, CArrayAnnotation, CMathContainer, and CCopasiParameterGroup.

Definition at line 74 of file CCopasiContainer.cpp.

References C_INT32, CCopasiObjectName::getElementName(), CObjectInterface::getObject(), CCopasiObject::getObject(), CCopasiObjectName::getObjectName(), CCopasiObject::getObjectName(), CCopasiObjectName::getObjectType(), CCopasiObject::getObjectType(), CCopasiObjectName::getRemainder(), CCopasiObject::isRoot(), and mObjects.

Referenced by addInitialAssignmentsToModel(), DataModelGUI::buildChangedObjects(), CModel::buildInitialSequence(), CMathContainer::CMathContainer(), CEvaluationNodeCall::compile(), CModelAdd::copyDelayExpression(), CModelAdd::copyEventAssignmentExpression(), CModelAdd::copyExpression(), CModelAdd::copyInitialExpression(), CModelAdd::copyTriggerExpression(), SBMLImporter::createCModelFromSBMLDocument(), CSEDMLExporter::createDataGenerators(), COutputAssistant::createDefaultOutput(), CExpression::createInitialExpression(), CSEDMLExporter::createScanTask(), findObjectByDisplayName(), CCopasiDataModel::getDataObject(), CEvaluationTree::getDeletedObjects(), CObjectLists::getListOfConstObjects(), CMathContainer::getMathObject(), CCopasiParameterGroup::getObject(), CArrayAnnotation::getObject(), CReaction::getObject(), CFittingPoint::getObjectDisplayName(), SEDMLUtils::getObjectForSbmlId(), CCopasiXMLParser::getObjectFromName(), CExpression::initObjects(), CQMoietiesTaskResult::load(), CQMathMatrixWidget::loadMatrices(), CQCrossSectionTaskWidget::loadTask(), main(), CModelMerging::mergeInExpression(), CCopasiDataModel::ObjectFromCN(), CQSimpleSelectionTree::populateTree(), CMoietiesProblem::printResult(), CSBMLExporter::replaceSpeciesReferences(), SBMLImporter::replaceTimeAndAvogadroNodeNames(), SEDMLUtils::resolveDatagenerator(), CCopasiObject::setObjectName(), and CModelExpansion::updateExpression().

75 {
76  if (cn == "")
77  {
78  if (isRoot())
79  return NULL;
80  else
81  return this;
82  }
83 
84  if (cn == "Property=DisplayName")
85  {
86  return CCopasiObject::getObject(cn);
87  }
88 
89  std::string Name = cn.getObjectName();
90  std::string Type = cn.getObjectType();
91 
92  if (getObjectName() == Name && getObjectType() == Type)
93  return getObject(cn.getRemainder());
94 
95  //check if the first part of the cn matches one of the children (by name and type)
96  std::pair< objectMap::const_iterator, objectMap::const_iterator > range =
97  mObjects.equal_range(Name);
98 
99  objectMap::const_iterator it = range.first;
100 
101  while (it != range.second && it->second->getObjectType() != Type) ++it;
102 
103  if (it == range.second) //not found in the list of children
104  {
105  if (Type == "String")
106  return new CCopasiStaticString(Name, this);
107  else if (Type == "Separator")
108  return new CCopasiReportSeparator(Name, this);
109  else
110  return NULL;
111  }
112 
113  const CObjectInterface * pObject = NULL;
114 
115  if (it->second->isNameVector() || it->second->isVector())
116  {
117  if (cn.getElementName(0, false) == "")
118  return it->second;
119 
120  pObject = it->second->getObject("[" + cn.getElementName(0, false) + "]");
121 
122  if (it->second->getObjectType() == "Reference" ||
123  !pObject ||
124  cn.getRemainder() == "")
125  return pObject;
126  else
127  return pObject->getObject(cn.getRemainder());
128  }
129 
130  //handle objects where the array flag is set. Currently this applies to the
131  //CArrayAnnotation object. Since this is also a container, we have to do this
132  //before handling general containers.
133  if (it->second->isArray())
134  {
135  //we need to call the getObject() method of the child array with the
136  //remainder of the cn, with the indices in square brackets, or with an empty string
137 
138  //if there are no indices there could still be a remainder (since the array can also be
139  //a container)
140  if (cn.getElementName(0, false) == "") //no indices
141  return it->second->getObject(cn.getRemainder());
142 
143  //get the indices from the CN
144  std::string indices;
145  std::string tmp;
146  C_INT32 ii = 0;
147 
148  while ((tmp = cn.getElementName(ii, false)) != "")
149  {
150  indices += "[" + tmp + "]";
151  ++ii;
152  }
153 
154  //try to get the array element from the indices
155  pObject = it->second->getObject(indices);
156 
157  //if the element could not be resolved, just return NULL. If there is no
158  //remainder, just return the array element.
159  //In all other cases we call getObject() on the array element with the remainder
160  //of the CN. The special treatment of the empty remainder is probably necessary
161  //since not all implementations of getObject(cn) handle the case of empty CN.
162  if (!pObject)
163  return NULL;
164 
165  if (cn.getRemainder() == "")
166  return pObject;
167  else
168  return pObject->getObject(cn.getRemainder());
169  }
170 
171  //handle generic containers.
172  if (it->second->isContainer())
173  return it->second->getObject(cn.getRemainder());
174 
175  if (it->second->isMatrix())
176  {
177  if (cn.getElementName(0, false) == "")
178  return it->second;
179 
180  pObject = it->second->getObject("[" + cn.getElementName(0, false) + "]" + //TODO really?
181  "[" + cn.getElementName(1, false) + "]");
182 
183  if (it->second->getObjectType() == "Reference" || !pObject)
184  return pObject;
185  else
186  return pObject->getObject(cn.getRemainder());
187  }
188 
189  return it->second->getObject(cn.getRemainder());
190 }
bool isRoot() const
const std::string & getObjectName() const
CCopasiObjectName getRemainder() const
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
const std::string & getObjectType() const
std::string getObjectType() const
#define C_INT32
Definition: copasi.h:90
std::string getElementName(const size_t &pos, const bool &unescape=true) const
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const =0
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
std::string getObjectName() const
const CCopasiContainer::objectMap & CCopasiContainer::getObjects ( ) const
virtual
std::string CCopasiContainer::getUnits ( ) const
virtual

Retrieve the units of the object.

Returns
std::string units

Reimplemented from CCopasiObject.

Definition at line 256 of file CCopasiContainer.cpp.

Referenced by SBMLImporter::createCCompartmentFromCompartment().

257 {return "";}
const CCopasiObject * CCopasiContainer::getValueObject ( ) const
virtual

Reimplemented from CCopasiObject.

Reimplemented in CMetab, and CModelEntity.

Definition at line 195 of file CCopasiContainer.cpp.

References CCopasiObject::getValuePointer(), and mObjects.

Referenced by CExperiment::compile().

196 {
197  void * ptr = getValuePointer();
198 
199  if (ptr == NULL) return NULL;
200 
201  objectMap::const_iterator it = mObjects.begin();
202  objectMap::const_iterator end = mObjects.end();
203 
204  for (; it != end; ++it)
205  if (ptr == it->second->getValuePointer()) return it->second;
206 
207  return NULL;
208 }
virtual void * getValuePointer() const
void CCopasiContainer::initObjects ( )
protected

Definition at line 210 of file CCopasiContainer.cpp.

Referenced by COptMethodStatistics::COptMethodStatistics().

210 {}
bool CCopasiContainer::remove ( CCopasiObject pObject)
virtual

Reimplemented in CCopasiVector< T >, CCopasiVector< CLGlobalRenderInformation >, CCopasiVector< CModification >, CCopasiVector< CLMetabGlyph >, CCopasiVector< CLCompartmentGlyph >, CCopasiVector< CLReferenceGlyph >, CCopasiVector< CSlider >, CCopasiVector< CBiologicalDescription >, CCopasiVector< CLGlobalStyle >, CCopasiVector< CEventAssignment >, CCopasiVector< CReference >, CCopasiVector< CMathEvent::CAssignment >, CCopasiVector< CLayout >, CCopasiVector< CLGradientStop >, CCopasiVector< CLMetabReferenceGlyph >, CCopasiVector< CMoiety >, CCopasiVector< CType >, CCopasiVector< CChemEqElement >, CCopasiVector< CLColorDefinition >, CCopasiVector< CLReactionGlyph >, CCopasiVector< CEvent >, CCopasiVector< CMathEvent >, CCopasiVector< CLGradientBase >, CCopasiVector< CLLocalRenderInformation >, CCopasiVector< CMetab >, CCopasiVector< CPlotItem >, CCopasiVector< CCopasiDataModel >, CCopasiVector< CLLineEnding >, CCopasiVector< CFittingPoint >, CCopasiVector< CLTextGlyph >, CCopasiVector< CCopasiObject >, CCopasiVector< CMathTrigger::CRootFinder >, CCopasiVector< CLLocalStyle >, CCopasiVector< CCreator >, CCopasiVector< CLGraphicalObject >, CCopasiVector< CMetabOld >, and CCopasiVector< CLGeneralGlyph >.

Definition at line 235 of file CCopasiContainer.cpp.

References mObjects.

Referenced by CCopasiVector< CLGeneralGlyph >::cleanup(), CCopasiVector< CLGeneralGlyph >::clear(), CCopasiXMLParser::TaskElement::end(), CCopasiVector< CLGeneralGlyph >::remove(), CCopasiVector< CLGeneralGlyph >::resize(), CCopasiObject::setObjectParent(), and CCopasiObject::~CCopasiObject().

236 {
237  objectMap::iterator it = mObjects.begin();
238  objectMap::iterator end = mObjects.end();
239 
240  /*
241  std::pair< objectMap::iterator, objectMap::iterator > range =
242  mObjects.equal_range(pObject->getObjectName());
243  objectMap::iterator it;
244  */
245  for (; it != end; ++it)
246  if (it->second == pObject) break;
247 
248  if (it == end) return false;
249 
250  mObjects.erase(it);
251 
252  return true;
253 }

Member Data Documentation

const std::vector< CCopasiContainer * > CCopasiContainer::EmptyList
static

Class CCopasiContainer

This class is the is used to group CCopasiObjects logically. It inself is an object. Contained objects are still globally accessible.

Copyright Stefan Hoops 2002

Definition at line 42 of file CCopasiContainer.h.

Referenced by COptItem::setLowerBound(), and COptItem::setUpperBound().

objectMap CCopasiContainer::mObjects
protected

The documentation for this class was generated from the following files: