CBMC
|
Timestamp class hierarchy. More...
#include <timestamper.h>
Public Types | |
enum class | clockt { NONE , MONOTONIC , WALL_CLOCK } |
Derived types of timestampert. More... | |
Public Member Functions | |
virtual | ~timestampert ()=default |
virtual std::string | stamp () const |
Default timestamp: the empty string. More... | |
Static Public Member Functions | |
static std::unique_ptr< const timestampert > | make (clockt clock_type) |
Factory method to build timestampert subclasses. More... | |
Timestamp class hierarchy.
This class hierarchy supports generation of timestamps in various textual formats. The timestamps returned by instances of this class are empty; more meaningful timestamps are returned by derived classes.
Instances of this class can be instantiated to emit empty timestamps, in case the user did not specify --timestamp
on the command line. The intended use of this class hierarchy is to create a pointer or std::unique_ptr called time
to a timestampert, and to initialize time
with either an actual timestampert object or one of the derived classes based on whether the user has asked for timestamps to be emitted. Clients can thus unconditionally call time->stamp()
and prepend that string to any logging messages; if the user didn't ask for timestamps, then the object pointed to by time
will be a timestampert and thus timestampert::stamp() will return only an empty string. Derived classes emit an actual timestamp followed by a space, so no conditional checking is needed by the client.
Definition at line 41 of file timestamper.h.
|
strong |
Derived types of timestampert.
Enumerator | |
---|---|
NONE | |
MONOTONIC | |
WALL_CLOCK |
Definition at line 45 of file timestamper.h.
|
virtualdefault |
|
static |
Factory method to build timestampert subclasses.
Definition at line 19 of file timestamper.cpp.
|
inlinevirtual |
Default timestamp: the empty string.
Reimplemented in wall_clock_timestampert, and monotonic_timestampert.
Definition at line 57 of file timestamper.h.