Template Class RingBufferImplementation

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

template<typename BufferT>
class RingBufferImplementation : public rclcpp::experimental::buffers::BufferImplementationBase<BufferT>

Store elements in a fixed-size, FIFO buffer.

All public member functions are thread-safe.

Public Functions

inline explicit RingBufferImplementation(size_t capacity)
inline virtual ~RingBufferImplementation()
inline virtual void enqueue(BufferT request) override

Add a new element to store in the ring buffer.

This member function is thread-safe.

Parameters:

request – the element to be stored in the ring buffer

inline virtual BufferT dequeue() override

Remove the oldest element from ring buffer.

This member function is thread-safe.

Returns:

the element that is being removed from the ring buffer

inline virtual std::vector<BufferT> get_all_data() override

Get all the elements from the ring buffer.

This member function is thread-safe.

Returns:

a vector containing all the elements from the ring buffer

inline size_t next(size_t val)

Get the next index value for the ring buffer.

This member function is thread-safe.

Parameters:

val – the current index value

Returns:

the next index value

inline virtual bool has_data() const override

Get if the ring buffer has at least one element stored.

This member function is thread-safe.

Returns:

true if there is data and false otherwise

inline bool is_full() const

Get if the size of the buffer is equal to its capacity.

This member function is thread-safe.

Returns:

true if the size of the buffer is equal is capacity and false otherwise

inline virtual size_t available_capacity() const override

Get the remaining capacity to store messages.

This member function is thread-safe.

Returns:

the number of free capacity for new messages

inline virtual void clear() override