Recorder Class Reference
Records ignition transport topics This class makes it easy to record topics to a log file. Responsibilities: topic name matching, time received tracking, multiple thread safety, subscribing to topics. More...
#include <Recorder.hh>
Public Member Functions | |
Recorder () | |
Default constructor. More... | |
Recorder (Recorder &&_old) | |
move constructor More... | |
~Recorder () | |
destructor More... | |
RecorderError | AddTopic (const std::string &_topic) |
Add a topic to be recorded (exact match only) More... | |
int64_t | AddTopic (const std::regex &_topic) |
Add a topic to be recorded (regex match) More... | |
std::string | Filename () const |
Get the name of the log file. More... | |
RecorderError | Start (const std::string &_file) |
Begin recording topics. More... | |
void | Stop () |
Stop recording topics. More... | |
RecorderError | Sync (const Clock *_clockIn) |
Synchronize recording with the given clock. More... | |
const std::set< std::string > & | Topics () const |
Get the set of topics have have been added. More... | |
Detailed Description
Records ignition transport topics This class makes it easy to record topics to a log file. Responsibilities: topic name matching, time received tracking, multiple thread safety, subscribing to topics.
Constructor & Destructor Documentation
◆ Recorder() [1/2]
Recorder | ( | ) |
Default constructor.
◆ Recorder() [2/2]
move constructor
- Parameters
-
[in] _old the instance being moved into this one
◆ ~Recorder()
~Recorder | ( | ) |
destructor
Member Function Documentation
◆ AddTopic() [1/2]
RecorderError AddTopic | ( | const std::string & | _topic | ) |
Add a topic to be recorded (exact match only)
- Parameters
-
[in] _topic The exact topic name
- Note
- This method attempts to subscribe to the topic immediately. The subscription will be kept until this is destructed.
- Returns
- NO_ERROR if the subscription was created.
◆ AddTopic() [2/2]
int64_t AddTopic | ( | const std::regex & | _topic | ) |
Add a topic to be recorded (regex match)
- Parameters
-
[in] _topic Pattern to match against topic names
- Note
- This method attempts to subscribe to topics immediately. These subscriptions will be kept until this is destructed. New topics that match the pattern will be added as they appear, including while recording is active.
- Returns
- number of topics subscribed or negative number on error
◆ Filename()
std::string Filename | ( | ) | const |
Get the name of the log file.
- Returns
- The name of the log file, or an empty string if Start has not been successfully called.
◆ Start()
RecorderError Start | ( | const std::string & | _file | ) |
Begin recording topics.
- Parameters
-
[in] _file path to log file
- Returns
- NO_ERROR if recording was successfully started. If the file already existed, this will return FAILED_TO_OPEN.
◆ Stop()
void Stop | ( | ) |
Stop recording topics.
◆ Sync()
RecorderError Sync | ( | const Clock * | _clockIn | ) |
◆ Topics()
const std::set<std::string>& Topics | ( | ) | const |
Get the set of topics have have been added.
- Returns
- The set of topic names that have been added using the AddTopic functions.
The documentation for this class was generated from the following file: