The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::log::DestinationInstance< std::string > Class Reference

Destination that opens and writes to a file with a format based on the file extension of the filename given during construction. More...

#include <Destination.hpp>

Inheritance diagram for sparta::log::DestinationInstance< std::string >:
Collaboration diagram for sparta::log::DestinationInstance< std::string >:

Public Member Functions

 DestinationInstance (const std::string &filename)
 Constructs the destination with the given filename. Data will be written in a format based on the extension.
 
virtual bool compareStrings (const std::string &filename) const override
 Returns true if the destination behind this interface was constructed with the string s.
 
virtual std::string stringize (bool pretty=false) const override
 Create a string representation of this Destination.
 
- Public Member Functions inherited from sparta::log::Destination
 Destination (const Destination &)=delete
 
Destinationoperator= (const Destination &)=delete
 
 Destination (const Destination &&rhp)
 
 Destination ()
 Default constructor.
 
template<std::size_t N>
bool compare (const char(&arg)[N]) const
 Comparison of destination for const char[]. Uses std::string comparison.
 
bool compare (const char *&arg) const
 Comparison of destination for const char[]. Uses std::string comparison.
 
bool compare (const std::string &arg) const
 Comparison of destination for std::string.
 
bool compare (const std::ostream &arg) const
 Handle Destination::operator== on ostreams.
 
template<typename T >
bool compare (const T &) const
 Operator= for for other unknown types.
 
virtual bool compareOstreams (const std::ostream &) const
 Returns true if the destination behind this interface was constructed with the ostream o.
 
void write (const sparta::log::Message &msg)
 
uint64_t getNumMessagesReceived () const
 Get the total number of messages logged through this destination.
 
uint64_t getNumMessagesWritten () const
 Gets the total number of messages received by this destination and then written to the actual output stream.
 
uint64_t getNumMessageDuplicates () const
 Gets the total number of times that a message has arrived at this destination after already having been written to the output stream.
 

Detailed Description

Destination that opens and writes to a file with a format based on the file extension of the filename given during construction.

File extensions canot be explicitly chosen there can be only 1 destination per file and the file content must be agreed upon by all taps writing to it. Restricting this by filename is failsafe.

Definition at line 450 of file Destination.hpp.

Constructor & Destructor Documentation

◆ DestinationInstance()

sparta::log::DestinationInstance< std::string >::DestinationInstance ( const std::string &  filename)
inline

Constructs the destination with the given filename. Data will be written in a format based on the extension.

Chooses a formatter from FORMATTERS based on the file extension

Definition at line 465 of file Destination.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ compareStrings()

virtual bool sparta::log::DestinationInstance< std::string >::compareStrings ( const std::string &  ) const
inlineoverridevirtual

Returns true if the destination behind this interface was constructed with the string s.

Reimplemented from sparta::log::Destination.

Definition at line 500 of file Destination.hpp.

◆ stringize()

virtual std::string sparta::log::DestinationInstance< std::string >::stringize ( bool  pretty = false) const
inlineoverridevirtual

Create a string representation of this Destination.

Parameters
prettyPrint a more verbose, multi-line representaiton (if available).
Returns
string representation of this node "<" <location> ">"

Subclasses should override this with representations appropriate for their type.

Implements sparta::log::Destination.

Definition at line 505 of file Destination.hpp.

Here is the call graph for this function:

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