COPASI API  4.16.103
Public Member Functions | Private Types | Private Attributes | List of all members
CCopasiXMLParser::EventElement Class Reference
Inheritance diagram for CCopasiXMLParser::EventElement:
Inheritance graph
[legend]
Collaboration diagram for CCopasiXMLParser::EventElement:
Collaboration graph
[legend]

Public Member Functions

virtual void end (const XML_Char *pszName)
 
 EventElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~EventElement ()
 
- Public Member Functions inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
 CXMLElementHandler (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void end (const XML_Char *C_UNUSED(pszName))
 
virtual void reset ()
 
virtual void start (const XML_Char *C_UNUSED(pszName), const XML_Char **C_UNUSED(papszAttrs))
 
virtual ~CXMLElementHandler ()
 

Private Types

enum  Element {
  Event = 0, MiriamAnnotation, Comment, ListOfUnsupportedAnnotations,
  TriggerExpression, DelayExpression, ListOfAssignments
}
 

Private Attributes

std::string mKey
 
ListOfAssignmentsElementmpListOfAssignmentsElementHandler
 

Additional Inherited Members

- Protected Member Functions inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
void addFix (const std::string &key, CCopasiObject *pObject)
 
void deleteCurrentHandler ()
 
- Protected Attributes inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
SCopasiXMLParserCommonmCommon
 
C_INT32 mCurrentElement
 
C_INT32 mLastKnownElement
 
CCopasiXMLParsermParser
 
CXMLElementHandlermpCurrentHandler
 

Detailed Description

Definition at line 1585 of file CCopasiXMLParser.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CCopasiXMLParser::EventElement::EventElement ( CCopasiXMLParser parser,
SCopasiXMLParserCommon common 
)
CCopasiXMLParser::EventElement::~EventElement ( )
virtual

Destructor

Definition at line 3187 of file CCopasiXMLParser.cpp.

References pdelete.

3188 {
3190 }
#define pdelete(p)
Definition: copasi.h:215
ListOfAssignmentsElement * mpListOfAssignmentsElementHandler

Member Function Documentation

void CCopasiXMLParser::EventElement::end ( const XML_Char *  pszName)
virtual

End element handler

Parameters
constXML_Char *pszName

Definition at line 3315 of file CCopasiXMLParser.cpp.

References SCopasiXMLParserCommon::CharacterData, CCopasiMessage::EXCEPTION, CEvent::getKey(), CCopasiMessage::getLastMessage(), CAnnotation::getUnsupportedAnnotations(), CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pEvent, CEvent::setDelayExpression(), CAnnotation::setMiriamAnnotation(), CAnnotation::setNotes(), CEvent::setTriggerExpression(), CCopasiMessage::size(), START_ELEMENT, and UNKNOWN_ELEMENT.

3316 {
3317  switch (mCurrentElement)
3318  {
3319  case Event:
3320 
3321  if (strcmp(pszName, "Event"))
3323  pszName, "Event", mParser.getCurrentLineNumber());
3324 
3327 
3328  /* Tell the parent element we are done. */
3329  mParser.onEndElement(pszName);
3330  break;
3331 
3332  case MiriamAnnotation:
3333 
3334  if (strcmp(pszName, "MiriamAnnotation"))
3336  pszName, "MiriamAnnotation", mParser.getCurrentLineNumber());
3337 
3339  mCommon.CharacterData = "";
3340  break;
3341 
3342  case Comment:
3343 
3344  if (strcmp(pszName, "Comment"))
3346  pszName, "Comment", mParser.getCurrentLineNumber());
3347 
3349  mCommon.CharacterData = "";
3350  break;
3351 
3353 
3354  if (strcmp(pszName, "ListOfUnsupportedAnnotations"))
3356  pszName, "ListOfUnsupportedAnnotations", mParser.getCurrentLineNumber());
3357 
3359 
3360  break;
3361 
3362  case TriggerExpression:
3363 
3364  if (strcmp(pszName, "TriggerExpression"))
3365  {
3367  pszName, "TriggerExpression", mParser.getCurrentLineNumber());
3368  }
3369 
3370  {
3371  size_t Size = CCopasiMessage::size();
3372 
3374 
3375  // Remove error messages created by setExpression as this may fail
3376  // due to incomplete model specification at this time.
3377  while (CCopasiMessage::size() > Size)
3378  {
3380  }
3381  }
3382 
3383  break;
3384 
3385  case DelayExpression:
3386 
3387  if (strcmp(pszName, "DelayExpression"))
3388  {
3390  pszName, "DelayExpression", mParser.getCurrentLineNumber());
3391  }
3392 
3393  {
3394  size_t Size = CCopasiMessage::size();
3395 
3397 
3398  // Remove error messages created by setExpression as this may fail
3399  // due to incomplete model specification at this time.
3400  while (CCopasiMessage::size() > Size)
3401  {
3403  }
3404  }
3405 
3406  break;
3407 
3408  case ListOfAssignments:
3409  break;
3410 
3411  case UNKNOWN_ELEMENT:
3412  break;
3413 
3414  default:
3416  pszName, "???", mParser.getCurrentLineNumber());
3417  break;
3418  }
3419 
3421  return;
3422 }
#define START_ELEMENT
void setNotes(const std::string &notes)
#define MCXML
const CAnnotation::UnsupportedAnnotation & getUnsupportedAnnotations() const
void setMiriamAnnotation(const std::string &miriamAnnotation, const std::string &newId, const std::string &oldId)
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
bool setTriggerExpression(const std::string &expression)
Definition: CEvent.cpp:474
static size_t size()
bool setDelayExpression(const std::string &expression)
Definition: CEvent.cpp:544
static CCopasiMessage getLastMessage()
ListOfUnsupportedAnnotationsElement mListOfUnsupportedAnnotationsElement
UnsupportedAnnotation & getUnsupportedAnnotations()
int getCurrentLineNumber() const
Definition: CExpat.h:470
virtual const std::string & getKey() const
Definition: CEvent.cpp:287
void CCopasiXMLParser::EventElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 3192 of file CCopasiXMLParser.cpp.

References CCopasiVectorN< CType >::add(), CCopasiMessage::EXCEPTION, CModel::getEvents(), CVersion::getVersionDevel(), SCopasiXMLParserCommon::mAssignments, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pEvent, SCopasiXMLParserCommon::pModel, SCopasiXMLParserCommon::pVersion, CEvent::setDelayAssignment(), CEvent::setFireAtInitialTime(), CCopasiObject::setObjectName(), CEvent::setPersistentTrigger(), and UNKNOWN_ELEMENT.

3194 {
3195  const char * Name;
3196  bool DelayAssignment;
3197  bool FireAtInitialTime;
3198  bool PersistentTrigger;
3199 
3200  mpCurrentHandler = NULL;
3202 
3203  while (mpCurrentHandler == NULL)
3204  {
3205  mCurrentElement++; /* We should always be on the next element */
3206 
3207  switch (mCurrentElement)
3208  {
3209  case Event:
3210 
3211  if (strcmp(pszName, "Event"))
3213  pszName, "Event", mParser.getCurrentLineNumber());
3214 
3215  mKey = mParser.getAttributeValue("key", papszAttrs);
3216  Name = mParser.getAttributeValue("name", papszAttrs);
3217  DelayAssignment =
3218  mParser.toBool(mParser.getAttributeValue("delayAssignment", papszAttrs, false));
3219  FireAtInitialTime =
3220  mParser.toBool(mParser.getAttributeValue("fireAtInitialTime", papszAttrs, false));
3221 
3222  if (mCommon.pVersion->getVersionDevel() <= 90)
3223  {
3224  PersistentTrigger = true;
3225  }
3226  else
3227  {
3228  PersistentTrigger = mParser.toBool(mParser.getAttributeValue("persistentTrigger", papszAttrs, true));
3229  }
3230 
3231  mCommon.pEvent = new CEvent();
3232  addFix(mKey, mCommon.pEvent);
3233  mCommon.pEvent->setObjectName(Name);
3234  mCommon.pEvent->setDelayAssignment(DelayAssignment);
3235  mCommon.pEvent->setFireAtInitialTime(FireAtInitialTime);
3236  mCommon.pEvent->setPersistentTrigger(PersistentTrigger);
3237 
3238  mCommon.pModel->getEvents().add(mCommon. pEvent, true);
3239 
3241  return;
3242 
3243  case MiriamAnnotation:
3244 
3245  if (!strcmp(pszName, "MiriamAnnotation"))
3247 
3248  break;
3249 
3250  case Comment:
3251 
3252  if (!strcmp(pszName, "Comment"))
3254 
3255  break;
3256 
3258 
3259  if (!strcmp(pszName, "ListOfUnsupportedAnnotations"))
3261 
3262  break;
3263 
3264  case TriggerExpression:
3265 
3266  if (!strcmp(pszName, "TriggerExpression"))
3268 
3269  break;
3270 
3271  case DelayExpression:
3272 
3273  if (!strcmp(pszName, "DelayExpression"))
3275 
3276  break;
3277 
3278  case ListOfAssignments:
3279 
3280  if (!strcmp(pszName, "ListOfAssignments"))
3281  {
3283  {
3285  new ListOfAssignmentsElement(mParser, mCommon);
3286 
3287  mCommon.mAssignments.reserve(100);
3288  mCommon.mAssignments.resize(0);
3289  }
3290 
3292  }
3293 
3294  break;
3295 
3296  default:
3299  break;
3300  }
3301  }
3302 
3304 
3306  {
3308  }
3309 
3310  mParser.onStartElement(pszName, papszAttrs);
3311 
3312  return;
3313 }
Definition: CEvent.h:152
UnknownElement mUnknownElement
CCopasiVectorN< CEvent > & getEvents()
Definition: CModel.cpp:1110
void setPersistentTrigger(const bool &persistentTrigger)
Definition: CEvent.cpp:434
static bool toBool(const char *attribute)
Definition: CExpat.h:728
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
void addFix(const std::string &key, CCopasiObject *pObject)
Definition: CXMLHandler.h:119
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
virtual bool add(const CType &src)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
CharacterDataElement mCharacterDataElement
void setDelayAssignment(const bool &delayCalculation)
Definition: CEvent.cpp:408
MiriamAnnotationElement mMiriamAnnotationElement
std::vector< std::pair< std::string, std::string > > mAssignments
void setFireAtInitialTime(const bool &fireAtInitialTime)
Definition: CEvent.cpp:424
ListOfAssignmentsElement * mpListOfAssignmentsElementHandler
ListOfUnsupportedAnnotationsElement mListOfUnsupportedAnnotationsElement
int getCurrentLineNumber() const
Definition: CExpat.h:470
CommentElement mCommentElement
C_INT32 getVersionDevel() const
Definition: CVersion.cpp:129
bool setObjectName(const std::string &name)

Member Data Documentation

std::string CCopasiXMLParser::EventElement::mKey
private

The key in the CopasiML file

Definition at line 1607 of file CCopasiXMLParser.h.

ListOfAssignmentsElement* CCopasiXMLParser::EventElement::mpListOfAssignmentsElementHandler
private

Definition at line 1609 of file CCopasiXMLParser.h.


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