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

Public Member Functions

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

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

Member Enumeration Documentation

Enum of invoked parsers

Enumerator
Modifier 

Definition at line 882 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 4454 of file CCopasiXMLParser.cpp.

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 4499 of file CCopasiXMLParser.cpp.

References CCopasiMessage::EXCEPTION, MCXML, CExpatTemplate< CExpat >::mParser, START_ELEMENT, and UNKNOWN_ELEMENT.

4500 {
4501  switch (mCurrentElement)
4502  {
4503  case Modifier:
4504 
4505  if (strcmp(pszName, "Modifier"))
4507  pszName, "Modifier", mParser.getCurrentLineNumber());
4508 
4511 
4512  /* Tell the parent element we are done. */
4513  mParser.onEndElement(pszName);
4514  break;
4515 
4516  case UNKNOWN_ELEMENT:
4518  break;
4519 
4520  default:
4522  pszName, "???", mParser.getCurrentLineNumber());
4523  break;
4524  }
4525 
4526  return;
4527 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::ModifierElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 4459 of file CCopasiXMLParser.cpp.

References CReaction::addModifier(), CCopasiMessage::EXCEPTION, fatalError, CKeyFactory::get(), CModelEntity::getKey(), SCopasiXMLParserCommon::KeyMap, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pReaction, and UNKNOWN_ELEMENT.

4461 {
4462  const char * Metabolite;
4463  CMetab * pMetabolite;
4464 
4465  const char * Stoichiometry;
4466 
4467  mCurrentElement++; /* We should always be on the next element */
4468 
4469  switch (mCurrentElement)
4470  {
4471  case Modifier:
4472 
4473  if (strcmp(pszName, "Modifier"))
4475  pszName, "Modifier", mParser.getCurrentLineNumber());
4476 
4477  Metabolite = mParser.getAttributeValue("metabolite", papszAttrs);
4478  Stoichiometry = mParser.getAttributeValue("stoichiometry", papszAttrs);
4479 
4480  pMetabolite = dynamic_cast< CMetab * >(mCommon.KeyMap.get(Metabolite));
4481 
4482  if (!pMetabolite) fatalError();
4483 
4484  mCommon.pReaction->addModifier(pMetabolite->getKey(),
4485  CCopasiXMLInterface::DBL(Stoichiometry));
4486  break;
4487 
4488  default:
4492  mParser.onStartElement(pszName, papszAttrs);
4493  break;
4494  }
4495 
4496  return;
4497 }
UnknownElement mUnknownElement
CCopasiObject * get(const std::string &key)
#define fatalError()
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
Definition: CMetab.h:178
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
bool addModifier(const std::string &metabKey, const C_FLOAT64 &multiplicity=1.0)
Definition: CReaction.cpp:240
virtual const std::string & getKey() const
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
int getCurrentLineNumber() const
Definition: CExpat.h:470

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