The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::log::Formatter Class Referenceabstract

File writer formatting interface. Subclsases can format for different file types (e.g. raw log, html, sql, etc.) More...

#include <Destination.hpp>

Inheritance diagram for sparta::log::Formatter:
Collaboration diagram for sparta::log::Formatter:

Classes

struct  Info
 Formatter type description. Used in a table to describe various formatter sublasses. More...
 

Public Member Functions

 Formatter (std::ostream &stream)
 Constructor.
 
virtual ~Formatter ()
 Destructor.
 
virtual void write (const sparta::log::Message &msg)=0
 Write a log message to a report.
 
virtual void writeHeader (const SimulationInfo &sim_info)=0
 Write a header to a newly-opened report.
 

Static Public Attributes

static const InfoFORMATTERS
 Formatter list terminated with a Info having an empty name which is interpreted as the default formatter.
 

Protected Attributes

std::ostream & stream_
 

Detailed Description

File writer formatting interface. Subclsases can format for different file types (e.g. raw log, html, sql, etc.)

Definition at line 234 of file Destination.hpp.

Constructor & Destructor Documentation

◆ Formatter()

sparta::log::Formatter::Formatter ( std::ostream &  stream)
inline

Constructor.

Parameters
streamOutput file to which formatter will write. This stream must remain open for the lifetime of this Formatter

Definition at line 255 of file Destination.hpp.

◆ ~Formatter()

virtual sparta::log::Formatter::~Formatter ( )
inlinevirtual

Destructor.

Definition at line 260 of file Destination.hpp.

Member Function Documentation

◆ write()

virtual void sparta::log::Formatter::write ( const sparta::log::Message msg)
pure virtual

◆ writeHeader()

virtual void sparta::log::Formatter::writeHeader ( const SimulationInfo sim_info)
pure virtual

Member Data Documentation

◆ FORMATTERS

const Info* sparta::log::Formatter::FORMATTERS
static

Formatter list terminated with a Info having an empty name which is interpreted as the default formatter.

DestinationInstance<std::string> will compare input filename against the extensions in this table and find a matching formatter.

List must end with a valid (default) Info struct having a NULL extension field

Definition at line 283 of file Destination.hpp.

◆ stream_

std::ostream& sparta::log::Formatter::stream_
protected

Definition at line 236 of file Destination.hpp.


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