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

Public Member Functions

virtual void end (const XML_Char *pszName)
 
 ParameterGroupElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
void setDerivedElement (CCopasiParameterGroup *pDerivedElement)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~ParameterGroupElement ()
 
- 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 { ParameterGroup = 0, Content }
 

Private Attributes

bool mDerivedElement
 
ParameterGroupElementmpParameterGroupHandler
 
ParameterElementmpParameterHandler
 
ParameterTextElementmpParameterTextHandler
 

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

Member Enumeration Documentation

Enum of invoked parsers

Enumerator
ParameterGroup 
Content 

Definition at line 2306 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 8834 of file CCopasiXMLParser.cpp.

References pdelete.

8835 {
8839 }
#define pdelete(p)
Definition: copasi.h:215
ParameterGroupElement * mpParameterGroupHandler

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 8910 of file CCopasiXMLParser.cpp.

References CCopasiMessage::EXCEPTION, CCopasiParameter::getKey(), CCopasiObject::getObjectName(), CCopasiParameter::getType(), CCopasiTask::getType(), CCopasiParameter::KEY, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, CCopasiTask::parameterFitting, SCopasiXMLParserCommon::ParameterGroupStack, SCopasiXMLParserCommon::pCurrentParameter, SCopasiXMLParserCommon::pCurrentTask, pdelete, START_ELEMENT, UNKNOWN_ELEMENT, and SCopasiXMLParserCommon::UnmappedKeyParameters.

8911 {
8912  CCopasiParameter * pParameter = NULL;
8913 
8914  switch (mCurrentElement)
8915  {
8916  case ParameterGroup:
8917 
8918  if (strcmp(pszName, "ParameterGroup") && !mDerivedElement)
8920  pszName, "ParameterGroup", mParser.getCurrentLineNumber());
8921 
8925 
8926  mDerivedElement = false;
8927 
8929  mParser.onEndElement(pszName);
8930 
8931  break;
8932 
8933  case Content:
8934 
8935  if (!strcmp(pszName, "Parameter") &&
8936  !strcmp(pszName, "ParameterText") &&
8937  !strcmp(pszName, "ParameterGroup"))
8939  pszName, "Parameter", mParser.getCurrentLineNumber());
8940 
8941  // We need to fix the "Key" parameter of each "Experiment" of the the "Parameter Estimation" problem,
8942  // since they are handled by the elevation of the problem to CFitProblem.
8943  if (mCommon.pCurrentTask != NULL &&
8945  (mCommon.pCurrentParameter->getObjectName() == "Key" ||
8946  mCommon.pCurrentParameter->getObjectName() == "Experiment Key"))
8947  {
8948  if (mCommon.UnmappedKeyParameters.size() > 0 &&
8951  }
8952 
8953  // Derived elements like methods and problems have already parameters:
8954  if (mDerivedElement)
8955  {
8956  pParameter =
8958  }
8959 
8960  if (pParameter != NULL)
8961  {
8962  CCopasiParameter::Type OriginalType = pParameter->getType();
8963  *pParameter = *mCommon.pCurrentParameter;
8964 
8965  if (mCommon.UnmappedKeyParameters.size() > 0 &&
8967  {
8968  if (OriginalType == CCopasiParameter::KEY)
8969  {
8971  }
8972  else
8973  {
8975  }
8976  }
8977 
8979  }
8980  else
8981  {
8983  mCommon.pCurrentParameter = NULL;
8984  }
8985 
8987  break;
8988 
8989  case UNKNOWN_ELEMENT:
8991  break;
8992 
8993  default:
8995  pszName, "???", mParser.getCurrentLineNumber());
8996  break;
8997  }
8998 
8999  return;
9000 }
#define pdelete(p)
Definition: copasi.h:215
#define START_ELEMENT
const std::string & getObjectName() const
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
const CCopasiParameter::Type & getType() const
virtual const std::string & getKey() const
CCopasiParameter * pCurrentParameter
Type getType() const
int getCurrentLineNumber() const
Definition: CExpat.h:470
std::vector< std::string > UnmappedKeyParameters
std::stack< CCopasiParameterGroup * > ParameterGroupStack
void CCopasiXMLParser::ParameterGroupElement::setDerivedElement ( CCopasiParameterGroup pDerivedElement)

Set the derived element for which the handler is called such as methods and problems

Parameters
CCopasiParameterGroup* pDerivedElement

Definition at line 9002 of file CCopasiXMLParser.cpp.

References CCopasiXMLParser::mCommon, and SCopasiXMLParserCommon::ParameterGroupStack.

9003 {
9004  mCommon.ParameterGroupStack.push(pDerivedElement);
9005  mDerivedElement = true;
9006 }
std::stack< CCopasiParameterGroup * > ParameterGroupStack
void CCopasiXMLParser::ParameterGroupElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 8841 of file CCopasiXMLParser.cpp.

References CCopasiXMLParser::mCommon, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::ParameterGroupStack, and UNKNOWN_ELEMENT.

8843 {
8844  mCurrentElement++; // We should always be on the next element
8845  mpCurrentHandler = NULL;
8846  std::string name;
8847 
8848  switch (mCurrentElement)
8849  {
8850  case ParameterGroup:
8851 
8852  if (mDerivedElement)
8853  {
8854  return;
8855  }
8856  else if (!strcmp(pszName, "ParameterGroup"))
8857  {
8858  name = mParser.getAttributeValue("name", papszAttrs);
8860  return;
8861  }
8862 
8863  break;
8864 
8865  case Content:
8866 
8867  if (!strcmp(pszName, "Parameter"))
8868  {
8869  if (!mpParameterHandler)
8870  {
8871  mpParameterHandler = new ParameterElement(mParser, mCommon);
8872  }
8873 
8875  }
8876  else if (!strcmp(pszName, "ParameterText"))
8877  {
8879  {
8880  mpParameterTextHandler = new ParameterTextElement(mParser, mCommon);
8881  }
8882 
8884  }
8885  else if (!strcmp(pszName, "ParameterGroup"))
8886  {
8888  {
8890  }
8891 
8893  }
8894 
8895  break;
8896 
8897  default:
8901  break;
8902  }
8903 
8904  if (mpCurrentHandler)
8906 
8907  mParser.onStartElement(pszName, papszAttrs);
8908 }
UnknownElement mUnknownElement
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
ParameterGroupElement(CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
ParameterGroupElement * mpParameterGroupHandler
std::stack< CCopasiParameterGroup * > ParameterGroupStack

Member Data Documentation

bool CCopasiXMLParser::ParameterGroupElement::mDerivedElement
private

Definition at line 2316 of file CCopasiXMLParser.h.

ParameterGroupElement* CCopasiXMLParser::ParameterGroupElement::mpParameterGroupHandler
private

Definition at line 2314 of file CCopasiXMLParser.h.

ParameterElement* CCopasiXMLParser::ParameterGroupElement::mpParameterHandler
private

Definition at line 2312 of file CCopasiXMLParser.h.

ParameterTextElement* CCopasiXMLParser::ParameterGroupElement::mpParameterTextHandler
private

Definition at line 2313 of file CCopasiXMLParser.h.


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