COPASI API  4.16.103
Public Member Functions | Private Attributes | Friends | List of all members
CFunctionParameters Class Reference

#include <CFunctionParameters.h>

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

Public Member Functions

void add (const CFunctionParameter &parameter)
 
bool add (CFunctionParameter *parameter, const bool &adopt=false)
 
bool add (const std::string &name, const CFunctionParameter::DataType &type, CFunctionParameter::Role usage)
 
 CFunctionParameters (const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
 
 CFunctionParameters (const CFunctionParameters &src, const CCopasiContainer *pParent=NULL)
 
void cleanup ()
 
size_t findParameterByName (const std::string &name, CFunctionParameter::DataType &dataType) const
 
size_t getNumberOfParametersByUsage (CFunctionParameter::Role usage) const
 
const CFunctionParametergetParameterByUsage (CFunctionParameter::Role usage, size_t &pos) const
 
bool isVector (CFunctionParameter::Role role) const
 
CFunctionParametersoperator= (const CFunctionParameters &src)
 
bool operator== (const CFunctionParameters &rhs) const
 
CFunctionParameteroperator[] (size_t index)
 
const CFunctionParameteroperator[] (size_t index) const
 
CFunctionParameteroperator[] (const std::string &name)
 
const CFunctionParameteroperator[] (const std::string &name) const
 
void remove (const std::string &name)
 
size_t size () const
 
void swap (const size_t &from, const size_t &to)
 
 ~CFunctionParameters ()
 
- 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 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 ()
 

Private Attributes

CCopasiVectorNS
< CFunctionParameter
mParameters
 

Friends

std::ostream & operator<< (std::ostream &os, const CFunctionParameters &d)
 

Additional Inherited Members

- 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 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 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 CCopasiContainer
objectMap mObjects
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

CFunctionParameters

Created for COPASI by Stefan Hoops (C) Stefan Hoops 2001

Definition at line 30 of file CFunctionParameters.h.

Constructor & Destructor Documentation

CFunctionParameters::CFunctionParameters ( const std::string &  name = "NoName",
const CCopasiContainer pParent = NULL 
)

Default constructor

Parameters
conststd::string & name (default: "NoName")
constCCopasiContainer * pParent (default: NULL)

CFunctionParameters

Created for Copasi by Stefan Hoops (C) Stefan Hoops 2001

Definition at line 29 of file CFunctionParameters.cpp.

References CONSTRUCTOR_TRACE.

30  :
31  CCopasiContainer(name, pParent, "Variable Description"),
32  mParameters("Variables", this)
CCopasiVectorNS< CFunctionParameter > mParameters
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202
CFunctionParameters::CFunctionParameters ( const CFunctionParameters src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
const CFunctionParameters &src
constCCopasiContainer * pParent (default: NULL)

Definition at line 35 of file CFunctionParameters.cpp.

References CONSTRUCTOR_TRACE.

36  :
37  CCopasiContainer(src, pParent),
38  mParameters(src.mParameters, this)
CCopasiVectorNS< CFunctionParameter > mParameters
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202
CFunctionParameters::~CFunctionParameters ( )

Destructor

Definition at line 41 of file CFunctionParameters.cpp.

References DESTRUCTOR_TRACE.

#define DESTRUCTOR_TRACE
Definition: copasi.h:206

Member Function Documentation

void CFunctionParameters::add ( const CFunctionParameter parameter)

Add a parameter to the parameter list

Parameters
const CFunctionParameter &parameter

Definition at line 54 of file CFunctionParameters.cpp.

References CCopasiVectorN< CType >::add(), and mParameters.

Referenced by CFunction::addVariable(), FunctionWidget1::copyFunctionContentsToFunction(), CKinFunction::createParameters(), CFunction::initVariables(), CMassAction::setInfix(), and CCopasiXMLParser::ParameterDescriptionElement::start().

55 {
56  mParameters.add(parameter);
57 }
CCopasiVectorNS< CFunctionParameter > mParameters
virtual bool add(const CType &src)
bool CFunctionParameters::add ( CFunctionParameter parameter,
const bool &  adopt = false 
)

Add a parameter to the parameter list

Parameters
CFunctionParameter *parameter
constbool & adopt (Default: false)
Returns
bool success

Definition at line 59 of file CFunctionParameters.cpp.

References CCopasiVectorN< CType >::add(), and mParameters.

61 {
62  mParameters.add(parameter, adopt);
63 
64  return true;
65 }
CCopasiVectorNS< CFunctionParameter > mParameters
virtual bool add(const CType &src)
bool CFunctionParameters::add ( const std::string &  name,
const CFunctionParameter::DataType type,
CFunctionParameter::Role  usage 
)

Add a parameter to the parameter list

Parameters
"conststring & name
const CFunctionParameter::DataType &type
const string &usage
Returns
bool success

Definition at line 67 of file CFunctionParameters.cpp.

References CCopasiVectorN< CType >::add(), C_INVALID_INDEX, CCopasiVectorN< CType >::getIndex(), and mParameters.

70 {
71  size_t Index = mParameters.getIndex(name);
72 
73  if (Index != C_INVALID_INDEX)
74  return false;
75 
76  CFunctionParameter *parameter =
77  new CFunctionParameter(name, type, usage);
78  mParameters.add(parameter, true);
79 
80  return true;
81 }
#define C_INVALID_INDEX
Definition: copasi.h:222
virtual size_t getIndex(const std::string &name) const
CCopasiVectorNS< CFunctionParameter > mParameters
virtual bool add(const CType &src)
void CFunctionParameters::cleanup ( )

Cleanup

Definition at line 43 of file CFunctionParameters.cpp.

References CCopasiVector< T >::cleanup(), and mParameters.

Referenced by CKinFunction::createParameters(), and CMassAction::setInfix().

44 {
46 }
CCopasiVectorNS< CFunctionParameter > mParameters
virtual void cleanup()
size_t CFunctionParameters::findParameterByName ( const std::string &  name,
CFunctionParameter::DataType dataType 
) const

find a parameter by its name and return its index

Definition at line 136 of file CFunctionParameters.cpp.

References C_INVALID_INDEX, CCopasiObject::getObjectName(), mParameters, and CCopasiVector< T >::size().

Referenced by FunctionWidget1::copyFunctionContentsToFunction(), CFunctionParameterMap::findParameterByName(), CFunction::getVariableIndex(), CFunction::initVariables(), CCopasiXMLParser::ParameterDescriptionElement::start(), and CReaction::variable2object().

138 {
139  //std::string VectorName = name.substr(0, name.find_last_of('_'));
140  std::string Name;
141  size_t i, imax = mParameters.size();
142 
143  for (i = 0; i < imax; i++)
144  {
145  Name = mParameters[i]->getObjectName();
146 
147  if (Name == name)
148  {
149  dataType = mParameters[i]->getType();
150  return i;
151  }
152  }
153 
154  return C_INVALID_INDEX;
155 }
const std::string & getObjectName() const
virtual size_t size() const
#define C_INVALID_INDEX
Definition: copasi.h:222
CCopasiVectorNS< CFunctionParameter > mParameters
size_t CFunctionParameters::getNumberOfParametersByUsage ( CFunctionParameter::Role  usage) const

gets the number of Parameters with a specific usage

Definition at line 125 of file CFunctionParameters.cpp.

References mParameters, and CCopasiVector< T >::size().

Referenced by CFunctionAnalyzer::checkKineticFunction(), CReactionInterface::connectFromScratch(), CReaction::initializeParameters(), CReactionInterface::isLocked(), CFunction::isSuitable(), CReaction::loadOld(), CReaction::loadOneRole(), FunctionWidget1::loadUsageTable(), and CReactionInterface::setMapping().

126 {
127  size_t i, imax = mParameters.size();
128  size_t count = 0;
129 
130  for (i = 0; i < imax; i++)
131  if (mParameters[i]->getUsage() == usage) ++count;
132 
133  return count;
134 }
virtual size_t size() const
CCopasiVectorNS< CFunctionParameter > mParameters
const CFunctionParameter * CFunctionParameters::getParameterByUsage ( CFunctionParameter::Role  usage,
size_t &  pos 
) const

Retrieves the first parameter with the specified usage after pos In a normal situation pos is set to 0 for the first call. It is increment by the method to allow subsequent searches to start after the last found item. This is usefull if several parameters with the same usage exist.

Parameters
const string &usage
size_t &pos (first call should be with 0)
Returns
"CFunctionParameter &" usageRange

Definition at line 106 of file CFunctionParameters.cpp.

References MCFunctionParameters, mParameters, CFunctionParameter::RoleNameDisplay, CCopasiVector< T >::size(), and CCopasiMessage::WARNING.

Referenced by CReactionInterface::connectFromScratch(), CReaction::initializeParameters(), CReactionInterface::isLocked(), CReaction::loadOld(), CReaction::loadOneRole(), and CReactionInterface::setMapping().

108 {
109  size_t i, imax = mParameters.size();
110 
111  for (i = pos; i < imax; i++)
112  if (mParameters[i]->getUsage() == usage)
113  {
114  pos = i + 1;
115  return mParameters[i];
116  }
117 
120  CFunctionParameter::RoleNameDisplay[usage].c_str(), pos);
121 
122  return NULL;
123 }
#define MCFunctionParameters
virtual size_t size() const
CCopasiVectorNS< CFunctionParameter > mParameters
static const std::string RoleNameDisplay[]
bool CFunctionParameters::isVector ( CFunctionParameter::Role  role) const

tells whether there is a parameter with vector type and the given role (if there is one it is assumed it is the only one with this role)

Definition at line 157 of file CFunctionParameters.cpp.

References mParameters, CCopasiVector< T >::size(), and CFunctionParameter::VINT32.

Referenced by CFunction::isSuitable(), CReaction::loadOneRole(), and FunctionWidget1::loadUsageTable().

158 {
159  size_t i, imax = mParameters.size();
160 
161  for (i = 0; i < imax; i++)
162  if (mParameters[i]->getUsage() == role)
163  return mParameters[i]->getType() >= CFunctionParameter::VINT32;
164 
165  //this assumes that if a parameter is not a vector then there
166  //will not be a vector parameter with the same role.
167  return false;
168 }
virtual size_t size() const
CCopasiVectorNS< CFunctionParameter > mParameters
CFunctionParameters & CFunctionParameters::operator= ( const CFunctionParameters src)

Assignment operator. Performs deep copy.

Definition at line 48 of file CFunctionParameters.cpp.

References CCopasiVector< T >::deepCopy(), and mParameters.

49 {
51  return *this;
52 }
CCopasiVectorNS< CFunctionParameter > mParameters
void deepCopy(const CCopasiVector< CType > &source)
bool CFunctionParameters::operator== ( const CFunctionParameters rhs) const

Definition at line 170 of file CFunctionParameters.cpp.

References CCopasiObject::getObjectName(), mParameters, CFunctionParameter::PARAMETER, size(), and CFunctionParameter::VARIABLE.

171 {
172  if (size() != rhs.size()) return false;
173 
174  CFunctionParameter::Role lhsRole, rhsRole;
175 
176  size_t i, imax = size();
177 
178  for (i = 0; i < imax; ++i)
179  {
180  if (mParameters[i]->getObjectName() != rhs.mParameters[i]->getObjectName()) return false;
181 
182  if (mParameters[i]->getType() != rhs.mParameters[i]->getType()) return false;
183 
184  lhsRole = mParameters[i]->getUsage();
185  rhsRole = rhs.mParameters[i]->getUsage();
186 
187  // We do not destinguish between PARAMETER and VARIABLE
188  if ((lhsRole == CFunctionParameter::PARAMETER || lhsRole == CFunctionParameter::VARIABLE) &&
190  continue;
191 
192  if (lhsRole != rhsRole) return false;
193  }
194 
195  return true;
196 }
const std::string & getObjectName() const
CCopasiVectorNS< CFunctionParameter > mParameters
CFunctionParameter * CFunctionParameters::operator[] ( size_t  index)

Definition at line 88 of file CFunctionParameters.cpp.

References mParameters.

89 {return mParameters[index];}
CCopasiVectorNS< CFunctionParameter > mParameters
const CFunctionParameter * CFunctionParameters::operator[] ( size_t  index) const

Definition at line 91 of file CFunctionParameters.cpp.

References mParameters.

92 {return mParameters[index];}
CCopasiVectorNS< CFunctionParameter > mParameters
CFunctionParameter * CFunctionParameters::operator[] ( const std::string &  name)

Definition at line 94 of file CFunctionParameters.cpp.

References mParameters.

95 {return mParameters[name];}
CCopasiVectorNS< CFunctionParameter > mParameters
const CFunctionParameter * CFunctionParameters::operator[] ( const std::string &  name) const

Definition at line 97 of file CFunctionParameters.cpp.

References mParameters.

98 {return mParameters[name];}
CCopasiVectorNS< CFunctionParameter > mParameters
void CFunctionParameters::remove ( const std::string &  name)

Remove a parameter from the parameter list

Parameters
const CFunctionParameter &parameter

Definition at line 83 of file CFunctionParameters.cpp.

References mParameters, and CCopasiVectorN< CType >::remove().

Referenced by FunctionWidget1::copyFunctionContentsToFunction(), CCopasiXMLParser::ListOfParameterDescriptionsElement::end(), and CFunction::initVariables().

84 {
85  mParameters.remove(name);
86 }
CCopasiVectorNS< CFunctionParameter > mParameters
virtual void remove(const std::string &name)
size_t CFunctionParameters::size ( ) const

number of parameters

Definition at line 100 of file CFunctionParameters.cpp.

References mParameters, and CCopasiVector< T >::size().

Referenced by CModelAdd::addReactions(), SBMLImporter::areEqualFunctions(), CFunctionParameterMap::CFunctionParameterMap(), CFunctionParameterMap::checkCallParameters(), CFunctionAnalyzer::checkKineticFunction(), CModelAnalyzer::checkReaction(), CFunctionParameterMap::clearCallParameters(), CReaction::compile(), CFunctionAnalyzer::constructCallParameters(), CFunctionAnalyzer::constructCallParametersActualValues(), CModel::convert2NonReversible(), FunctionWidget1::copyFunctionContentsToFunction(), CReactionInterface::copyMapping(), SBMLImporter::createCReactionFromReaction(), SBMLImporter::createExpressionFromFunction(), CSBMLExporter::createFunctionDefinition(), CSBMLExporter::createKineticExpression(), CSBMLExporter::createKineticLaw(), CFunction::createListOfParametersForMathML(), CMMLOutput::createParameterMapping(), SBMLImporter::doMapping(), CModelExpansion::duplicateReaction(), CCopasiXMLParser::ListOfParameterDescriptionsElement::end(), CFunctionAnalyzer::evaluateNode(), expand_function_call(), CODEExporterC::exportSingleFunction(), SBMLImporter::findCorrespondingFunction(), CFindDimensions::findDimensions(), CReactionInterface::getDeletedParameters(), CObjectLists::getListOfConstObjects(), CFunctionParameterMap::initCallParameters(), CReaction::initializeMetaboliteKeyMap(), CFunction::initVariables(), CODEExporterC::KineticFunction2ODEmember(), FunctionWidget1::loadParameterTable(), CModelMerging::mergeMetabolites(), operator==(), CModel::printParameterOverview(), CModelExpansion::replaceInReaction(), CCopasiXML::saveFunctionList(), CCopasiXML::saveModel(), CFindDimensions::setupDimensions(), CReactionInterface::size(), CFunction::splitFunction(), CCopasiXMLParser::ParameterDescriptionElement::start(), test_compare_utilities::test_copasi_function_expansion(), test000078::test_l2v4_import_unordered_functions(), CEvaluationNodeCall::verifyParameters(), and CFunction::writeMathML().

100 {return mParameters.size();}
virtual size_t size() const
CCopasiVectorNS< CFunctionParameter > mParameters
void CFunctionParameters::swap ( const size_t &  from,
const size_t &  to 
)

Swap parameters

Parameters
constsize_t & from
constsize_t & to

Definition at line 102 of file CFunctionParameters.cpp.

References mParameters, and CCopasiVector< T >::swap().

Referenced by CCopasiXMLParser::ParameterDescriptionElement::start().

103 {mParameters.swap(from, to);}
virtual void swap(const size_t &indexFrom, const size_t &indexTo)
CCopasiVectorNS< CFunctionParameter > mParameters

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CFunctionParameters d 
)
friend

insert operator

Definition at line 198 of file CFunctionParameters.cpp.

199 {
200  //os << "++++CFunctionParameters: " << std::endl;
201  //os << " CFunctionParameters.mParameters " << std::endl << d.mParameters;
202  //os << "----CFunctionParameters " << std::endl;
203 
204  size_t i, imax = d.mParameters.size();
205 
206  for (i = 0; i < imax; ++i)
207  {
208  if (0 == i)
209  os << " (";
210  else
211  os << " ";
212 
213  os << *d.mParameters[i];
214 
215  if (imax - 1 == i)
216  os << ")\n";
217  else
218  os << ",\n";
219  }
220 
221  return os;
222 }
virtual size_t size() const
CCopasiVectorNS< CFunctionParameter > mParameters

Member Data Documentation

CCopasiVectorNS< CFunctionParameter > CFunctionParameters::mParameters
private

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