Regilo
A simple C++ library for controlling the Neato XV robot and the Hokuyo scanner.
|
The Log class is a basic log with a simple read/write functionality. More...
#include <log.hpp>
Public Member Functions | |
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 | read (std::string &logCommand) 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 void | write (const std::string &command, const std::string &response) override |
Write a command and response to the log. More... | |
![]() | |
virtual | ~ILog ()=default |
Default destructor. | |
Public Attributes | |
char | MESSAGE_END = '$' |
A char that the log message ends with. | |
Protected Member Functions | |
virtual void | readMetadata (std::istream &metaStream) |
Read meta data from the log. More... | |
virtual void | writeMetadata (std::ostream &metaStream) |
Write meta data to the log. More... | |
Protected Attributes | |
std::iostream & | stream |
The underlying stream. | |
std::size_t | version = 1 |
The log version. | |
The Log class is a basic log with a simple read/write functionality.
It is used to log all commands that were send to the device.
regilo::Log::Log | ( | const std::string & | filePath | ) |
Log constructor with logging to a file.
filePath | The path of file. |
regilo::Log::Log | ( | std::iostream & | stream | ) |
Log constructor with logging to a stream.
stream | Input/output stream. |
|
inlineoverridevirtual |
Get the path of file if the log was created with a path otherwise the empty string.
Implements regilo::ILog.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
overridevirtual |
|
overridevirtual |
Read one command from the log.
logCommand | The input of the command that was read. |
Implements regilo::ILog.
Reimplemented in regilo::TimedLog< DurationT >.
|
overridevirtual |
Read specified command from the log (the others are skipped).
command | The command to read (The boost::algorithm::starts_with() method is used to compare). |
Implements regilo::ILog.
|
overridevirtual |
Read specified command from the log (the others are skipped).
command | The command to read (The boost::algorithm::starts_with() method is used to compare). |
logCommand | The input of the command that was read. |
Implements regilo::ILog.
|
protectedvirtual |
Read meta data from the log.
metaStream | A stream that is used for reading. |
Reimplemented in regilo::TimedLog< DurationT >.
|
overridevirtual |
Write a command and response to the log.
command | The command (with all parameters). |
response | The response of the command. |
Implements regilo::ILog.
Reimplemented in regilo::TimedLog< DurationT >.
|
protectedvirtual |
Write meta data to the log.
metaStream | A stream that is used for writing. |
Reimplemented in regilo::TimedLog< DurationT >.