Eclipse SUMO - Simulation of Urban MObility
OutputFormatter Class Referenceabstract

Abstract base class for output formatters. More...

#include <OutputFormatter.h>

Inheritance diagram for OutputFormatter:
[legend]

Public Member Functions

virtual bool closeTag (std::ostream &into, const std::string &comment="")=0
 Closes the most recently opened tag and optinally add a comment. 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 writePadding (std::ostream &into, const std::string &val)=0
 
virtual void writePreformattedTag (std::ostream &into, const std::string &val)=0
 
virtual bool writeXMLHeader (std::ostream &into, const std::string &rootElement, const std::map< SumoXMLAttr, std::string > &attrs, bool includeConfig=true)=0
 Writes an XML header with optional configuration. More...
 
virtual bool wroteHeader () const =0
 
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 49 of file OutputFormatter.h.

Constructor & Destructor Documentation

◆ ~OutputFormatter()

virtual OutputFormatter::~OutputFormatter ( )
inlinevirtual

Destructor.

Definition at line 52 of file OutputFormatter.h.

Member Function Documentation

◆ closeTag()

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

Closes the most recently opened tag and optinally add a comment.

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 PlainXMLFormatter.

Referenced by OutputDevice::closeTag().

Here is the caller graph for this function:

◆ 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 PlainXMLFormatter.

Referenced by OutputDevice::openTag().

Here is the caller graph for this function:

◆ 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 PlainXMLFormatter.

◆ writePadding()

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

Implemented in PlainXMLFormatter.

Referenced by OutputDevice::writePadding().

Here is the caller graph for this function:

◆ writePreformattedTag()

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

Implemented in PlainXMLFormatter.

Referenced by OutputDevice::writePreformattedTag().

Here is the caller graph for this function:

◆ writeXMLHeader()

virtual bool OutputFormatter::writeXMLHeader ( std::ostream &  into,
const std::string &  rootElement,
const std::map< SumoXMLAttr, std::string > &  attrs,
bool  includeConfig = true 
)
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
Todo:

Check which parameter is used herein

Describe what is saved

Implemented in PlainXMLFormatter.

Referenced by OutputDevice::writeXMLHeader().

Here is the caller graph for this function:

◆ wroteHeader()

virtual bool OutputFormatter::wroteHeader ( ) const
pure virtual

Implemented in PlainXMLFormatter.

Referenced by OutputDevice::wroteHeader().

Here is the caller graph for this function:

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