Darwin
1.10(beta)
|
Provides a queue datastructure on a fixed number of indexes. At most one copy of each index can appear in the queue (a second enqueue is ignored). Membership of the queue can be queried. More...
Public Member Functions | |
drwnIndexQueue () | |
default constructor of an empty queue | |
drwnIndexQueue (size_t n) | |
constructor takes the maximum number of indexes | |
~drwnIndexQueue () | |
destructor | |
bool | empty () const |
returns true if the queue is empty | |
void | clear () |
clears the queue | |
void | resize (size_t n) |
clears and resizes the queue | |
int | front () const |
return the element at the front of the queue (or -1 if empty) | |
int | back () const |
return the element at the back of the queue (or -1 if empty) | |
bool | is_queued (int u) const |
returns true if u is in the queue | |
void | push_back (int u) |
add u to the back of the queue | |
void | push_front (int u) |
add u to the front of the queue | |
void | pop_front () |
remove the elelemt from the head of the queue | |
void | erase (int u) |
remove u from the queue or do nothing if not in the queue | |
Protected Attributes | |
int | _head |
int | _tail |
vector< int > | _rev |
vector< int > | _fwd |
Static Protected Attributes | |
static const int | TERMINAL = -1 |
Provides a queue datastructure on a fixed number of indexes. At most one copy of each index can appear in the queue (a second enqueue is ignored). Membership of the queue can be queried.
Example usage: