COPASI API  4.16.103
CCopasiContainer.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2002 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 /*!
16  \file CCopasiContainer.h
17  \brief Header file of class CCopasiContainer
18  */
19 
20 /**
21  * Class CCopasiContainer
22  *
23  * This class is the is used to group CCopasiObjects logically. It inself is
24  * an object. Contained objects are still globally accessible.
25  *
26  * Copyright Stefan Hoops 2002
27  */
28 
29 #ifndef COPASI_CCopasiContainer
30 #define COPASI_CCopasiContainer
31 
32 #include <map>
33 #include <vector>
34 
36 
38 {
39  //Attributes
40 public:
41 
42  static const std::vector< CCopasiContainer * > EmptyList;
43 
44  typedef std::multimap<std::string, CCopasiObject * > objectMap;
45 
46 protected:
48 
49 private:
50  // Operations
52 
53 public:
54  CCopasiContainer(const std::string & name,
55  const CCopasiContainer * pParent = NULL,
56  const std::string & type = "CN",
57  const unsigned C_INT32 & flag = CCopasiObject::Container);
58 
60  const CCopasiContainer * pParent = NULL);
61 
62  virtual ~CCopasiContainer();
63 
64  virtual const CObjectInterface * getObject(const CCopasiObjectName & cn) const;
65 
66  virtual const CCopasiObject * getValueObject() const;
67 
68  virtual const objectMap & getObjects() const;
69 
70  virtual bool add(CCopasiObject * pObject, const bool & adopt = true);
71 
72  virtual bool remove(CCopasiObject * pObject);
73 
74  /**
75  * Retrieve the units of the object.
76  * @return std::string units
77  */
78  virtual std::string getUnits() const;
79 
80  /**
81  * Retrieve the units of the child object.
82  * @return std::string units
83  */
84  virtual std::string getChildObjectUnits(const CCopasiObject * pObject) const;
85 
86 protected:
87  void initObjects();
88 
89  template <class CType> CCopasiObject * addObjectReference(const std::string & name,
90  CType & reference,
91  const unsigned C_INT32 & flag = 0)
92  {return createReference(name, this, reference, flag);}
93 
94  template <class CType> CCopasiObject * addVectorReference(const std::string & name,
95  CType & reference,
96  const unsigned C_INT32 & flag = 0)
97  {return createVectorReference(name, this, reference, flag);}
98 
99  template <class CType> CCopasiObject * addMatrixReference(const std::string & name,
100  CType & reference,
101  const unsigned C_INT32 & flag = 0)
102  {return createMatrixReference(name, this, reference, flag);}
103 };
104 
105 #endif // COPASI_CCopasiContainer
CCopasiMatrixReference< CType > * createMatrixReference(const std::string &name, const CCopasiContainer *pParent, CType &reference, const unsigned C_INT32 &flag=0)
virtual const objectMap & getObjects() const
#define C_INT32
Definition: copasi.h:90
std::multimap< std::string, CCopasiObject * > objectMap
virtual std::string getChildObjectUnits(const CCopasiObject *pObject) const
static const std::vector< CCopasiContainer * > EmptyList
virtual const CCopasiObject * getValueObject() const
virtual ~CCopasiContainer()
long int flag
Definition: f2c.h:52
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
virtual std::string getUnits() const
CCopasiObject * addVectorReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
CCopasiVectorReference< CType > * createVectorReference(const std::string &name, const CCopasiContainer *pParent, CType &reference, const unsigned C_INT32 &flag=0)
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
CCopasiObject * addMatrixReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
CCopasiObject * addObjectReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
CCopasiObjectReference< CType > * createReference(const std::string &name, const CCopasiContainer *pParent, CType &reference, const unsigned C_INT32 &flag=0)