Class MessageCacheCircularBuffer
Defined in File message_cache_circular_buffer.hpp
Inheritance Relationships
Base Type
public rosbag2_cpp::cache::CacheBufferInterface
(Class CacheBufferInterface)
Class Documentation
-
class MessageCacheCircularBuffer : public rosbag2_cpp::cache::CacheBufferInterface
This class implements a circular buffer message cache. Since the buffer size is limited by total byte size of the storage messages rather than a fix number of messages, a deque is used instead of a vector since older messages can always be dropped from the front and new messages added to the end. The buffer will never consume more than max_cache_size bytes, and will log a warning message if an individual message exceeds the buffer size.
Public Functions
-
MessageCacheCircularBuffer() = delete
-
explicit MessageCacheCircularBuffer(size_t max_cache_size)
-
virtual bool push(CacheBufferInterface::buffer_element_t msg) override
If buffer size has some space left, we push the message regardless of its size, but if this results in exceeding buffer size, we begin dropping old messages.
-
virtual void clear() override
Clear buffer.
-
virtual size_t size() override
Get number of elements in the buffer.
-
virtual const std::vector<CacheBufferInterface::buffer_element_t> &data() override
Get buffer data.
-
MessageCacheCircularBuffer() = delete