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

Public Member Functions

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

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

Member Enumeration Documentation

Enumerator
ListOfReports 
Report 

Definition at line 2456 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 9377 of file CCopasiXMLParser.cpp.

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 9426 of file CCopasiXMLParser.cpp.

References CCopasiMessage::EXCEPTION, CKeyFactory::get(), CCopasiObject::getCN(), SCopasiXMLParserCommon::KeyMap, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::reportReferenceMap, START_ELEMENT, SCopasiXMLParserCommon::taskReferenceMap, and UNKNOWN_ELEMENT.

9427 {
9428  std::map<std::string, std::vector<CCopasiTask*> >::iterator it;
9429 
9430  std::vector<CCopasiTask*>::iterator innerIt;
9431 
9432  CReportDefinition* reportDefinition;
9433 
9434  std::map<std::string , std::vector < std::pair < std::vector <CRegisteredObjectName >*, size_t > > >::iterator outerIt;
9435 
9436  std::vector<std::pair < std::vector <CRegisteredObjectName >*, size_t > >::iterator innerIt2;
9437 
9438  std::vector<CRegisteredObjectName>* nameVector;
9439 
9440  size_t reportIndex;
9441 
9442  switch (mCurrentElement)
9443  {
9444  case ListOfReports:
9445 
9446  if (strcmp(pszName, "ListOfReports"))
9448  pszName, "ListOfReports", mParser.getCurrentLineNumber());
9449 
9452  // here would be a good place to resolve the report reference
9453  // issues
9454  it = mCommon.taskReferenceMap.begin();
9455 
9456  while (it != mCommon.taskReferenceMap.end())
9457  {
9458  reportDefinition = dynamic_cast<CReportDefinition*>(mCommon.KeyMap.get((*it).first));
9459  innerIt = (*it).second.begin();
9460 
9461  while (innerIt != (*it).second.end())
9462  {
9463  (*innerIt)->getReport().setReportDefinition(reportDefinition);
9464  ++innerIt;
9465  }
9466 
9467  ++it;
9468  }
9469 
9470  outerIt = mCommon.reportReferenceMap.begin();
9471 
9472  while (outerIt != mCommon.reportReferenceMap.end())
9473  {
9474  reportDefinition = dynamic_cast<CReportDefinition*>(mCommon.KeyMap.get((*outerIt).first));
9475  innerIt2 = (*outerIt).second.begin();
9476 
9477  while (innerIt2 != (*outerIt).second.end())
9478  {
9479  reportIndex = (*innerIt2).second;
9480  nameVector = (*innerIt2).first;
9481  (*nameVector)[reportIndex] = reportDefinition->getCN();
9482  ++innerIt2;
9483  }
9484 
9485  ++outerIt;
9486  }
9487 
9488  //Tell the parent element we are done.
9489  mParser.onEndElement(pszName);
9490  break;
9491 
9492  case Report:
9494  break;
9495 
9496  case UNKNOWN_ELEMENT:
9498  break;
9499 
9500  default:
9502  pszName, "???", mParser.getCurrentLineNumber());
9503  break;
9504  }
9505 
9506  return;
9507 }
std::map< std::string, std::vector< std::pair< std::vector< CRegisteredObjectName > *, size_t > > > reportReferenceMap
#define START_ELEMENT
virtual CCopasiObjectName getCN() const
CCopasiObject * get(const std::string &key)
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
std::map< std::string, std::vector< CCopasiTask * > > taskReferenceMap
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::ListOfReportsElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 9382 of file CCopasiXMLParser.cpp.

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

9384 {
9385  mCurrentElement++; // We should always be on the next element
9386 
9387  switch (mCurrentElement)
9388  {
9389  case ListOfReports:
9390 
9391  if (strcmp(pszName, "ListOfReports"))
9393  pszName, "ListOfReports", mParser.getCurrentLineNumber());
9394 
9395  if (!mCommon.pReportList)
9397 
9398  break;
9399 
9400  case Report:
9401 
9402  if (strcmp(pszName, "Report"))
9404  pszName, "Report", mParser.getCurrentLineNumber());
9405 
9406  /* If we do not have a report element handler we create one. */
9407  if (!mpCurrentHandler)
9408  mpCurrentHandler = new ReportElement(mParser, mCommon);
9409 
9410  /* Push the report element handler on the stack and call it. */
9412  mpCurrentHandler->start(pszName, papszAttrs);
9413  break;
9414 
9415  default:
9419  mParser.onStartElement(pszName, papszAttrs);
9420  break;
9421  }
9422 
9423  return;
9424 }
UnknownElement mUnknownElement
#define MCXML
CReportDefinitionVector * pReportList
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
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: