The Sparta Modeling Framework
|
Generic Logging destination stream interface which writes sparta::log::Message structures to some output [file]stream. Subclasses will implement stream I/O based on construction arguments. More...
#include <Destination.hpp>
Public Member Functions | |
Destination (const Destination &)=delete | |
Destination & | operator= (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 | compareStrings (const std::string &) const |
Returns true if the destination behind this interface was constructed with the string s. | |
virtual bool | compareOstreams (const std::ostream &) const |
Returns true if the destination behind this interface was constructed with the ostream o. | |
virtual std::string | stringize (bool pretty=false) const =0 |
Create a string representation of this Destination. | |
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. | |
Generic Logging destination stream interface which writes sparta::log::Message structures to some output [file]stream. Subclasses will implement stream I/O based on construction arguments.
Destinations are uniquely identified by their construction argument (i.e. string or ostream reference).
Destinations are managed by sparta::log::DestinationManager to ensure that there are usually no duplicates.
This Interface constains some compare and compareX methods which are used to compare the Destinations by string or ostream. Supporting destinations identified by a different attribute will require the appropriate comparison support to this class. In general, this should be 1 compare template specialization and a virtual compareTYPE function which returns false by default and is overloaded in a DestinationInstance specialization which actually compares.
Noncopyable and non-assignable
Definition at line 53 of file Destination.hpp.
|
inline |
|
inline |
Default constructor.
Definition at line 70 of file Destination.hpp.
|
inlinevirtual |
Definition at line 76 of file Destination.hpp.
|
inline |
Comparison of destination for const char[]. Uses std::string comparison.
Definition at line 93 of file Destination.hpp.
|
inline |
Comparison of destination for const char[]. Uses std::string comparison.
Definition at line 84 of file Destination.hpp.
|
inline |
Handle Destination::operator== on ostreams.
Definition at line 109 of file Destination.hpp.
|
inline |
Comparison of destination for std::string.
Definition at line 101 of file Destination.hpp.
|
inline |
Operator= for for other unknown types.
Definition at line 120 of file Destination.hpp.
|
inlinevirtual |
Returns true if the destination behind this interface was constructed with the ostream o.
Reimplemented in sparta::log::DestinationInstance< std::ostream >.
Definition at line 139 of file Destination.hpp.
|
inlinevirtual |
Returns true if the destination behind this interface was constructed with the string s.
Reimplemented in sparta::log::DestinationInstance< std::string >.
Definition at line 131 of file Destination.hpp.
|
inline |
Gets the total number of times that a message has arrived at this destination after already having been written to the output stream.
This is expected and can occur when multiple taps are on the propagation path of a log message. The duplicates will not be written to the same destination. Note that multiple destinations could refer to the same output file if they were constructed with different but equivalent paths or constructed with different ofstream instances with handles to the same file.
Definition at line 198 of file Destination.hpp.
|
inline |
Get the total number of messages logged through this destination.
Definition at line 178 of file Destination.hpp.
|
inline |
Gets the total number of messages received by this destination and then written to the actual output stream.
Definition at line 184 of file Destination.hpp.
|
pure virtual |
Create a string representation of this Destination.
pretty | Print a more verbose, multi-line representaiton (if available). |
Subclasses should override this with representations appropriate for their type.
Implemented in sparta::log::DestinationInstance< std::ostream >, and sparta::log::DestinationInstance< std::string >.
|
inline |
Definition at line 155 of file Destination.hpp.