Defined in File message_cache_interface.hpp
This class provides the interface for all MessageCache implementations. The interface is designed around double buffered MessageCache implementations due to the inherent performance benefit that they provide.
Any class that implements the MessageCacheInterface should make use of a class derived from the CacheBufferInterface as its buffer(s). Any synchronization that is required to manage more than one CacheBuffer should be handled in the class that implements this interface.
inline virtual ~MessageCacheInterface()
Push a bag message into the producer buffer.
virtual std::shared_ptr<CacheBufferInterface> get_consumer_buffer() = 0
Get a pointer to the buffer that can be used for consuming the cached messages. This call locks access to the buffer,
get_consumer_bufferwill block until
release_consumer_bufferis called to unlock access to the buffer. Consumer should call
release_consumer_bufferwhen they are done consuming the messages.
a pointer to the consumer buffer interface.
virtual void release_consumer_buffer() = 0
Signals that tne consumer is done consuming, unlocking the buffer so it may be swapped.
inline virtual void wait_for_data()
Blocks current thread and going to wait until notify_data_ready will be called.
virtual void swap_buffers() = 0
Swap producer and consumer buffers. Note: this will block if
get_consumer_bufferhas been called but
release_consumer_bufferhas not been called yet to signal end of consuming.
inline virtual void begin_flushing()
Go into a read-only state to drain the final consumer buffer without letting in new data.
inline virtual void done_flushing()
begin_flushing, once the final consumer buffer is emptied.
inline virtual void log_dropped()
Print a log message with details of any dropped messages.
- inline virtual ~MessageCacheInterface()