Class BaseDecompressorInterface

Class Documentation

class BaseDecompressorInterface

An interface for developers adding a new decompression algorithm to rosbag2. These functions must be implemented so that a reader can properly decompress a file or bag message. A corresponding compressor with an identical compression format must also be implemented.

Example file decompression usage:

MyDecompressor my_decompressor(); std::string current_uri = get_current_file(); std::string compressed_path_uri = my_decompressor.decompress_uri(current_uri); storage = storage_factory.open_read_only(compressed_path_uri, storage_options.storage_id);

Example message decompression usage:

MyDecompressor my_decompressor(); std::shared_ptr<SerializedBagMessage> bag_message = storage.read_next(); std::shared_ptr<SerializedBagMessage> decompressed_message = my_decompressor.decompress_serialized_bag_message(bag_message.get());

Public Functions

virtual ~BaseDecompressorInterface() = default
virtual std::string decompress_uri(const std::string &uri) = 0

Decompress a file on disk.

Parameters:

uri – Input file to decompress with file extension.

Returns:

The relative path to the decompressed file without the compressed extension.

virtual void decompress_serialized_bag_message(rosbag2_storage::SerializedBagMessage *bag_message) = 0

Decompress the serialized_data of a serialized bag message in place.

Parameters:

bag_message[inout] A serialized bag message.

virtual std::string get_decompression_identifier() const = 0

Get the identifier of the compression algorithm. This is appended to the extension of the compressed file.

Public Static Functions

static inline std::string get_package_name()
static inline std::string get_base_class_name()