COPASI API  4.40.278
CEvent Class Reference

#include <CEvent.h>

Inheritance diagram for CEvent:
[legend]

Public Types

enum  Type { Assignment , Discontinuity , Callback , Stop }
 
- 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
 
- Public Types inherited from CAnnotation
typedef std::map< std::string, std::string > UnsupportedAnnotation
 

Public Member Functions

bool appendDependentAssignments (std::set< const CDataObject * > candidates, std::set< const CDataObject * > &dependents) const
 
virtual bool applyData (const CData &data, CUndoData::CChangeSet &changes)
 
 CEvent (const CEvent &src, const CDataContainer *pParent)
 
 CEvent (const std::string &name="NoName", const CDataContainer *pParent=NO_PARENT)
 
void cleanup ()
 
CIssue compile (CObjectInterface::ContainerList listOfContainer)
 
virtual void createUndoData (CUndoData &undoData, const CUndoData::Type &type, const CData &oldData=CData(), const CCore::Framework &framework=CCore::Framework::ParticleNumbers) const
 
void deleteAssignment (const std::string &key)
 
CDataVectorN< CEventAssignment > & getAssignments ()
 
const CDataVectorN< CEventAssignment > & getAssignments () const
 
const bool & getDelayAssignment () const
 
std::string getDelayExpression () const
 
CExpressiongetDelayExpressionPtr ()
 
const CExpressiongetDelayExpressionPtr () const
 
const bool & getFireAtInitialTime () const
 
virtual const std::string & getKey () const
 
virtual std::string getObjectDisplayName () const
 
std::string getOriginFor (const DataObjectSet &deletedObjects) const
 
const bool & getPersistentTrigger () const
 
std::string getPriorityExpression () const
 
CExpressiongetPriorityExpressionPtr ()
 
const CExpressiongetPriorityExpressionPtr () const
 
const std::string & getSBMLId () const
 
std::string getTriggerExpression () const
 
CExpressiongetTriggerExpressionPtr ()
 
const CExpressiongetTriggerExpressionPtr () const
 
const TypegetType () const
 
void setDelayAssignment (const bool &delayCalculation)
 
bool setDelayExpression (const std::string &expression)
 
bool setDelayExpressionPtr (CExpression *pExpression)
 
void setFireAtInitialTime (const bool &fireAtInitialTime)
 
virtual bool setObjectParent (const CDataContainer *pParent)
 
void setPersistentTrigger (const bool &persistentTrigger)
 
bool setPriorityExpression (const std::string &expression)
 
bool setPriorityExpressionPtr (CExpression *pExpression)
 
void setSBMLId (const std::string &id) const
 
bool setTriggerExpression (const std::string &expression)
 
bool setTriggerExpressionPtr (CExpression *pExpression)
 
void setType (const Type &type)
 
virtual CData toData () const
 
 ~CEvent ()
 
- Public Member Functions inherited from CDataContainer
virtual bool add (CDataObject *pObject, const bool &adopt=true)
 
virtual bool appendDeletedDependentData (CUndoData &undoData) const
 
 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 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 ~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
 
CDataContainergetObjectAncestor (const std::string &type) const
 
CDataModelgetObjectDataModel () const
 
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)
 
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 ()
 
- Public Member Functions inherited from CAnnotation
bool addUnsupportedAnnotation (const std::string &name, const std::string &xml)
 
bool applyData (const CData &data, CUndoData::CChangeSet &changes)
 
 CAnnotation ()
 
 CAnnotation (const CAnnotation &src)
 
void createUndoData (CUndoData &undoData, const CUndoData::Type &type, const CData &oldData=CData(), const CCore::Framework &framework=CCore::Framework::ParticleNumbers) const
 
const std::string & getMiriamAnnotation () const
 
const std::string & getNotes () const
 
UnsupportedAnnotationgetUnsupportedAnnotations ()
 
const UnsupportedAnnotationgetUnsupportedAnnotations () const
 
void initMiriamAnnotation (const std::string &newId)
 
bool operator== (const CAnnotation &rhs) const
 
bool removeUnsupportedAnnotation (const std::string &name)
 
bool replaceUnsupportedAnnotation (const std::string &name, const std::string &xml)
 
void setMiriamAnnotation (const std::string &miriamAnnotation, const std::string &newId, const std::string &oldId)
 
void setNotes (const std::string &notes)
 
CData toData () const
 
virtual ~CAnnotation ()
 

Static Public Member Functions

static CEventfromData (const CData &data, CUndoObjectInterface *pParent)
 
- 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 Member Functions inherited from CAnnotation
static CMIRIAMInfoallocateMiriamInfo (CDataContainer *pParent)
 
static CAnnotationcastObject (CDataObject *pObject)
 
static const CAnnotationcastObject (const CDataObject *pObject)
 
static void freeMiriamInfo (CDataContainer *pParent)
 

Private Member Functions

void initObjects ()
 
CEventoperator= (const CEvent &)
 

Private Attributes

CDataVectorN< CEventAssignmentmAssignments
 
bool mDelayAssignment
 
bool mFireAtInitialTime
 
CCallbackInterfacempCallback
 
CExpressionmpDelayExpression
 
bool mPersistentTrigger
 
CModelmpModel
 
CExpressionmpPriorityExpression
 
CExpressionmpTriggerExpression
 
std::string mSBMLId
 
Type mType
 

Friends

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

Additional Inherited Members

- 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
 
- Protected Attributes inherited from CAnnotation
std::string mKey
 

Member Enumeration Documentation

◆ Type

Enumerator
Assignment 
Discontinuity 
Callback 
Stop 

Constructor & Destructor Documentation

◆ CEvent() [1/2]

CEvent::CEvent ( const std::string &  name = "NoName",
const CDataContainer pParent = NO_PARENT 
)

Default constructor

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

References CKeyFactory::add(), CRootContainer::getKeyFactory(), CDataObject::getObjectType(), CAnnotation::initMiriamAnnotation(), initObjects(), and CAnnotation::mKey.

Referenced by fromData().

◆ CEvent() [2/2]

CEvent::CEvent ( const CEvent src,
const CDataContainer pParent 
)

◆ ~CEvent()

Member Function Documentation

◆ appendDependentAssignments()

bool CEvent::appendDependentAssignments ( std::set< const CDataObject * >  candidates,
std::set< const CDataObject * > &  dependents 
) const

Appends pointers to assignments which are dependent on the candidates to the list.

Parameters
std::set<const CDataObject * > candidates
std::set<const CDataObject * > & dependents
Returns
bool objectsAppended

◆ applyData()

◆ cleanup()

void CEvent::cleanup ( )

Delete

◆ compile()

◆ createUndoData()

◆ deleteAssignment()

void CEvent::deleteAssignment ( const std::string &  key)

Delete assignment with the given key. Please note this is not the target key.

Parameters
conststd::string & key

References CKeyFactory::get(), CRootContainer::getKeyFactory(), and mAssignments.

◆ fromData()

CEvent * CEvent::fromData ( const CData data,
CUndoObjectInterface pParent 
)
static

Static method to create a CDataObject based on the provided data

Parameters
constCData & data
Returns
CEvent * pDataObject

References CEvent(), CData::getProperty(), NO_PARENT, CData::OBJECT_NAME, and CDataValue::toString().

◆ getAssignments() [1/2]

CDataVectorN< CEventAssignment > & CEvent::getAssignments ( )

Retrieve the assignments

Returns
CDataVectorN< CEventAssignment > & assignments

References mAssignments.

◆ getAssignments() [2/2]

◆ getDelayAssignment()

const bool & CEvent::getDelayAssignment ( ) const

Retrieve whether to delay the calculation of the assignment.

Returns
const bool & delayCalculation

References mDelayAssignment.

Referenced by CModelAdd::addEvents(), CMathEvent::compile(), CSBMLExporter::createEvent(), CModelExpansion::duplicateEvent(), and CCopasiXML::saveModel().

◆ getDelayExpression()

std::string CEvent::getDelayExpression ( ) const

Retrieve the expression of the delay as a string.

Returns
std::string expression

References CEvaluationTree::getInfix(), mpDelayExpression, and CExpression::updateInfix().

Referenced by CMathEvent::compile(), createUndoData(), CModelExpansion::duplicateEvent(), CCopasiXML::saveModel(), and toData().

◆ getDelayExpressionPtr() [1/2]

◆ getDelayExpressionPtr() [2/2]

const CExpression * CEvent::getDelayExpressionPtr ( ) const

Retrieve the pointer to the expression of the delay.

Returns
CExpression* pExpression

References mpDelayExpression, and CExpression::updateInfix().

◆ getFireAtInitialTime()

const bool & CEvent::getFireAtInitialTime ( ) const

Retrieve whether the trigger may fire at the initial time.

Returns
const bool & fireAtInitialTime

References mFireAtInitialTime.

Referenced by CMathEvent::compile(), CSBMLExporter::createEvent(), CModelExpansion::duplicateEvent(), and CCopasiXML::saveModel().

◆ getKey()

const std::string & CEvent::getKey ( ) const
virtual

Retrieves the key of the event

Returns
std::string key

Reimplemented from CAnnotation.

References CAnnotation::getKey().

Referenced by CModelExpansion::duplicateEvent(), EventHandler::processEnd(), and CCopasiXML::saveModel().

◆ getObjectDisplayName()

std::string CEvent::getObjectDisplayName ( ) const
virtual

Retrieve display name. Special treatment for reaction to provide a shorter display

Reimplemented from CDataObject.

References CDataObject::getObjectAncestor(), CDataObject::getObjectDisplayName(), and CDataObject::getObjectName().

◆ getOriginFor()

std::string CEvent::getOriginFor ( const DataObjectSet deletedObjects) const

Return information where the element in the object set is being used.

Parameters
deletedObjectsan object set that is used by the event
Returns
a string representing how the object is being used, this will be one of "Unused", "Trigger", "Priority", "Delay", "EventAssignment Expression" or "EventAssignment Target"

References CDataVector< CType >::begin(), CEvaluationTree::containsCN(), CDataVector< CType >::end(), CDataObject::getCN(), CEventAssignment::getExpressionPtr(), CDataObject::getObjectDisplayName(), CEventAssignment::getTargetObject(), mAssignments, mpDelayExpression, mpPriorityExpression, mpTriggerExpression, and CDataObject::Separator.

◆ getPersistentTrigger()

const bool & CEvent::getPersistentTrigger ( ) const

Retrieve whether the trigger must remain true between firing and executions.

Returns
const bool & persistentTrigger

References mPersistentTrigger.

Referenced by CMathEvent::compile(), CSBMLExporter::createEvent(), CModelExpansion::duplicateEvent(), and CCopasiXML::saveModel().

◆ getPriorityExpression()

std::string CEvent::getPriorityExpression ( ) const

Retrieve the expression of the priority as a string.

Returns
std::string expression

References CEvaluationTree::getInfix(), mpPriorityExpression, and CExpression::updateInfix().

Referenced by CMathEvent::compile(), createUndoData(), CModelExpansion::duplicateEvent(), CCopasiXML::saveModel(), and toData().

◆ getPriorityExpressionPtr() [1/2]

CExpression * CEvent::getPriorityExpressionPtr ( )

Retrieve the pointer to the expression of the priority.

Returns
CExpression* pExpression

References mpPriorityExpression, and CExpression::updateInfix().

Referenced by CMathEvent::compile(), and CModelExpansion::duplicateEvent().

◆ getPriorityExpressionPtr() [2/2]

const CExpression * CEvent::getPriorityExpressionPtr ( ) const

Retrieve the pointer to the expression of the priority.

Returns
CExpression* pExpression

References mpPriorityExpression, and CExpression::updateInfix().

◆ getSBMLId()

const std::string & CEvent::getSBMLId ( ) const

◆ getTriggerExpression()

std::string CEvent::getTriggerExpression ( ) const

◆ getTriggerExpressionPtr() [1/2]

CExpression * CEvent::getTriggerExpressionPtr ( )

Retrieve the pointer to the expression of trigger.

Returns
CExpression* pExpression

References mpTriggerExpression, and CExpression::updateInfix().

◆ getTriggerExpressionPtr() [2/2]

◆ getType()

const CEvent::Type & CEvent::getType ( ) const

Retrieve the type of the event

Returns
const Type & type

References mType.

Referenced by CMathEvent::compile().

◆ initObjects()

void CEvent::initObjects ( )
private

References mpModel, and CModel::setCompileFlag().

Referenced by CEvent().

◆ operator=()

CEvent& CEvent::operator= ( const CEvent )
private

◆ setDelayAssignment()

void CEvent::setDelayAssignment ( const bool &  delayCalculation)

Set whether the calculation or the assignment shall be delayed.

Parameters
constbool & delayCalculation

References mDelayAssignment, mpModel, and CModel::setCompileFlag().

Referenced by CModelAdd::addEvents(), CAnalyticsTask::createEvent(), CCrossSectionTask::createEvent(), CModelExpansion::duplicateEvent(), SBMLImporter::importEvent(), and EventHandler::processStart().

◆ setDelayExpression()

bool CEvent::setDelayExpression ( const std::string &  expression)

Set the expression of delay from a string. The return value indicates if parsing the expression was successful.

Parameters
conststd::string & expression
Returns
bool success

References CEvaluationTree::getInfix(), mpDelayExpression, mpModel, CModel::setCompileFlag(), and CExpression::setInfix().

Referenced by applyData(), CModelAdd::copyDelayExpression(), CModelExpansion::duplicateEvent(), and EventHandler::processEnd().

◆ setDelayExpressionPtr()

bool CEvent::setDelayExpressionPtr ( CExpression pExpression)

Set the expression of delay from an expression.

Parameters
CExpression*pExpression
Returns
bool success

References CDataContainer::add(), CExpression::compile(), mpDelayExpression, mpModel, pdelete, CDataContainer::remove(), CModel::setCompileFlag(), CDataObject::setObjectName(), and CDataObject::setObjectParent().

Referenced by SBMLImporter::importEvent().

◆ setFireAtInitialTime()

void CEvent::setFireAtInitialTime ( const bool &  fireAtInitialTime)

Set whether the trigger may fire at the initial time.

Parameters
constbool & fireAtInitialTime

References mFireAtInitialTime, mpModel, and CModel::setCompileFlag().

Referenced by CModelExpansion::duplicateEvent(), SBMLImporter::importEvent(), and EventHandler::processStart().

◆ setObjectParent()

bool CEvent::setObjectParent ( const CDataContainer pParent)
virtual

Set the object parent

Parameters
constCDataContainer * pParent
Returns
bool success

Reimplemented from CDataObject.

References CDataObject::getObjectAncestor(), CDataObject::getObjectParent(), mpModel, CModel::setCompileFlag(), and CDataObject::setObjectParent().

◆ setPersistentTrigger()

void CEvent::setPersistentTrigger ( const bool &  persistentTrigger)

Set whether the trigger must remain true between firing and executions.

Parameters
constbool & persistentTrigger

References mPersistentTrigger, mpModel, and CModel::setCompileFlag().

Referenced by CAnalyticsTask::createEvent(), CCrossSectionTask::createEvent(), CModelExpansion::duplicateEvent(), SBMLImporter::importEvent(), and EventHandler::processStart().

◆ setPriorityExpression()

bool CEvent::setPriorityExpression ( const std::string &  expression)

Set the expression of priority from a string. The return value indicates if parsing the expression was successful.

Parameters
conststd::string & expression
Returns
bool success

References CEvaluationTree::getInfix(), mpModel, mpPriorityExpression, CModel::setCompileFlag(), and CExpression::setInfix().

Referenced by applyData(), CModelExpansion::duplicateEvent(), and EventHandler::processEnd().

◆ setPriorityExpressionPtr()

bool CEvent::setPriorityExpressionPtr ( CExpression pExpression)

Set the expression of priority from an expression.

Parameters
CExpression*pExpression
Returns
bool success

References CDataContainer::add(), CExpression::compile(), mpModel, mpPriorityExpression, pdelete, CDataContainer::remove(), CModel::setCompileFlag(), CDataObject::setObjectName(), and CDataObject::setObjectParent().

Referenced by SBMLImporter::importEvent().

◆ setSBMLId()

void CEvent::setSBMLId ( const std::string &  id) const

Sets the SBMLId.

Parameters
conststd::string & id

References mSBMLId.

Referenced by SBMLImporter::importEvent().

◆ setTriggerExpression()

bool CEvent::setTriggerExpression ( const std::string &  expression)

◆ setTriggerExpressionPtr()

bool CEvent::setTriggerExpressionPtr ( CExpression pExpression)

Set the expression of trigger from an expression.

Parameters
CExpression*pExpression
Returns
bool success

References CDataContainer::add(), CExpression::compile(), mpModel, mpTriggerExpression, pdelete, CDataContainer::remove(), CModel::setCompileFlag(), CDataObject::setObjectName(), and CDataObject::setObjectParent().

Referenced by SBMLImporter::importEvent().

◆ setType()

void CEvent::setType ( const Type type)

◆ toData()

Friends And Related Function Documentation

◆ operator<<

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

insert operator

Member Data Documentation

◆ mAssignments

CDataVectorN< CEventAssignment > CEvent::mAssignments
private

A vector assignments expressions which specify the changes made by the event.

Referenced by applyData(), compile(), createUndoData(), deleteAssignment(), getAssignments(), getOriginFor(), and toData().

◆ mDelayAssignment

bool CEvent::mDelayAssignment
private

A Boolean flag indicating whether the calculation or the assignment should be delayed in the case that a delay is present.

Referenced by applyData(), createUndoData(), getDelayAssignment(), setDelayAssignment(), and toData().

◆ mFireAtInitialTime

bool CEvent::mFireAtInitialTime
private

A Boolean flag indicating whether the trigger may fire at the initial time if the trigger expression is true;

Referenced by applyData(), createUndoData(), getFireAtInitialTime(), setFireAtInitialTime(), and toData().

◆ mpCallback

CCallbackInterface* CEvent::mpCallback
private

A pointer to an optional callback function to be executed when the event is triggered.

◆ mpDelayExpression

CExpression* CEvent::mpDelayExpression
private

◆ mPersistentTrigger

bool CEvent::mPersistentTrigger
private

A Boolean flag indicating whether the trigger expression must remain true between firing and executing the event.

Referenced by applyData(), createUndoData(), getPersistentTrigger(), setPersistentTrigger(), and toData().

◆ mpModel

◆ mpPriorityExpression

CExpression* CEvent::mpPriorityExpression
private

◆ mpTriggerExpression

CExpression* CEvent::mpTriggerExpression
private

Pointer to the boolean Trigger Expression of the event

Referenced by compile(), getOriginFor(), getTriggerExpression(), getTriggerExpressionPtr(), setTriggerExpression(), setTriggerExpressionPtr(), and ~CEvent().

◆ mSBMLId

std::string CEvent::mSBMLId
mutableprivate

The id of the corresponding event in an SBML file. This value is either set upon importing an SBML file, or when the object is first exported to an SBML file.

Referenced by getSBMLId(), and setSBMLId().

◆ mType

Type CEvent::mType
private

The type of the event

Referenced by getType(), setTriggerExpression(), and setType().


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