Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Q Class Reference

This class implements a linked list "queue" of buffers. More...

#include <Queue.hxx>

Inheritance diagram for Q:
Atomic Bucket

Public Member Functions

 Q ()
 Default Constructor.
 
 ~Q ()
 Default destructor.
 
Atomiclock ()
 
void insert (QMember *item, unsigned index=0)
 Add an item to the back of the queue.
 
void insert_locked (QMember *item, unsigned index=0)
 Add an item to the back of the queue.
 
QMembernext (unsigned index)
 Get an item from the front of the queue.
 
Result next ()
 Get an item from the front of the queue.
 
Result next_locked ()
 Get an item from the front of the queue.
 
size_t pending (unsigned index)
 Get the number of pending items in the queue.
 
size_t pending ()
 Get the number of pending items in the queue.
 
bool empty (unsigned index)
 Test if the queue is empty.
 
bool empty ()
 Test if the queue is empty.
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (Q)
 
- Private Member Functions inherited from Atomic
void lock ()
 
void unlock ()
 

Private Attributes

QMemberhead
 head item in queue
 
QMembertail
 tail item in queue
 
size_t count
 number of items in queue
 

Detailed Description

This class implements a linked list "queue" of buffers.

It may be instantiated to use the mainBufferPool for its memory pool, or optionally another BufferPool instance may be specified for its memory pool.

Definition at line 97 of file Queue.hxx.

Constructor & Destructor Documentation

◆ Q()

Q::Q ( )
inline

Default Constructor.

Definition at line 102 of file Queue.hxx.

◆ ~Q()

Q::~Q ( )
inline

Default destructor.

Definition at line 111 of file Queue.hxx.

Member Function Documentation

◆ empty() [1/2]

bool Q::empty ( )
inline

Test if the queue is empty.

Returns
true if empty, else false

Definition at line 233 of file Queue.hxx.

◆ empty() [2/2]

bool Q::empty ( unsigned  index)
inline

Test if the queue is empty.

Parameters
indexin the list to operate on
Returns
true if empty, else false

Definition at line 225 of file Queue.hxx.

◆ insert()

void Q::insert ( QMember item,
unsigned  index = 0 
)
inline

Add an item to the back of the queue.

Parameters
itemto add to queue
indexunused parameter

Definition at line 124 of file Queue.hxx.

◆ insert_locked()

void Q::insert_locked ( QMember item,
unsigned  index = 0 
)
inline

Add an item to the back of the queue.

Needs external locking.

Parameters
itemto add to queue
indexunused parameter

Definition at line 146 of file Queue.hxx.

◆ lock()

Atomic * Q::lock ( )
inline

Definition at line 115 of file Queue.hxx.

◆ next() [1/2]

Result Q::next ( )
inline

Get an item from the front of the queue.

Returns
Result structure with item retrieved from queue, NULL if no item available

Definition at line 176 of file Queue.hxx.

◆ next() [2/2]

QMember * Q::next ( unsigned  index)
inline

Get an item from the front of the queue.

Parameters
indexin the list to operate on
Returns
item retrieved from queue, NULL if no item available

Definition at line 167 of file Queue.hxx.

◆ next_locked()

Result Q::next_locked ( )
inline

Get an item from the front of the queue.

Returns
Result structure with item retrieved from queue, NULL if no item available

Definition at line 186 of file Queue.hxx.

◆ pending() [1/2]

size_t Q::pending ( )
inline

Get the number of pending items in the queue.

Returns
number of pending items in the queue

Definition at line 216 of file Queue.hxx.

◆ pending() [2/2]

size_t Q::pending ( unsigned  index)
inline

Get the number of pending items in the queue.

Parameters
indexin the list to operate on
Returns
number of pending items in the queue

Definition at line 208 of file Queue.hxx.

Member Data Documentation

◆ count

size_t Q::count
private

number of items in queue

Definition at line 246 of file Queue.hxx.

◆ head

QMember* Q::head
private

head item in queue

Definition at line 240 of file Queue.hxx.

◆ tail

QMember* Q::tail
private

tail item in queue

Definition at line 243 of file Queue.hxx.


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