Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ogdf::BoundedQueue< E, INDEX > Class Template Reference

The parameterized class BoundedQueue implements queues with bounded size. More...

#include <ogdf/basic/BoundedQueue.h>

Public Member Functions

 BoundedQueue ()
 Pointer to first element of total array.
 
 BoundedQueue (BoundedQueue< E > &&Q)
 Constructs a bounded queue containing the elements of Q (move semantics).
 
 BoundedQueue (const BoundedQueue< E > &Q)
 Constructs a bounded queue that is a copy of Q.
 
 BoundedQueue (INDEX n)
 Constructs an empty bounded queue for at most n elements.
 
 ~BoundedQueue ()
 Destruction.
 
void append (const E &x)
 Adds x at the end of queue.
 
E & bottom ()
 Returns back element.
 
const E & bottom () const
 Returns back element.
 
INDEX capacity () const
 Returns the capacity of the bounded queue.
 
void clear ()
 Makes the queue empty.
 
bool empty ()
 Returns true iff the queue is empty.
 
bool full ()
 Returns true iff the queue is full.
 
void init ()
 Reinitializes the bounded queue to a non-valid bounded queue.
 
void init (INDEX n)
 Reinitializes the bounded queue to a bounded queue for at most n elements.
 
BoundedQueue< E > & operator= (BoundedQueue< E > &&Q)
 Assignment operator (move semantics).
 
BoundedQueue< E > & operator= (const BoundedQueue< E > &Q)
 Assignment operator.
 
pop ()
 Removes front element and returns it.
 
void print (std::ostream &os, char delim=' ') const
 Prints the queue to output stream os with the seperator delim.
 
INDEX size () const
 Returns current size of the queue.
 
E & top ()
 Returns front element.
 
const E & top () const
 Returns front element.
 

Private Member Functions

void copy (const BoundedQueue< E > &Q)
 

Private Attributes

E * m_pEnd
 Pointer to first element of current sequence.
 
E * m_pFirst
 Pointer to one past last element of total array.
 
E * m_pStart
 
E * m_pStop
 Pointer to one past last element of current sequence.
 

Detailed Description

template<class E, class INDEX = int>
class ogdf::BoundedQueue< E, INDEX >

The parameterized class BoundedQueue implements queues with bounded size.

Template Parameters
Eis the element type.
INDEXis the index type. The default index type is int, other possible types are short and long long (on 64-bit systems).

Definition at line 47 of file BoundedQueue.h.

Constructor & Destructor Documentation

◆ BoundedQueue() [1/4]

template<class E , class INDEX = int>
ogdf::BoundedQueue< E, INDEX >::BoundedQueue ( )
inline

Pointer to first element of total array.

Creates a non-valid bounded queue. Needs to be reinitialized first.

Definition at line 55 of file BoundedQueue.h.

◆ BoundedQueue() [2/4]

template<class E , class INDEX = int>
ogdf::BoundedQueue< E, INDEX >::BoundedQueue ( INDEX  n)
inlineexplicit

Constructs an empty bounded queue for at most n elements.

Definition at line 58 of file BoundedQueue.h.

◆ BoundedQueue() [3/4]

template<class E , class INDEX = int>
ogdf::BoundedQueue< E, INDEX >::BoundedQueue ( const BoundedQueue< E > &  Q)
inline

Constructs a bounded queue that is a copy of Q.

Definition at line 69 of file BoundedQueue.h.

◆ BoundedQueue() [4/4]

template<class E , class INDEX = int>
ogdf::BoundedQueue< E, INDEX >::BoundedQueue ( BoundedQueue< E > &&  Q)
inline

Constructs a bounded queue containing the elements of Q (move semantics).

The queue Q is non valid afterwards, i.e., its capacity is zero. It has to be reinitialized if new elements shall be appended.

Definition at line 76 of file BoundedQueue.h.

◆ ~BoundedQueue()

template<class E , class INDEX = int>
ogdf::BoundedQueue< E, INDEX >::~BoundedQueue ( )
inline

Destruction.

Definition at line 85 of file BoundedQueue.h.

Member Function Documentation

◆ append()

template<class E , class INDEX = int>
void ogdf::BoundedQueue< E, INDEX >::append ( const E &  x)
inline

Adds x at the end of queue.

Definition at line 181 of file BoundedQueue.h.

◆ bottom() [1/2]

template<class E , class INDEX = int>
E & ogdf::BoundedQueue< E, INDEX >::bottom ( )
inline

Returns back element.

Definition at line 129 of file BoundedQueue.h.

◆ bottom() [2/2]

template<class E , class INDEX = int>
const E & ogdf::BoundedQueue< E, INDEX >::bottom ( ) const
inline

Returns back element.

Definition at line 119 of file BoundedQueue.h.

◆ capacity()

template<class E , class INDEX = int>
INDEX ogdf::BoundedQueue< E, INDEX >::capacity ( ) const
inline

Returns the capacity of the bounded queue.

Definition at line 145 of file BoundedQueue.h.

◆ clear()

template<class E , class INDEX = int>
void ogdf::BoundedQueue< E, INDEX >::clear ( )
inline

Makes the queue empty.

Definition at line 200 of file BoundedQueue.h.

◆ copy()

template<class E , class INDEX = int>
void ogdf::BoundedQueue< E, INDEX >::copy ( const BoundedQueue< E > &  Q)
inlineprivate

Definition at line 216 of file BoundedQueue.h.

◆ empty()

template<class E , class INDEX = int>
bool ogdf::BoundedQueue< E, INDEX >::empty ( )
inline

Returns true iff the queue is empty.

Definition at line 148 of file BoundedQueue.h.

◆ full()

template<class E , class INDEX = int>
bool ogdf::BoundedQueue< E, INDEX >::full ( )
inline

Returns true iff the queue is full.

Definition at line 151 of file BoundedQueue.h.

◆ init() [1/2]

template<class E , class INDEX = int>
void ogdf::BoundedQueue< E, INDEX >::init ( )
inline

Reinitializes the bounded queue to a non-valid bounded queue.

Definition at line 88 of file BoundedQueue.h.

◆ init() [2/2]

template<class E , class INDEX = int>
void ogdf::BoundedQueue< E, INDEX >::init ( INDEX  n)
inline

Reinitializes the bounded queue to a bounded queue for at most n elements.

Definition at line 94 of file BoundedQueue.h.

◆ operator=() [1/2]

template<class E , class INDEX = int>
BoundedQueue< E > & ogdf::BoundedQueue< E, INDEX >::operator= ( BoundedQueue< E > &&  Q)
inline

Assignment operator (move semantics).

The queue Q is non valid afterwards, i.e., its capacity is zero. It has to be reinitialized if new elements shall be appended.

Definition at line 168 of file BoundedQueue.h.

◆ operator=() [2/2]

template<class E , class INDEX = int>
BoundedQueue< E > & ogdf::BoundedQueue< E, INDEX >::operator= ( const BoundedQueue< E > &  Q)
inline

Assignment operator.

Definition at line 157 of file BoundedQueue.h.

◆ pop()

template<class E , class INDEX = int>
E ogdf::BoundedQueue< E, INDEX >::pop ( )
inline

Removes front element and returns it.

Definition at line 190 of file BoundedQueue.h.

◆ print()

template<class E , class INDEX = int>
void ogdf::BoundedQueue< E, INDEX >::print ( std::ostream &  os,
char  delim = ' ' 
) const
inline

Prints the queue to output stream os with the seperator delim.

Definition at line 203 of file BoundedQueue.h.

◆ size()

template<class E , class INDEX = int>
INDEX ogdf::BoundedQueue< E, INDEX >::size ( ) const
inline

Returns current size of the queue.

Definition at line 139 of file BoundedQueue.h.

◆ top() [1/2]

template<class E , class INDEX = int>
E & ogdf::BoundedQueue< E, INDEX >::top ( )
inline

Returns front element.

Definition at line 113 of file BoundedQueue.h.

◆ top() [2/2]

template<class E , class INDEX = int>
const E & ogdf::BoundedQueue< E, INDEX >::top ( ) const
inline

Returns front element.

Definition at line 107 of file BoundedQueue.h.

Member Data Documentation

◆ m_pEnd

template<class E , class INDEX = int>
E* ogdf::BoundedQueue< E, INDEX >::m_pEnd
private

Pointer to first element of current sequence.

Definition at line 49 of file BoundedQueue.h.

◆ m_pFirst

template<class E , class INDEX = int>
E* ogdf::BoundedQueue< E, INDEX >::m_pFirst
private

Pointer to one past last element of total array.

Definition at line 51 of file BoundedQueue.h.

◆ m_pStart

template<class E , class INDEX = int>
E* ogdf::BoundedQueue< E, INDEX >::m_pStart
private

Definition at line 48 of file BoundedQueue.h.

◆ m_pStop

template<class E , class INDEX = int>
E* ogdf::BoundedQueue< E, INDEX >::m_pStop
private

Pointer to one past last element of current sequence.

Definition at line 50 of file BoundedQueue.h.


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