Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
QList< ITEMS > Class Template Reference

A list of queues. More...

#include <Queue.hxx>

Inheritance diagram for QList< ITEMS >:
QListProtectedWait< items >

Public Types

typedef ::Result Result
 

Public Member Functions

 QList ()
 Default Constructor.
 
 ~QList ()
 Destructor.
 
Atomiclock ()
 
void insert (QMember *item, unsigned index)
 Add an item to the back of the queue.
 
void insert_locked (QMember *item, unsigned index)
 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 queue in priority order.
 
Result next_locked ()
 
size_t pending (unsigned index)
 Get the number of pending items in the queue.
 
size_t pending ()
 Get the total number of pending items in all queues in the list.
 
size_t size ()
 
bool empty (unsigned index)
 Test if the queue is empty.
 
bool empty ()
 Test if all the queues are empty.
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (QList)
 

Private Attributes

Q list [ITEMS]
 the list of queues
 

Detailed Description

template<unsigned ITEMS>
class QList< ITEMS >

A list of queues.

Index 0 is the highest priority queue with increasingly higher indexes having increasingly lower priority.

Definition at line 465 of file Queue.hxx.

Member Typedef Documentation

◆ Result

template<unsigned ITEMS>
typedef ::Result QList< ITEMS >::Result

Definition at line 481 of file Queue.hxx.

Constructor & Destructor Documentation

◆ QList()

template<unsigned ITEMS>
QList< ITEMS >::QList ( )
inline

Default Constructor.

Definition at line 470 of file Queue.hxx.

◆ ~QList()

template<unsigned ITEMS>
QList< ITEMS >::~QList ( )
inline

Destructor.

Definition at line 477 of file Queue.hxx.

Member Function Documentation

◆ empty() [1/2]

template<unsigned ITEMS>
bool QList< ITEMS >::empty ( )
inline

Test if all the queues are empty.

Returns
true if empty (all lists), else false

Definition at line 586 of file Queue.hxx.

◆ empty() [2/2]

template<unsigned ITEMS>
bool QList< ITEMS >::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 578 of file Queue.hxx.

◆ insert()

template<unsigned ITEMS>
void QList< ITEMS >::insert ( QMember item,
unsigned  index 
)
inline

Add an item to the back of the queue.

Parameters
itemto add to queue
indexin the list to operate on

Definition at line 492 of file Queue.hxx.

◆ insert_locked()

template<unsigned ITEMS>
void QList< ITEMS >::insert_locked ( QMember item,
unsigned  index 
)
inline

Add an item to the back of the queue.

Needs external locking.

Parameters
itemto add to queue
indexin the list to operate on

Definition at line 502 of file Queue.hxx.

◆ lock()

template<unsigned ITEMS>
Atomic * QList< ITEMS >::lock ( )
inline

Definition at line 483 of file Queue.hxx.

◆ next() [1/2]

template<unsigned ITEMS>
Result QList< ITEMS >::next ( )
inline

Get an item from the front of the queue queue in priority order.

Returns
item retrieved from queue + index, NULL if no item available

Definition at line 524 of file Queue.hxx.

◆ next() [2/2]

template<unsigned ITEMS>
QMember * QList< ITEMS >::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 515 of file Queue.hxx.

◆ next_locked()

template<unsigned ITEMS>
Result QList< ITEMS >::next_locked ( )
inline

Definition at line 530 of file Queue.hxx.

◆ pending() [1/2]

template<unsigned ITEMS>
size_t QList< ITEMS >::pending ( )
inline

Get the total number of pending items in all queues in the list.

Returns
number of total pending items in all queues in the list

Definition at line 555 of file Queue.hxx.

◆ pending() [2/2]

template<unsigned ITEMS>
size_t QList< ITEMS >::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 547 of file Queue.hxx.

◆ size()

template<unsigned ITEMS>
size_t QList< ITEMS >::size ( )
inline
Returns
how many entries are enqueued right now (across all lists).

Definition at line 569 of file Queue.hxx.

Member Data Documentation

◆ list

template<unsigned ITEMS>
Q QList< ITEMS >::list[ITEMS]
private

the list of queues

Definition at line 601 of file Queue.hxx.


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