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

Public Member Functions

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

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

Member Enumeration Documentation

Enum of invoked parsers

Enumerator
KineticLaw 
ListOfCallParameters 

Definition at line 757 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 4707 of file CCopasiXMLParser.cpp.

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 4774 of file CCopasiXMLParser.cpp.

References CCopasiMessage::EXCEPTION, CReaction::getFunction(), CCopasiRootContainer::getUndefinedFunction(), CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pFunction, SCopasiXMLParserCommon::pReaction, CReaction::setFunction(), CReaction::setParameterMappingVector(), SCopasiXMLParserCommon::SourceParameterKeys, START_ELEMENT, and UNKNOWN_ELEMENT.

4775 {
4776  switch (mCurrentElement)
4777  {
4778  case KineticLaw:
4779 
4780  if (strcmp(pszName, "KineticLaw"))
4782  pszName, "KineticLaw", mParser.getCurrentLineNumber());
4783 
4784  mCommon.pReaction->setFunction(dynamic_cast< CFunction * >(mCommon.pFunction));
4785 
4786  {
4787  std::map< std::string, std::vector< std::string > >::const_iterator it
4788  = mCommon.SourceParameterKeys.begin();
4789  std::map< std::string, std::vector< std::string > >::const_iterator end
4790  = mCommon.SourceParameterKeys.end();
4791 
4792  for (; it != end; ++it)
4793  if (it->second.size() > 0)
4794  mCommon.pReaction->setParameterMappingVector(it->first, it->second);
4795  }
4796  mCommon.SourceParameterKeys.clear();
4797 
4800 
4801  /* Tell the parent element we are done. */
4802  mParser.onEndElement(pszName);
4803  break;
4804 
4805  case ListOfCallParameters:
4806 
4807  if (strcmp(pszName, "ListOfCallParameters"))
4809  pszName, "ListOfCallParameters", mParser.getCurrentLineNumber());
4810 
4812  break;
4813 
4814  case UNKNOWN_ELEMENT:
4815 
4817  mCurrentElement = KineticLaw;
4818  else
4819  mCurrentElement = mLastKnownElement;
4820 
4821  break;
4822 
4823  default:
4825  pszName, "???", mParser.getCurrentLineNumber());
4826  break;
4827  }
4828 
4829  return;
4830 }
static CFunction * getUndefinedFunction()
#define START_ELEMENT
std::map< std::string, std::vector< std::string > > SourceParameterKeys
#define MCXML
void setParameterMappingVector(const std::string &parameterName, const std::vector< std::string > &keys)
Definition: CReaction.cpp:390
virtual void onEndElement(const XML_Char *pszName)
virtual void end(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
const CFunction * getFunction() const
Definition: CReaction.cpp:252
bool setFunction(const std::string &functionName)
Definition: CReaction.cpp:255
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::KineticLawElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 4712 of file CCopasiXMLParser.cpp.

References CCopasiMessage::EXCEPTION, CKeyFactory::get(), CCopasiObject::getObjectName(), CCopasiRootContainer::getUndefinedFunction(), SCopasiXMLParserCommon::KeyMap, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pFunction, SCopasiXMLParserCommon::pReaction, CCopasiMessage::RAW, and UNKNOWN_ELEMENT.

4714 {
4715  const char * Function;
4716 
4717  mCurrentElement++; /* We should always be on the next element */
4718 
4719  switch (mCurrentElement)
4720  {
4721  case KineticLaw:
4722 
4723  if (strcmp(pszName, "KineticLaw"))
4725  pszName, "KineticLaw", mParser.getCurrentLineNumber());
4726 
4727  Function = mParser.getAttributeValue("function", papszAttrs);
4728 
4729  mCommon.pFunction =
4730  dynamic_cast< CFunction* >(mCommon.KeyMap.get(Function));
4731 
4732  if (!mCommon.pFunction)
4733  {
4734  CCopasiMessage(CCopasiMessage::RAW, MCXML + 7, Function,
4735  mCommon.pReaction->getObjectName().c_str(),
4738  }
4739 
4740  // This must be deferred till the end since we need to check for consistency
4741  // of the parameters first (Bug 832)
4742  // mCommon.pReaction->setFunction(pFunction);
4743  break;
4744 
4745  case ListOfCallParameters:
4746 
4747  if (strcmp(pszName, "ListOfCallParameters"))
4749  pszName, "ListOfCallParameters", mParser.getCurrentLineNumber());
4750 
4752  mParser.onStartElement(pszName, papszAttrs);
4753 
4754  /* If we do not have a etc element handler we create one. */
4755  if (!mpCurrentHandler)
4756  mpCurrentHandler = new ListOfCallParametersElement(mParser, mCommon);
4757 
4758  /* Push the etc element handler on the stack and call it. */
4760  mpCurrentHandler->start(pszName, papszAttrs);
4761  break;
4762 
4763  default:
4767  mParser.onStartElement(pszName, papszAttrs);
4768  break;
4769  }
4770 
4771  return;
4772 }
static CFunction * getUndefinedFunction()
UnknownElement mUnknownElement
const std::string & getObjectName() const
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 UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
virtual void start(const XML_Char *C_UNUSED(pszName), const XML_Char **C_UNUSED(papszAttrs))
Definition: CXMLHandler.h:87
The class for handling a chemical kinetic function.
Definition: CFunction.h:29
int getCurrentLineNumber() const
Definition: CExpat.h:470

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