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

Public Member Functions

 AssignmentElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void end (const XML_Char *pszName)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~AssignmentElement ()
 
- 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 { Assignment = 0, Expression }
 

Private Attributes

std::pair< std::string,
std::string > 
mAssignmentPair
 
std::string mKey
 

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 1686 of file CCopasiXMLParser.h.

Member Enumeration Documentation

Enum of invoked parsers

Enumerator
Assignment 
Expression 

Definition at line 1694 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 3577 of file CCopasiXMLParser.cpp.

References SCopasiXMLParserCommon::CharacterData, CCopasiMessage::EXCEPTION, CCopasiMessage::getLastMessage(), CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pEventAssignment, CEventAssignment::setExpression(), CCopasiMessage::size(), START_ELEMENT, and UNKNOWN_ELEMENT.

3578 {
3579  switch (mCurrentElement)
3580  {
3581  case Assignment:
3582 
3583  if (strcmp(pszName, "Assignment"))
3585  pszName, "Assignment", mParser.getCurrentLineNumber());
3586 
3589 
3590  /* Tell the parent element we are done. */
3591  mParser.onEndElement(pszName);
3592  break;
3593 
3594  case Expression:
3595 
3596  if (strcmp(pszName, "Expression"))
3598  pszName, "Expression", mParser.getCurrentLineNumber());
3599 
3600  {
3601  size_t Size = CCopasiMessage::size();
3602 
3603  if (mCommon.pEventAssignment != NULL)
3605 
3607 
3608  // Remove error messages created by setExpression as this may fail
3609  // due to incomplete model specification at this time.
3610  while (CCopasiMessage::size() > Size)
3611  {
3613  }
3614  }
3615 
3617  break;
3618 
3619  case UNKNOWN_ELEMENT:
3621  break;
3622 
3623  default:
3625  pszName, "???", mParser.getCurrentLineNumber());
3626  break;
3627  }
3628 
3629  return;
3630 }
#define START_ELEMENT
bool setExpression(const std::string &expression)
Definition: CEvent.cpp:167
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
static size_t size()
static CCopasiMessage getLastMessage()
int getCurrentLineNumber() const
Definition: CExpat.h:470
CEventAssignment * pEventAssignment
void CCopasiXMLParser::AssignmentElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 3524 of file CCopasiXMLParser.cpp.

References CCopasiVectorN< CType >::add(), C_INVALID_INDEX, CCopasiMessage::EXCEPTION, CKeyFactory::get(), CEvent::getAssignments(), CCopasiVectorN< CType >::getIndex(), CModelEntity::getKey(), SCopasiXMLParserCommon::KeyMap, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pEvent, SCopasiXMLParserCommon::pEventAssignment, and UNKNOWN_ELEMENT.

3526 {
3527  mpCurrentHandler = NULL;
3528  mCurrentElement++; /* We should always be on the next element */
3529 
3530  const CModelEntity* pME = NULL;
3531 
3532  switch (mCurrentElement)
3533  {
3534  case Assignment:
3535 
3536  if (strcmp(pszName, "Assignment"))
3538  pszName, "Assignment", mParser.getCurrentLineNumber());
3539 
3540  mCommon.pEventAssignment = NULL;
3541  mKey = mParser.getAttributeValue("targetKey", papszAttrs);
3542  pME = dynamic_cast<const CModelEntity *>(mCommon.KeyMap.get(mKey));
3543 
3544  if (pME != NULL &&
3546  {
3549  }
3550 
3551  return;
3552 
3553  case Expression:
3554 
3555  if (!strcmp(pszName, "Expression"))
3556  {
3558  }
3559 
3560  break;
3561 
3562  default:
3566  break;
3567  }
3568 
3569  if (mpCurrentHandler)
3571 
3572  mParser.onStartElement(pszName, papszAttrs);
3573 
3574  return;
3575 }
const CCopasiVectorN< CEventAssignment > & getAssignments() const
Definition: CEvent.cpp:678
UnknownElement mUnknownElement
CCopasiObject * get(const std::string &key)
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
#define C_INVALID_INDEX
Definition: copasi.h:222
virtual size_t getIndex(const std::string &name) const
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
virtual bool add(const CType &src)
virtual const std::string & getKey() const
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
CharacterDataElement mCharacterDataElement
int getCurrentLineNumber() const
Definition: CExpat.h:470
CEventAssignment * pEventAssignment

Member Data Documentation

std::pair<std::string, std::string> CCopasiXMLParser::AssignmentElement::mAssignmentPair
private

Definition at line 1705 of file CCopasiXMLParser.h.

std::string CCopasiXMLParser::AssignmentElement::mKey
private

The key in the CopasiML file

Definition at line 1703 of file CCopasiXMLParser.h.


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