Class BaseCompressorInterface

Class Documentation

class BaseCompressorInterface

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

Example file compression usage:

MyCompressor my_compressor(); std::string current_uri = storage.get_relative_path(); std::string compressed_path_uri = my_compressor.compress_uri(current_uri); relative_file_paths.push_back(compressed_path_uri);

Example message compression usage:

MyCompressor my_compressor(); std::shared_ptr<SerializedBagMessage> bag_message = std::make_shared<SerializedBagMessage>(); …fill message my_compressor.compress_serialized_bag_message(bag_message.get());

Public Functions

virtual ~BaseCompressorInterface() = default
virtual std::string compress_uri(const std::string &uri) = 0

Compress a file on disk.

Parameters:

uri – Input file to compress with file extension.

Returns:

The relative path to the compressed file with the compressed extension.

virtual void compress_serialized_bag_message(const rosbag2_storage::SerializedBagMessage *bag_message, rosbag2_storage::SerializedBagMessage *compressed_message) = 0

Compress the serialized_data of a serialized bag message.

Parameters:
  • bag_message[in] A serialized bag message.

  • compressed_message[out] Compressed message.

virtual std::string get_compression_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()

Get the compressor package name

static inline std::string get_base_class_name()

Get the compressor base class name