COPASI API  4.16.103
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
CExperimentObjectMap Class Reference

#include <CExperimentObjectMap.h>

Inheritance diagram for CExperimentObjectMap:
Inheritance graph
[legend]
Collaboration diagram for CExperimentObjectMap:
Collaboration graph
[legend]

Classes

class  CDataColumn
 

Public Member Functions

 CExperimentObjectMap (const std::string &name="Object Map", const CCopasiContainer *pParent=NULL)
 
 CExperimentObjectMap (const CExperimentObjectMap &src, const CCopasiContainer *pParent=NULL)
 
 CExperimentObjectMap (const CCopasiParameterGroup &group, const CCopasiContainer *pParent=NULL)
 
bool compile (const std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
 
virtual bool elevateChildren ()
 
void fixBuild55 ()
 
C_FLOAT64 getDefaultScale (const size_t &index) const
 
const size_t & getLastColumn () const
 
size_t getLastNotIgnoredColumn () const
 
const CVector< CCopasiObject * > & getMappedObjects () const
 
virtual const std::string & getName (const size_t &index) const
 
std::string getObjectCN (const size_t &index) const
 
CExperiment::Type getRole (const size_t &index) const
 
C_FLOAT64 getScale (const size_t &index) const
 
bool setNumCols (const size_t &numCols)
 
bool setObjectCN (const size_t &index, const std::string &objectCN)
 
bool setRole (const size_t &index, const CExperiment::Type &role)
 
bool setScale (const size_t &index, const C_FLOAT64 &scale)
 
virtual ~CExperimentObjectMap ()
 
- Public Member Functions inherited from CCopasiParameterGroup
bool addGroup (const std::string &name)
 
bool addParameter (const CCopasiParameter &parameter)
 
bool addParameter (const std::string &name, const CCopasiParameter::Type type)
 
template<class CType >
bool addParameter (const std::string &name, const CCopasiParameter::Type type, const CType &value)
 
void addParameter (CCopasiParameter *pParameter)
 
CCopasiParameterGroupassertGroup (const std::string &name)
 
template<class CType >
CCopasiParameterassertParameter (const std::string &name, const CCopasiParameter::Type type, const CType &defaultValue)
 
index_iterator beginIndex () const
 
name_iterator beginName () const
 
 CCopasiParameterGroup (const CCopasiParameterGroup &src, const CCopasiContainer *pParent=NULL)
 
 CCopasiParameterGroup (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &objectType="ParameterGroup")
 
void clear ()
 
index_iterator endIndex () const
 
name_iterator endName () const
 
CCopasiParameterGroupgetGroup (const std::string &name)
 
const CCopasiParameterGroupgetGroup (const std::string &name) const
 
CCopasiParameterGroupgetGroup (const size_t &index)
 
const CCopasiParameterGroupgetGroup (const size_t &index) const
 
size_t getIndex (const std::string &name) const
 
std::string getKey (const std::string &name) const
 
std::string getKey (const size_t &index) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
CCopasiParametergetParameter (const std::string &name)
 
const CCopasiParametergetParameter (const std::string &name) const
 
CCopasiParametergetParameter (const size_t &index)
 
const CCopasiParametergetParameter (const size_t &index) const
 
CCopasiParameter::Type getType (const std::string &name) const
 
CCopasiParameter::Type getType (const size_t &index) const
 
std::string getUniqueParameterName (const CCopasiParameter *pParameter) const
 
const CCopasiParameter::ValuegetValue (const std::string &name) const
 
const CCopasiParameter::ValuegetValue (const size_t &index) const
 
CCopasiParameter::ValuegetValue (const std::string &name)
 
CCopasiParameter::ValuegetValue (const size_t &index)
 
CCopasiParameterGroupoperator= (const CCopasiParameterGroup &rhs)
 
virtual void print (std::ostream *ostream) const
 
bool removeParameter (const std::string &name)
 
bool removeParameter (const size_t &index)
 
template<class CType >
bool setValue (const std::string &name, const CType &value)
 
template<class CType >
bool setValue (const size_t &index, const CType &value)
 
size_t size () const
 
bool swap (const size_t &iFrom, const size_t &iTo)
 
bool swap (index_iterator &from, index_iterator &to)
 
virtual ~CCopasiParameterGroup ()
 
- Public Member Functions inherited from CCopasiParameter
 CCopasiParameter (const CCopasiParameter &src, const CCopasiContainer *pParent=NULL)
 
 CCopasiParameter (const std::string &name, const Type &type, const void *pValue=NULL, const CCopasiContainer *pParent=NULL, const std::string &objectType="Parameter")
 
virtual CCopasiObjectName getCN () const
 
virtual const std::string & getKey () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const CCopasiParameter::TypegetType () const
 
const ValuegetValue () const
 
ValuegetValue ()
 
virtual voidgetValuePointer () const
 
CCopasiObjectgetValueReference () const
 
bool isValidValue (const C_FLOAT64 &value) const
 
bool isValidValue (const C_INT32 &value) const
 
bool isValidValue (const unsigned C_INT32 &value) const
 
bool isValidValue (const bool &value) const
 
bool isValidValue (const std::string &value) const
 
bool isValidValue (const CCopasiObjectName &value) const
 
bool isValidValue (const std::vector< CCopasiParameter * > &value) const
 
CCopasiParameteroperator= (const CCopasiParameter &rhs)
 
template<class CType >
bool setValue (const CType &value)
 
bool setValue (const std::vector< CCopasiParameter * > &value)
 
virtual ~CCopasiParameter ()
 
- Public Member Functions inherited from CCopasiContainer
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 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 const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () 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
 
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 ()
 

Private Member Functions

void initializeParameter ()
 

Private Attributes

size_t mLastColumn
 
CVector< CCopasiObject * > mObjects
 

Additional Inherited Members

- Public Types inherited from CCopasiParameterGroup
typedef parameterGroup::iterator index_iterator
 
typedef
CCopasiContainer::objectMap::iterator 
name_iterator
 
typedef std::vector
< CCopasiParameter * > 
parameterGroup
 
- Public Types inherited from CCopasiParameter
enum  Type {
  DOUBLE = 0, UDOUBLE, INT, UINT,
  BOOL, GROUP, STRING, CN,
  KEY, FILE, EXPRESSION, INVALID
}
 
- Public Types inherited from CCopasiContainer
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
 
- 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)
 
- Static Public Attributes inherited from CCopasiParameter
static const std::string TypeName []
 
static const char * XMLType []
 
- Static Public Attributes inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 
- 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
}
 
- Protected Member Functions inherited from CCopasiParameterGroup
 CCopasiParameterGroup ()
 
- Protected Member Functions inherited from CCopasiContainer
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 inherited from CCopasiParameter
std::string mKey
 
CCopasiObjectmpValueReference
 
size_t mSize
 
Value mValue
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 23 of file CExperimentObjectMap.h.

Constructor & Destructor Documentation

CExperimentObjectMap::CExperimentObjectMap ( const std::string &  name = "Object Map",
const CCopasiContainer pParent = NULL 
)

Default constructor

Parameters
conststd::string & name (default: Object Map)
constCCopasiContainer * pParent (default: NULL)

Definition at line 27 of file CExperimentObjectMap.cpp.

References initializeParameter().

28  :
29  CCopasiParameterGroup(name, pParent),
30  mObjects(0),
31  mLastColumn(0)
CVector< CCopasiObject * > mObjects
CExperimentObjectMap::CExperimentObjectMap ( const CExperimentObjectMap src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
constCExperimentObjectMap & src
constCCopasiContainer * pParent (default: NULL)

Definition at line 34 of file CExperimentObjectMap.cpp.

References initializeParameter().

CExperimentObjectMap::CExperimentObjectMap ( const CCopasiParameterGroup group,
const CCopasiContainer pParent = NULL 
)

Specific constructor used for reading copasi files

Parameters
constCCopasiParameterGroup & group
constCCopasiContainer * pParent (default: NULL)

Definition at line 41 of file CExperimentObjectMap.cpp.

References initializeParameter().

42  :
43  CCopasiParameterGroup(group, pParent),
44  mObjects(0),
45  mLastColumn(0)
CVector< CCopasiObject * > mObjects
CExperimentObjectMap::~CExperimentObjectMap ( )
virtual

Destructor

Definition at line 48 of file CExperimentObjectMap.cpp.

48 {}

Member Function Documentation

bool CExperimentObjectMap::compile ( const std::vector< CCopasiContainer * >  listOfContainer = CCopasiContainer::EmptyList)

Compile the map. This function must be called before any operations can be performed.

Parameters
conststd::vector< CCopasiContainer * > listOfContainer
Returns
bool success

Definition at line 222 of file CExperimentObjectMap.cpp.

References C_INVALID_INDEX, CCopasiParameter::CN, getName(), getObjectCN(), CCopasiObject::getObjectDataModel(), CCopasiObject::isValueDbl(), mLastColumn, mObjects, CVector< CType >::resize(), and CCopasiParameterGroup::size().

Referenced by CExperiment::compile().

223 {
224  size_t i, imax = size();
225  size_t Column;
226 
227  // We need to find out the size of the object map
228  if (imax == 0)
230  else
231  {
232  mLastColumn = strtoul(getName(0).c_str(), NULL, 0);
233 
234  for (i = 1; i < imax; i++)
235  {
236  Column = strtoul(getName(i).c_str(), NULL, 0);
237 
238  if (mLastColumn < Column)
239  mLastColumn = Column;
240  }
241  }
242 
244  mObjects = NULL;
245 
246  CCopasiObject * pObject = NULL;
247  std::string CN;
248 
249  for (i = 0; i < imax; i++)
250  {
251  if ((CN = getObjectCN(i)) == "") continue;
252 
253  if ((pObject =
254  getObjectDataModel()->ObjectFromName(listOfContainer, CN)) != NULL &&
255  pObject->isValueDbl())
256  {
257  Column = strtoul(getName(i).c_str(), NULL, 0);
258  mObjects[Column] = pObject;
259  }
260  else
261  return false;
262  }
263 
264  return true;
265 }
CCopasiDataModel * getObjectDataModel()
virtual const std::string & getName(const size_t &index) const
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
#define C_INVALID_INDEX
Definition: copasi.h:222
CVector< CCopasiObject * > mObjects
bool isValueDbl() const
std::string getObjectCN(const size_t &index) const
bool CExperimentObjectMap::elevateChildren ( )
virtual

This methods must be called to elevate subgroups to derived objects. The default implementation does nothing.

Returns
bool success

Reimplemented from CCopasiParameterGroup.

Definition at line 55 of file CExperimentObjectMap.cpp.

References CCopasiParameterGroup::assertGroup(), CCopasiParameterGroup::assertParameter(), CCopasiParameterGroup::clear(), CCopasiParameter::CN, CCopasiObject::getObjectName(), CCopasiParameter::mValue, and CCopasiParameter::Value::pGROUP.

Referenced by CExperimentObjectMap::CDataColumn::initializeParameter(), and initializeParameter().

56 {
57  bool success = true;
58 
59  std::vector<CCopasiParameter *>::iterator itColumn = mValue.pGROUP->begin();
60  std::vector<CCopasiParameter *>::iterator endColumn = mValue.pGROUP->end();
61 
62  if (itColumn != endColumn &&
63  dynamic_cast< CCopasiParameterGroup * >(*itColumn) == NULL) // We have an old data format.
64  {
66 
67  for (; itColumn != endColumn; ++itColumn)
68  {
69  CCopasiParameterGroup * pGroup = New.assertGroup((*itColumn)->getObjectName());
70  pGroup->assertParameter("Object CN", CCopasiParameter::CN, *(*itColumn)->getValue().pCN);
71  }
72 
73  clear();
74  *this = New;
75  }
76 
77  for (itColumn = mValue.pGROUP->begin(); itColumn != endColumn; ++itColumn)
78  if (((*itColumn) = elevate<CDataColumn, CCopasiParameterGroup>(*itColumn)) == NULL)
79  success = false;
80 
81  return success;
82 }
const std::string & getObjectName() const
std::vector< CCopasiParameter * > * pGROUP
CCopasiParameterGroup * assertGroup(const std::string &name)
CCopasiParameter * assertParameter(const std::string &name, const CCopasiParameter::Type type, const CType &defaultValue)
void CExperimentObjectMap::fixBuild55 ( )

Fix files written with Version 4.10.55, which wrote the square root of user defined weights for the parameter fitting task

Definition at line 273 of file CExperimentObjectMap.cpp.

References CCopasiParameterGroup::beginIndex(), CCopasiParameterGroup::endIndex(), and CExperimentObjectMap::CDataColumn::fixBuild55().

Referenced by CExperiment::fixBuild55().

274 {
277 
278  for (; it != end; ++it)
279  {
280  CDataColumn * pColumn = dynamic_cast< CDataColumn * >(*it);
281 
282  if (pColumn != NULL)
283  {
284  pColumn->fixBuild55();
285  }
286  }
287 }
index_iterator endIndex() const
index_iterator beginIndex() const
parameterGroup::iterator index_iterator
C_FLOAT64 CExperimentObjectMap::getDefaultScale ( const size_t &  index) const

Retrieve the default scaling factor according to the selected weight method of the indexed column

Parameters
constsize_t & index
Returns
C_FLOAT64 defaultScale

Definition at line 211 of file CExperimentObjectMap.cpp.

References CExperimentObjectMap::CDataColumn::getDefaultScale(), CCopasiParameterGroup::getGroup(), and StringPrint().

Referenced by CExperimentObjectMap::CDataColumn::getScale(), CQExperimentData::loadTable(), CExperimentObjectMap::CDataColumn::setScale(), and CQExperimentData::updateScales().

212 {
213  const CDataColumn * pColumn =
214  dynamic_cast< const CDataColumn * >(getGroup(StringPrint("%d", index)));
215 
216  if (pColumn)
217  return pColumn->getDefaultScale();
218  else
219  return std::numeric_limits<C_FLOAT64>::quiet_NaN();
220 }
std::string StringPrint(const char *format,...)
Definition: utility.cpp:87
CCopasiParameterGroup * getGroup(const std::string &name)
const size_t & CExperimentObjectMap::getLastColumn ( ) const

Retrieve the last mapped column number

Returns
const size_t & lastColumn

Definition at line 270 of file CExperimentObjectMap.cpp.

References mLastColumn.

Referenced by CExperiment::compile().

271 {return mLastColumn;}
size_t CExperimentObjectMap::getLastNotIgnoredColumn ( ) const

Retrieve the last non ignored column

Returns
size_t lastNotIgnoredColumn

Definition at line 110 of file CExperimentObjectMap.cpp.

References C_INT32, CExperiment::ignore, CCopasiParameter::mValue, and CCopasiParameter::Value::pGROUP.

Referenced by CExperiment::compile(), and CExperiment::printResult().

111 {
112  std::vector<CCopasiParameter *>::iterator itColumn = mValue.pGROUP->begin();
113  std::vector<CCopasiParameter *>::iterator endColumn = mValue.pGROUP->end();
114 
115  C_INT32 LastNotIgnored = -1;
116 
117  for (; itColumn != endColumn; ++itColumn)
118  if (static_cast< CDataColumn * >(*itColumn)->getRole() != CExperiment::ignore)
119  {
120  C_INT32 index = strtol(static_cast< CDataColumn * >(*itColumn)->getObjectName().c_str(), NULL, 10);
121 
122  if (index > LastNotIgnored) LastNotIgnored = index;
123  }
124 
125  return LastNotIgnored;
126 }
std::vector< CCopasiParameter * > * pGROUP
#define C_INT32
Definition: copasi.h:90
const CVector< CCopasiObject * > & CExperimentObjectMap::getMappedObjects ( ) const

Retrieve the vector of mapped objects

Returns
const CVector< CCopasiObject * > & mappedObjects

Definition at line 267 of file CExperimentObjectMap.cpp.

References mObjects.

Referenced by CExperiment::compile(), and CExperiment::printResult().

268 {return mObjects;}
CVector< CCopasiObject * > mObjects
const std::string & CExperimentObjectMap::getName ( const size_t &  index) const
virtual

Retrieve the name of a parameter or subgroup

Parameters
constsize_t & index
Returns
std::string name

Reimplemented from CCopasiParameterGroup.

Definition at line 129 of file CExperimentObjectMap.cpp.

References CCopasiParameterGroup::getGroup(), CCopasiObject::getObjectName(), and StringPrint().

Referenced by compile().

130 {
131  static const std::string NoName("");
132 
133  const CDataColumn * pColumn =
134  dynamic_cast< const CDataColumn * >(getGroup(StringPrint("%d", index)));
135 
136  if (pColumn)
137  return pColumn->getObjectName();
138  else
139  return NoName;
140 }
std::string StringPrint(const char *format,...)
Definition: utility.cpp:87
CCopasiParameterGroup * getGroup(const std::string &name)
std::string CExperimentObjectMap::getObjectCN ( const size_t &  index) const

Retrieve the object CN of the object mapped to the indexed column

Parameters
constsize_t & index
Returns
std::stringobjctCN

Definition at line 177 of file CExperimentObjectMap.cpp.

References CCopasiParameterGroup::getGroup(), CExperimentObjectMap::CDataColumn::getObjectCN(), and StringPrint().

Referenced by compile(), CExperiment::elevateChildren(), CQExperimentData::loadTable(), CQExperimentData::saveTable(), and CExperiment::updateFittedPoints().

178 {
179  const CDataColumn * pColumn =
180  dynamic_cast< const CDataColumn * >(getGroup(StringPrint("%d", index)));
181 
182  if (pColumn)
183  return pColumn->getObjectCN();
184  else
185  return "";
186 }
std::string StringPrint(const char *format,...)
Definition: utility.cpp:87
CCopasiParameterGroup * getGroup(const std::string &name)
CExperiment::Type CExperimentObjectMap::getRole ( const size_t &  index) const

Retrieve the role of the indexed column

Parameters
constsize_t & index
Returns
CExperiment::Type role

Definition at line 154 of file CExperimentObjectMap.cpp.

References CCopasiParameterGroup::getGroup(), CExperimentObjectMap::CDataColumn::getRole(), CExperiment::ignore, and StringPrint().

Referenced by CExperiment::compile(), CQExperimentData::loadTable(), CExperiment::printResult(), CExperiment::read(), CQExperimentData::saveTable(), CExperiment::updateFittedPoints(), and CQExperimentData::updateScales().

155 {
156  const CDataColumn * pColumn =
157  dynamic_cast< const CDataColumn * >(getGroup(StringPrint("%d", index)));
158 
159  if (pColumn)
160  return pColumn->getRole();
161  else
162  return CExperiment::ignore;
163 }
std::string StringPrint(const char *format,...)
Definition: utility.cpp:87
CCopasiParameterGroup * getGroup(const std::string &name)
C_FLOAT64 CExperimentObjectMap::getScale ( const size_t &  index) const

Retrieve the scaling factor of the indexed column

Parameters
constsize_t & index
Returns
C_FLOAT64 scale

Definition at line 200 of file CExperimentObjectMap.cpp.

References CCopasiParameterGroup::getGroup(), CExperimentObjectMap::CDataColumn::getScale(), and StringPrint().

Referenced by CExperiment::compile(), CQExperimentData::loadTable(), and CQExperimentData::saveTable().

201 {
202  const CDataColumn * pColumn =
203  dynamic_cast< const CDataColumn * >(getGroup(StringPrint("%d", index)));
204 
205  if (pColumn)
206  return pColumn->getScale();
207  else
208  return std::numeric_limits<C_FLOAT64>::quiet_NaN();
209 }
std::string StringPrint(const char *format,...)
Definition: utility.cpp:87
CCopasiParameterGroup * getGroup(const std::string &name)
void CExperimentObjectMap::initializeParameter ( )
private

Allocates all group parameters and assures that they are properly initialized.

Definition at line 50 of file CExperimentObjectMap.cpp.

References elevateChildren().

Referenced by CExperimentObjectMap().

51 {
53 }
bool CExperimentObjectMap::setNumCols ( const size_t &  numCols)

Set the number of data columns

Parameters
constsize_t & numCols
Returns
bool success

Definition at line 84 of file CExperimentObjectMap.cpp.

References CCopasiParameterGroup::assertGroup(), CCopasiParameter::mValue, CCopasiParameter::Value::pGROUP, and StringPrint().

Referenced by CExperiment::elevateChildren(), and CQExperimentData::saveTable().

85 {
86  if (numCols == mValue.pGROUP->size())
87  return true;
88 
89  // We only clear the vector of parameter. We do not destroy the parameter they are still
90  // accessible through CCopasiContainer::mObjects and thus will be automatically destroyed.
91  mValue.pGROUP->clear();
92 
93  bool success = true;
94 
95  for (size_t col = 0; col < numCols; col++)
96  {
97  CCopasiParameterGroup * pGrp = assertGroup(StringPrint("%d", col));
98 
99  // assertGroup() adds only newly created groups to mValue.pGROUP. We need to add the existing
100  // ones.
101  if (mValue.pGROUP->size() < col + 1)
102  mValue.pGROUP->push_back(pGrp);
103 
104  success &= (elevate<CDataColumn, CCopasiParameterGroup>(pGrp) != NULL);
105  }
106 
107  return success;
108 }
std::vector< CCopasiParameter * > * pGROUP
CCopasiParameterGroup * assertGroup(const std::string &name)
std::string StringPrint(const char *format,...)
Definition: utility.cpp:87
bool CExperimentObjectMap::setObjectCN ( const size_t &  index,
const std::string &  objectCN 
)

Set the object CN of the object mapped to the indexed column

Parameters
constsize_t & index
conststd::string & objectCN
Returns
bool success

Definition at line 165 of file CExperimentObjectMap.cpp.

References CCopasiParameterGroup::getGroup(), CExperimentObjectMap::CDataColumn::setObjectCN(), and StringPrint().

Referenced by CExperiment::elevateChildren(), CExperimentObjectMap::CDataColumn::operator=(), and CQExperimentData::saveTable().

167 {
168  CDataColumn * pColumn =
169  dynamic_cast< CDataColumn * >(getGroup(StringPrint("%d", index)));
170 
171  if (pColumn)
172  return pColumn->setObjectCN((CCopasiObjectName) CN);
173  else
174  return false;
175 }
std::string StringPrint(const char *format,...)
Definition: utility.cpp:87
CCopasiParameterGroup * getGroup(const std::string &name)
bool CExperimentObjectMap::setRole ( const size_t &  index,
const CExperiment::Type role 
)

Set the role of the indexed column

Parameters
constsize_t & index
constCExperiment::Type & role
Returns
bool success

Definition at line 142 of file CExperimentObjectMap.cpp.

References CCopasiParameterGroup::getGroup(), CExperimentObjectMap::CDataColumn::setRole(), and StringPrint().

Referenced by CExperiment::elevateChildren(), CQExperimentData::loadTable(), CQExperimentData::saveTable(), and CQExperimentData::slotExprimentType().

144 {
145  CDataColumn * pColumn =
146  dynamic_cast< CDataColumn * >(getGroup(StringPrint("%d", index)));
147 
148  if (pColumn)
149  return pColumn->setRole(role);
150  else
151  return false;
152 }
std::string StringPrint(const char *format,...)
Definition: utility.cpp:87
CCopasiParameterGroup * getGroup(const std::string &name)
bool CExperimentObjectMap::setScale ( const size_t &  index,
const C_FLOAT64 scale 
)

Set the scaling factor for the indexed column

Parameters
constsize_t & index
constC_FLOAT64 & scale
Returns
bool success

Definition at line 188 of file CExperimentObjectMap.cpp.

References CCopasiParameterGroup::getGroup(), CExperimentObjectMap::CDataColumn::setScale(), and StringPrint().

Referenced by CExperimentObjectMap::CDataColumn::operator=(), CQExperimentData::saveTable(), and CExperiment::setWeightMethod().

190 {
191  CDataColumn * pColumn =
192  dynamic_cast< CDataColumn * >(getGroup(StringPrint("%d", index)));
193 
194  if (pColumn)
195  return pColumn->setScale(weight);
196  else
197  return false;
198 }
std::string StringPrint(const char *format,...)
Definition: utility.cpp:87
CCopasiParameterGroup * getGroup(const std::string &name)

Member Data Documentation

size_t CExperimentObjectMap::mLastColumn
private

The last mapped column

Definition at line 299 of file CExperimentObjectMap.h.

Referenced by compile(), and getLastColumn().

CVector<CCopasiObject *> CExperimentObjectMap::mObjects
private

A vector of pointer to the objects corresponding to the data column.

Definition at line 294 of file CExperimentObjectMap.h.

Referenced by compile(), and getMappedObjects().


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