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

Public Member Functions

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

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

Member Enumeration Documentation

Enumerator
ListOfFunctions 
Function 

Definition at line 2867 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 651 of file CCopasiXMLParser.cpp.

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 700 of file CCopasiXMLParser.cpp.

References C_INVALID_INDEX, CEvaluationTree::compile(), CCopasiMessage::EXCEPTION, CCopasiObject::getObjectName(), CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pFunctionList, CCopasiMessage::RAW, CCopasiVector< T >::size(), START_ELEMENT, and UNKNOWN_ELEMENT.

701 {
702  switch (mCurrentElement)
703  {
704  case ListOfFunctions:
705 
706  if (strcmp(pszName, "ListOfFunctions"))
708  pszName, "ListOfFunctions", mParser.getCurrentLineNumber());
709 
712  {
713  size_t i, imax = mCommon.pFunctionList->size();
714 
715  for (i = imax - 1; i != C_INVALID_INDEX; i--)
716  {
717  CFunction * pFunction =
718  dynamic_cast<CFunction *>((*mCommon.pFunctionList)[i]);
719 
720  if (pFunction && !pFunction->compile())
721  {
723  pFunction->getObjectName().c_str(),
725  // We can keep the function as the compile is later checked again.
726  // mCommon.pFunctionList->CCopasiVector< CEvaluationTree >::remove(i);
727  }
728  }
729  }
730 
731  /* Tell the parent element we are done. */
732  mParser.onEndElement(pszName);
733  break;
734 
735  case Function:
736 
737  if (strcmp(pszName, "Function"))
739  pszName, "Function", mParser.getCurrentLineNumber());
740 
742  break;
743 
744  case UNKNOWN_ELEMENT:
745  mCurrentElement = mLastKnownElement;
746  break;
747 
748  default:
750  pszName, "???", mParser.getCurrentLineNumber());
751  break;
752  }
753 
754  return;
755 }
CCopasiVectorN< CFunction > * pFunctionList
#define START_ELEMENT
const std::string & getObjectName() const
virtual size_t size() const
#define MCXML
#define C_INVALID_INDEX
Definition: copasi.h:222
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
virtual bool compile()
The class for handling a chemical kinetic function.
Definition: CFunction.h:29
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::ListOfFunctionsElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 656 of file CCopasiXMLParser.cpp.

References CCopasiMessage::EXCEPTION, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pFunctionList, and UNKNOWN_ELEMENT.

658 {
659  mCurrentElement++; /* We should always be on the next element */
660 
661  switch (mCurrentElement)
662  {
663  case ListOfFunctions:
664 
665  if (strcmp(pszName, "ListOfFunctions"))
667  pszName, "ListOfFunctions", mParser.getCurrentLineNumber());
668 
669  if (!mCommon.pFunctionList)
671 
672  break;
673 
674  case Function:
675 
676  if (strcmp(pszName, "Function"))
678  pszName, "Function", mParser.getCurrentLineNumber());
679 
680  /* If we do not have a function element handler we create one. */
681  if (!mpCurrentHandler)
682  mpCurrentHandler = new FunctionElement(mParser, mCommon);
683 
684  /* Push the Function element handler on the stack and call it. */
686  mpCurrentHandler->start(pszName, papszAttrs);
687  break;
688 
689  default:
693  mParser.onStartElement(pszName, papszAttrs);
694  break;
695  }
696 
697  return;
698 }
CCopasiVectorN< CFunction > * pFunctionList
UnknownElement mUnknownElement
#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
int getCurrentLineNumber() const
Definition: CExpat.h:470

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