rclcpp  master
C++ ROS Client Library API
Public Member Functions | List of all members
rclcpp::experimental::buffers::RingBufferImplementation< BufferT > Class Template Reference

Store elements in a fixed-size, FIFO buffer. More...

#include <ring_buffer_implementation.hpp>

Inheritance diagram for rclcpp::experimental::buffers::RingBufferImplementation< BufferT >:
Inheritance graph
[legend]
Collaboration diagram for rclcpp::experimental::buffers::RingBufferImplementation< BufferT >:
Collaboration graph
[legend]

Public Member Functions

 RingBufferImplementation (size_t capacity)
 
virtual ~RingBufferImplementation ()
 
void enqueue (BufferT request)
 Add a new element to store in the ring buffer. More...
 
BufferT dequeue ()
 Remove the oldest element from ring buffer. More...
 
size_t next (size_t val)
 Get the next index value for the ring buffer. More...
 
bool has_data () const
 Get if the ring buffer has at least one element stored. More...
 
bool is_full () const
 Get if the size of the buffer is equal to its capacity. More...
 
void clear ()
 
- Public Member Functions inherited from rclcpp::experimental::buffers::BufferImplementationBase< BufferT >
virtual ~BufferImplementationBase ()
 

Detailed Description

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

Store elements in a fixed-size, FIFO buffer.

All public member functions are thread-safe.

Constructor & Destructor Documentation

◆ RingBufferImplementation()

template<typename BufferT >
rclcpp::experimental::buffers::RingBufferImplementation< BufferT >::RingBufferImplementation ( size_t  capacity)
inlineexplicit

◆ ~RingBufferImplementation()

template<typename BufferT >
virtual rclcpp::experimental::buffers::RingBufferImplementation< BufferT >::~RingBufferImplementation ( )
inlinevirtual

Member Function Documentation

◆ enqueue()

template<typename BufferT >
void rclcpp::experimental::buffers::RingBufferImplementation< BufferT >::enqueue ( BufferT  request)
inlinevirtual

Add a new element to store in the ring buffer.

This member function is thread-safe.

Parameters
requestthe element to be stored in the ring buffer

Implements rclcpp::experimental::buffers::BufferImplementationBase< BufferT >.

◆ dequeue()

template<typename BufferT >
BufferT rclcpp::experimental::buffers::RingBufferImplementation< BufferT >::dequeue ( )
inlinevirtual

Remove the oldest element from ring buffer.

This member function is thread-safe.

Returns
the element that is being removed from the ring buffer

Implements rclcpp::experimental::buffers::BufferImplementationBase< BufferT >.

◆ next()

template<typename BufferT >
size_t rclcpp::experimental::buffers::RingBufferImplementation< BufferT >::next ( size_t  val)
inline

Get the next index value for the ring buffer.

This member function is thread-safe.

Parameters
valthe current index value
Returns
the next index value

◆ has_data()

template<typename BufferT >
bool rclcpp::experimental::buffers::RingBufferImplementation< BufferT >::has_data ( ) const
inlinevirtual

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

Implements rclcpp::experimental::buffers::BufferImplementationBase< BufferT >.

◆ is_full()

template<typename BufferT >
bool rclcpp::experimental::buffers::RingBufferImplementation< BufferT >::is_full ( ) const
inline

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

◆ clear()

template<typename BufferT >
void rclcpp::experimental::buffers::RingBufferImplementation< BufferT >::clear ( )
inlinevirtual

The documentation for this class was generated from the following file: