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

#include <CCopasiParameter.h>

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

Classes

union  Value
 

Public Types

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
 

Public Member Functions

 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)
 
virtual void print (std::ostream *ostream) const
 
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 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 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 ()
 

Static Public Attributes

static const std::string TypeName []
 
static const char * XMLType []
 
- Static Public Attributes inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 

Protected Attributes

std::string mKey
 
CCopasiObjectmpValueReference
 
size_t mSize
 
Value mValue
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 

Private Member Functions

 CCopasiParameter ()
 
Value createValue (const Value &value)
 
void deleteValue ()
 

Private Attributes

CCopasiParameter::Type mType
 

Friends

std::ostream & operator<< (std::ostream &os, const CCopasiParameter &o)
 
bool operator== (const CCopasiParameter &lhs, const CCopasiParameter &rhs)
 

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
}
 
- 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)
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

CCopasiParameter class. This class is used to describe parameters. This class is intended to be used with integration or optimization methods or reactions.

Created for COPASI by Stefan Hoops 2002

Definition at line 35 of file CCopasiParameter.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CCopasiParameter::CCopasiParameter ( )
private

Default constructor

Definition at line 65 of file CCopasiParameter.cpp.

References mValue, and CCopasiParameter::Value::pVOID.

Referenced by CCopasiParameterGroup::addParameter(), and CCopasiParameterGroup::operator=().

65  :
66  CCopasiContainer("NoName", NULL, "Parameter"),
67  mKey(CCopasiRootContainer::getKeyFactory()->add("Parameter", this)),
68  mType(INVALID),
69  mSize(0),
70  mValue(),
71  mpValueReference(NULL)
72 {mValue.pVOID = NULL;}
CCopasiParameter::Type mType
CCopasiObject * mpValueReference
static CKeyFactory * getKeyFactory()
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
CCopasiParameter::CCopasiParameter ( const CCopasiParameter src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

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

Definition at line 74 of file CCopasiParameter.cpp.

References createValue(), and mValue.

75  :
76  CCopasiContainer(src, pParent),
78  mType(src.mType),
79  mSize(0),
80  mValue(),
81  mpValueReference(NULL)
82 {
83  createValue(src.mValue);
84 }
CCopasiParameter::Type mType
CCopasiObject * mpValueReference
const std::string & getObjectType() const
Value createValue(const Value &value)
static CKeyFactory * getKeyFactory()
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
CCopasiParameter::CCopasiParameter ( const std::string &  name,
const Type type,
const void pValue = NULL,
const CCopasiContainer pParent = NULL,
const std::string &  objectType = "Parameter" 
)

Specific constructor

Parameters
conststring & name
constCCopasiParameter::Type & type
constvoid * pValue (default: NULL)
constCCopasiContainer * pParent (default: NULL)
conststd::string & objectType (default: "Parameter")

Definition at line 86 of file CCopasiParameter.cpp.

References createValue(), mValue, and CCopasiParameter::Value::pVOID.

90  :
91  CCopasiContainer(name, pParent, objectType,
93  ((type == DOUBLE || type == UDOUBLE) ? CCopasiObject::ValueDbl :
94  ((type == INT || type == UINT) ? CCopasiObject::ValueInt :
95  ((type == STRING || type == CN || type == KEY || type == FILE || type == EXPRESSION) ? CCopasiObject::ValueString :
96  (type == BOOL) ? CCopasiObject::ValueBool : 0)))),
98  mType(type),
99  mSize(0),
100  mValue(),
101  mpValueReference(NULL)
102 {
104  value.pVOID = const_cast<void *>(pValue);
105  mValue = createValue(value);
106 }
objectType
CCopasiParameter::Type mType
CCopasiObject * mpValueReference
Value createValue(const Value &value)
static CKeyFactory * getKeyFactory()
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
CCopasiParameter::~CCopasiParameter ( )
virtual

Destructor

Definition at line 108 of file CCopasiParameter.cpp.

References deleteValue(), CCopasiRootContainer::getKeyFactory(), CCopasiRootContainer::getRoot(), mKey, and CKeyFactory::remove().

109 {
112 
113  deleteValue();
114 }
bool remove(const std::string &key)
static CKeyFactory * getKeyFactory()
static const CCopasiContainer * getRoot()

Member Function Documentation

CCopasiParameter::Value CCopasiParameter::createValue ( const Value value)
private

Create or copy the value

Parameters
constCCopasiParameter::Value & value
Returns
CCopasiParameter::Value Value

Definition at line 429 of file CCopasiParameter.cpp.

References CCopasiContainer::addObjectReference(), BOOL, C_FLOAT64, C_INT32, CN, DOUBLE, EXPRESSION, FILE, GROUP, INT, INVALID, KEY, mpValueReference, mSize, mType, mValue, CCopasiParameter::Value::pBOOL, CCopasiParameter::Value::pCN, CCopasiParameter::Value::pDOUBLE, CCopasiParameter::Value::pGROUP, CCopasiParameter::Value::pINT, CCopasiParameter::Value::pSTRING, CCopasiParameter::Value::pUINT, CCopasiParameter::Value::pVOID, STRING, UDOUBLE, UINT, CCopasiObject::ValueBool, CCopasiObject::ValueDbl, CCopasiObject::ValueInt, and CCopasiObject::ValueString.

Referenced by CCopasiParameter(), and operator=().

430 {
431  switch (mType)
432  {
435  mValue.pDOUBLE = new C_FLOAT64;
436 
437  if (value.pDOUBLE) * mValue.pDOUBLE = * value.pDOUBLE;
438 
439  mSize = sizeof(C_FLOAT64);
441  break;
442 
444  mValue.pINT = new C_INT32;
445 
446  if (value.pINT) * mValue.pINT = * value.pINT;
447 
448  mSize = sizeof(C_INT32);
450  break;
451 
453  mValue.pUINT = new unsigned C_INT32;
454 
455  if (value.pUINT) * mValue.pUINT = * value.pUINT;
456 
457  mSize = sizeof(unsigned C_INT32);
459  break;
460 
462  mValue.pBOOL = new bool;
463 
464  if (value.pBOOL) * mValue.pBOOL = * value.pBOOL;
465 
466  mSize = sizeof(bool);
468  break;
469 
474 
475  if (value.pSTRING)
476  mValue.pSTRING = new std::string(* value.pSTRING);
477  else
478  mValue.pSTRING = new std::string;
479 
480  mSize = sizeof(std::string);
482  break;
483 
485 
486  if (value.pCN)
487  mValue.pCN = new CRegisteredObjectName(* value.pCN);
488  else
490 
491  mSize = sizeof(CRegisteredObjectName);
493  break;
494 
496  mValue.pGROUP = new std::vector< CCopasiParameter * >;
497  mSize = sizeof(std::vector< CCopasiParameter * >);
498  break;
499 
501  mValue.pVOID = NULL;
502  mSize = 0;
503  break;
504  }
505 
506  return mValue;
507 }
CCopasiParameter::Type mType
CCopasiObject * mpValueReference
std::vector< CCopasiParameter * > * pGROUP
#define C_INT32
Definition: copasi.h:90
CRegisteredObjectName * pCN
unsigned C_INT32 * pUINT
#define C_FLOAT64
Definition: copasi.h:92
CCopasiObject * addObjectReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
void CCopasiParameter::deleteValue ( )
private

Delete the value

Definition at line 509 of file CCopasiParameter.cpp.

References BOOL, CN, DOUBLE, EXPRESSION, fatalError, FILE, GROUP, INT, INVALID, KEY, mType, mValue, CCopasiParameter::Value::pBOOL, CCopasiParameter::Value::pCN, CCopasiParameter::Value::pDOUBLE, CCopasiParameter::Value::pGROUP, CCopasiParameter::Value::pINT, CCopasiParameter::Value::pSTRING, CCopasiParameter::Value::pUINT, CCopasiParameter::Value::pVOID, STRING, UDOUBLE, and UINT.

Referenced by operator=(), and ~CCopasiParameter().

510 {
511  if (mValue.pVOID == NULL) return;
512 
513  switch (mType)
514  {
517  delete mValue.pDOUBLE;
518  break;
519 
521  delete mValue.pINT;
522  break;
523 
525  delete mValue.pUINT;
526  break;
527 
529  delete mValue.pBOOL;
530  break;
531 
536  delete mValue.pSTRING;
537  break;
538 
540  delete mValue.pCN;
541  break;
542 
544  delete mValue.pGROUP;
545  break;
546 
548  break;
549 
550  default:
551  fatalError();
552  break;
553  }
554 
555  mValue.pVOID = NULL;
556  return;
557 }
CCopasiParameter::Type mType
std::vector< CCopasiParameter * > * pGROUP
#define fatalError()
CRegisteredObjectName * pCN
unsigned C_INT32 * pUINT
CCopasiObjectName CCopasiParameter::getCN ( ) const
virtual

Retrieve the CN of the math container The math container provides values for the numerical values of model objects. For the CN mechanism to work properly it has to pretend to be the model.

Returns
CCopasiObjectName

Reimplemented from CCopasiObject.

Definition at line 412 of file CCopasiParameter.cpp.

References CCopasiObjectName::escape(), CCopasiObject::getCN(), CCopasiObject::getObjectParent(), CCopasiObject::getObjectType(), and CCopasiParameterGroup::getUniqueParameterName().

Referenced by CFixLocalReactionParameters::changeModel(), CSBMLExporter::createKineticLaw(), CSensProblem::initDebugProblem(), CSensMethod::initialize(), CSBMLExporter::replace_local_parameters(), SBMLImporter::sbmlId2CopasiCN(), and CEvaluationNodeObject::toAST().

413 {
414  CCopasiContainer * pObjectParent = getObjectParent();
415  CCopasiParameterGroup * pGroup;
416 
417  if (pObjectParent != NULL &&
418  (pGroup = dynamic_cast< CCopasiParameterGroup * >(pObjectParent)) != NULL)
419  {
420  return pObjectParent->getCN() + "," + CCopasiObjectName::escape(getObjectType()) + "=" + CCopasiObjectName::escape(pGroup->getUniqueParameterName(this));
421  }
422 
423  return CCopasiObject::getCN();
424 }
std::string getUniqueParameterName(const CCopasiParameter *pParameter) const
virtual CCopasiObjectName getCN() const
const std::string & getObjectType() const
static std::string escape(const std::string &name)
CCopasiContainer * getObjectParent() const
const std::string & CCopasiParameter::getKey ( ) const
virtual
std::string CCopasiParameter::getObjectDisplayName ( bool  regular = true,
bool  richtext = false 
) const
virtual

Overload display name. Special treatment for reaction parameters to provide a shorter display.

Reimplemented from CCopasiObject.

Definition at line 560 of file CCopasiParameter.cpp.

References CCopasiObject::getObjectAncestor(), getObjectDisplayName(), CCopasiObject::getObjectDisplayName(), CCopasiObject::getObjectName(), CCopasiObject::getObjectParent(), getType(), CCopasiParameterGroup::getUniqueParameterName(), and GROUP.

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

561 {
562  // if one of the ancestors is a reaction and the parameter is not a group
563  // it is (hopefully) a kinetic parameter
564 
565  CCopasiObject* tmp = this->getObjectAncestor("Reaction");
566 
567  if (tmp && getType() != GROUP)
568  {
569  return tmp->getObjectDisplayName(regular, richtext) + "." + getObjectName();
570  }
571 
572  CCopasiContainer * pObjectParent = getObjectParent();
573  CCopasiParameterGroup * pGroup;
574 
575  if (pObjectParent != NULL &&
576  (pGroup = dynamic_cast< CCopasiParameterGroup * >(pObjectParent)) != NULL)
577  {
578  std::string DisplayName = pGroup->getObjectDisplayName(regular, richtext);
579 
580  if (DisplayName.length() >= 2 &&
581  (DisplayName.substr(DisplayName.length() - 2) == "[]"))
582  {
583  DisplayName.insert(DisplayName.length() - 1, pGroup->getUniqueParameterName(this));
584  }
585  else
586  {
587  if ((DisplayName.length() != 0) && (DisplayName[DisplayName.length() - 1] != '.'))
588  {
589  DisplayName += ".";
590  }
591 
592  DisplayName += pGroup->getUniqueParameterName(this);
593  }
594 
595  if (getType() == GROUP)
596  {
597  DisplayName += "[]";
598  }
599 
600  return DisplayName;
601  }
602 
603  return CCopasiObject::getObjectDisplayName(regular, richtext);
604 }
CCopasiContainer * getObjectAncestor(const std::string &type) const
std::string getUniqueParameterName(const CCopasiParameter *pParameter) const
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
const std::string & getObjectName() const
const CCopasiParameter::Type & getType() const
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
CCopasiContainer * getObjectParent() const
const CCopasiParameter::Type & CCopasiParameter::getType ( void  ) const
const CCopasiParameter::Value & CCopasiParameter::getValue ( ) const

Retrieve the private value of the parameter.

Returns
const CCopasiParameter::Value & Value

Definition at line 247 of file CCopasiParameter.cpp.

References mValue.

Referenced by CLyapWolfMethod::calculate(), CHybridMethod::calculateAmu(), CFixLocalReactionParameters::changeModel(), CFunctionAnalyzer::constructCallParametersActualValues(), CSEDMLExporter::createScanTask(), CSensMethod::CSensMethod(), CSensProblem::CSensProblem(), CTrajectoryTask::CTrajectoryTask(), CTSSATask::CTSSATask(), CFitProblem::elevateChildren(), CFitItem::elevateChildren(), COptProblem::elevateChildren(), CCopasiXMLParser::PlotItemElement::end(), CCopasiXMLParser::PlotSpecificationElement::end(), CCopasiXMLParser::TaskElement::end(), CCopasiXMLParser::COPASIElement::end(), CODEExporter::exportReacParamsAndFuncs(), CScanProblem::fixBuild81(), CPlotItem::getActivity(), CScanProblem::getContinueFromCurrentState(), CHybridMethodODE45::getDefaultAtol(), CHybridMethodLSODA::getDefaultAtol(), CScanProblem::getOutputInSubtask(), CSteadyStateMethod::getStabilityResolution(), CScanProblem::getSubtask(), CLNAProblem::getSubTask(), CMCAProblem::getSubTask(), CCopasiParameterGroup::getValue(), SEDMLImporter::importTasks(), CQPreferenceDialog::init(), CQProgressItemText::initFromProcessReportItem(), CQProgressItemBar::initFromProcessReportItem(), COptMethodEP::initialize(), COptMethodSteepestDescent::initialize(), CRandomSearch::initialize(), COptMethodDE::initialize(), COptMethodSRES::initialize(), COptMethodGA::initialize(), COptMethodPS::initialize(), COptMethodGASR::initialize(), COptMethodHookeJeeves::initialize(), COptMethodLevenbergMarquardt::initialize(), COptMethodNelderMead::initialize(), COptMethodSA::initialize(), COptMethodCoranaWalk::initialize(), COptMethodPraxis::initialize(), COptMethodSS::initialize(), CTSSATask::initialize(), CTrajectoryTask::initialize(), CNewtonMethod::initialize(), CCrossSectionTask::initialize(), CTSSAMethod::initializeIntegrationsParameter(), CExperimentObjectMap::CDataColumn::initializeParameter(), CRecentFiles::initializeParameter(), CSteadyStateMethod::initializeParameter(), CMIRIAMResource::initializeParameter(), CLyapProblem::initializeParameter(), CNewtonMethod::initializeParameter(), CTrajectoryProblem::initializeParameter(), CTSSAProblem::initializeParameter(), CMCAMethod::initializeParameter(), CCrossSectionProblem::initializeParameter(), CHybridMethodODE45::initializeParameter(), CLyapWolfMethod::initializeParameter(), CTauLeapMethod::initializeParameter(), CStochMethod::initializeParameter(), CConfigurationFile::initializeParameter(), COptItem::initializeParameter(), CFitProblem::initializeParameter(), CLsodaMethod::initializeParameter(), CMIRIAMResources::initializeParameter(), CCrossValidationSet::initializeParameter(), CTrajectoryMethodDsaLsodar::initializeParameter(), COptProblem::initializeParameter(), CHybridMethod::initializeParameter(), CHybridMethodLSODA::initializeParameter(), CExperiment::initializeParameter(), CHybridMethod::initMethod(), CHybridMethodODE45::initMethod(), CHybridMethodLSODA::initMethod(), CSteadyStateProblem::isJacobianRequested(), CPlotSpecification::isLogX(), CPlotSpecification::isLogY(), CSteadyStateProblem::isStabilityAnalysisRequested(), CLNAProblem::isSteadyStateRequested(), CMCAProblem::isSteadyStateRequested(), CNewtonMethod::isValidProblem(), CHybridMethod::isValidProblem(), CHybridMethodLSODA::isValidProblem(), CStochDirectMethod::isValidProblem(), CTrajAdaptiveSA::isValidProblem(), CLyapWolfMethod::isValidProblem(), CStochMethod::isValidProblem(), CTrajectoryMethodDsaLsodar::isValidProblem(), CSteadyStateProblem::load(), CTrajectoryTask::load(), CReactionInterface::loadMappingAndValues(), CExperiment::operator=(), COptMethodEP2::optimise(), COptMethodHGASA::optimise(), CHybridMethod::partitionSystem(), CHybridMethodLSODA::partitionSystem(), CCSPMethod::predifineAnnotation(), CModel::printParameterOverview(), CModelParameter::refreshFromModel(), CSBMLExporter::replace_local_parameters(), CCopasiXMLInterface::saveParameter(), CTrajectoryTask::setMethodType(), CCrossSectionTask::setMethodType(), CExperimentObjectMap::CDataColumn::setObjectCN(), CExperimentObjectMap::CDataColumn::setScale(), CPlotItem::setType(), CHybridMethod::setupPartition(), CHybridMethodLSODA::setupPartition(), CQPreferenceDialog::slotBtnOk(), CILDMMethod::start(), CILDMModifiedMethod::start(), CTauLeapMethod::start(), CStochDirectMethod::start(), CCSPMethod::start(), CLyapWolfMethod::start(), CTrajAdaptiveSA::start(), CStochMethod::start(), and SteadyStateWidget::taskFinishedEvent().

247 {return mValue;}
CCopasiParameter::Value & CCopasiParameter::getValue ( )

Retrieve the private value of the parameter.

Returns
CCopasiParameter::Value & Value

Definition at line 249 of file CCopasiParameter.cpp.

References mValue.

249 {return mValue;}
void * CCopasiParameter::getValuePointer ( ) const
virtual

Retrieve a pointer to the value of the object

Reimplemented from CCopasiObject.

Definition at line 426 of file CCopasiParameter.cpp.

References mValue, and CCopasiParameter::Value::pVOID.

Referenced by CSensMethod::calculate_one_level(), CExperiment::compile(), CSensMethod::do_target_calculation(), and CSensMethod::scaling_variables().

427 {return const_cast<void *>(mValue.pVOID);}
CCopasiObject * CCopasiParameter::getValueReference ( ) const
bool CCopasiParameter::isValidValue ( const C_FLOAT64 value) const

Check whether the value corresponds to the type

Parameters
constC_FLOAT64 & value
Returns
bool isValidValue

Definition at line 259 of file CCopasiParameter.cpp.

References DOUBLE, mType, and UDOUBLE.

Referenced by CCopasiParameterGroup::addParameter(), and setValue().

260 {
264  value < 0.0)) return false;
265 
266  return true;
267 }
CCopasiParameter::Type mType
bool CCopasiParameter::isValidValue ( const C_INT32 value) const

Check whether the value corresponds to the type

Parameters
constC_INT32 & value
Returns
bool isValidValue

Definition at line 269 of file CCopasiParameter.cpp.

References INT, and mType.

270 {
271  if (mType != CCopasiParameter::INT) return false;
272 
273  return true;
274 }
CCopasiParameter::Type mType
bool CCopasiParameter::isValidValue ( const unsigned C_INT32 value) const

Check whether the value corresponds to the type

Parameters
constunsigned C_INT32 & value
Returns
bool isValidValue

Definition at line 276 of file CCopasiParameter.cpp.

References mType, and UINT.

277 {
278  if (mType != CCopasiParameter::UINT) return false;
279 
280  return true;
281 }
CCopasiParameter::Type mType
bool CCopasiParameter::isValidValue ( const bool &  value) const

Check whether the value corresponds to the type

Parameters
constbool & value
Returns
bool isValidValue
bool CCopasiParameter::isValidValue ( const std::string &  value) const

Check whether the value corresponds to the type

Parameters
conststd::string & value
Returns
bool isValidValue

Definition at line 290 of file CCopasiParameter.cpp.

References EXPRESSION, FILE, CKeyFactory::isValidKey(), KEY, mType, and STRING.

291 {
293  return CKeyFactory::isValidKey(value);
294 
297  mType != CCopasiParameter::EXPRESSION) return false;
298 
299  return true;
300 }
CCopasiParameter::Type mType
static bool isValidKey(const std::string &key, const std::string &prefix="")
Definition: CKeyFactory.cpp:30
bool CCopasiParameter::isValidValue ( const CCopasiObjectName value) const

Check whether the value corresponds to the type

Parameters
constCRegisteredObjectName & value
Returns
bool isValidValue
bool CCopasiParameter::isValidValue ( const std::vector< CCopasiParameter * > &  value) const

Check whether the value corresponds to the type

Parameters
constCCopasiParameterGroup::parameterGroup & value
Returns
bool isValidValue
CCopasiParameter & CCopasiParameter::operator= ( const CCopasiParameter rhs)

Assignment operator

Parameters
constCCopasiParameter & rhs
Returns
CCopasiParameter & lhs

Definition at line 116 of file CCopasiParameter.cpp.

References BOOL, CN, createValue(), deleteValue(), DOUBLE, EXPRESSION, FILE, CCopasiObject::getObjectName(), GROUP, INT, INVALID, KEY, mType, mValue, CCopasiParameter::Value::pBOOL, CCopasiParameter::Value::pCN, CCopasiParameter::Value::pDOUBLE, CCopasiParameter::Value::pINT, CCopasiParameter::Value::pSTRING, CCopasiObject::setObjectName(), STRING, UDOUBLE, and UINT.

117 {
118  if (getObjectName() != rhs.getObjectName())
120 
121  switch (rhs.mType)
122  {
125 
126  if (mType != DOUBLE &&
127  mType != UDOUBLE)
128  {
129  deleteValue();
130  mType = rhs.mType;
131  createValue(rhs.mValue);
132  }
133  else
134  {
135  mType = rhs.mType;
136  *mValue.pDOUBLE = *rhs.mValue.pDOUBLE;
137  }
138 
139  break;
140 
143 
144  if (mType != INT &&
145  mType != UINT)
146  {
147  deleteValue();
148  mType = rhs.mType;
149  createValue(rhs.mValue);
150  }
151  else
152  {
153  mType = rhs.mType;
154  *mValue.pINT = *rhs.mValue.pINT;
155  }
156 
157  break;
158 
160 
161  if (mType != BOOL)
162  {
163  deleteValue();
164  mType = BOOL;
165  createValue(rhs.mValue);
166  }
167  else
168  {
169  *mValue.pBOOL = *rhs.mValue.pBOOL;
170  }
171 
172  break;
173 
178 
179  if (mType != STRING &&
180  mType != KEY &&
181  mType != FILE &&
182  mType != EXPRESSION)
183  {
184  deleteValue();
185  mType = rhs.mType;
186  createValue(rhs.mValue);
187  }
188  else
189  {
190  mType = rhs.mType;
191  *mValue.pSTRING = *rhs.mValue.pSTRING;
192  }
193 
194  break;
195 
197 
198  if (mType != CN)
199  {
200  deleteValue();
201  mType = CN;
202  createValue(rhs.mValue);
203  }
204  else
205  {
206  *mValue.pCN = *rhs.mValue.pCN;
207  }
208 
209  break;
210 
212 
213  if (mType != GROUP)
214  {
215  deleteValue();
216  mType = GROUP;
217  createValue(rhs.mValue);
218  }
219 
220  *static_cast<CCopasiParameterGroup *>(this) =
221  *static_cast<const CCopasiParameterGroup *>(&rhs);
222 
223  break;
224 
226 
227  if (mType != INVALID)
228  {
229  deleteValue();
230  mType = INVALID;
231  createValue(rhs.mValue);
232  }
233 
234  break;
235  }
236 
237  return *this;
238 }
const std::string & getObjectName() const
CCopasiParameter::Type mType
CRegisteredObjectName * pCN
Value createValue(const Value &value)
bool setObjectName(const std::string &name)
void CCopasiParameter::print ( std::ostream *  ostream) const
virtual

This is the output method for any object. The default implementation provided with CCopasiObject uses the ostream operator<< of the object to print the object.To override this default behavior one needs to reimplement the virtual print function.

Parameters
std::ostream* ostream

Reimplemented from CCopasiObject.

Reimplemented in CCopasiParameterGroup, COptProblem, CCopasiMethod, CCopasiProblem, CSensProblem, CCrossSectionProblem, CLNAProblem, CMCAProblem, CFitProblem, and COscillationProblem.

Definition at line 316 of file CCopasiParameter.cpp.

317 {*ostream << *this;}
template<class CType >
bool CCopasiParameter::setValue ( const CType &  value)
inline
bool CCopasiParameter::setValue ( const std::vector< CCopasiParameter * > &  value)

Set the value of the parameter when the origin is a parameter group. This function is currently not implemented and creates a fatalError when called.

Parameters
constCCopasiParameter::parameterGroup& value
Returns
bool false

Definition at line 241 of file CCopasiParameter.cpp.

References fatalError.

242 {
243  fatalError();
244  return false;
245 }
#define fatalError()

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CCopasiParameter o 
)
friend

Output stream operator

Parameters
ostream& os
constCCopasiParameter & A
Returns
ostream & os

Definition at line 319 of file CCopasiParameter.cpp.

320 {
321  os << " " << o.getObjectName() << ": ";
322 
323  switch (o.mType)
324  {
327  os << * o.mValue.pDOUBLE;
328  break;
329 
331  os << * o.mValue.pINT;
332  break;
333 
335  os << * o.mValue.pUINT;
336  break;
337 
339  os << * o.mValue.pBOOL;
340  break;
341 
346  os << * o.mValue.pSTRING;
347  break;
348 
350  os << * o.mValue.pCN;
351  break;
352 
355  break;
356  }
357 
358  return os;
359 }
const std::string & getObjectName() const
CCopasiParameter::Type mType
CRegisteredObjectName * pCN
unsigned C_INT32 * pUINT
bool operator== ( const CCopasiParameter lhs,
const CCopasiParameter rhs 
)
friend

Comparison operator

Parameters
constCCopasiParameter & lhs
constCCopasiParameter & rhs
Returns
bool equal

Definition at line 361 of file CCopasiParameter.cpp.

362 {
363  if (lhs.getObjectName() != rhs.getObjectName()) return false;
364 
365  if (lhs.mType != rhs.mType) return false;
366 
367  switch (lhs.mType)
368  {
371  return *lhs.mValue.pDOUBLE == *rhs.mValue.pDOUBLE;
372  break;
373 
375  return *lhs.mValue.pINT == *rhs.mValue.pINT;
376  break;
377 
379  return *lhs.mValue.pUINT == *rhs.mValue.pUINT;
380  break;
381 
383  return *lhs.mValue.pBOOL == *rhs.mValue.pBOOL;
384  break;
385 
390  return *lhs.mValue.pSTRING == *rhs.mValue.pSTRING;
391  break;
392 
394  return *lhs.mValue.pCN == *rhs.mValue.pCN;
395  break;
396 
398  return *static_cast<const CCopasiParameterGroup *>(&lhs) ==
399  *static_cast<const CCopasiParameterGroup *>(&rhs);
400  break;
401 
403  default:
404  return !memcmp(lhs.mValue.pVOID, rhs.mValue.pVOID, lhs.mSize);
405  break;
406  }
407 
408  return false;
409 }
const std::string & getObjectName() const
CCopasiParameter::Type mType
CRegisteredObjectName * pCN
unsigned C_INT32 * pUINT

Member Data Documentation

std::string CCopasiParameter::mKey
protected

The key of the parameter.

Definition at line 86 of file CCopasiParameter.h.

Referenced by getKey(), CExperiment::initializeParameter(), and ~CCopasiParameter().

CCopasiObject* CCopasiParameter::mpValueReference
mutableprotected

A pointer to the object reference for the value

Definition at line 108 of file CCopasiParameter.h.

Referenced by createValue(), and getValueReference().

size_t CCopasiParameter::mSize
protected

The size allocated for the value of the parameter.

Definition at line 98 of file CCopasiParameter.h.

Referenced by createValue(), and operator==().

CCopasiParameter::Type CCopasiParameter::mType
private

The type of the parameter

Definition at line 92 of file CCopasiParameter.h.

Referenced by createValue(), deleteValue(), getType(), isValidValue(), operator<<(), operator=(), and operator==().

Value CCopasiParameter::mValue
protected
const std::string CCopasiParameter::TypeName
static
Initial value:
=
{
"float",
"unsigned float",
"integer",
"unsigned integer",
"bool",
"group",
"string",
"common name",
"key",
"file",
"expression",
""
}

String literals for the GUI to display type names of parameters known to COPASI.

CCopasiParameter class. This class is used to describe method paramters. This class is intended to be used with integration or optimization methods.

Created for Copasi by Stefan Hoops 2002

Definition at line 75 of file CCopasiParameter.h.

const char * CCopasiParameter::XMLType
static
Initial value:
=
{
"float",
"unsignedFloat",
"integer",
"unsignedInteger",
"bool",
"group",
"string",
"cn",
"key",
"file",
"expression",
NULL
}

XML type names of parameters known to COPASI.

Definition at line 80 of file CCopasiParameter.h.

Referenced by CCopasiXMLInterface::saveParameter(), CCopasiXMLParser::ParameterElement::start(), and CCopasiXMLParser::ParameterTextElement::start().


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