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

Public Member Functions

virtual void end (const XML_Char *pszName)
 
 PlotSpecificationElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~PlotSpecificationElement ()
 
- 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 {
  PlotSpecification = 0, Parameter, ParameterGroup, ListOfChannels,
  ListOfPlotItems
}
 

Private Attributes

size_t mLineNumber
 

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

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Destructor

Definition at line 6016 of file CCopasiXMLParser.cpp.

6017 {}

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 6117 of file CCopasiXMLParser.cpp.

References CCopasiParameter::BOOL, CCopasiParameter::CN, CCopasiParameter::DOUBLE, CCopasiMessage::EXCEPTION, CCopasiParameter::EXPRESSION, fatalError, CCopasiParameter::FILE, CKeyFactory::get(), CCopasiParameter::getKey(), CCopasiObject::getKey(), CCopasiObject::getObjectName(), CCopasiParameterGroup::getParameter(), CCopasiParameter::getType(), CCopasiParameter::getValue(), CCopasiParameter::GROUP, CCopasiParameter::INT, CCopasiParameter::INVALID, CCopasiParameter::KEY, SCopasiXMLParserCommon::KeyMap, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, CCopasiParameter::Value::pBOOL, CCopasiParameter::Value::pCN, SCopasiXMLParserCommon::pCurrentParameter, SCopasiXMLParserCommon::pCurrentPlot, pdelete, CCopasiParameter::Value::pDOUBLE, CCopasiParameter::Value::pFILE, CCopasiParameter::Value::pINT, CCopasiParameter::Value::pKEY, CCopasiParameter::Value::pSTRING, CCopasiParameter::Value::pUDOUBLE, CCopasiParameter::Value::pUINT, CCopasiMessage::RAW, CCopasiParameter::setValue(), START_ELEMENT, CCopasiParameter::STRING, CCopasiParameter::UDOUBLE, CCopasiParameter::UINT, UNKNOWN_ELEMENT, and SCopasiXMLParserCommon::UnmappedKeyParameters.

6118 {
6119  CCopasiParameter* p;
6120 
6121  switch (mCurrentElement)
6122  {
6123  case PlotSpecification:
6124 
6125  if (!strcmp(pszName, "PlotSpecification"))
6126  {
6129  mParser.onEndElement(pszName);
6130  }
6131 
6132  break;
6133 
6134  case Parameter:
6135 
6136  if (!strcmp(pszName, "Parameter"))
6137  {
6139 
6140  if (p)
6141  {
6142  switch (p->getType())
6143  {
6144  case CCopasiParameter::INT:
6146  break;
6147 
6150  break;
6151 
6154  break;
6155 
6158  break;
6159 
6162  break;
6163 
6166  break;
6167 
6168  case CCopasiParameter::KEY:
6169  {
6170  CCopasiObject * pObject =
6172 
6173  if (pObject)
6174  p->setValue(pObject->getKey());
6175  else
6176  {
6178  mCommon.UnmappedKeyParameters.push_back(p->getKey());
6179  }
6180  }
6181  break;
6182 
6185  break;
6186 
6187  case CCopasiParameter::CN:
6189  break;
6190 
6194  break;
6195 
6196  default:
6197  fatalError();
6198  break;
6199  }
6200  }
6201  else
6202  {
6205  mLineNumber);
6206  }
6207 
6210  }
6211 
6212  break;
6213 
6214  case ParameterGroup:
6215 
6216  if (strcmp(pszName, "ParameterGroup"))
6217  {
6219 
6220  if (p)
6221  {
6222  switch (p->getType())
6223  {
6225  *(CCopasiParameterGroup *) p =
6227  break;
6228 
6229  case CCopasiParameter::INT:
6235  case CCopasiParameter::CN:
6236  case CCopasiParameter::KEY:
6240  break;
6241 
6242  default:
6243  fatalError();
6244  break;
6245  }
6246  }
6247  else
6248  {
6251  mLineNumber);
6252  }
6253 
6256  }
6257 
6258  break;
6259 
6260  case ListOfChannels:
6261 
6262  if (!strcmp(pszName, "ListOfChannels"))
6263  {
6265  }
6266 
6267  break;
6268 
6269  case ListOfPlotItems:
6270 
6271  if (!strcmp(pszName, "ListOfPlotItems"))
6272  {
6274  }
6275 
6276  break;
6277 
6278  case UNKNOWN_ELEMENT:
6280  break;
6281 
6282  default:
6284  pszName, "???", mParser.getCurrentLineNumber());
6285  break;
6286  }
6287 
6289  return;
6290 }
CPlotSpecification * pCurrentPlot
#define pdelete(p)
Definition: copasi.h:215
bool setValue(const CType &value)
#define START_ELEMENT
const std::string & getObjectName() const
CCopasiObject * get(const std::string &key)
#define fatalError()
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
CRegisteredObjectName * pCN
virtual const std::string & getKey() const
#define UNKNOWN_ELEMENT
const CCopasiParameter::Type & getType() const
virtual const std::string & getKey() const
const Value & getValue() const
unsigned C_INT32 * pUINT
CCopasiParameter * getParameter(const std::string &name)
CCopasiParameter * pCurrentParameter
int getCurrentLineNumber() const
Definition: CExpat.h:470
std::vector< std::string > UnmappedKeyParameters
void CCopasiXMLParser::PlotSpecificationElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 6019 of file CCopasiXMLParser.cpp.

References CPlotItem::curve2d, CCopasiMessage::EXCEPTION, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pCurrentPlot, SCopasiXMLParserCommon::pCurrentPlotItem, CPlotSpecification::setActive(), CCopasiObject::setObjectName(), CPlotItem::setType(), toEnum(), UNKNOWN_ELEMENT, and CPlotItem::XMLType.

6020 {
6021  mCurrentElement++; /* We should always be on hte next element */
6022  mpCurrentHandler = NULL;
6023  mLineNumber = (size_t) - 1;
6024 
6025  const char * name;
6026  const char * sType;
6027  const char * active;
6028 
6029  switch (mCurrentElement)
6030  {
6031  case PlotSpecification:
6032 
6033  if (strcmp(pszName, "PlotSpecification"))
6035  pszName, "PlotSpecification", mParser.getCurrentLineNumber());
6036 
6037  // create a new CPlotSpecification element depending on the type
6040  name = mParser.getAttributeValue("name", papszAttrs);
6042  sType = mParser.getAttributeValue("type", papszAttrs);
6044  active = mParser.getAttributeValue("active", papszAttrs, "true");
6045 
6047  return;
6048  break;
6049 
6050  case Parameter:
6051 
6052  if (!strcmp(pszName, "Parameter"))
6053  {
6055 
6056  if (!mpCurrentHandler)
6057  {
6058  mpCurrentHandler = new ParameterElement(mParser, mCommon);
6059  }
6060  }
6061 
6062  break;
6063 
6064  case ParameterGroup:
6065 
6066  if (!strcmp(pszName, "ParameterGroup"))
6067  {
6069 
6070  if (!mpCurrentHandler)
6071  {
6072  mpCurrentHandler = new ParameterGroupElement(mParser, mCommon);
6073  }
6074  }
6075 
6076  break;
6077 
6078  case ListOfChannels:
6079 
6080  if (!strcmp(pszName, "ListOfChannels"))
6081  {
6082  if (!mpCurrentHandler)
6083  {
6084  mpCurrentHandler = new ListOfChannelsElement(mParser, mCommon);
6085  }
6086  }
6087 
6088  break;
6089 
6090  case ListOfPlotItems:
6091 
6092  if (!strcmp(pszName, "ListOfPlotItems"))
6093  {
6094  if (!mpCurrentHandler)
6095  {
6096  mpCurrentHandler = new ListOfPlotItemsElement(mParser, mCommon);
6097  }
6098  }
6099 
6100  break;
6101 
6102  default:
6106  break;
6107  }
6108 
6109  if (mpCurrentHandler)
6111 
6112  mParser.onStartElement(pszName, papszAttrs);
6113 
6114  return;
6115 }
CPlotSpecification * pCurrentPlot
UnknownElement mUnknownElement
static bool toBool(const char *attribute)
Definition: CExpat.h:728
void setActive(const bool &active)
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)
static const char * XMLType[]
Definition: CPlotItem.h:104
void setType(CPlotItem::Type type)
Definition: CPlotItem.cpp:99
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
CType toEnum(const char *attribute, const char **enumNames, const CType &enumDefault)
Definition: utility.h:107
int getCurrentLineNumber() const
Definition: CExpat.h:470
bool setObjectName(const std::string &name)

Member Data Documentation

size_t CCopasiXMLParser::PlotSpecificationElement::mLineNumber
private

The line number the unknown parameter was encountered.

Definition at line 2063 of file CCopasiXMLParser.h.


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