COPASI API
4.16.103
|
#include <CFunctionDB.h>
Public Member Functions | |
bool | add (CFunction *pFunction, const bool &adopt) |
CFunction * | addAndAdaptName (CFunction *pFunction) |
bool | appendDependentFunctions (std::set< const CCopasiObject * > candidates, std::set< const CCopasiObject * > &dependentFunctions) const |
CFunctionDB (const std::string &name, const CCopasiContainer *pParent) | |
void | cleanup () |
CFunction * | findFunction (const std::string &functionName) |
CFunction * | findLoadFunction (const std::string &functionName) |
std::string | getFilename () const |
std::vector< CFunction * > | getUsedFunctions (const CModel *pModel) const |
void | initObjects () |
std::set< std::string > | listDependentTrees (const std::string &name) const |
bool | load () |
bool | load (const std::string &fileName) |
C_INT32 | load (CReadConfig &configbuffer) |
CCopasiVectorN< CFunction > & | loadedFunctions () |
bool | removeFunction (size_t index) |
bool | removeFunction (const std::string &key) |
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 () |
![]() | |
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 CObjectInterface * | getObject (const CCopasiObjectName &cn) const |
virtual const objectMap & | getObjects () const |
virtual std::string | getUnits () const |
virtual const CCopasiObject * | getValueObject () const |
virtual bool | remove (CCopasiObject *pObject) |
virtual | ~CCopasiContainer () |
![]() | |
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 DataObjectSet & | getDirectDependencies (const DataObjectSet &context=DataObjectSet()) const |
virtual const std::string & | getKey () const |
CCopasiContainer * | getObjectAncestor (const std::string &type) const |
CCopasiDataModel * | getObjectDataModel () |
const CCopasiDataModel * | getObjectDataModel () const |
virtual std::string | getObjectDisplayName (bool regular=true, bool richtext=false) const |
const std::string & | getObjectName () const |
CCopasiContainer * | getObjectParent () const |
const std::string & | getObjectType () const |
virtual const CObjectInterface::ObjectSet & | getPrerequisites () const |
virtual Refresh * | getRefresh () const |
UpdateMethod * | getUpdateMethod () const |
virtual void * | getValuePointer () 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 () |
![]() | |
CObjectInterface () | |
virtual | ~CObjectInterface () |
Private Attributes | |
std::string | mFilename |
CCopasiVectorN< CFunction > | mLoadedFunctions |
Additional Inherited Members | |
![]() | |
typedef std::multimap < std::string, CCopasiObject * > | objectMap |
![]() | |
typedef std::set< const CCopasiObject * > | DataObjectSet |
typedef std::vector< Refresh * > | DataUpdateSequence |
![]() | |
typedef std::set< const CObjectInterface * > | ObjectSet |
typedef std::vector < CObjectInterface * > | UpdateSequence |
![]() | |
static std::vector< Refresh * > | buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet()) |
static void | setRenameHandler (CRenameHandler *rh) |
![]() | |
static const std::vector < CCopasiContainer * > | EmptyList |
![]() | |
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 } |
![]() | |
template<class CType > | |
CCopasiObject * | addMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
template<class CType > | |
CCopasiObject * | addObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
template<class CType > | |
CCopasiObject * | addVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
void | initObjects () |
![]() | |
CCopasiObject () | |
CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0) | |
![]() | |
objectMap | mObjects |
![]() | |
static CRenameHandler * | smpRenameHandler = NULL |
Definition at line 35 of file CFunctionDB.h.
CFunctionDB::CFunctionDB | ( | const std::string & | name, |
const CCopasiContainer * | pParent | ||
) |
Default constructor
const | std::string & name (default: "NoName") |
const | CCopasiContainer * pParent (default: NULL) |
Created for Copasi by Stefan Hoops (C) Stefan Hoops 2001
Definition at line 36 of file CFunctionDB.cpp.
References CONSTRUCTOR_TRACE, and initObjects().
|
virtual |
Destructor
Definition at line 46 of file CFunctionDB.cpp.
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) |
Definition at line 254 of file CFunctionDB.cpp.
References CCopasiVectorN< CType >::add(), and mLoadedFunctions.
Referenced by addAndAdaptName(), SBMLImporter::createCFunctionFromFunctionDefinition(), SBMLImporter::createCReactionFromReaction(), CQFunctionDM::insertRows(), CReaction::setFunctionFromExpressionTree(), FunctionWidget1::slotBtnNew(), and ReactionsWidget1::slotNewFunction().
Add the function to the database, if necessary adapt the name so it is unique.
Definition at line 258 of file CFunctionDB.cpp.
References add(), C_INVALID_INDEX, CCopasiVectorN< CType >::getIndex(), CCopasiObject::getObjectName(), mLoadedFunctions, pdelete, and CCopasiObject::setObjectName().
Referenced by CModel::convert2NonReversible(), test000058::test_bug1025_10(), test000058::test_bug1025_5(), test000059::test_unique_id_17(), test000059::test_unique_id_18(), test000059::test_unique_id_19(), test000059::test_unique_id_20(), test000059::test_unique_id_21(), and test000059::test_unique_id_21_2().
bool CFunctionDB::appendDependentFunctions | ( | std::set< const CCopasiObject * > | candidates, |
std::set< const CCopasiObject * > & | dependentFunctions | ||
) | const |
Appends pointers to function, which are dependent on any of the candidates to the list dependentFunctions.
std::set< | const CCopasiObject * > candidates |
std::set< | const CCopasiObject * > & dependentFunctions |
Definition at line 396 of file CFunctionDB.cpp.
References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), and mLoadedFunctions.
Referenced by CQMessageBox::confirmDelete(), and FunctionWidget1::leave().
void CFunctionDB::cleanup | ( | ) |
Definition at line 52 of file CFunctionDB.cpp.
References CCopasiVector< T >::cleanup(), 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 |
Definition at line 325 of file CFunctionDB.cpp.
References C_INVALID_INDEX, CCopasiVectorN< CType >::getIndex(), and mLoadedFunctions.
Referenced by CEvaluationNodeCall::calls(), CEvaluationNodeCall::compile(), SBMLImporter::createCFunctionFromFunctionDefinition(), SBMLImporter::createCReactionFromReaction(), CSBMLExporter::createFunctionSetFromFunctionNames(), expand_function_call(), CODEExporterC::exportSingleFunction(), CODEExporter::exportSingleFunction(), SBMLImporter::findCorrespondingFunction(), SBMLImporter::findFunctionCalls(), CODEExporter::findFunctionsCalls(), CEvaluationNodeCall::getCalledTree(), SBMLImporter::isConstantFlux(), CODEExporter::modifyTreeForMassAction(), SBMLImporter::restoreFunctionDB(), CODEExporterC::setExportNameOfFunction(), CReaction::setFunctionFromExpressionTree(), CSBMLExporter::setFunctionSBMLIds(), suitableFunctions(), test000067::test_bug1060(), test_compare_utilities::test_copasi_function_expansion(), 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 |
Definition at line 335 of file CFunctionDB.cpp.
References CCopasiObject::getObjectName(), mLoadedFunctions, and CCopasiVector< T >::size().
Referenced by CReaction::setFunction(), CReactionInterface::setFunctionAndDoMapping(), and CReactionInterface::setFunctionWithEmptyMapping().
std::string CFunctionDB::getFilename | ( | ) | const |
Retrieves a list of all functions used in the model
Definition at line 428 of file CFunctionDB.cpp.
References CModel::appendDependentModelObjects(), CCopasiVector< T >::begin(), CFunction::completeFunctionList(), CCopasiVector< T >::end(), and mLoadedFunctions.
Referenced by CCopasiXML::buildFunctionList().
void CFunctionDB::initObjects | ( | ) |
Definition at line 54 of file CFunctionDB.cpp.
References CCopasiContainer::addObjectReference(), and mFilename.
Referenced by CFunctionDB().
std::set< std::string > CFunctionDB::listDependentTrees | ( | const std::string & | name | ) | const |
Retrieve a list of evaluation trees depending on the tree with the given name.
const | std::string & name |
Definition at line 414 of file CFunctionDB.cpp.
References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), and mLoadedFunctions.
bool CFunctionDB::load | ( | ) |
Definition at line 59 of file CFunctionDB.cpp.
References FunctionDBxml, CCopasiXML::load(), mLoadedFunctions, and CCopasiXML::setFunctionList().
Referenced by CCopasiRootContainer::initializeChildren(), and DataModelGUI::loadFunctionDB().
bool CFunctionDB::load | ( | const std::string & | fileName | ) |
Definition at line 76 of file CFunctionDB.cpp.
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. |
Definition at line 98 of file CFunctionDB.cpp.
References CCopasiVectorN< CType >::add(), C_INT32, CEvaluationTree::compile(), fatalError, CEvaluationTree::Function, CCopasiMessage::getLastMessage(), CEvaluationTree::getType(), CReadConfig::getVariable(), CFunction::load(), CReadConfig::LOOP, CEvaluationTree::MassAction, MCCopasiVector, mLoadedFunctions, pdelete, CCopasiMessage::peekLastMessage(), CEvaluationTree::PreDefined, and CEvaluationTree::UserDefined.
CCopasiVectorN< CFunction > & CFunctionDB::loadedFunctions | ( | ) |
Retrieves the vector of loaded functions.
Definition at line 346 of file CFunctionDB.cpp.
References mLoadedFunctions.
Referenced by CSBMLExporter::collectIds(), CFunction::completeFunctionList(), SBMLImporter::createCFunctionFromFunctionDefinition(), SBMLImporter::createCModelFromSBMLDocument(), CQFunctionDM::data(), COptProblem::elevateChildren(), CQFunctionDM::isFunctionReadOnly(), CQBrowserPaneDM::load(), stress_test::normalizeFunctionDB(), CQFunctionDM::removeRows(), CCopasiDataModel::removeSBMLIdFromFunctions(), SBMLImporter::removeUnusedFunctions(), CQFunctionDM::rowCount(), CQFunctionDM::setData(), FunctionWidget1::slotBtnNew(), CQFunctionsWidget::slotDoubleClicked(), and ReactionsWidget1::slotNewFunction().
bool CFunctionDB::removeFunction | ( | size_t | index | ) |
Definition at line 291 of file CFunctionDB.cpp.
References CCopasiVector< T >::begin(), C_INVALID_INDEX, CCopasiVector< T >::end(), CCopasiRootContainer::getDatamodelList(), and mLoadedFunctions.
Referenced by removeFunction(), CQFunctionDM::removeRows(), SBMLImporter::restoreFunctionDB(), and FunctionWidget1::slotBtnDelete().
bool CFunctionDB::removeFunction | ( | const std::string & | key | ) |
Definition at line 311 of file CFunctionDB.cpp.
References C_INVALID_INDEX, CKeyFactory::get(), CCopasiRootContainer::getKeyFactory(), mLoadedFunctions, and removeFunction().
bool CFunctionDB::save | ( | const std::string & | fileName | ) |
Definition at line 91 of file CFunctionDB.cpp.
References mLoadedFunctions, and CCopasiXML::setFunctionList().
Referenced by DataModelGUI::saveFunctionDB().
void CFunctionDB::setFilename | ( | const std::string & | filename | ) |
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 CCopasiVector 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 |
Definition at line 350 of file CFunctionDB.cpp.
References fatalError, findFunction(), CFunction::isSuitable(), mLoadedFunctions, CCopasiVector< T >::size(), and TriTrue.
Referenced by SBMLImporter::findCorrespondingFunction(), and CReactionInterface::getListOfPossibleFunctions().
|
private |
Filename which contains the function database
Definition at line 42 of file CFunctionDB.h.
Referenced by getFilename(), initObjects(), and setFilename().
|
private |
Vector of the currently loaded functions
Definition at line 47 of file CFunctionDB.h.
Referenced by add(), addAndAdaptName(), appendDependentFunctions(), cleanup(), findFunction(), findLoadFunction(), getUsedFunctions(), listDependentTrees(), load(), loadedFunctions(), removeFunction(), save(), and suitableFunctions().