Gazebo Transport

API Reference

8.5.0

Interface to a log file. More...

#include <Log.hh>

Public Member Functions

 Log ()
 constructor More...
 
 Log (Log &&_old)
 move constructor More...
 
 ~Log ()
 destructor More...
 
const log::DescriptorDescriptor () const
 Get a Descriptor for this log. The Descriptor will be generated the first time that this function is called after a new file has been opened. More...
 
std::chrono::nanoseconds EndTime () const
 Get end time of the log, or in other words the time of the last message found in the log. More...
 
std::string Filename () const
 Get the name of the log file. More...
 
bool InsertMessage (const std::chrono::nanoseconds &_time, const std::string &_topic, const std::string &_type, const void *_data, std::size_t _len)
 Insert a message into the log file. More...
 
bool Open (const std::string &_file, std::ios_base::openmode _mode=std::ios_base::in)
 Open a log file. More...
 
Batch QueryMessages (const QueryOptions &_options=AllTopics())
 Get messages according to the specified options. By default, it will query all messages over the entire time range of the log. More...
 
std::chrono::nanoseconds StartTime () const
 Get start time of the log, or in other words the time of the first message found in the log. More...
 
bool Valid () const
 Indicate if a log has been successfully opened. More...
 
std::string Version () const
 Get the schema version of the opened log. More...
 

Detailed Description

Interface to a log file.

Constructor & Destructor Documentation

◆ Log() [1/2]

Log ( )

constructor

◆ Log() [2/2]

Log ( Log &&  _old)

move constructor

Parameters
[in]_oldthe instance being moved into this one

◆ ~Log()

~Log ( )

destructor

Member Function Documentation

◆ Descriptor()

const log::Descriptor* Descriptor ( ) const

Get a Descriptor for this log. The Descriptor will be generated the first time that this function is called after a new file has been opened.

Returns
A Descriptor for this log, if a log file is currently loaded. If no log file is loaded, this returns a nullptr.

◆ EndTime()

std::chrono::nanoseconds EndTime ( ) const

Get end time of the log, or in other words the time of the last message found in the log.

Returns
end time of the log, or zero if the log is not valid or if data retrieval failed.

◆ Filename()

std::string Filename ( ) const

Get the name of the log file.

Returns
The name of the log file, or an empty string if Open has not been successfully called.

◆ InsertMessage()

bool InsertMessage ( const std::chrono::nanoseconds _time,
const std::string _topic,
const std::string _type,
const void *  _data,
std::size_t  _len 
)

Insert a message into the log file.

Parameters
[in]_timeTime the message was received (ns since Unix epoch)
[in]_topicName of the topic the message was on
[in]_typeName of the message type
[in]_datapointer to a buffer containing the message data
[in]_lennumber of bytes of data
Returns
true if the message was successfully inserted

◆ Open()

bool Open ( const std::string _file,
std::ios_base::openmode  _mode = std::ios_base::in 
)

Open a log file.

Parameters
[in]_filepath to log file
[in]_modeflag indicating read only or read/write Can use (in or out)
Returns
True if the log file was successfully opened, false otherwise.

◆ QueryMessages()

Batch QueryMessages ( const QueryOptions _options = AllTopics())

Get messages according to the specified options. By default, it will query all messages over the entire time range of the log.

Parameters
[in]_optionsA QueryOptions type to indicate what kind of messages you would like to query.
Returns
A Batch which matches the requested QueryOptions.

◆ StartTime()

std::chrono::nanoseconds StartTime ( ) const

Get start time of the log, or in other words the time of the first message found in the log.

Returns
start time of the log, or zero if the log is not valid or if data retrieval failed.

◆ Valid()

bool Valid ( ) const

Indicate if a log has been successfully opened.

Returns
true if a log is open

◆ Version()

std::string Version ( ) const

Get the schema version of the opened log.

Returns
the current version of the schema in the log file
empty string if the log has not been opened

The documentation for this class was generated from the following file: