|
COPASI API
4.40.278
|
#include <CFunctionDB.h>
Public Member Functions | |
| bool | add (CFunction *pFunction, const bool &adopt) |
| CFunction * | addAndAdaptName (CFunction *pFunction) |
| bool | appendDependentFunctions (const ObjectSet &candidates, DataObjectSet &dependentFunctions) const |
| CFunctionDB (const std::string &name, const CDataContainer *pParent) | |
| void | cleanup () |
| CFunction * | findFunction (const std::string &functionName) |
| CFunction * | findLoadFunction (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 CObjectInterface * | getObject (const CCommonName &cn) const override |
| virtual objectMap & | getObjects () |
| virtual const objectMap & | getObjects () const |
| virtual const std::string | getUnits () const override |
| virtual const CDataObject * | getValueObject () const override |
| virtual CUndoObjectInterface * | insert (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 CDataObject * | getDataObject () const override |
| virtual const std::string & | getKey () const |
| CDataContainer * | getObjectAncestor (const std::string &type) const |
| CDataModel * | getObjectDataModel () const |
| virtual std::string | getObjectDisplayName () const override |
| const CObjectInterface * | getObjectFromCN (const CCommonName &cn) const |
| const std::string & | getObjectName () const |
| CDataContainer * | getObjectParent () const |
| const std::string & | getObjectType () const |
| virtual const CObjectInterface::ObjectSet & | getPrerequisites () const override |
| virtual const CValidity & | getValidity () 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< CFunction > | mLoadedFunctions |
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 CDataContainer * | fromData (const CData &data, CUndoObjectInterface *pParent) |
Static Public Member Functions inherited from CDataObject | |
| static CDataObject * | fromData (const CData &data, CUndoObjectInterface *pParent) |
| static void | sanitizeObjectName (std::string &name) |
Static Public Member Functions inherited from CObjectInterface | |
| static const CDataObject * | DataObject (const CObjectInterface *pInterface) |
| static CObjectInterface * | GetObjectFromCN (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 |
| CFunctionDB::CFunctionDB | ( | const std::string & | name, |
| const CDataContainer * | pParent | ||
| ) |
Default constructor
| const | std::string & name (default: "NoName") |
| const | CDataContainer * pParent (default: NULL) |
Created for Copasi by Stefan Hoops (C) Stefan Hoops 2001
References CONSTRUCTOR_TRACE, and initObjects().
|
virtual |
Destructor
References cleanup(), and DESTRUCTOR_TRACE.
| bool CFunctionDB::add | ( | CFunction * | pFunction, |
| const bool & | adopt | ||
| ) |
Add the function to the database
| CFunction | * pFunction |
| const | bool & adopt (default = false) |
References CDataVectorN< CType >::add(), and mLoadedFunctions.
Referenced by addAndAdaptName(), and SBMLImporter::createCFunctionFromFunctionDefinition().
Add the function to the database, if necessary adapt the name so it is unique.
References add(), C_INVALID_INDEX, CDataVectorN< CType >::getIndex(), CDataObject::getObjectName(), mLoadedFunctions, pdelete, and CDataObject::setObjectName().
Referenced by CModel::convert2NonReversible(), and CReaction::createFunctionFromExpression().
| 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.
| const | ObjectSet & candidates |
| std::set< | const CDataObject * > & dependentFunctions |
References CMathDependencyGraph::appendAllDependents(), and mDependencies.
Referenced by CDataContainer::appendDeletedDependentData(), and removeFunction().
| void CFunctionDB::cleanup | ( | ) |
References CDataVector< CType >::cleanup(), CMathDependencyGraph::clear(), mDependencies, and mLoadedFunctions.
Referenced by ~CFunctionDB().
| CFunction * CFunctionDB::findFunction | ( | const std::string & | functionName | ) |
Delete the function functionName from the database
| const string | &functionName |
| const string | &functionName |
References C_INVALID_INDEX, CDataVectorN< CType >::getIndex(), and mLoadedFunctions.
Referenced by CEvaluationNodeCall::calls(), CEvaluationNodeCall::compile(), SBMLImporter::createCReactionFromReaction(), CSBMLExporter::createFunctionSetFromFunctionNames(), CODEExporter::exportSingleFunction(), CODEExporterC::exportSingleFunction(), SBMLImporter::findCorrespondingFunction(), SBMLImporter::findFunctionCalls(), CODEExporter::findFunctionsCalls(), CEvaluationNodeCall::getCalledTree(), SBMLImporter::isConstantFlux(), CODEExporter::modifyTreeForMassAction(), SBMLImporter::restoreFunctionDB(), CODEExporterC::setExportNameOfFunction(), CSBMLExporter::setFunctionSBMLIds(), suitableFunctions(), and CEvaluationNodeCall::toAST().
| 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.
| const string | &functionName |
References CDataVectorN< CType >::getIndex(), mLoadedFunctions, and CDataVector< CType >::size().
Referenced by CReaction::setFunction(), CReactionInterface::setFunctionAndDoMapping(), and CReactionInterface::setFunctionWithEmptyMapping().
| std::string CFunctionDB::getFilename | ( | ) | const |
References mFilename.
Retrieves a list of all functions used in the model
References CModel::appendAllDependents(), CDataVector< CType >::begin(), CFunction::completeFunctionList(), CDataVector< CType >::end(), and mLoadedFunctions.
Referenced by CCopasiXML::buildFunctionList(), and purgeUnusedUserDefinedFunctions().
| void CFunctionDB::initObjects | ( | ) |
References CDataContainer::addObjectReference(), CUnit::Avogadro, and mFilename.
Referenced by CFunctionDB().
| bool CFunctionDB::load | ( | ) |
References mLoadedFunctions, and CCopasiXML::setFunctionList().
Referenced by CRootContainer::initializeChildren().
| bool CFunctionDB::load | ( | const std::string & | fileName | ) |
References CCopasiXML::load(), mLoadedFunctions, and CCopasiXML::setFunctionList().
| C_INT32 CFunctionDB::load | ( | CReadConfig & | configbuffer | ) |
Loads an object with data coming from a CReadConfig object. (CReadConfig object reads an input stream)
| pconfigbuffer | reference to a CReadConfig object. |
References CDataVectorN< CType >::add(), C_INT32, CEvaluationTree::compile(), fatalError, CEvaluationTree::Function, CCopasiMessage::getLastMessage(), CEvaluationTree::getType(), CReadConfig::getVariable(), CFunction::load(), CReadConfig::LOOP, CEvaluationTree::MassAction, MCDataVector, mLoadedFunctions, NO_PARENT, pdelete, CCopasiMessage::peekLastMessage(), CEvaluationTree::PreDefined, and CEvaluationTree::UserDefined.
| CDataVectorN< CFunction > & CFunctionDB::loadedFunctions | ( | ) |
Retrieves the vector of loaded functions.
References mLoadedFunctions.
Referenced by CSBMLExporter::collectIds(), CFunction::completeFunctionList(), SBMLImporter::createCFunctionFromFunctionDefinition(), SBMLImporter::createCModelFromSBMLDocument(), SBMLImporter::createCReactionFromReaction(), COptProblem::elevateChildren(), CDataModel::removeSBMLIdFromFunctions(), and SBMLImporter::removeUnusedFunctions().
| void CFunctionDB::purgeUnusedUserDefinedFunctions | ( | ) |
Purge all unused user defined functions from the data base
References CDataObject::DataModel, CRootContainer::getDatamodelList(), getUsedFunctions(), and mLoadedFunctions.
| bool CFunctionDB::removeFunction | ( | const std::string & | key | ) |
References C_INVALID_INDEX, CKeyFactory::get(), CRootContainer::getKeyFactory(), mLoadedFunctions, and removeFunction().
| bool CFunctionDB::removeFunction | ( | size_t | index | ) |
| bool CFunctionDB::save | ( | const std::string & | fileName | ) |
References CDirEntry::dirName(), mLoadedFunctions, and CCopasiXML::setFunctionList().
| void CFunctionDB::setFilename | ( | const std::string & | filename | ) |
References mFilename.
| 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!
| const size_t | noSubstrates the number of substrates |
| const size_t | noProducts the number of products |
| const TriLogic | reversible the reversibility status |
References fatalError, findFunction(), CFunction::isSuitable(), mLoadedFunctions, CDataVector< CType >::size(), and TriTrue.
Referenced by CReactionInterface::getListOfPossibleFunctions().
|
private |
The function dependencies
Referenced by appendDependentFunctions(), and cleanup().
|
private |
Filename which contains the function database
Referenced by getFilename(), initObjects(), and setFilename().
|
private |
Vector of the currently loaded functions
Referenced by add(), addAndAdaptName(), cleanup(), findFunction(), findLoadFunction(), getUsedFunctions(), load(), loadedFunctions(), purgeUnusedUserDefinedFunctions(), removeFunction(), save(), and suitableFunctions().