COPASI API  4.40.278
CFunctionDB Class Reference

#include <CFunctionDB.h>

Inheritance diagram for CFunctionDB:
[legend]

Public Member Functions

bool add (CFunction *pFunction, const bool &adopt)
 
CFunctionaddAndAdaptName (CFunction *pFunction)
 
bool appendDependentFunctions (const ObjectSet &candidates, DataObjectSet &dependentFunctions) const
 
 CFunctionDB (const std::string &name, const CDataContainer *pParent)
 
void cleanup ()
 
CFunctionfindFunction (const std::string &functionName)
 
CFunctionfindLoadFunction (const std::string &functionName)
 
std::string getFilename () const
 
std::vector< const CFunction * > getUsedFunctions (const CModel *pModel) const
 
void initObjects ()
 
bool load ()
 
bool load (const std::string &fileName)
 
C_INT32 load (CReadConfig &configbuffer)
 
CDataVectorN< CFunction > & loadedFunctions ()
 
void purgeUnusedUserDefinedFunctions ()
 
bool removeFunction (const std::string &key)
 
bool removeFunction (size_t index)
 
bool save (const std::string &fileName)
 
void setFilename (const std::string &filename)
 
std::vector< CFunction * > suitableFunctions (const size_t noSubstrates, const size_t noProducts, const TriLogic reversibility)
 
virtual ~CFunctionDB ()
 
- Public Member Functions inherited from CDataContainer
virtual bool add (CDataObject *pObject, const bool &adopt=true)
 
virtual bool appendDeletedDependentData (CUndoData &undoData) const
 
virtual bool applyData (const CData &data, CUndoData::CChangeSet &changes) override
 
 CDataContainer (const CDataContainer &src, const CDataContainer *pParent)
 
 CDataContainer (const std::string &name, const CDataContainer *pParent=NO_PARENT, const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None)
 
virtual void createUndoData (CUndoData &undoData, const CUndoData::Type &type, const CData &oldData=CData(), const CCore::Framework &framework=CCore::Framework::ParticleNumbers) const override
 
virtual std::string getChildObjectUnits (const CDataObject *pObject) const
 
void getDescendants (CDataObject::DataObjectSet &descendants, const bool &recursive=false) const
 
virtual size_t getIndex (const CDataObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCommonName &cn) const override
 
virtual objectMapgetObjects ()
 
virtual const objectMapgetObjects () const
 
virtual const std::string getUnits () const override
 
virtual const CDataObjectgetValueObject () const override
 
virtual CUndoObjectInterfaceinsert (const CData &data) override
 
void objectRenamed (CDataObject *pObject, const std::string &oldName)
 
virtual bool remove (CDataObject *pObject)
 
virtual CData toData () const override
 
virtual ~CDataContainer ()
 
- Public Member Functions inherited from CDataObject
void addIssue (const CIssue &issue)
 
void addReference (const CDataContainer *pReference)
 
virtual void calculateValue () override
 
 CDataObject (const CDataObject &src, const CDataContainer *pParent=NULL)
 
virtual void destruct () override
 
virtual CCommonName getCN () const override
 
virtual const CDataObjectgetDataObject () const override
 
virtual const std::string & getKey () const
 
CDataContainergetObjectAncestor (const std::string &type) const
 
CDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName () const override
 
const CObjectInterfacegetObjectFromCN (const CCommonName &cn) const
 
const std::string & getObjectName () const
 
CDataContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const CObjectInterface::ObjectSetgetPrerequisites () const override
 
virtual const CValiditygetValidity () const override
 
virtual void * getValuePointer () const override
 
bool hasFlag (const Flag &flag) const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CCore::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const override
 
bool prerequisitsContains (const DataObjectSet &objects) const
 
virtual void print (std::ostream *ostream) const override
 
void removeIssue (const CIssue &issue)
 
void removeReference (const CDataContainer *pReference)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CDataContainer *pParent)
 
void validityChanged (const CValidity &changedValidity) override
 
void validityRemoved (const CValidity &changedValidity)
 
virtual ~CDataObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
 CObjectInterface (const CObjectInterface &src)
 
virtual ~CObjectInterface ()
 
- Public Member Functions inherited from CUndoObjectInterface
 CUndoObjectInterface ()
 
 CUndoObjectInterface (const CUndoObjectInterface &src)
 
bool generateUuid ()
 
const xg::Guid & getUuid () const
 
bool setUuid (const std::string &uuid)
 
bool setUuid (const xg::Guid &uuid)
 
virtual void updateIndex (const size_t &index, const CUndoObjectInterface *pUndoObject)
 
virtual ~CUndoObjectInterface ()
 

Private Attributes

CMathDependencyGraph mDependencies
 
std::string mFilename
 
CDataVectorN< CFunctionmLoadedFunctions
 

Additional Inherited Members

- Public Types inherited from CDataContainer
typedef CDataObjectMap objectMap
 
- Public Types inherited from CDataObject
typedef std::set< const CDataObject * > DataObjectSet
 
enum  Flag {
  Container , Vector , Matrix , NameVector ,
  Reference , ValueBool , ValueInt , ValueInt64 ,
  ValueDbl , NonUniqueName , StaticString , ValueString ,
  Separator , DisplayName , ModelEntity , Array ,
  DataModel , Root , Gui , __SIZE
}
 
- Public Types inherited from CObjectInterface
typedef std::vector< const CDataContainer * > ContainerList
 
typedef std::set< const CObjectInterface * > ObjectSet
 
- Static Public Member Functions inherited from CDataContainer
static CDataContainerfromData (const CData &data, CUndoObjectInterface *pParent)
 
- Static Public Member Functions inherited from CDataObject
static CDataObjectfromData (const CData &data, CUndoObjectInterface *pParent)
 
static void sanitizeObjectName (std::string &name)
 
- Static Public Member Functions inherited from CObjectInterface
static const CDataObjectDataObject (const CObjectInterface *pInterface)
 
static CObjectInterfaceGetObjectFromCN (const ContainerList &listOfContainer, const CCommonName &objName)
 
- Static Public Member Functions inherited from CUndoObjectInterface
template<class CType >
static CType * fromData (const CData &, CUndoObjectInterface *)
 
- Static Public Attributes inherited from CDataContainer
static const CObjectInterface::ContainerList EmptyList
 
- Protected Member Functions inherited from CDataContainer
template<class CType >
CDataMatrixReference< CType > * addMatrixReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
template<class CType >
CDataObjectReference< CType > * addObjectReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
template<class CType >
CDataVectorReference< CType > * addVectorReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
 CDataContainer (const CDataContainer &src)
 
void initObjects ()
 
- Protected Member Functions inherited from CDataObject
 CDataObject ()
 
 CDataObject (const std::string &name, const CDataContainer *pParent=static_cast< CDataContainer * >((void *) 0), const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None)
 
- Protected Attributes inherited from CDataContainer
objectMap mObjects
 
- Protected Attributes inherited from CDataObject
ObjectSet mPrerequisits
 
std::set< CDataContainer * > mReferences
 
- Protected Attributes inherited from CObjectInterface
CValidity mValidity
 

Constructor & Destructor Documentation

◆ CFunctionDB()

CFunctionDB::CFunctionDB ( const std::string &  name,
const CDataContainer pParent 
)

Default constructor

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

CFunctionDB

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

References CONSTRUCTOR_TRACE, and initObjects().

◆ ~CFunctionDB()

CFunctionDB::~CFunctionDB ( )
virtual

Destructor

References cleanup(), and DESTRUCTOR_TRACE.

Member Function Documentation

◆ add()

bool CFunctionDB::add ( CFunction pFunction,
const bool &  adopt 
)

Add the function to the database

Parameters
CFunction* pFunction
constbool & adopt (default = false)
Returns
bool success

References CDataVectorN< CType >::add(), and mLoadedFunctions.

Referenced by addAndAdaptName(), and SBMLImporter::createCFunctionFromFunctionDefinition().

◆ addAndAdaptName()

CFunction * CFunctionDB::addAndAdaptName ( CFunction pFunction)

◆ appendDependentFunctions()

bool CFunctionDB::appendDependentFunctions ( const ObjectSet candidates,
CDataObject::DataObjectSet dependentFunctions 
) const

Appends pointers to function, which are dependent on any of the candidates to the list dependentFunctions.

Parameters
constObjectSet & candidates
std::set<const CDataObject * > & dependentFunctions
Returns
bool functionsAppended

References CMathDependencyGraph::appendAllDependents(), and mDependencies.

Referenced by CDataContainer::appendDeletedDependentData(), and removeFunction().

◆ cleanup()

void CFunctionDB::cleanup ( )

◆ findFunction()

◆ findLoadFunction()

CFunction * CFunctionDB::findLoadFunction ( const std::string &  functionName)

Search for a function among the loaded functions. If no function is found the database is searched and the apropriate function is loaded.

Parameters
const string&functionName
Returns
CFunction * function (NULL if function is not found)

References CDataVectorN< CType >::getIndex(), mLoadedFunctions, and CDataVector< CType >::size().

Referenced by CReaction::setFunction(), CReactionInterface::setFunctionAndDoMapping(), and CReactionInterface::setFunctionWithEmptyMapping().

◆ getFilename()

std::string CFunctionDB::getFilename ( ) const

References mFilename.

◆ getUsedFunctions()

std::vector< const CFunction * > CFunctionDB::getUsedFunctions ( const CModel pModel) const

Retrieves a list of all functions used in the model

Returns
std::vector< const CFunction * > usedFunctions

References CModel::appendAllDependents(), CDataVector< CType >::begin(), CFunction::completeFunctionList(), CDataVector< CType >::end(), and mLoadedFunctions.

Referenced by CCopasiXML::buildFunctionList(), and purgeUnusedUserDefinedFunctions().

◆ initObjects()

void CFunctionDB::initObjects ( )

◆ load() [1/3]

bool CFunctionDB::load ( )

◆ load() [2/3]

bool CFunctionDB::load ( const std::string &  fileName)

◆ load() [3/3]

◆ loadedFunctions()

◆ purgeUnusedUserDefinedFunctions()

void CFunctionDB::purgeUnusedUserDefinedFunctions ( )

Purge all unused user defined functions from the data base

References CDataObject::DataModel, CRootContainer::getDatamodelList(), getUsedFunctions(), and mLoadedFunctions.

◆ removeFunction() [1/2]

bool CFunctionDB::removeFunction ( const std::string &  key)

◆ removeFunction() [2/2]

◆ save()

bool CFunctionDB::save ( const std::string &  fileName)

◆ setFilename()

void CFunctionDB::setFilename ( const std::string &  filename)

References mFilename.

◆ suitableFunctions()

std::vector< CFunction * > CFunctionDB::suitableFunctions ( const size_t  noSubstrates,
const size_t  noProducts,
const TriLogic  reversibility 
)

Retrieves the vector of functions that are suitable for a number of substrates, products and reversibility status. Note: The returns CDataVector has to be deleted after use!

Parameters
const size_tnoSubstrates the number of substrates
const size_tnoProducts the number of products
const TriLogicreversible the reversibility status
Returns
"std::vector<CFunction*> " suitableFunctions

References fatalError, findFunction(), CFunction::isSuitable(), mLoadedFunctions, CDataVector< CType >::size(), and TriTrue.

Referenced by CReactionInterface::getListOfPossibleFunctions().

Member Data Documentation

◆ mDependencies

CMathDependencyGraph CFunctionDB::mDependencies
private

The function dependencies

Referenced by appendDependentFunctions(), and cleanup().

◆ mFilename

std::string CFunctionDB::mFilename
private

Filename which contains the function database

Referenced by getFilename(), initObjects(), and setFilename().

◆ mLoadedFunctions


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