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

Public Member Functions

virtual void end (const XML_Char *pszName)
 
 ProductElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~ProductElement ()
 
- 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 { Product = 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 957 of file CCopasiXMLParser.h.

Member Enumeration Documentation

Enum of invoked parsers

Enumerator
Product 

Definition at line 965 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 4284 of file CCopasiXMLParser.cpp.

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 4329 of file CCopasiXMLParser.cpp.

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

4330 {
4331  switch (mCurrentElement)
4332  {
4333  case Product:
4334 
4335  if (strcmp(pszName, "Product"))
4337  pszName, "Product", mParser.getCurrentLineNumber());
4338 
4341 
4342  /* Tell the parent element we are done. */
4343  mParser.onEndElement(pszName);
4344  break;
4345 
4346  case UNKNOWN_ELEMENT:
4348  break;
4349 
4350  default:
4352  pszName, "???", mParser.getCurrentLineNumber());
4353  break;
4354  }
4355 
4356  return;
4357 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::ProductElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 4289 of file CCopasiXMLParser.cpp.

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

4291 {
4292  const char * Metabolite;
4293  CMetab * pMetabolite;
4294 
4295  const char * Stoichiometry;
4296 
4297  mCurrentElement++; /* We should always be on the next element */
4298 
4299  switch (mCurrentElement)
4300  {
4301  case Product:
4302 
4303  if (strcmp(pszName, "Product"))
4305  pszName, "Product", mParser.getCurrentLineNumber());
4306 
4307  Metabolite = mParser.getAttributeValue("metabolite", papszAttrs);
4308  Stoichiometry = mParser.getAttributeValue("stoichiometry", papszAttrs);
4309 
4310  pMetabolite = dynamic_cast< CMetab * >(mCommon.KeyMap.get(Metabolite));
4311 
4312  if (!pMetabolite) fatalError();
4313 
4314  mCommon.pReaction->addProduct(pMetabolite->getKey(),
4315  CCopasiXMLInterface::DBL(Stoichiometry));
4316  break;
4317 
4318  default:
4322  mParser.onStartElement(pszName, papszAttrs);
4323  break;
4324  }
4325 
4326  return;
4327 }
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
bool addProduct(const std::string &metabKey, const C_FLOAT64 &multiplicity=1.0)
Definition: CReaction.cpp:236
#define MCXML
Definition: CMetab.h:178
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
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: