22 #ifndef OutputDevice_h
23 #define OutputDevice_h
106 const std::string& rootElement =
"");
144 OutputDevice(
const bool binary =
false,
const unsigned int defaultIndentation = 0);
181 const std::string& attrs =
"",
182 const std::string& comment =
"");
185 template <
typename E>
253 template <
typename T>
270 template <
typename T>
288 if (val !=
"" && val !=
"default") {
301 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
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
OutputDevice(const bool binary=false, const unsigned int defaultIndentation=0)
Constructor.
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.
void setPrecision(unsigned int precision=OUTPUT_ACCURACY)
Sets the precison or resets it to default.
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" ...
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 bool createDeviceByOption(const std::string &optionName, const std::string &rootElement="")
Creates the device using the output definition stored in the named option.
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.
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.