85 std::chrono::time_point<std::chrono::system_clock>
loadTime;
119 static void closeAll(
bool keepErrorRetrievers =
false);
127 OutputDevice(
const int defaultIndentation = 0,
const std::string& filename =
"");
185 const std::string& schemaFile,
186 std::map<SumoXMLAttr, std::string> attrs = std::map<SumoXMLAttr, std::string>(),
187 bool includeConfig =
true);
219 bool closeTag(
const std::string& comment =
"");
239 template <
typename T,
class ATTR_TYPE>
263 template <
typename T>
280 template <
typename T>
282 const bool isNull =
false,
const bool escape =
false) {
283 assert(attributeMask.none() || (
int)attr <= (
int)attributeMask.size());
284 if (attributeMask.none() || attributeMask.test(attr)) {
302 template <
typename Func>
304 const bool isNull =
false,
const bool escape =
false) {
305 assert((
int)attr <= (
int)attributeMask.size());
306 if (attributeMask.none() || attributeMask.test(attr)) {
329 if (val !=
"" && val !=
"default") {
362 void inform(
const std::string& msg,
const bool progress =
false);
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::bitset< 96 > SumoXMLAttrMask
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
int gPrecision
the precision for floating point outputs
Static storage of an output device and its base (abstract) implementation.
void lf()
writes a line feed if applicable
virtual std::ostream & getOStream()=0
Returns the associated ostream.
OutputDevice(const OutputDevice &)=delete
Invalidated copy constructor.
OutputDevice & writeOptionalAttr(const SumoXMLAttr attr, const T &val, const SumoXMLAttrMask &attributeMask, const bool isNull=false, const bool escape=false)
writes a named attribute unless filtered
virtual ~OutputDevice()
Destructor.
static Settings mySettings
the output related option values, set by SystemFrame so that this class does not depend on the option...
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 & writePreformattedTag(const std::string &val)
writes a preformatted tag to the device but ensures that any pending tags are closed
void inform(const std::string &msg, const bool progress=false)
Retrieves a message to this device.
OutputDevice & writePadding(const std::string &val)
writes padding (ignored for binary output)
void close()
Closes the device and removes it from the dictionary.
OutputDevice & writeFuncAttr(const SumoXMLAttr attr, const Func &valFunc, const SumoXMLAttrMask &attributeMask, const bool isNull=false, const bool escape=false)
writes a named attribute with a generating function unless filtered
OutputDevice & operator=(const OutputDevice &)=delete
Invalidated assignment operator.
OutputDevice & operator<<(const T &t)
Abstract output operator.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute
virtual void postWriteHook()
Called after every write access.
static bool deviceExists(const std::string &name)
Returns whether a device with the given name has already been created.
const std::string & getFilename()
get filename or suitable description of this device
void setExpectedAttributes(const SumoXMLAttrMask &expected, const int depth)
OutputFormatter * myFormatter
The formatter for XML, CSV or Parquet.
virtual bool isNull()
returns the information whether the device will discard all output
OutputDevice & writeOptionalAttr(const SumoXMLAttr attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute unless null
int getPrecision()
Returns the precision of the underlying stream.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
const std::string myFilename
static void closeAll(bool keepErrorRetrievers=false)
void setFormatter(OutputFormatter *formatter)
static OutputDevice & getDevice(const std::string &name, bool usePrefix=true)
Returns the described OutputDevice.
static int myPrevConsoleCP
old console code page to restore after ending
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
static std::map< std::string, OutputDevice * > myOutputDevices
map from names to output devices
OutputDevice & writeTime(const SumoXMLAttr attr, const SUMOTime val)
virtual bool ok()
returns the information whether one can write into the device
values of the output related options, handed over by SystemFrame so that this class does not depend o...
std::string suffix
the suffix to append to all output file names
std::string prefix
the prefix to prepend to all output file names
std::string columnHeader
how to derive column headers (CSV and Parquet)
std::string columnSeparator
the separator for CSV output
std::string compression
the compression algorithm for Parquet output
std::chrono::time_point< std::chrono::system_clock > loadTime
the time the configuration was loaded, used to replace TIME in prefix, suffix and file names
std::string format
the default output format ("xml", "csv" or "parquet")