If you can read this text, it means you are not experiencing this website at its best. This website is designed for used with a standards-compliant browser.
Current version: 2.3.2
ZThreads
A platform-independent, multi-threading and synchronization library for C++
Home Documentation Downloads CVS Contact

Queue Class Template Reference

#include <Queue.h>

Inheritance diagram for Queue:

Cancelable NonCopyable BlockingQueue BoundedQueue LockedQueue MonitoredQueue List of all members.

Public Member Functions

virtual ~Queue ()
 Destroy a Queue.
virtual void add (const T &item)=0
virtual bool add (const T &item, unsigned long timeout)=0
virtual T next ()=0
virtual T next (unsigned long timeout)=0
virtual void cancel ()=0
virtual size_t size ()=0
virtual size_t size (unsigned long timeout)=0
virtual bool empty ()
virtual bool empty (unsigned long timeout)

Detailed Description

template<typename T>
class ZThread::Queue< T >

Author:
Eric Crahen <http://www.code-foo.com>
Date:
<2003-07-16T11:32:42-0400>
Version:
2.3.0
A Queue defines an interface for a value-oriented collection objects (similar to STL collections).


Member Function Documentation

virtual bool add const T &  item,
unsigned long  timeout
[pure virtual]
 

Add an object to this Queue.

Parameters:
item value to be added to the Queue
timeout maximum amount of time (milliseconds) this method may block the calling thread.
Returns:
  • true if a copy of item can be added before timeout milliseconds elapse.
  • false otherwise.
Exceptions:
Cancellation_Exception thrown if this Queue has been canceled.
Precondition:
The Queue should not have been canceled prior to the invocation of this function.
Postcondition:
If this function returns true a copy of item will have been added to the Queue.

Implemented in BoundedQueue, LockedQueue, and MonitoredQueue.

virtual void add const T &  item  )  [pure virtual]
 

Add an object to this Queue.

Parameters:
item value to be added to the Queue
Exceptions:
Cancellation_Exception thrown if this Queue has been canceled.
Precondition:
The Queue should not have been canceled prior to the invocation of this function.
Postcondition:
If no exception is thrown, a copy of item will have been added to the Queue.

Implemented in BlockingQueue, BoundedQueue, LockedQueue, and MonitoredQueue.

virtual void cancel  )  [pure virtual]
 

Canceling a Queue disables it, disallowing further additions. Values already present in the Queue can still be retrieved and are still available through the next() methods.

Canceling a Queue more than once has no effect.

Postcondition:
The next() methods will continue to return objects until the Queue has been emptied.

Once emptied, the next() methods will throw a Cancellation_Exception.

The add() methods will throw a Cancellation_Exceptions from this point on.

Implements Cancelable.

Implemented in BlockingQueue, BoundedQueue, LockedQueue, and MonitoredQueue.

virtual bool empty unsigned long  timeout  )  [inline, virtual]
 

Test whether any values are available in this Queue.

Parameters:
timeout maximum amount of time (milliseconds) this method may block the calling thread.
Returns:
  • true if there are no values available.
  • false if there are values available.
Exceptions:
Timeout_Exception thrown if timeout milliseconds expire before a value becomes available

Reimplemented in BoundedQueue, and MonitoredQueue.

virtual bool empty  )  [inline, virtual]
 

Test whether any values are available in this Queue.

Returns:
  • true if there are no values available.
  • false if there are values available.

Reimplemented in BoundedQueue, and MonitoredQueue.

virtual T next unsigned long  timeout  )  [pure virtual]
 

Retrieve and remove a value from this Queue.

Parameters:
timeout maximum amount of time (milliseconds) this method may block the calling thread.
Returns:
T next available value
Exceptions:
Cancellation_Exception thrown if this Queue has been canceled.
Timeout_Exception thrown if the timeout expires before a value can be retrieved.
Precondition:
The Queue should not have been canceled prior to the invocation of this function.
Postcondition:
The value returned will have been removed from the Queue.

Implemented in BlockingQueue, BoundedQueue, LockedQueue, and MonitoredQueue.

virtual T next  )  [pure virtual]
 

Retrieve and remove a value from this Queue.

Returns:
T next available value
Exceptions:
Cancellation_Exception thrown if this Queue has been canceled.
Precondition:
The Queue should not have been canceled prior to the invocation of this function.
Postcondition:
The value returned will have been removed from the Queue.

Implemented in BlockingQueue, BoundedQueue, LockedQueue, and MonitoredQueue.

virtual size_t size unsigned long  timeout  )  [pure virtual]
 

Count the values present in this Queue.

Parameters:
timeout maximum amount of time (milliseconds) this method may block the calling thread.
Returns:
size_t number of elements available in the Queue.
Exceptions:
Timeout_Exception thrown if timeout milliseconds expire before a value becomes available

Implemented in BlockingQueue, BoundedQueue, LockedQueue, and MonitoredQueue.

virtual size_t size  )  [pure virtual]
 

Count the values present in this Queue.

Returns:
size_t number of elements available in the Queue.

Implemented in BlockingQueue, BoundedQueue, LockedQueue, and MonitoredQueue.


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