SUMO - Simulation of Urban MObility
OutputFormatter Class Referenceabstract

Abstract base class for output formatters. More...

#include <OutputFormatter.h>

Inheritance diagram for OutputFormatter:
Inheritance graph
Collaboration diagram for OutputFormatter:
Collaboration graph

Public Member Functions

virtual bool closeTag (std::ostream &into)=0
 Closes the most recently opened tag. More...
 
virtual void openTag (std::ostream &into, const std::string &xmlElement)=0
 Opens an XML tag. More...
 
virtual void openTag (std::ostream &into, const SumoXMLTag &xmlElement)=0
 Opens an XML tag. More...
 
virtual void writePreformattedTag (std::ostream &into, const std::string &val)=0
 
virtual bool writeXMLHeader (std::ostream &into, const std::string &rootElement, const std::string &attrs="", const std::string &comment="")=0
 Writes an XML header with optional configuration. More...
 
virtual ~OutputFormatter ()
 Destructor. More...
 

Detailed Description

Abstract base class for output formatters.

OutputFormatter format XML like output into the output stream. There are only two implementation at the moment, "normal" XML and binary XML.

Definition at line 59 of file OutputFormatter.h.

Constructor & Destructor Documentation

§ ~OutputFormatter()

virtual OutputFormatter::~OutputFormatter ( )
inlinevirtual

Destructor.

Definition at line 62 of file OutputFormatter.h.

References closeTag(), openTag(), writePreformattedTag(), and writeXMLHeader().

Member Function Documentation

§ closeTag()

virtual bool OutputFormatter::closeTag ( std::ostream &  into)
pure virtual

Closes the most recently opened tag.

Parameters
[in]intoThe output stream to use
Returns
Whether a further element existed in the stack and could be closed
Todo:
it is not verified that the topmost element was closed

Implemented in BinaryFormatter, and PlainXMLFormatter.

Referenced by OutputDevice::closeTag(), and ~OutputFormatter().

§ openTag() [1/2]

virtual void OutputFormatter::openTag ( std::ostream &  into,
const std::string &  xmlElement 
)
pure virtual

Opens an XML tag.

An indentation, depending on the current xml-element-stack size, is written followed by the given xml element ("<" + xmlElement) The xml element is added to the stack, then.

Parameters
[in]intoThe output stream to use
[in]xmlElementName of element to open
Returns
The OutputDevice for further processing

Implemented in BinaryFormatter, and PlainXMLFormatter.

Referenced by OutputDevice::openTag(), and ~OutputFormatter().

§ openTag() [2/2]

virtual void OutputFormatter::openTag ( std::ostream &  into,
const SumoXMLTag xmlElement 
)
pure virtual

Opens an XML tag.

Helper method which finds the correct string before calling openTag.

Parameters
[in]intoThe output stream to use
[in]xmlElementId of the element to open

Implemented in BinaryFormatter, and PlainXMLFormatter.

§ writePreformattedTag()

virtual void OutputFormatter::writePreformattedTag ( std::ostream &  into,
const std::string &  val 
)
pure virtual

§ writeXMLHeader()

virtual bool OutputFormatter::writeXMLHeader ( std::ostream &  into,
const std::string &  rootElement,
const std::string &  attrs = "",
const std::string &  comment = "" 
)
pure virtual

Writes an XML header with optional configuration.

If something has been written (myXMLStack is not empty), nothing is written and false returned.

Parameters
[in]intoThe output stream to use
[in]rootElementThe root element to use
[in]attrsAdditional attributes to save within the rootElement
[in]commentAdditional comment (saved in front the rootElement)
Todo:

Check which parameter is used herein

Describe what is saved

Implemented in BinaryFormatter, and PlainXMLFormatter.

Referenced by OutputDevice::writeXMLHeader(), and ~OutputFormatter().


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