activemq-cpp-3.4.0

decaf::util::Queue< E > Class Template Reference

A kind of collection provides advanced operations than other basic collections, such as insertion, extraction, and inspection. More...

#include <src/main/decaf/util/Queue.h>

Inheritance diagram for decaf::util::Queue< E >:

Public Member Functions

virtual ~Queue ()
virtual bool offer (const E &value)=0
 Inserts the specified element into the queue provided that the condition allows such an operation.
virtual bool poll (E &result)=0
 Gets and removes the element in the head of the queue.
virtual E remove ()=0
 Gets and removes the element in the head of the queue.
virtual bool peek (E &result) const =0
 Gets but not removes the element in the head of the queue.
virtual E element () const =0
 Gets but not removes the element in the head of the queue.

Detailed Description

template<typename E>
class decaf::util::Queue< E >

A kind of collection provides advanced operations than other basic collections, such as insertion, extraction, and inspection.

Generally, a queue orders its elements by means of first-in-first-out. While priority queue orders its elements according to a comparator specified or the elements' natural order. Furthermore, a stack orders its elements last-in-first out.

Queue does not provide blocking queue methods, which will block until the operation of the method is allowed. BlockingQueue interface defines such methods.

Unlike the Java Queue interface the methods of this class cannot return null to indicate that a Queue is empty since null has no meaning for elements such as classes, structs and primitive types and cannot be used in a meaningful way to check for an empty queue. Methods that would have returned null in the Java Queue interface have been altered to return a boolean value indicating if the operation succeeded and take single argument that is a reference to the location where the returned value is to be assigned. This implies that elements in the Queue must be assignable in order to utilize these methods.

Since:
1.0

Constructor & Destructor Documentation

template<typename E>
virtual decaf::util::Queue< E >::~Queue ( ) [inline, virtual]

Member Function Documentation

template<typename E>
virtual bool decaf::util::Queue< E >::offer ( const E &  value) [pure virtual]

Inserts the specified element into the queue provided that the condition allows such an operation.

The method is generally preferable to the collection.add(E), since the latter might throw an exception if the operation fails.

Parameters:
valuethe specified element to insert into the queue.
Returns:
true if the operation succeeds and false if it fails.
Exceptions:
NullPointerExceptionif the Queue implementation does not allow Null values to be inserted into the Queue.
IllegalArgumentExceptionif some property of the specified element prevents it from being added to this queue

Implemented in decaf::util::concurrent::LinkedBlockingQueue< E >, decaf::util::concurrent::SynchronousQueue< E >, decaf::util::LinkedList< E >, decaf::util::PriorityQueue< E >, decaf::util::LinkedList< Pointer< Transport > >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< Pointer< BackupTransport > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.

Referenced by decaf::util::AbstractQueue< E >::add().

template<typename E>
virtual bool decaf::util::Queue< E >::poll ( E &  result) [pure virtual]

Gets and removes the element in the head of the queue.

If the operation succeeds the value of the element at the head of the Queue is assigned to the result parameter and the method returns true. If the operation fails the method returns false and the value of the result parameter is undefined.

Parameters:
resultReference to an instance of the contained type to assigned the removed value to.
Returns:
true if the element at the head of the queue was removed and assigned to the result parameter.

Implemented in decaf::util::concurrent::LinkedBlockingQueue< E >, decaf::util::concurrent::SynchronousQueue< E >, decaf::util::LinkedList< E >, decaf::util::PriorityQueue< E >, decaf::util::LinkedList< Pointer< Transport > >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< Pointer< BackupTransport > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.

Referenced by decaf::util::AbstractQueue< E >::clear(), and decaf::util::AbstractQueue< E >::remove().


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