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

Public Member Functions

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

Private Attributes

std::string mActiveSet
 
ModelParameterSetElementmpModelParameterSetElement
 

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

Member Enumeration Documentation

Enum of invoked parsers

Enumerator
ListOfModelParameterSets 
ModelParameterSet 

Definition at line 176 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 27 of file ListOfModelParameterSets.cpp.

References pdelete.

28 {
30 }
#define pdelete(p)
Definition: copasi.h:215

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 89 of file ListOfModelParameterSets.cpp.

References CModelParameterSet::assignSetContent(), CCopasiMessage::EXCEPTION, CKeyFactory::get(), CCopasiMessage::getLastMessage(), CModel::getModelParameterSet(), SCopasiXMLParserCommon::KeyMap, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pModel, CCopasiMessage::size(), START_ELEMENT, and UNKNOWN_ELEMENT.

90 {
91  switch (mCurrentElement)
92  {
94 
95  if (strcmp(pszName, "ListOfModelParameterSets"))
97  pszName, "ListOfModelParameterSets", mParser.getCurrentLineNumber());
98 
102 
103  /* Tell the parent element we are done. */
104  mParser.onEndElement(pszName);
105  return;
106 
107  break;
108 
109  case ModelParameterSet:
110 
111  if (strcmp(pszName, "ModelParameterSet"))
113  pszName, "ModelParameterSet", mParser.getCurrentLineNumber());
114 
115  {
116  const CModelParameterSet * pModelParameterSet = dynamic_cast< CModelParameterSet * >(mCommon.KeyMap.get(mActiveSet));
117 
118  if (pModelParameterSet != NULL)
119  {
120  size_t Size = CCopasiMessage::size();
121 
122  mCommon.pModel->getModelParameterSet().assignSetContent(*pModelParameterSet, false);
123  delete pModelParameterSet;
124  mActiveSet = "";
125 
126  // Remove error messages created by setExpression as this may fail
127  // due to incomplete model specification at this time.
128  while (CCopasiMessage::size() > Size)
130  }
131  }
132 
134  break;
135 
136  case UNKNOWN_ELEMENT:
138  break;
139 
140  default:
142  pszName, "???", mParser.getCurrentLineNumber());
143  break;
144  }
145 
147 
148  return;
149 }
const CModelParameterSet & getModelParameterSet() const
Definition: CModel.cpp:1072
CCopasiObject * get(const std::string &key)
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
#define START_ELEMENT
static size_t size()
static CCopasiMessage getLastMessage()
int getCurrentLineNumber() const
Definition: CExpat.h:470
void assignSetContent(const CModelParameterSet &src, const bool &createMissing)
void CCopasiXMLParser::ListOfModelParameterSetsElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 33 of file ListOfModelParameterSets.cpp.

References CCopasiVector< T >::clear(), CCopasiMessage::EXCEPTION, CModel::getModelParameterSets(), CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pModel, and UNKNOWN_ELEMENT.

35 {
36  mpCurrentHandler = NULL;
38 
39  while (mpCurrentHandler == NULL)
40  {
41  mCurrentElement++; /* We should always be on the next element */
42 
43  switch (mCurrentElement)
44  {
46 
47  if (strcmp(pszName, "ListOfModelParameterSets"))
49  pszName, "ListOfModelParameterSets", mParser.getCurrentLineNumber());
50 
52 
54  mActiveSet = mParser.getAttributeValue("activeSet", papszAttrs, "");
55 
56  return;
57 
58  case ModelParameterSet:
59 
60  if (!strcmp(pszName, "ModelParameterSet"))
61  {
62  /* If we do not have a ModelParameterSet element handler we create one. */
65 
67  }
68 
69  break;
70 
71  default:
74  break;
75  }
76  }
77 
79 
81  {
82  mLastKnownElement = mCurrentElement;
83  }
84 
85  mParser.onStartElement(pszName, papszAttrs);
86 }
UnknownElement mUnknownElement
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)
const CCopasiVectorN< CModelParameterSet > & getModelParameterSets() const
Definition: CModel.cpp:1066
virtual void clear()
int getCurrentLineNumber() const
Definition: CExpat.h:470

Member Data Documentation

std::string CCopasiXMLParser::ListOfModelParameterSetsElement::mActiveSet
private

The key of the active parameter set

Definition at line 213 of file CCopasiXMLParser.h.

ModelParameterSetElement* CCopasiXMLParser::ListOfModelParameterSetsElement::mpModelParameterSetElement
private

A pointer to the ModelParameterSet element handler

Definition at line 218 of file CCopasiXMLParser.h.


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