#include <BoundedQueue.hpp>
Public Types | |
typedef BoundedQueue< T, C > | OfType |
typedef T | Task |
typedef C | Container |
Public Member Functions | |
BoundedQueue () | |
Constructs BoundedQueue with default configurator. | |
BoundedQueue (const OfType &queue) | |
Constructs BoundedQueue using configuration from passed BoundedQueue object. | |
BoundedQueue (const Configurator &config) | |
Constructs BoundedQueue using supplied configuration object. | |
~BoundedQueue () | |
Destructs instance of BoundedQueue object. | |
void | setUp () |
Initializes queuing environemnt. | |
bool | empty () const |
Returns true if queue does not have any tasks. | |
bool | full () const |
Returns true if queue has reached upper bound . | |
void | flush () |
Clears the queue. | |
Task & | front () |
Returns reference to the front task in the queue which must be non-empty. | |
const Task & | front () const |
void | push (const Task &val) |
Pushes a task onto the queue for pickup by Executor. | |
void | pop () |
Removes a front task from the queue. |
Use BoundedQueue class to create objects that will serve as bounded task queues. Scheduler uses an instance of a queue object to buffer arriving tasks. BoundedQueue has a property called upper bound
which restricts the maximum number of tasks that can be queued. If upper bound
limit is reached and a new task is scheduled, QueueOverflowError exception is thrown. To prevent this, Scheduler calls full() method of a queue before putting new tasks. BoundedQueue can be combined with other types of queues to achieve desired functionality. For example, one can combine BoundedQueue with SortedQueue; the resulting queue will be a priority, bounded queue.
|
Constructs BoundedQueue using configuration from passed BoundedQueue object.
|
|
Constructs BoundedQueue using supplied configuration object.
|
|
Destructs instance of BoundedQueue object.
|
|
Returns Otherwise returns false.
|
|
Clears the queue.
|
|
Returns reference to the front task in the queue which must be non-empty.
|
|
Returns Otherwise returns false.
|
|
Removes a front task from the queue.
|
|
Pushes a task onto the queue for pickup by Executor.
|
|
Initializes queuing environemnt. Called just before Scheduler begins queing tasks. |