|
MADARA
3.1.8
|
Defines a generic "first-in/first-out" (FIFO) Abstract Data Type (ADT) using a circular linked list. More...
#include <LQueue.h>
Classes | |
| class | Overflow |
| Exception thrown by methods in this class when an overflow condition occurs. More... | |
| class | Underflow |
| Exception thrown by methods in this class when an underflow condition occurs. More... | |
Public Types | |
| typedef LQueueConstIterator< T > | const_iterator |
| typedef LQueueIterator< T > | iterator |
| typedef T | value_type |
Public Member Functions | |
| LQueue (size_t size_hint=0) | |
| Constructor. More... | |
| LQueue (const LQueue< T > &rhs) | |
| Copy constructor. More... | |
| ~LQueue (void) | |
| Perform actions needed when queue goes out of scope. More... | |
| iterator | begin (void) |
| Get an iterator that points to the beginning of the queue. More... | |
| const_iterator | begin (void) const |
| Get a const iterator that points to the beginning of the queue. More... | |
| T | dequeue (void) |
| Remove and return the front item on the queue. More... | |
| iterator | end (void) |
| Get an iterator that points to the end of the queue. More... | |
| const_iterator | end (void) const |
| Get a const iterator that points to the end of the queue. More... | |
| void | enqueue (const T &new_item) |
| Place a new_item at the tail of the queue. More... | |
| T | front (void) const |
| Returns the front queue item without removing it. More... | |
| bool | is_empty (void) const |
| Returns 1 if the queue is empty, otherwise returns 0. More... | |
| bool | is_full (void) const |
| Returns 1 if the queue is full, otherwise returns 0. More... | |
| bool | operator!= (const LQueue< T > &s) const |
| Compare this queue with rhs for inequality such that *this>!=s is always the complement of the boolean return value of *this==s. More... | |
| LQueue< T > & | operator= (const LQueue< T > &rhs) |
| Assignment operator. More... | |
| bool | operator== (const LQueue< T > &rhs) const |
| Compare this queue with rhs for equality. More... | |
| size_t | size (void) const |
| Returns the current number of elements in the queue. More... | |
Protected Member Functions | |
| void | copy_list (const LQueue< T > &rhs) |
| void | delete_list (void) |
| void | dequeue_i (void) |
| Remove the front item on the queue. Does not throw exceptions. More... | |
Private Attributes | |
| size_t | count_ |
| Number of items that are currently in the queue. More... | |
| LQueueNode< T > * | tail_ |
| We only need to keep a single pointer for the circular linked list. More... | |
Friends | |
| class | LQueueConstIterator< T > |
| class | LQueueIterator< T > |
Defines a generic "first-in/first-out" (FIFO) Abstract Data Type (ADT) using a circular linked list.
This queue is a circular linked list where the tail_ pointer points to a dummy node which makes implementation much easier (particularly iterator traversal). When enqueuing an item, the dummy node contains the new item and points to a new dummy node. The head of the list is thsu always tail_->next_. Dequeuing an object gets rid of the head node and makes the dummy node point to the new head.
| typedef LQueueConstIterator<T> madara::utility::LQueue< T >::const_iterator |
| typedef LQueueIterator<T> madara::utility::LQueue< T >::iterator |
| typedef T madara::utility::LQueue< T >::value_type |
| madara::utility::LQueue< T >::LQueue | ( | size_t | size_hint = 0 | ) |
Constructor.
Definition at line 193 of file LQueue.cpp.
| madara::utility::LQueue< T >::LQueue | ( | const LQueue< T > & | rhs | ) |
Copy constructor.
Definition at line 208 of file LQueue.cpp.
| madara::utility::LQueue< T >::~LQueue | ( | void | ) |
Perform actions needed when queue goes out of scope.
Definition at line 285 of file LQueue.cpp.
| madara::utility::LQueue< T >::iterator madara::utility::LQueue< T >::begin | ( | void | ) |
Get an iterator that points to the beginning of the queue.
Definition at line 421 of file LQueue.cpp.
| madara::utility::LQueue< T >::const_iterator madara::utility::LQueue< T >::begin | ( | void | ) | const |
Get a const iterator that points to the beginning of the queue.
Definition at line 439 of file LQueue.cpp.
|
protected |
Definition at line 230 of file LQueue.cpp.
|
protected |
Definition at line 253 of file LQueue.cpp.
| T madara::utility::LQueue< T >::dequeue | ( | void | ) |
Remove and return the front item on the queue.
Throws the Underflow exception if the queue is empty.
Definition at line 349 of file LQueue.cpp.
|
protected |
Remove the front item on the queue. Does not throw exceptions.
Definition at line 370 of file LQueue.cpp.
| madara::utility::LQueue< T >::iterator madara::utility::LQueue< T >::end | ( | void | ) |
Get an iterator that points to the end of the queue.
Definition at line 430 of file LQueue.cpp.
| madara::utility::LQueue< T >::const_iterator madara::utility::LQueue< T >::end | ( | void | ) | const |
Get a const iterator that points to the end of the queue.
Definition at line 448 of file LQueue.cpp.
| void madara::utility::LQueue< T >::enqueue | ( | const T & | new_item | ) |
Place a new_item at the tail of the queue.
Throws the Overflow exception if the queue is full, e.g., if memory is exhausted.
Definition at line 320 of file LQueue.cpp.
| T madara::utility::LQueue< T >::front | ( | void | ) | const |
Returns the front queue item without removing it.
Throws the Underflow exception if the queue is empty.
Definition at line 390 of file LQueue.cpp.
| bool madara::utility::LQueue< T >::is_empty | ( | void | ) | const |
Returns 1 if the queue is empty, otherwise returns 0.
Definition at line 404 of file LQueue.cpp.
| bool madara::utility::LQueue< T >::is_full | ( | void | ) | const |
Returns 1 if the queue is full, otherwise returns 0.
Definition at line 412 of file LQueue.cpp.
| bool madara::utility::LQueue< T >::operator!= | ( | const LQueue< T > & | s | ) | const |
Compare this queue with rhs for inequality such that *this>!=s is always the complement of the boolean return value of *this==s.
Definition at line 310 of file LQueue.cpp.
| madara::utility::LQueue< T > & madara::utility::LQueue< T >::operator= | ( | const LQueue< T > & | rhs | ) |
Assignment operator.
Definition at line 266 of file LQueue.cpp.
| bool madara::utility::LQueue< T >::operator== | ( | const LQueue< T > & | rhs | ) | const |
Compare this queue with rhs for equality.
Returns true if the sizes of the two queues are equal and all the elements from 0 .. size() are equal, else false.
Definition at line 298 of file LQueue.cpp.
| size_t madara::utility::LQueue< T >::size | ( | void | ) | const |
Returns the current number of elements in the queue.
Definition at line 185 of file LQueue.cpp.
|
friend |
|
friend |
|
private |
|
private |