COPASI API  4.16.103
Classes | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CMathEventN Class Reference

#include <CMathEvent.h>

Collaboration diagram for CMathEventN:
Collaboration graph
[legend]

Classes

class  CAssignment
 
class  CTrigger
 

Public Member Functions

void addAssignment (CMathObject *pTarget, CMathObject *pExpression)
 
 CMathEventN ()
 
bool compile (CEvent *pDataEvent, CMathContainer &container)
 
bool compile (CMathContainer &container)
 
void copy (const CMathEventN &src, CMathContainer &container, const size_t &valueOffset, const size_t &objectOffset)
 
const CVector< CAssignment > & getAssignments () const
 
const CTriggergetTrigger () const
 
void initialize (CMath::sPointers &pointers)
 
void setDelayExpression (const std::string &infix, CMathContainer &container)
 
void setPriorityExpression (const std::string &infix, CMathContainer &container)
 
void setTriggerExpression (const std::string &infix, CMathContainer &container)
 
 ~CMathEventN ()
 

Static Public Member Functions

static void allocate (CMathEventN *pEvent, const CEvent *pDataEvent, const CMathContainer &container)
 

Private Attributes

CVector< CAssignmentmAssignments
 
bool mDelayAssignment
 
bool mFireAtInitialTime
 
CMathObjectmpDelay
 
bool mPersistentTrigger
 
CMathObjectmpPriority
 
CTrigger mTrigger
 
CEvent::Type mType
 

Detailed Description

Definition at line 20 of file CMathEvent.h.

Constructor & Destructor Documentation

CMathEventN::CMathEventN ( )

Default constructor

Definition at line 846 of file CMathEvent.cpp.

846  :
848  mTrigger(),
849  mAssignments(),
850  mpDelay(NULL),
851  mpPriority(NULL),
852  mFireAtInitialTime(false),
853  mPersistentTrigger(false),
854  mDelayAssignment(true)
855 {}
bool mPersistentTrigger
Definition: CMathEvent.h:275
bool mFireAtInitialTime
Definition: CMathEvent.h:274
CTrigger mTrigger
Definition: CMathEvent.h:270
CMathObject * mpPriority
Definition: CMathEvent.h:273
CMathObject * mpDelay
Definition: CMathEvent.h:272
CVector< CAssignment > mAssignments
Definition: CMathEvent.h:271
bool mDelayAssignment
Definition: CMathEvent.h:276
CEvent::Type mType
Definition: CMathEvent.h:269
CMathEventN::~CMathEventN ( )

Destructor

Definition at line 860 of file CMathEvent.cpp.

861 {}

Member Function Documentation

void CMathEventN::addAssignment ( CMathObject pTarget,
CMathObject pExpression 
)

Add an assignment

Parameters
CMathObject* pTarget
CMathObject* pExpression

Definition at line 991 of file CMathEvent.cpp.

References mAssignments, CMathEventN::CAssignment::setExpression(), and CMathEventN::CAssignment::setTarget().

Referenced by CMathContainer::replaceDiscontinuousNode().

992 {
993  size_t OldSize = mAssignments.size();
994  mAssignments.resize(OldSize + 1, true);
995 
996  CAssignment & Assignment = mAssignments[OldSize];
997  Assignment.setTarget(pTarget);
998  Assignment.setExpression(pExpression);
999 }
CVector< CAssignment > mAssignments
Definition: CMathEvent.h:271
void CMathEventN::allocate ( CMathEventN pEvent,
const CEvent pDataEvent,
const CMathContainer container 
)
static

Definition at line 838 of file CMathEvent.cpp.

References CMathEventN::CTrigger::allocate(), CEvent::getAssignments(), mAssignments, mTrigger, and CCopasiVector< T >::size().

Referenced by CMathContainer::allocate().

841 {
842  pEvent->mTrigger.allocate(pDataEvent, container);
843  pEvent->mAssignments.resize(pDataEvent->getAssignments().size());
844 }
const CCopasiVectorN< CEventAssignment > & getAssignments() const
Definition: CEvent.cpp:678
virtual size_t size() const
CTrigger mTrigger
Definition: CMathEvent.h:270
CVector< CAssignment > mAssignments
Definition: CMathEvent.h:271
void allocate(const CEvent *pDataEvent, const CMathContainer &container)
Definition: CMathEvent.cpp:163
bool CMathEventN::compile ( CEvent pDataEvent,
CMathContainer container 
)

Definition at line 916 of file CMathEvent.cpp.

References CCopasiVector< T >::begin(), CMathEventN::CAssignment::compile(), CExpression::compile(), CMathEventN::CTrigger::compile(), CEvent::getAssignments(), CEvent::getDelayAssignment(), CEvent::getDelayExpression(), CEvent::getFireAtInitialTime(), CEvent::getPersistentTrigger(), CEvent::getPriorityExpression(), mAssignments, mDelayAssignment, mFireAtInitialTime, mpDelay, mPersistentTrigger, mpPriority, mTrigger, CMathObject::setExpression(), and CExpression::setInfix().

Referenced by CMathEventN::CTrigger::compile(), CMathContainer::compileEvents(), CMathEventN::CTrigger::compileFUNCTION(), and CMathEventN::CTrigger::setExpression().

918 {
919  bool success = true;
920 
923  mDelayAssignment = pDataEvent->getDelayAssignment();
924 
925  // Compile Trigger
926  success &= mTrigger.compile(pDataEvent, container);
927 
928  CAssignment * pAssignment = mAssignments.array();
929  CAssignment * pAssignmentEnd = pAssignment + mAssignments.size();
931 
932  // Compile assignments.
933  for (; pAssignment != pAssignmentEnd; ++pAssignment, ++itAssignment)
934  {
935  success &= pAssignment->compile(*itAssignment, container);
936  }
937 
938  std::vector< CCopasiContainer * > ListOfContainer;
939  // ListOfContainer.push_back(const_cast< CMathContainer * >(&container));
940 
941  // Compile the delay object.
942  CExpression DelayExpression("DelayExpression", &container);
943  success &= DelayExpression.setInfix(pDataEvent->getDelayExpression());
944  success &= DelayExpression.compile(ListOfContainer);
945  success &= mpDelay->setExpression(DelayExpression, container);
946 
947  // Compile the priority object.
948  CExpression PriorityExpression("PriorityExpression", &container);
949  success &= PriorityExpression.setInfix(pDataEvent->getPriorityExpression());
950  success &= PriorityExpression.compile(ListOfContainer);
951  success &= mpPriority->setExpression(PriorityExpression, container);
952 
953  return success;
954 }
const CCopasiVectorN< CEventAssignment > & getAssignments() const
Definition: CEvent.cpp:678
bool mPersistentTrigger
Definition: CMathEvent.h:275
const bool & getDelayAssignment() const
Definition: CEvent.cpp:419
bool compile(CEvent *pDataEvent, CMathContainer &container)
Definition: CMathEvent.cpp:247
iterator begin()
bool mFireAtInitialTime
Definition: CMathEvent.h:274
CTrigger mTrigger
Definition: CMathEvent.h:270
CMathObject * mpPriority
Definition: CMathEvent.h:273
const bool & getPersistentTrigger() const
Definition: CEvent.cpp:439
bool setExpression(const std::string &infix, const bool &isBoolean, CMathContainer &container)
CMathObject * mpDelay
Definition: CMathEvent.h:272
std::string getDelayExpression() const
Definition: CEvent.cpp:591
CVector< CAssignment > mAssignments
Definition: CMathEvent.h:271
bool mDelayAssignment
Definition: CMathEvent.h:276
const bool & getFireAtInitialTime() const
Definition: CEvent.cpp:429
std::string getPriorityExpression() const
Definition: CEvent.cpp:658
bool CMathEventN::compile ( CMathContainer container)

Definition at line 956 of file CMathEvent.cpp.

References CMathEventN::CTrigger::compile(), and mTrigger.

957 {
958  bool success = true;
959 
960  // Compile Trigger
961  success &= mTrigger.compile(NULL, container);
962 
963  // Compile assignments.
964  // Nothing to do since the target and expression objects are already compiled
965 
966  // The delay object is already compiled.
967  // The priority object is already compiled.
968 
969  return success;
970 }
bool compile(CEvent *pDataEvent, CMathContainer &container)
Definition: CMathEvent.cpp:247
CTrigger mTrigger
Definition: CMathEvent.h:270
void CMathEventN::copy ( const CMathEventN src,
CMathContainer container,
const size_t &  valueOffset,
const size_t &  objectOffset 
)

Copy an existing object

Parameters
constCMathEventN & src
CMathContainer& container
constsize_t & valueOffset
constsize_t & objectOffset

Definition at line 894 of file CMathEvent.cpp.

References CMathEventN::CAssignment::copy(), CMathEventN::CTrigger::copy(), mAssignments, mDelayAssignment, mFireAtInitialTime, mpDelay, mPersistentTrigger, mpPriority, mTrigger, and mType.

Referenced by CMathContainer::CMathContainer().

895 {
896  mType = src.mType;
897  mTrigger.copy(src.mTrigger, container, valueOffset, objectOffset);
898 
899  mAssignments.resize(src.mAssignments.size());
900  CAssignment * pAssignment = mAssignments.array();
901  CAssignment * pAssignmentEnd = pAssignment + mAssignments.size();
902  const CAssignment * pAssignmentSrc = src.mAssignments.array();
903 
904  for (; pAssignment != pAssignmentEnd; ++pAssignment, ++pAssignmentSrc)
905  {
906  pAssignment->copy(*pAssignmentSrc, container, valueOffset, objectOffset);
907  }
908 
909  mpDelay = src.mpDelay + objectOffset;
910  mpPriority = src.mpPriority + objectOffset;
914 }
bool mPersistentTrigger
Definition: CMathEvent.h:275
bool mFireAtInitialTime
Definition: CMathEvent.h:274
CTrigger mTrigger
Definition: CMathEvent.h:270
void copy(const CTrigger &src, CMathContainer &container, const size_t &valueOffset, const size_t &objectOffset)
Definition: CMathEvent.cpp:226
CMathObject * mpPriority
Definition: CMathEvent.h:273
CMathObject * mpDelay
Definition: CMathEvent.h:272
CVector< CAssignment > mAssignments
Definition: CMathEvent.h:271
bool mDelayAssignment
Definition: CMathEvent.h:276
CEvent::Type mType
Definition: CMathEvent.h:269
const CVector< CMathEventN::CAssignment > & CMathEventN::getAssignments ( ) const

Definition at line 1001 of file CMathEvent.cpp.

References mAssignments.

Referenced by CMathContainer::allocate().

1002 {
1003  return mAssignments;
1004 }
CVector< CAssignment > mAssignments
Definition: CMathEvent.h:271
const CMathEventN::CTrigger & CMathEventN::getTrigger ( ) const

Definition at line 863 of file CMathEvent.cpp.

References mTrigger.

Referenced by CMathContainer::allocate().

864 {
865  return mTrigger;
866 }
CTrigger mTrigger
Definition: CMathEvent.h:270
void CMathEventN::initialize ( CMath::sPointers pointers)

Definition at line 868 of file CMathEvent.cpp.

References CMath::Event, CMath::EventDelay, CMath::EventPriority, CMathEventN::CAssignment::initialize(), CMathObject::initialize(), CMathEventN::CTrigger::initialize(), mAssignments, mpDelay, mpPriority, mTrigger, CMath::sPointers::pEventDelays, CMath::sPointers::pEventDelaysObject, CMath::sPointers::pEventPriorities, CMath::sPointers::pEventPrioritiesObject, and CMath::SimulationTypeUndefined.

Referenced by CMathContainer::initializeEvents().

869 {
870  mTrigger.initialize(pointers);
871 
872  CAssignment * pAssignment = mAssignments.array();
873  CAssignment * pAssignmentEnd = pAssignment + mAssignments.size();
874 
875  // Initialize assignments.
876  for (; pAssignment != pAssignmentEnd; ++pAssignment)
877  {
878  pAssignment->initialize(pointers);
879  }
880 
881  // Initialize delay object.
882  mpDelay = pointers.pEventDelaysObject;
885  false, false, NULL);
886 
887  // Initialize priority object.
888  mpPriority = pointers.pEventDelaysObject;
891  false, false, NULL);
892 }
C_FLOAT64 * pEventDelays
Definition: CMathEnum.h:107
void initialize(CMath::sPointers &pointers)
Definition: CMathEvent.cpp:200
CTrigger mTrigger
Definition: CMathEvent.h:270
CMathObject * mpPriority
Definition: CMathEvent.h:273
C_FLOAT64 * pEventPriorities
Definition: CMathEnum.h:108
CMathObject * mpDelay
Definition: CMathEvent.h:272
CVector< CAssignment > mAssignments
Definition: CMathEvent.h:271
CMathObject * pEventDelaysObject
Definition: CMathEnum.h:134
static void initialize(CMathObject *&pObject, C_FLOAT64 *&pValue, const CMath::ValueType &valueType, const CMath::EntityType &entityType, const CMath::SimulationType &simulationType, const bool &isIntensiveProperty, const bool &isInitialValue, const CCopasiObject *pDataObject)
Definition: CMathObject.cpp:23
CMathObject * pEventPrioritiesObject
Definition: CMathEnum.h:135
void CMathEventN::setDelayExpression ( const std::string &  infix,
CMathContainer container 
)

Set the delay expression

Parameters
conststd::string & infix
CMathContainer& container

Definition at line 977 of file CMathEvent.cpp.

References mpDelay, and CMathObject::setExpression().

978 {
979  assert(mpDelay != NULL);
980 
981  mpDelay->setExpression(infix, false, container);
982 }
bool setExpression(const std::string &infix, const bool &isBoolean, CMathContainer &container)
CMathObject * mpDelay
Definition: CMathEvent.h:272
void CMathEventN::setPriorityExpression ( const std::string &  infix,
CMathContainer container 
)

Set the priority expression

Parameters
conststd::string & infix
CMathContainer& container

Definition at line 984 of file CMathEvent.cpp.

References mpPriority, and CMathObject::setExpression().

985 {
986  assert(mpPriority != NULL);
987 
988  mpPriority->setExpression(infix, false, container);
989 }
CMathObject * mpPriority
Definition: CMathEvent.h:273
bool setExpression(const std::string &infix, const bool &isBoolean, CMathContainer &container)
void CMathEventN::setTriggerExpression ( const std::string &  infix,
CMathContainer container 
)

Set the trigger expression

Parameters
conststd::string & infix
CMathContainer& container

Definition at line 972 of file CMathEvent.cpp.

References mTrigger, and CMathEventN::CTrigger::setExpression().

Referenced by CMathContainer::replaceDiscontinuousNode().

973 {
974  mTrigger.setExpression(infix, container);
975 }
void setExpression(const std::string &infix, CMathContainer &container)
Definition: CMathEvent.cpp:292
CTrigger mTrigger
Definition: CMathEvent.h:270

Member Data Documentation

CVector< CAssignment > CMathEventN::mAssignments
private

Definition at line 271 of file CMathEvent.h.

Referenced by addAssignment(), allocate(), compile(), copy(), getAssignments(), and initialize().

bool CMathEventN::mDelayAssignment
private

Definition at line 276 of file CMathEvent.h.

Referenced by compile(), and copy().

bool CMathEventN::mFireAtInitialTime
private

Definition at line 274 of file CMathEvent.h.

Referenced by compile(), and copy().

CMathObject* CMathEventN::mpDelay
private

Definition at line 272 of file CMathEvent.h.

Referenced by compile(), copy(), initialize(), and setDelayExpression().

bool CMathEventN::mPersistentTrigger
private

Definition at line 275 of file CMathEvent.h.

Referenced by compile(), and copy().

CMathObject* CMathEventN::mpPriority
private

Definition at line 273 of file CMathEvent.h.

Referenced by compile(), copy(), initialize(), and setPriorityExpression().

CTrigger CMathEventN::mTrigger
private

Definition at line 270 of file CMathEvent.h.

Referenced by allocate(), compile(), copy(), getTrigger(), initialize(), and setTriggerExpression().

CEvent::Type CMathEventN::mType
private

Definition at line 269 of file CMathEvent.h.

Referenced by copy().


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