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

Public Member Functions

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

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

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Destructor

Definition at line 1343 of file CCopasiXMLParser.cpp.

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 1393 of file CCopasiXMLParser.cpp.

References C_INVALID_INDEX, CCopasiMessage::EXCEPTION, CCopasiObject::getObjectName(), CFunction::getVariables(), CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pFunction, CFunctionParameters::remove(), CFunctionParameters::size(), START_ELEMENT, CFunctionParameter::TEMPORARY, and UNKNOWN_ELEMENT.

1394 {
1395  switch (mCurrentElement)
1396  {
1398 
1399  if (strcmp(pszName, "ListOfParameterDescriptions"))
1401  pszName, "ListOfParameterDescriptions", mParser.getCurrentLineNumber());
1402 
1405 
1406  // We need to remove all parameters which have been temporarily added to the list of variables
1407  {
1408  CFunction * pFunction = dynamic_cast<CFunction *>(mCommon.pFunction);
1409 
1410  if (pFunction)
1411  {
1412  CFunctionParameters & Variables = pFunction->getVariables();
1413  size_t i = Variables.size() - 1;
1414 
1415  for (; i != C_INVALID_INDEX && Variables[i]->getUsage() == CFunctionParameter::TEMPORARY; i--)
1416  Variables.remove(Variables[i]->getObjectName());
1417  }
1418  }
1419  /* Tell the parent element we are done. */
1420  mParser.onEndElement(pszName);
1421  break;
1422 
1423  case ParameterDescription:
1424 
1425  if (strcmp(pszName, "ParameterDescription"))
1427  pszName, "ParameterDescription", mParser.getCurrentLineNumber());
1428 
1430  break;
1431 
1432  case UNKNOWN_ELEMENT:
1433  mCurrentElement = mLastKnownElement;
1434  break;
1435 
1436  default:
1438  pszName, "???", mParser.getCurrentLineNumber());
1439  break;
1440  }
1441 
1442  return;
1443 }
#define START_ELEMENT
const std::string & getObjectName() const
#define MCXML
#define C_INVALID_INDEX
Definition: copasi.h:222
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
void remove(const std::string &name)
The class for handling a chemical kinetic function.
Definition: CFunction.h:29
int getCurrentLineNumber() const
Definition: CExpat.h:470
CFunctionParameters & getVariables()
Definition: CFunction.cpp:148
void CCopasiXMLParser::ListOfParameterDescriptionsElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 1348 of file CCopasiXMLParser.cpp.

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

1350 {
1351  mCurrentElement++; /* We should always be on the next element */
1352 
1353  switch (mCurrentElement)
1354  {
1356 
1358 
1359  if (strcmp(pszName, "ListOfParameterDescriptions"))
1361  pszName, "ListOfParameterDescriptions", mParser.getCurrentLineNumber());
1362 
1364 
1365  break;
1366 
1367  case ParameterDescription:
1368 
1369  if (strcmp(pszName, "ParameterDescription"))
1371  pszName, "ParameterDescription", mParser.getCurrentLineNumber());
1372 
1373  /* If we do not have a ParameterDescription element handler we create one. */
1374  if (!mpCurrentHandler)
1375  mpCurrentHandler = new ParameterDescriptionElement(mParser, mCommon);
1376 
1377  /* Push the ParameterDescription element handler on the stack and call it. */
1379  mpCurrentHandler->start(pszName, papszAttrs);
1380  break;
1381 
1382  default:
1386  mParser.onStartElement(pszName, papszAttrs);
1387  break;
1388  }
1389 
1390  return;
1391 }
UnknownElement mUnknownElement
#define MCXML
std::map< size_t, std::string > mFunctionParameterKeyMap
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
virtual void reset()
Definition: CXMLHandler.h:99
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: