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

#include <CEvent.h>

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

Public Types

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

Public Member Functions

 CEvent (const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
 
 CEvent (const CEvent &src, const CCopasiContainer *pParent=NULL)
 
void cleanup ()
 
bool compile (std::vector< CCopasiContainer * > listOfContainer)
 
void deleteAssignment (const std::string &key)
 
const CCopasiVectorN
< CEventAssignment > & 
getAssignments () const
 
CCopasiVectorN
< CEventAssignment > & 
getAssignments ()
 
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 (bool regular=true, bool richtext=false) const
 
const bool & getPersistentTrigger () const
 
std::string getPriorityExpression () const
 
CExpressiongetPriorityExpressionPtr ()
 
const CExpressiongetPriorityExpressionPtr () const
 
const std::string & getSBMLId () const
 
std::string getTriggerExpression () const
 
const CExpressiongetTriggerExpressionPtr () const
 
CExpressiongetTriggerExpressionPtr ()
 
const TypegetType () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) 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 CCopasiContainer *pParent)
 
void setPersistentTrigger (const bool &persistentTrigger)
 
bool setPriorityExpression (const std::string &expression)
 
bool setPriorityExpressionPtr (CExpression *pExpression)
 
void setSBMLId (const std::string &id)
 
bool setTriggerExpression (const std::string &expression)
 
bool setTriggerExpressionPtr (CExpression *pExpression)
 
void setType (const Type &type)
 
 ~CEvent ()
 
- 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
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () 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 void print (std::ostream *ostream) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
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 ()
 
- Public Member Functions inherited from CAnnotation
bool addUnsupportedAnnotation (const std::string &name, const std::string &xml)
 
 CAnnotation ()
 
 CAnnotation (const CAnnotation &src)
 
const std::string & getMiriamAnnotation () const
 
const std::string & getNotes () const
 
UnsupportedAnnotationgetUnsupportedAnnotations ()
 
const UnsupportedAnnotationgetUnsupportedAnnotations () const
 
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)
 
virtual ~CAnnotation ()
 

Private Member Functions

void initObjects ()
 
CEventoperator= (const CEvent &)
 

Private Attributes

CCopasiVectorN< CEventAssignmentmAssignments
 
bool mDelayAssignment
 
bool mFireAtInitialTime
 
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 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 Member Functions inherited from CAnnotation
static CAnnotationcastObject (CCopasiObject *pObject)
 
static const CAnnotationcastObject (const CCopasiObject *pObject)
 
- 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
 
- Protected Attributes inherited from CAnnotation
std::string mKey
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 152 of file CEvent.h.

Member Enumeration Documentation

Enumerator
Assignment 
Discontinuity 
CutPlane 

Definition at line 155 of file CEvent.h.

Constructor & Destructor Documentation

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

Default constructor

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

Definition at line 238 of file CEvent.cpp.

References CKeyFactory::add(), CCopasiRootContainer::getKeyFactory(), CCopasiObject::getObjectType(), initObjects(), and CAnnotation::mKey.

239  :
240  CCopasiContainer(name, pParent, "Event"),
241  CAnnotation(),
242  mpModel(static_cast<CModel *>(getObjectAncestor("Model"))),
243  mAssignments("ListOfAssignments", this),
244  mDelayAssignment(true),
245  mFireAtInitialTime(false),
246  mPersistentTrigger(false),
247  mpTriggerExpression(NULL),
248  mpDelayExpression(NULL),
249  mpPriorityExpression(NULL),
251 {
253 
254  initObjects();
255 }
CExpression * mpTriggerExpression
Definition: CEvent.h:440
CCopasiContainer * getObjectAncestor(const std::string &type) const
CExpression * mpDelayExpression
Definition: CEvent.h:445
bool mPersistentTrigger
Definition: CEvent.h:435
const std::string & getObjectType() const
Type mType
Definition: CEvent.h:455
CModel * mpModel
Definition: CEvent.h:412
std::string mKey
Definition: CAnnotation.h:119
bool mFireAtInitialTime
Definition: CEvent.h:429
CCopasiVectorN< CEventAssignment > mAssignments
Definition: CEvent.h:417
std::string add(const std::string &prefix, CCopasiObject *pObject)
void initObjects()
Definition: CEvent.cpp:380
static CKeyFactory * getKeyFactory()
CExpression * mpPriorityExpression
Definition: CEvent.h:450
bool mDelayAssignment
Definition: CEvent.h:423
CEvent::CEvent ( const CEvent src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

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

Definition at line 257 of file CEvent.cpp.

References CKeyFactory::add(), CCopasiRootContainer::getKeyFactory(), CAnnotation::getMiriamAnnotation(), CCopasiObject::getObjectType(), initObjects(), CAnnotation::mKey, and CAnnotation::setMiriamAnnotation().

258  :
259  CCopasiContainer(src, pParent),
260  CAnnotation(src),
261  mpModel(static_cast<CModel *>(getObjectAncestor("Model"))),
262  mAssignments(src.mAssignments, this),
266  mpTriggerExpression(src.mpTriggerExpression != NULL ? new CExpression(*src.mpTriggerExpression, this) : NULL),
267  mpDelayExpression(src.mpDelayExpression != NULL ? new CExpression(*src.mpDelayExpression, this) : NULL),
268  mpPriorityExpression(src.mpPriorityExpression != NULL ? new CExpression(*src.mpPriorityExpression, this) : NULL),
269  mType(src.mType)
270 {
272 
273  initObjects();
274 
276 }
CExpression * mpTriggerExpression
Definition: CEvent.h:440
CCopasiContainer * getObjectAncestor(const std::string &type) const
CExpression * mpDelayExpression
Definition: CEvent.h:445
bool mPersistentTrigger
Definition: CEvent.h:435
const std::string & getObjectType() const
void setMiriamAnnotation(const std::string &miriamAnnotation, const std::string &newId, const std::string &oldId)
Type mType
Definition: CEvent.h:455
const std::string & getMiriamAnnotation() const
CModel * mpModel
Definition: CEvent.h:412
std::string mKey
Definition: CAnnotation.h:119
bool mFireAtInitialTime
Definition: CEvent.h:429
CCopasiVectorN< CEventAssignment > mAssignments
Definition: CEvent.h:417
std::string add(const std::string &prefix, CCopasiObject *pObject)
void initObjects()
Definition: CEvent.cpp:380
static CKeyFactory * getKeyFactory()
CExpression * mpPriorityExpression
Definition: CEvent.h:450
bool mDelayAssignment
Definition: CEvent.h:423
CEvent::~CEvent ( )

Destructor

Definition at line 278 of file CEvent.cpp.

References CCopasiRootContainer::getKeyFactory(), CAnnotation::mKey, mpDelayExpression, mpPriorityExpression, mpTriggerExpression, pdelete, and CKeyFactory::remove().

279 {
284 }
CExpression * mpTriggerExpression
Definition: CEvent.h:440
bool remove(const std::string &key)
#define pdelete(p)
Definition: copasi.h:215
CExpression * mpDelayExpression
Definition: CEvent.h:445
std::string mKey
Definition: CAnnotation.h:119
static CKeyFactory * getKeyFactory()
CExpression * mpPriorityExpression
Definition: CEvent.h:450

Member Function Documentation

void CEvent::cleanup ( )

Delete

bool CEvent::compile ( std::vector< CCopasiContainer * >  listOfContainer)

Compile the event.

Parameters
std::vector<CCopasiContainer * > listOfContainer
Returns
bool success

Definition at line 346 of file CEvent.cpp.

References CCopasiObject::addDirectDependency(), CCopasiVector< T >::begin(), CCopasiObject::clearDirectDependencies(), CExpression::compile(), CCopasiVector< T >::end(), mAssignments, mpDelayExpression, and mpTriggerExpression.

347 {
348  bool success = true;
349 
350  // Clear the old direct dependencies.
352 
353  // Compile the trigger expression
354  if (mpTriggerExpression != NULL)
355  {
356  success &= mpTriggerExpression->compile(listOfContainer);
358  }
359 
360  // Compile the delay expression
361  if (mpDelayExpression != NULL)
362  {
363  success &= mpDelayExpression->compile(listOfContainer);
365  }
366 
367  // Compile the assignments
370 
371  for (; itAssignment != endAssignment; ++itAssignment)
372  {
373  success &= (*itAssignment)->compile(listOfContainer);
374  addDirectDependency(*itAssignment);
375  }
376 
377  return success;
378 }
CExpression * mpTriggerExpression
Definition: CEvent.h:440
void clearDirectDependencies()
CExpression * mpDelayExpression
Definition: CEvent.h:445
iterator begin()
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
Definition: CExpression.cpp:97
iterator end()
void addDirectDependency(const CCopasiObject *pObject)
CCopasiVectorN< CEventAssignment > mAssignments
Definition: CEvent.h:417
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

Definition at line 688 of file CEvent.cpp.

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

689 {
690  CEventAssignment * pAssignment =
692 
693  if (pAssignment != NULL)
694  {
695  mAssignments.CCopasiVector< CEventAssignment >::remove(pAssignment);
696  }
697 }
CCopasiObject * get(const std::string &key)
CCopasiVectorN< CEventAssignment > mAssignments
Definition: CEvent.h:417
static CKeyFactory * getKeyFactory()
const CCopasiVectorN< CEventAssignment > & CEvent::getAssignments ( ) const
CCopasiVectorN< CEventAssignment > & CEvent::getAssignments ( )

Retrieve the assignments

Returns
CCopasiVectorN< CEventAssignment > & assignments

Definition at line 683 of file CEvent.cpp.

References mAssignments.

684 {
685  return mAssignments;
686 }
CCopasiVectorN< CEventAssignment > mAssignments
Definition: CEvent.h:417
const bool & CEvent::getDelayAssignment ( ) const

Retrieve whether to delay the calculation of the assignment.

Returns
const bool & delayCalculation

Definition at line 419 of file CEvent.cpp.

References mDelayAssignment.

Referenced by CModelAdd::addEvents(), CMathEventN::compile(), CMathEvent::compile(), CSBMLExporter::createEvent(), CQEventDM::data(), CModelExpansion::duplicateEvent(), CQEventWidget1::loadFromEvent(), CCopasiXML::saveModel(), and CQEventWidget1::saveToEvent().

420 {
421  return mDelayAssignment;
422 }
bool mDelayAssignment
Definition: CEvent.h:423
std::string CEvent::getDelayExpression ( ) const

Retrieve the expression of the delay as a string.

Returns
std::string expression

Definition at line 591 of file CEvent.cpp.

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

Referenced by CMathEventN::compile(), CMathEvent::compile(), CModel::convert2NonReversible(), CQEventDM::data(), CModelExpansion::duplicateEvent(), CQEventWidget1::loadFromEvent(), CCopasiXML::saveModel(), and CQEventWidget1::saveToEvent().

592 {
593  if (mpDelayExpression == NULL)
594  return "";
595 
597 
598  return mpDelayExpression->getInfix();
599 }
CExpression * mpDelayExpression
Definition: CEvent.h:445
bool updateInfix()
const std::string & getInfix() const
CExpression * CEvent::getDelayExpressionPtr ( )

Retrieve the pointer to the expression of the delay.

Returns
CExpression* pExpression

Definition at line 606 of file CEvent.cpp.

References mpDelayExpression.

Referenced by CModelAdd::addEvents(), CModelAdd::copyDelayExpression(), CQEventDM::data(), CModelExpansion::duplicateEvent(), CSBMLExporter::isEventSBMLCompatible(), SBMLImporter::removeUnusedFunctions(), and CModelExpansion::replaceInEvent().

607 {
608  return mpDelayExpression;
609 }
CExpression * mpDelayExpression
Definition: CEvent.h:445
const CExpression * CEvent::getDelayExpressionPtr ( ) const

Retrieve the pointer to the expression of the delay.

Returns
CExpression* pExpression

Definition at line 601 of file CEvent.cpp.

References mpDelayExpression.

602 {
603  return mpDelayExpression;
604 }
CExpression * mpDelayExpression
Definition: CEvent.h:445
const bool & CEvent::getFireAtInitialTime ( ) const

Retrieve whether the trigger may fire at the initial time.

Returns
const bool & fireAtInitialTime

Definition at line 429 of file CEvent.cpp.

References mFireAtInitialTime.

Referenced by CMathEventN::compile(), and CCopasiXML::saveModel().

430 {
431  return mFireAtInitialTime;
432 }
bool mFireAtInitialTime
Definition: CEvent.h:429
const std::string & CEvent::getKey ( ) const
virtual

Retrieves the key of the event

Returns
std::string key

Reimplemented from CAnnotation.

Definition at line 287 of file CEvent.cpp.

References CAnnotation::getKey().

Referenced by CModelExpansion::duplicateEvent(), CCopasiXMLParser::EventElement::end(), CQEventDM::insertRows(), CCopasiXML::saveModel(), CQEventDM::setData(), and CSBMLExporter::updateMIRIAMAnnotation().

288 {
289  return CAnnotation::getKey();
290 }
virtual const std::string & getKey() const
std::string CEvent::getObjectDisplayName ( bool  regular = true,
bool  richtext = false 
) const
virtual

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

Reimplemented from CCopasiObject.

Definition at line 464 of file CEvent.cpp.

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

465 {
466  CModel* tmp = dynamic_cast<CModel*>(this->getObjectAncestor("Model"));
467 
468  if (tmp)
469  return "((" + getObjectName() + "))";
470 
471  return CCopasiObject::getObjectDisplayName(regular, richtext);
472 }
CCopasiContainer * getObjectAncestor(const std::string &type) const
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
const std::string & getObjectName() const
Definition: CModel.h:50
const bool & CEvent::getPersistentTrigger ( ) const

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

Returns
const bool & persistentTrigger

Definition at line 439 of file CEvent.cpp.

References mPersistentTrigger.

Referenced by CMathEventN::compile(), and CCopasiXML::saveModel().

440 {
441  return mPersistentTrigger;
442 }
bool mPersistentTrigger
Definition: CEvent.h:435
std::string CEvent::getPriorityExpression ( ) const

Retrieve the expression of the priority as a string.

Returns
std::string expression

Definition at line 658 of file CEvent.cpp.

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

Referenced by CMathEventN::compile(), and CModel::convert2NonReversible().

659 {
660  if (mpPriorityExpression == NULL)
661  return "";
662 
664 
665  return mpPriorityExpression->getInfix();
666 }
bool updateInfix()
CExpression * mpPriorityExpression
Definition: CEvent.h:450
const std::string & getInfix() const
CExpression * CEvent::getPriorityExpressionPtr ( )

Retrieve the pointer to the expression of the priority.

Returns
CExpression* pExpression

Definition at line 668 of file CEvent.cpp.

References mpPriorityExpression.

669 {
670  return mpPriorityExpression;
671 }
CExpression * mpPriorityExpression
Definition: CEvent.h:450
const CExpression * CEvent::getPriorityExpressionPtr ( ) const

Retrieve the pointer to the expression of the priority.

Returns
CExpression* pExpression

Definition at line 673 of file CEvent.cpp.

References mpPriorityExpression.

674 {
675  return mpPriorityExpression;
676 }
CExpression * mpPriorityExpression
Definition: CEvent.h:450
const std::string & CEvent::getSBMLId ( ) const

Returns a reference to the SBML Id.

Definition at line 403 of file CEvent.cpp.

References mSBMLId.

Referenced by CSBMLExporter::collectIds(), CSBMLExporter::createEvent(), CSBMLExporter::exportEventAssignments(), and CCopasiXML::saveModel().

404 {
405  return this->mSBMLId;
406 }
std::string mSBMLId
Definition: CEvent.h:462
std::string CEvent::getTriggerExpression ( ) const

Retrieve the expression of trigger as a string.

Returns
std::string expression

Definition at line 524 of file CEvent.cpp.

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

Referenced by CMathEventN::CTrigger::allocate(), CMathEventN::CTrigger::compile(), CModel::convert2NonReversible(), CQEventDM::data(), CModelExpansion::duplicateEvent(), CQEventWidget1::loadFromEvent(), CCopasiXML::saveModel(), and CQEventWidget1::saveToEvent().

525 {
526  if (mpTriggerExpression == NULL)
527  return "";
528 
530 
531  return mpTriggerExpression->getInfix();
532 }
CExpression * mpTriggerExpression
Definition: CEvent.h:440
bool updateInfix()
const std::string & getInfix() const
const CExpression * CEvent::getTriggerExpressionPtr ( ) const

Retrieve the pointer to the expression of trigger.

Returns
CExpression* pExpression

Definition at line 534 of file CEvent.cpp.

References mpTriggerExpression.

Referenced by CModelAdd::addEvents(), CMathEvent::compile(), CModelAdd::copyTriggerExpression(), CQEventDM::data(), CModelExpansion::duplicateEvent(), CSBMLExporter::isEventSBMLCompatible(), SBMLImporter::removeUnusedFunctions(), and CModelExpansion::replaceInEvent().

535 {
536  return mpTriggerExpression;
537 }
CExpression * mpTriggerExpression
Definition: CEvent.h:440
CExpression * CEvent::getTriggerExpressionPtr ( )

Retrieve the pointer to the expression of trigger.

Returns
CExpression* pExpression

Definition at line 539 of file CEvent.cpp.

References mpTriggerExpression.

540 {
541  return mpTriggerExpression;
542 }
CExpression * mpTriggerExpression
Definition: CEvent.h:440
const CEvent::Type & CEvent::getType ( ) const

Retrieve the type of the event

Returns
const Type & type

Definition at line 699 of file CEvent.cpp.

References mType.

Referenced by CMathEvent::compile().

700 {
701  return mType;
702 }
Type mType
Definition: CEvent.h:455
void CEvent::initObjects ( )
private

Definition at line 380 of file CEvent.cpp.

References mpModel, and CModel::setCompileFlag().

Referenced by CEvent().

381 {
382  if (mpModel != NULL)
383  {
384  mpModel->setCompileFlag(true);
385  }
386 }
CModel * mpModel
Definition: CEvent.h:412
void setCompileFlag(bool flag=true)
Definition: CModel.cpp:607
bool CEvent::mustBeDeleted ( const DataObjectSet deletedObjects) const
virtual

Check whether an object must be deleted because its prerequisites can no longer be fulfilled due to the given deleted objects

Parameters
constDataObjectSet & deletedObjects
Returns
bool mustBeDeleted

Reimplemented from CCopasiObject.

Definition at line 293 of file CEvent.cpp.

References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), mAssignments, mpDelayExpression, mpPriorityExpression, and mpTriggerExpression.

294 {
295  bool MustBeDeleted = false;
296 
297  CCopasiObject::DataObjectSet ChildObjects;
298 
299  if (mpTriggerExpression != NULL)
300  {
301  ChildObjects.insert(mpTriggerExpression);
302  }
303 
304  if (mpDelayExpression != NULL)
305  {
306  ChildObjects.insert(mpDelayExpression);
307  }
308 
309  if (mpPriorityExpression != NULL)
310  {
311  ChildObjects.insert(mpPriorityExpression);
312  }
313 
314  // We need to add all assignment targets and expressions
317 
318  for (; itAssignment != endAssignment; ++itAssignment)
319  {
320  if ((*itAssignment)->getTargetObject() != NULL)
321  {
322  ChildObjects.insert((*itAssignment)->getTargetObject());
323  }
324 
325  if ((*itAssignment)->getExpressionPtr() != NULL)
326  {
327  ChildObjects.insert((*itAssignment)->getExpressionPtr());
328  }
329  }
330 
331  DataObjectSet::const_iterator it = ChildObjects.begin();
332  DataObjectSet::const_iterator end = ChildObjects.end();
333 
334  for (; it != end; ++it)
335  {
336  if ((*it)->mustBeDeleted(deletedObjects))
337  {
338  MustBeDeleted = true;
339  break;
340  }
341  }
342 
343  return MustBeDeleted;
344 }
CExpression * mpTriggerExpression
Definition: CEvent.h:440
CExpression * mpDelayExpression
Definition: CEvent.h:445
iterator begin()
iterator end()
CCopasiVectorN< CEventAssignment > mAssignments
Definition: CEvent.h:417
CExpression * mpPriorityExpression
Definition: CEvent.h:450
std::set< const CCopasiObject * > DataObjectSet
CEvent& CEvent::operator= ( const CEvent )
private
void CEvent::setDelayAssignment ( const bool &  delayCalculation)

Set whether the calculation or the assignment shall be delayed.

Parameters
constbool & delayCalculation

Definition at line 408 of file CEvent.cpp.

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

Referenced by CModelAdd::addEvents(), CModelExpansion::duplicateEvent(), SBMLImporter::importEvent(), CQEventWidget1::saveToEvent(), and CCopasiXMLParser::EventElement::start().

409 {
410  if (mDelayAssignment != delayAssignment &&
411  mpModel != NULL)
412  {
413  mpModel->setCompileFlag(true);
414  }
415 
416  mDelayAssignment = delayAssignment;
417 }
CModel * mpModel
Definition: CEvent.h:412
void setCompileFlag(bool flag=true)
Definition: CModel.cpp:607
bool mDelayAssignment
Definition: CEvent.h:423
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

Definition at line 544 of file CEvent.cpp.

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

Referenced by CModel::convert2NonReversible(), CModelAdd::copyDelayExpression(), CModelExpansion::duplicateEvent(), CCopasiXMLParser::EventElement::end(), and CQEventWidget1::saveToEvent().

545 {
546  if (mpDelayExpression == NULL)
547  mpDelayExpression = new CExpression("DelayExpression", this);
548 
549  if (mpDelayExpression->getInfix() != expression &&
550  mpModel != NULL)
551  {
552  mpModel->setCompileFlag(true);
553  }
554 
555  return mpDelayExpression->setInfix(expression);
556 }
virtual bool setInfix(const std::string &infix)
Definition: CExpression.cpp:63
CExpression * mpDelayExpression
Definition: CEvent.h:445
CModel * mpModel
Definition: CEvent.h:412
void setCompileFlag(bool flag=true)
Definition: CModel.cpp:607
const std::string & getInfix() const
bool CEvent::setDelayExpressionPtr ( CExpression pExpression)

Set the expression of delay from an expression.

Parameters
CExpression*pExpression
Returns
bool success

Definition at line 558 of file CEvent.cpp.

References CCopasiContainer::add(), CExpression::compile(), mpDelayExpression, mpModel, pdelete, CModel::setCompileFlag(), CCopasiObject::setObjectName(), and CCopasiObject::setObjectParent().

Referenced by SBMLImporter::importEvent().

559 {
560  if (pExpression == mpDelayExpression) return true;
561 
562  if (pExpression == NULL) return false;
563 
564  if (mpModel != NULL)
565  {
566  mpModel->setCompileFlag(true);
567  }
568 
570  mpDelayExpression = pExpression;
571 
572  mpDelayExpression->setObjectName("DelayExpression");
573  add(mpDelayExpression, true);
574  std::vector< CCopasiContainer * > listOfContainer;
575  listOfContainer.push_back(mpModel);
576 
577  if (mpDelayExpression->compile(listOfContainer))
578  {
579  pdelete(pOld);
580  return true;
581  }
582 
583  // If compile fails we do not take ownership
584  // and we remove the object from the container
585  remove(mpDelayExpression);
587  mpDelayExpression = pOld;
588  return false;
589 }
virtual bool setObjectParent(const CCopasiContainer *pParent)
#define pdelete(p)
Definition: copasi.h:215
CExpression * mpDelayExpression
Definition: CEvent.h:445
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
Definition: CExpression.cpp:97
CModel * mpModel
Definition: CEvent.h:412
void setCompileFlag(bool flag=true)
Definition: CModel.cpp:607
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
bool setObjectName(const std::string &name)
void CEvent::setFireAtInitialTime ( const bool &  fireAtInitialTime)

Set whether the trigger may fire at the initial time.

Parameters
constbool & fireAtInitialTime

Definition at line 424 of file CEvent.cpp.

References mFireAtInitialTime.

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

425 {
426  mFireAtInitialTime = fireAtInitialTime;
427 }
bool mFireAtInitialTime
Definition: CEvent.h:429
bool CEvent::setObjectParent ( const CCopasiContainer pParent)
virtual

Set the object parent

Parameters
constCCopasiContainer * pParent
Returns
bool success

Reimplemented from CCopasiObject.

Definition at line 444 of file CEvent.cpp.

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

445 {
446  if (pParent != getObjectParent() &&
447  mpModel != NULL)
448  {
449  mpModel->setCompileFlag(true);
450  }
451 
452  bool success = CCopasiContainer::setObjectParent(pParent);
453 
454  mpModel = static_cast<CModel *>(getObjectAncestor("Model"));
455 
456  if (mpModel != NULL)
457  {
458  mpModel->setCompileFlag(true);
459  }
460 
461  return success;
462 }
virtual bool setObjectParent(const CCopasiContainer *pParent)
CCopasiContainer * getObjectAncestor(const std::string &type) const
CModel * mpModel
Definition: CEvent.h:412
void setCompileFlag(bool flag=true)
Definition: CModel.cpp:607
Definition: CModel.h:50
CCopasiContainer * getObjectParent() const
void CEvent::setPersistentTrigger ( const bool &  persistentTrigger)

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

Parameters
constbool & persistentTrigger

Definition at line 434 of file CEvent.cpp.

References mPersistentTrigger.

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

435 {
436  mPersistentTrigger = persistentTrigger;
437 }
bool mPersistentTrigger
Definition: CEvent.h:435
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

Definition at line 611 of file CEvent.cpp.

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

Referenced by CModel::convert2NonReversible().

612 {
613  if (mpPriorityExpression == NULL)
614  mpPriorityExpression = new CExpression("PriorityExpression", this);
615 
616  if (mpPriorityExpression->getInfix() != expression &&
617  mpModel != NULL)
618  {
619  mpModel->setCompileFlag(true);
620  }
621 
622  return mpPriorityExpression->setInfix(expression);
623 }
virtual bool setInfix(const std::string &infix)
Definition: CExpression.cpp:63
CModel * mpModel
Definition: CEvent.h:412
void setCompileFlag(bool flag=true)
Definition: CModel.cpp:607
CExpression * mpPriorityExpression
Definition: CEvent.h:450
const std::string & getInfix() const
bool CEvent::setPriorityExpressionPtr ( CExpression pExpression)

Set the expression of priority from an expression.

Parameters
CExpression*pExpression
Returns
bool success

Definition at line 625 of file CEvent.cpp.

References CCopasiContainer::add(), CExpression::compile(), mpModel, mpPriorityExpression, pdelete, CModel::setCompileFlag(), CCopasiObject::setObjectName(), and CCopasiObject::setObjectParent().

626 {
627  if (pExpression == mpPriorityExpression) return true;
628 
629  if (pExpression == NULL) return false;
630 
631  if (mpModel != NULL)
632  {
633  mpModel->setCompileFlag(true);
634  }
635 
637  mpPriorityExpression = pExpression;
638 
639  mpPriorityExpression->setObjectName("PriorityExpression");
640  add(mpPriorityExpression, true);
641  std::vector< CCopasiContainer * > listOfContainer;
642  listOfContainer.push_back(mpModel);
643 
644  if (mpPriorityExpression->compile(listOfContainer))
645  {
646  pdelete(pOld);
647  return true;
648  }
649 
650  // If compile fails we do not take ownership
651  // and we remove the object from the container
652  remove(mpPriorityExpression);
654  mpPriorityExpression = pOld;
655  return false;
656 }
virtual bool setObjectParent(const CCopasiContainer *pParent)
#define pdelete(p)
Definition: copasi.h:215
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
Definition: CExpression.cpp:97
CModel * mpModel
Definition: CEvent.h:412
void setCompileFlag(bool flag=true)
Definition: CModel.cpp:607
CExpression * mpPriorityExpression
Definition: CEvent.h:450
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
bool setObjectName(const std::string &name)
void CEvent::setSBMLId ( const std::string &  id)

Sets the SBMLId.

Parameters
conststd::string & id

Definition at line 398 of file CEvent.cpp.

References mSBMLId.

Referenced by SBMLImporter::importEvent().

399 {
400  this->mSBMLId = id;
401 }
std::string mSBMLId
Definition: CEvent.h:462
bool CEvent::setTriggerExpression ( const std::string &  expression)

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

Parameters
conststd::string & expression
Returns
bool success

Definition at line 474 of file CEvent.cpp.

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

Referenced by CModel::convert2NonReversible(), CModelAdd::copyTriggerExpression(), CMathContainer::createDiscontinuityDataEvent(), CCrossSectionTask::createEvent(), CModelExpansion::duplicateEvent(), CCopasiXMLParser::EventElement::end(), and CQEventWidget1::saveToEvent().

475 {
476  if (mpTriggerExpression == NULL)
477  {
478  mpTriggerExpression = new CExpression("TriggerExpression", this);
480  }
481 
482  if (mpTriggerExpression->getInfix() != expression &&
483  mpModel != NULL)
484  {
485  mpModel->setCompileFlag(true);
486  }
487 
488  return mpTriggerExpression->setInfix(expression);
489 }
CExpression * mpTriggerExpression
Definition: CEvent.h:440
virtual bool setInfix(const std::string &infix)
Definition: CExpression.cpp:63
void setIsBoolean(const bool &booleanRequired)
Definition: CExpression.cpp:58
CModel * mpModel
Definition: CEvent.h:412
void setCompileFlag(bool flag=true)
Definition: CModel.cpp:607
const std::string & getInfix() const
bool CEvent::setTriggerExpressionPtr ( CExpression pExpression)

Set the expression of trigger from an expression.

Parameters
CExpression*pExpression
Returns
bool success

Definition at line 491 of file CEvent.cpp.

References CCopasiContainer::add(), CExpression::compile(), mpModel, mpTriggerExpression, pdelete, CModel::setCompileFlag(), CCopasiObject::setObjectName(), and CCopasiObject::setObjectParent().

Referenced by SBMLImporter::importEvent().

492 {
493  if (pExpression == mpTriggerExpression) return true;
494 
495  if (pExpression == NULL) return false;
496 
497  if (mpModel != NULL)
498  {
499  mpModel->setCompileFlag(true);
500  }
501 
503  mpTriggerExpression = pExpression;
504 
505  mpTriggerExpression->setObjectName("TriggerExpression");
506  add(mpTriggerExpression, true);
507  std::vector< CCopasiContainer * > listOfContainer;
508  listOfContainer.push_back(mpModel);
509 
510  if (mpTriggerExpression->compile(listOfContainer))
511  {
512  pdelete(pOld);
513  return true;
514  }
515 
516  // If compile fails we do not take ownership
517  // and we remove the object from the container
518  remove(mpTriggerExpression);
520  mpTriggerExpression = pOld;
521  return false;
522 }
virtual bool setObjectParent(const CCopasiContainer *pParent)
CExpression * mpTriggerExpression
Definition: CEvent.h:440
#define pdelete(p)
Definition: copasi.h:215
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
Definition: CExpression.cpp:97
CModel * mpModel
Definition: CEvent.h:412
void setCompileFlag(bool flag=true)
Definition: CModel.cpp:607
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
bool setObjectName(const std::string &name)
void CEvent::setType ( const Type type)

Set the type of the event

Parameters
constType & type

Definition at line 704 of file CEvent.cpp.

References mType.

Referenced by CMathContainer::createDiscontinuityDataEvent(), and CCrossSectionTask::createEvent().

705 {
706  mType = type;
707 }
Type mType
Definition: CEvent.h:455

Friends And Related Function Documentation

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

insert operator

Definition at line 388 of file CEvent.cpp.

389 {
390  os << "CEvent: " << d.getObjectName() << std::endl;
391  os << " SBML id: " << d.mSBMLId << std::endl;
392 
393  os << "----CEvent" << std::endl;
394 
395  return os;
396 }
const std::string & getObjectName() const
std::string mSBMLId
Definition: CEvent.h:462

Member Data Documentation

CCopasiVectorN< CEventAssignment > CEvent::mAssignments
private

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

Definition at line 417 of file CEvent.h.

Referenced by compile(), deleteAssignment(), getAssignments(), and mustBeDeleted().

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.

Definition at line 423 of file CEvent.h.

Referenced by getDelayAssignment(), and setDelayAssignment().

bool CEvent::mFireAtInitialTime
private

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

Definition at line 429 of file CEvent.h.

Referenced by getFireAtInitialTime(), and setFireAtInitialTime().

CExpression* CEvent::mpDelayExpression
private

Pointer to the Delay Expression of the event

Definition at line 445 of file CEvent.h.

Referenced by compile(), getDelayExpression(), getDelayExpressionPtr(), mustBeDeleted(), setDelayExpression(), setDelayExpressionPtr(), and ~CEvent().

bool CEvent::mPersistentTrigger
private

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

Definition at line 435 of file CEvent.h.

Referenced by getPersistentTrigger(), and setPersistentTrigger().

CModel* CEvent::mpModel
private
CExpression* CEvent::mpPriorityExpression
private

Pointer to the Priority Expression of the event

Definition at line 450 of file CEvent.h.

Referenced by getPriorityExpression(), getPriorityExpressionPtr(), mustBeDeleted(), setPriorityExpression(), setPriorityExpressionPtr(), and ~CEvent().

CExpression* CEvent::mpTriggerExpression
private

Pointer to the boolean Trigger Expression of the event

Definition at line 440 of file CEvent.h.

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

std::string CEvent::mSBMLId
private

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.

Definition at line 462 of file CEvent.h.

Referenced by getSBMLId(), operator<<(), and setSBMLId().

Type CEvent::mType
private

The type of the event

Definition at line 455 of file CEvent.h.

Referenced by getType(), and setType().


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