The TimedLog class is used to log all commands with their timestamp.
More...
#include <log.hpp>
|
typedef DurationT | Duration |
| The duration type for this log.
|
|
|
virtual | ~TimedLog ()=default |
| Default destructor.
|
|
virtual std::chrono::nanoseconds | getLastCommandNanoseconds () const override |
| Get the last command time (after reading). More...
|
|
DurationT | getLastCommandTime () const |
| Get the last command time (after reading). More...
|
|
virtual void | syncTime (bool sync=true) override |
| Sync command times with real time. More...
|
|
virtual std::string | read (std::string &logCommand) override |
| Read one command from the log. More...
|
|
virtual void | write (const std::string &command, const std::string &response) override |
| Write a command and response to the log. More...
|
|
| Log (const std::string &filePath) |
| Log constructor with logging to a file. More...
|
|
| Log (std::iostream &stream) |
| Log constructor with logging to a stream. More...
|
|
virtual const std::string & | getFilePath () const override |
| Get the path of file if the log was created with a path otherwise the empty string. More...
|
|
virtual std::iostream & | getStream () override |
| Get the current underlying stream. More...
|
|
virtual bool | isEnd () const override |
| Test if the stream is EOF. More...
|
|
virtual std::string | read () override |
| Read one command from the log. More...
|
|
virtual std::string | readCommand (const std::string &command) override |
| Read specified command from the log (the others are skipped). More...
|
|
virtual std::string | readCommand (const std::string &command, std::string &logCommand) override |
| Read specified command from the log (the others are skipped). More...
|
|
virtual | ~ILog ()=default |
| Default destructor.
|
|
virtual | ~ITimedLog ()=default |
| Default destructor.
|
|
template<typename Duration > |
Duration | getLastCommandTimeAs () const |
| Get the last command time (after reading). More...
|
|
|
virtual void | readMetadata (std::istream &metaStream) override |
| Read meta data from the log. More...
|
|
virtual void | writeMetadata (std::ostream &metaStream) override |
| Write meta data to the log. More...
|
|
|
char | MESSAGE_END = '$' |
| A char that the log message ends with.
|
|
std::iostream & | stream |
| The underlying stream.
|
|
std::size_t | version = 1 |
| The log version.
|
|
template<typename DurationT = std::chrono::milliseconds>
class regilo::TimedLog< DurationT >
The TimedLog class is used to log all commands with their timestamp.
template<typename DurationT = std::chrono::milliseconds>
virtual std::chrono::nanoseconds regilo::TimedLog< DurationT >::getLastCommandNanoseconds |
( |
| ) |
const |
|
inlineoverridevirtual |
Get the last command time (after reading).
- Returns
- Time since epoch as std::chrono::nanoseconds.
Implements regilo::ITimedLog.
template<typename DurationT = std::chrono::milliseconds>
Get the last command time (after reading).
- Returns
- Time since epoch as Duration.
template<typename DurationT >
Read one command from the log.
- Parameters
-
logCommand | The input of the command that was read. |
- Returns
- The response of the command.
Reimplemented from regilo::Log.
template<typename DurationT >
Read meta data from the log.
- Parameters
-
metaStream | A stream that is used for reading. |
Reimplemented from regilo::Log.
template<typename DurationT = std::chrono::milliseconds>
Sync command times with real time.
It means that all read methods will block their executions until the current time is bigger than the command time.
Implements regilo::ITimedLog.
template<typename DurationT >
void regilo::TimedLog< DurationT >::write |
( |
const std::string & |
command, |
|
|
const std::string & |
response |
|
) |
| |
|
overridevirtual |
Write a command and response to the log.
- Parameters
-
command | The command (with all parameters). |
response | The response of the command. |
Reimplemented from regilo::Log.
template<typename DurationT >
Write meta data to the log.
- Parameters
-
metaStream | A stream that is used for writing. |
Reimplemented from regilo::Log.
The documentation for this class was generated from the following file: