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

Public Member Functions

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

Private Attributes

size_t mLineNumber
 
CXMLElementHandler
< CCopasiXMLParser,
SCopasiXMLParserCommon > * 
mpListOfChannelsElement
 
CXMLElementHandler
< CCopasiXMLParser,
SCopasiXMLParserCommon > * 
mpParameterElement
 
CXMLElementHandler
< CCopasiXMLParser,
SCopasiXMLParserCommon > * 
mpParameterGroupElement
 

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

Member Enumeration Documentation

Constructor & Destructor Documentation

CCopasiXMLParser::PlotItemElement::PlotItemElement ( CCopasiXMLParser parser,
SCopasiXMLParserCommon common 
)

Constructor

Definition at line 5777 of file CCopasiXMLParser.cpp.

5777  :
5779  mpParameterElement(NULL),
5782  mLineNumber(0)
5783 
5784 {}
CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > * mpParameterElement
CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > * mpListOfChannelsElement
CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > * mpParameterGroupElement
CCopasiXMLParser::PlotItemElement::~PlotItemElement ( )
virtual

Destructor

Definition at line 5786 of file CCopasiXMLParser.cpp.

References pdelete.

5787 {
5791 }
#define pdelete(p)
Definition: copasi.h:215
CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > * mpParameterElement
CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > * mpListOfChannelsElement
CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > * mpParameterGroupElement

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 5882 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::pCurrentPlotItem, 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.

5883 {
5884  CCopasiParameter * p = NULL;
5885 
5886  switch (mCurrentElement)
5887  {
5888  case PlotItem:
5889 
5890  if (strcmp(pszName, "PlotItem"))
5892  pszName, "PlotItem", mParser.getCurrentLineNumber());
5893 
5896  mParser.onEndElement(pszName);
5897  break;
5898 
5899  case Parameter:
5900 
5901  if (!strcmp(pszName, "Parameter"))
5902  {
5904  //TODO warning if type mismatch. Is silently ignored currently.
5905 
5906  if (p && p->getType() == mCommon.pCurrentParameter->getType())
5907  {
5908  switch (p->getType())
5909  {
5910  case CCopasiParameter::INT:
5912  break;
5913 
5916  break;
5917 
5920  break;
5921 
5924  break;
5925 
5928  break;
5929 
5932  break;
5933 
5934  case CCopasiParameter::KEY:
5935  {
5936  CCopasiObject * pObject =
5938 
5939  if (pObject)
5940  p->setValue(pObject->getKey());
5941  else
5942  {
5944  mCommon.UnmappedKeyParameters.push_back(p->getKey());
5945  }
5946  }
5947  break;
5948 
5951  break;
5952 
5953  case CCopasiParameter::CN:
5955  break;
5956 
5960  break;
5961 
5962  default:
5963  fatalError();
5964  break;
5965  }
5966  }
5967  else
5968  {
5971  mLineNumber);
5972  }
5973 
5976  }
5977 
5978  break;
5979 
5980  case ParameterGroup:
5981 
5982  if (!strcmp(pszName, "ParameterGroup"))
5983  {
5985  }
5986 
5987  break;
5988 
5989  case ListOfChannels:
5990 
5991  if (!strcmp(pszName, "ListOfChannels"))
5992  {
5994  }
5995 
5996  break;
5997 
5998  case UNKNOWN_ELEMENT:
6000  break;
6001 
6002  default:
6004  pszName, "???", mParser.getCurrentLineNumber());
6005  break;
6006  }
6007 
6008  return;
6009 }
#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::PlotItemElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 5793 of file CCopasiXMLParser.cpp.

References CPlotSpecification::createItem(), CCopasiMessage::EXCEPTION, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pCurrentPlot, SCopasiXMLParserCommon::pCurrentPlotItem, toEnum(), UNKNOWN_ELEMENT, CPlotItem::unset, and CPlotItem::XMLType.

5794 {
5795  mCurrentElement++; /* We should always be on hte next element */
5796  mpCurrentHandler = NULL;
5797  std::string name;
5798  std::string sType;
5799 
5800  mLineNumber = (size_t) - 1;
5801 
5802  switch (mCurrentElement)
5803  {
5804  case PlotItem:
5805 
5806  if (strcmp(pszName, "PlotItem"))
5808  pszName, "PlotItem", mParser.getCurrentLineNumber());
5809 
5810  // create a new CPlotSpecification element depending on the type
5811  name = mParser.getAttributeValue("name", papszAttrs);
5812  sType = mParser.getAttributeValue("type", papszAttrs);
5815 
5816  return;
5817  break;
5818 
5819  case Parameter:
5820 
5821  if (!strcmp(pszName, "Parameter"))
5822  {
5824 
5825  if (!mpParameterElement)
5826  {
5827  mpParameterElement = new ParameterElement(mParser, mCommon);
5828  }
5829 
5831  }
5832 
5833  break;
5834 
5835  case ParameterGroup:
5836 
5837  if (!strcmp(pszName, "ParameterGroup"))
5838  {
5840 
5842  {
5843  mpParameterGroupElement = new ParameterGroupElement(mParser, mCommon);
5844  }
5845 
5847  }
5848 
5849  break;
5850 
5851  case ListOfChannels:
5852 
5853  if (!strcmp(pszName, "ListOfChannels"))
5854  {
5856 
5858  {
5859  mpListOfChannelsElement = new ListOfChannelsElement(mParser, mCommon);
5860  }
5861 
5863  }
5864 
5865  break;
5866 
5867  default:
5871  break;
5872  }
5873 
5874  if (mpCurrentHandler)
5876 
5877  mParser.onStartElement(pszName, papszAttrs);
5878 
5879  return;
5880 }
CPlotSpecification * pCurrentPlot
UnknownElement mUnknownElement
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
CPlotItem * createItem(const std::string &name, CPlotItem::Type type)
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
static const char * XMLType[]
Definition: CPlotItem.h:104
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > * mpParameterElement
CType toEnum(const char *attribute, const char **enumNames, const CType &enumDefault)
Definition: utility.h:107
int getCurrentLineNumber() const
Definition: CExpat.h:470
CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > * mpListOfChannelsElement
CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > * mpParameterGroupElement

Member Data Documentation

size_t CCopasiXMLParser::PlotItemElement::mLineNumber
private

The line number the unknown parameter was encountered.

Definition at line 1932 of file CCopasiXMLParser.h.

CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >* CCopasiXMLParser::PlotItemElement::mpListOfChannelsElement
private

Pointer to the List Of Channels Element Handler

Definition at line 1927 of file CCopasiXMLParser.h.

CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >* CCopasiXMLParser::PlotItemElement::mpParameterElement
private

Pointer to the Parameter Element Handler

Definition at line 1917 of file CCopasiXMLParser.h.

CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >* CCopasiXMLParser::PlotItemElement::mpParameterGroupElement
private

Pointer to the Parameter Group Element Handler

Definition at line 1922 of file CCopasiXMLParser.h.


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