23 #ifndef OutputDevice_h
24 #define OutputDevice_h
108 const std::string& rootElement =
"",
109 const std::string& schemaFile =
"");
147 OutputDevice(
const bool binary =
false,
const int defaultIndentation = 0);
184 const std::string& attrs =
"",
185 const std::string& comment =
"");
188 template <
typename E>
256 template <
typename T>
273 template <
typename T>
291 if (val !=
"" && val !=
"default") {
315 void inform(
const std::string& msg,
const char progress = 0);
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
void close()
Closes the device and removes it from the dictionary.
SumoXMLTag
Numbers representing SUMO-XML - element names.
static std::map< std::string, OutputDevice * > myOutputDevices
map from names to output devices
OutputDevice & writePreformattedTag(const std::string &val)
writes a preformatted tag to the device but ensures that any pending tags are closed ...
void setPrecision(int precision=OUTPUT_ACCURACY)
Sets the precison or resets it to default.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
bool writeXMLHeader(const std::string &rootElement, const std::string &attrs="", const std::string &comment="")
Writes an XML header with optional configuration.
bool writeHeader(const SumoXMLTag &rootElement)
void inform(const std::string &msg, const char progress=0)
Retrieves a message to this device.
OutputDevice & writeNonEmptyAttr(const SumoXMLAttr attr, const std::string &val)
writes a string attribute only if it is not the empty string and not the string "default" ...
OutputDevice(const bool binary=false, const int defaultIndentation=0)
Constructor.
virtual bool ok()
returns the information whether one can write into the device
OutputDevice & writeAttr(const std::string &attr, const T &val)
writes an arbitrary attribute
OutputDevice & operator<<(const T &t)
Abstract output operator.
virtual ~OutputDevice()
Destructor.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
static std::string realString(const SUMOReal v, const int precision=OUTPUT_ACCURACY)
Helper method for string formatting.
OutputFormatter * myFormatter
The formatter for XML.
static bool createDeviceByOption(const std::string &optionName, const std::string &rootElement="", const std::string &schemaFile="")
Creates the device using the output definition stored in the named option.
OutputDevice & operator=(const OutputDevice &)
Invalidated assignment operator.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
virtual std::ostream & getOStream()=0
Returns the associated ostream.
virtual void postWriteHook()
Called after every write access.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void lf()
writes a line feed if applicable
bool isBinary() const
Returns whether we have a binary output.