Template Class RTERing

Template Parameter Order

  1. typename Elem

  2. MbufType type

Class Documentation

template<typename Elem, MbufType type = MbufType::Raw>
class RTERing

A wrapper around an rte_ring.

Public Types

using value_type = typename std::conditional<type == MbufType::Raw, Elem, RTEMbuf<Elem>>::type
using owning_value_type = RTEMbufElement<Elem, type>
using pointer = value_type*
using const_pointer = std::add_const_t<pointer>
using double_pointer = pointer*
using reference = value_type&
using const_reference = std::add_const_t<reference>

Public Functions

inline ~RTERing()

Deconstructs the ring, and deallocates all the elements still in the ring.

inline std::optional<owning_value_type> enqueue(owning_value_type &&elem)

Enqueues a single element into the queue.

Parameters:

elem – The element to enqueue.

template<size_t N>
inline RTEMbufArray<Elem, N, type> enqueue_burst(RTEMbufArray<Elem, N, type> &&array)
inline std::optional<owning_value_type> dequeue()

Dequeues a single element from the queue.

Returns:

A std::unique_ptr to the dequeued element.

template<size_t N>
inline RTEMbufArray<Elem, N, type> dequeue_burst(size_t num = N)
inline size_t count() const
Returns:

The amount of elements enqueued in the ring.

inline size_t capacity() const
inline size_t free_count() const
inline bool empty() const
RTERing(const RTERing&) = delete
RTERing &operator=(const RTERing&) = delete
inline RTERing(RTERing &&other)
inline RTERing &operator=(RTERing &&other)

Public Static Functions

static inline tl::expected<RTERing, int> init(const std::string &name, RTEMempool<Elem, type> &mempool, size_t num_elems, unsigned int flags, int socket_id = rte_socket_id())
static inline tl::expected<RTERing, int> init(const std::string &name, size_t num_elems, unsigned int flags, int socket_id = rte_socket_id())