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

Public Member Functions

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

Member Enumeration Documentation

Enum of invoked parsers

Enumerator
Substrate 

Definition at line 1048 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 4114 of file CCopasiXMLParser.cpp.

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 4159 of file CCopasiXMLParser.cpp.

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

4160 {
4161  switch (mCurrentElement)
4162  {
4163  case Substrate:
4164 
4165  if (strcmp(pszName, "Substrate"))
4167  pszName, "Substrate", mParser.getCurrentLineNumber());
4168 
4171 
4172  /* Tell the parent element we are done. */
4173  mParser.onEndElement(pszName);
4174  break;
4175 
4176  case UNKNOWN_ELEMENT:
4178  break;
4179 
4180  default:
4182  pszName, "???", mParser.getCurrentLineNumber());
4183  break;
4184  }
4185 
4186  return;
4187 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::SubstrateElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 4119 of file CCopasiXMLParser.cpp.

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

4121 {
4122  const char * Metabolite;
4123  CMetab * pMetabolite;
4124 
4125  const char * Stoichiometry;
4126 
4127  mCurrentElement++; /* We should always be on the next element */
4128 
4129  switch (mCurrentElement)
4130  {
4131  case Substrate:
4132 
4133  if (strcmp(pszName, "Substrate"))
4135  pszName, "Substrate", mParser.getCurrentLineNumber());
4136 
4137  Metabolite = mParser.getAttributeValue("metabolite", papszAttrs);
4138  Stoichiometry = mParser.getAttributeValue("stoichiometry", papszAttrs);
4139 
4140  pMetabolite = dynamic_cast< CMetab * >(mCommon.KeyMap.get(Metabolite));
4141 
4142  if (!pMetabolite) fatalError();
4143 
4144  mCommon.pReaction->addSubstrate(pMetabolite->getKey(),
4145  CCopasiXMLInterface::DBL(Stoichiometry));
4146  break;
4147 
4148  default:
4152  mParser.onStartElement(pszName, papszAttrs);
4153  break;
4154  }
4155 
4156  return;
4157 }
UnknownElement mUnknownElement
bool addSubstrate(const std::string &metabKey, const C_FLOAT64 &multiplicity=1.0)
Definition: CReaction.cpp:232
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)
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: