MySQL  8.0.18
Source Code Documentation
circular_buffer_queue< Element_type > Class Template Reference

The class defines a type of queue with a predefined max size that is implemented using the circular memory buffer. More...

#include <rpl_rli_pdb.h>

Public Member Functions

 circular_buffer_queue (ulong max)
 
 circular_buffer_queue ()
 
 ~circular_buffer_queue ()
 
ulong de_queue (Element_type *item)
 Content of the being dequeued item is copied to the arg-pointer location. More...
 
ulong de_tail (Element_type *item)
 Similar to de_queue but extracting happens from the tail side. More...
 
ulong en_queue (Element_type *item)
 return the index where the arg item locates or an error encoded as a value in beyond of the legacy range [0, size) (value ‘size’ is excluded). More...
 
Element_type * head_queue ()
 return the value of data member of the head of the queue. More...
 
bool gt (ulong i, ulong k)
 two index comparision to determine which of the two is ordered first. More...
 
bool in (ulong k)
 
bool empty ()
 
bool full ()
 

Public Attributes

Prealloced_array< Element_type, 1 > m_Q
 
ulong size
 
ulong avail
 
ulong entry
 
volatile ulong len
 
bool inited_queue
 

Detailed Description

template<typename Element_type>
class circular_buffer_queue< Element_type >

The class defines a type of queue with a predefined max size that is implemented using the circular memory buffer.

That is items of the queue are accessed as indexed elements of the array buffer in a way that when the index value reaches a max value it wraps around to point to the first buffer element.

Constructor & Destructor Documentation

◆ circular_buffer_queue() [1/2]

template<typename Element_type>
circular_buffer_queue< Element_type >::circular_buffer_queue ( ulong  max)
inline

◆ circular_buffer_queue() [2/2]

template<typename Element_type>
circular_buffer_queue< Element_type >::circular_buffer_queue ( )
inline

◆ ~circular_buffer_queue()

template<typename Element_type>
circular_buffer_queue< Element_type >::~circular_buffer_queue ( )
inline

Member Function Documentation

◆ de_queue()

template<typename Element_type>
ulong circular_buffer_queue< Element_type >::de_queue ( Element_type *  item)

Content of the being dequeued item is copied to the arg-pointer location.

Dequeue from head.

Parameters
[out]itemA pointer to the being dequeued item.
Returns
the queue's array index that the de-queued item located at, or an error encoded in beyond the index legacy range.
Parameters
[out]itemA pointer to the being dequeued item.
Returns
the queue's array index that the de-queued item located at, or an error as an int outside the legacy [0, size) (value ‘size’ is excluded) range.

◆ de_tail()

template<typename Element_type>
ulong circular_buffer_queue< Element_type >::de_tail ( Element_type *  item)

Similar to de_queue but extracting happens from the tail side.

Parameters
[out]itemA pointer to the being dequeued item.
Returns
the queue's array index that the de-queued item located at, or an error.

◆ empty()

template<typename Element_type>
bool circular_buffer_queue< Element_type >::empty ( )
inline

◆ en_queue()

template<typename Element_type>
ulong circular_buffer_queue< Element_type >::en_queue ( Element_type *  item)

return the index where the arg item locates or an error encoded as a value in beyond of the legacy range [0, size) (value ‘size’ is excluded).

Returns
the index where the arg item has been located or an error.

◆ full()

template<typename Element_type>
bool circular_buffer_queue< Element_type >::full ( )
inline

◆ gt()

template<typename Element_type >
bool circular_buffer_queue< Element_type >::gt ( ulong  i,
ulong  k 
)

two index comparision to determine which of the two is ordered first.

Note
The caller makes sure the args are within the valid range, incl cases the queue is empty or full.
Returns
true if the first arg identifies a queue entity ordered after one defined by the 2nd arg, false otherwise.

◆ head_queue()

template<typename Element_type>
Element_type* circular_buffer_queue< Element_type >::head_queue ( )
inline

return the value of data member of the head of the queue.

◆ in()

template<typename Element_type>
bool circular_buffer_queue< Element_type >::in ( ulong  k)
inline

Member Data Documentation

◆ avail

template<typename Element_type>
ulong circular_buffer_queue< Element_type >::avail

◆ entry

template<typename Element_type>
ulong circular_buffer_queue< Element_type >::entry

◆ inited_queue

template<typename Element_type>
bool circular_buffer_queue< Element_type >::inited_queue

◆ len

template<typename Element_type>
volatile ulong circular_buffer_queue< Element_type >::len

◆ m_Q

template<typename Element_type>
Prealloced_array<Element_type, 1> circular_buffer_queue< Element_type >::m_Q

◆ size

template<typename Element_type>
ulong circular_buffer_queue< Element_type >::size

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