ZThread::Queue< T > Class Template Reference

#include <Queue.h>

Inheritance diagram for ZThread::Queue< T >:

ZThread::Cancelable ZThread::NonCopyable ZThread::BlockingQueue< T, LockType, StorageType > ZThread::BoundedQueue< T, LockType, StorageType > ZThread::LockedQueue< T, LockType, StorageType > ZThread::MonitoredQueue< T, LockType, StorageType > 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

template<typename T>
virtual bool ZThread::Queue< T >::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 ZThread::BoundedQueue< T, LockType, StorageType >, ZThread::LockedQueue< T, LockType, StorageType >, and ZThread::MonitoredQueue< T, LockType, StorageType >.

template<typename T>
virtual void ZThread::Queue< T >::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 ZThread::BlockingQueue< T, LockType, StorageType >, ZThread::BoundedQueue< T, LockType, StorageType >, ZThread::LockedQueue< T, LockType, StorageType >, and ZThread::MonitoredQueue< T, LockType, StorageType >.

template<typename T>
virtual void ZThread::Queue< T >::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 ZThread::Cancelable.

Implemented in ZThread::BlockingQueue< T, LockType, StorageType >, ZThread::BoundedQueue< T, LockType, StorageType >, ZThread::LockedQueue< T, LockType, StorageType >, and ZThread::MonitoredQueue< T, LockType, StorageType >.

template<typename T>
virtual bool ZThread::Queue< T >::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 ZThread::BoundedQueue< T, LockType, StorageType >, and ZThread::MonitoredQueue< T, LockType, StorageType >.

template<typename T>
virtual bool ZThread::Queue< T >::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 ZThread::BoundedQueue< T, LockType, StorageType >, and ZThread::MonitoredQueue< T, LockType, StorageType >.

template<typename T>
virtual T ZThread::Queue< 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 ZThread::BlockingQueue< T, LockType, StorageType >, ZThread::BoundedQueue< T, LockType, StorageType >, ZThread::LockedQueue< T, LockType, StorageType >, and ZThread::MonitoredQueue< T, LockType, StorageType >.

template<typename T>
virtual T ZThread::Queue< 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 ZThread::BlockingQueue< T, LockType, StorageType >, ZThread::BoundedQueue< T, LockType, StorageType >, ZThread::LockedQueue< T, LockType, StorageType >, and ZThread::MonitoredQueue< T, LockType, StorageType >.

template<typename T>
virtual size_t ZThread::Queue< 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 ZThread::BlockingQueue< T, LockType, StorageType >, ZThread::BoundedQueue< T, LockType, StorageType >, ZThread::LockedQueue< T, LockType, StorageType >, and ZThread::MonitoredQueue< T, LockType, StorageType >.

template<typename T>
virtual size_t ZThread::Queue< T >::size (  )  [pure virtual]

Count the values present in this Queue.

Returns:
size_t number of elements available in the Queue.

Implemented in ZThread::BlockingQueue< T, LockType, StorageType >, ZThread::BoundedQueue< T, LockType, StorageType >, ZThread::LockedQueue< T, LockType, StorageType >, and ZThread::MonitoredQueue< T, LockType, StorageType >.


The documentation for this class was generated from the following file:
Generated on Wed Aug 30 03:27:48 2006 for SWG EMU by  doxygen 1.4.7