activemq-cpp-3.6.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.
- Public Member Functions inherited from decaf::util::Collection< E >
virtual ~Collection ()
virtual void copy (const Collection< E > &collection)=0
 Renders this Collection as a Copy of the given Collection.
virtual bool add (const E &value)=0
 Returns true if this collection changed as a result of the call.
virtual bool addAll (const Collection< E > &collection)=0
 Adds all of the elements in the specified collection to this collection.
virtual void clear ()=0
 Removes all of the elements from this collection (optional operation).
virtual bool contains (const E &value) const =0
 Returns true if this collection contains the specified element.
virtual bool containsAll (const Collection< E > &collection) const =0
 Returns true if this collection contains all of the elements in the specified collection.
virtual bool equals (const Collection< E > &value) const =0
 Compares the passed collection to this one, if they contain the same elements, i.e.
virtual bool isEmpty () const =0
virtual bool remove (const E &value)=0
 Removes a single instance of the specified element from the collection.
virtual bool removeAll (const Collection< E > &collection)=0
 Removes all this collection's elements that are also contained in the specified collection (optional operation).
virtual bool retainAll (const Collection< E > &collection)=0
 Retains only the elements in this collection that are contained in the specified collection (optional operation).
virtual int size () const =0
 Returns the number of elements in this collection.
virtual std::vector< E > toArray () const =0
 Returns an array containing all of the elements in this collection.
- Public Member Functions inherited from decaf::lang::Iterable< E >
virtual ~Iterable ()
virtual decaf::util::Iterator
< E > * 
iterator ()=0
virtual decaf::util::Iterator
< E > * 
iterator () const =0
- Public Member Functions inherited from decaf::util::concurrent::Synchronizable
virtual ~Synchronizable ()
virtual void lock ()=0
 Locks the object.
virtual bool tryLock ()=0
 Attempts to Lock the object, if the lock is already held by another thread than this method returns false.
virtual void unlock ()=0
 Unlocks the object.
virtual void wait ()=0
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void wait (long long millisecs)=0
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void wait (long long millisecs, int nanos)=0
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void notify ()=0
 Signals a waiter on this object that it can now wake up and continue.
virtual void notifyAll ()=0
 Signals the waiters on this object that it can now wake up and continue.

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 ( )
inlinevirtual

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::LinkedList< E >, 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< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, decaf::util::LinkedList< cms::Connection * >, and decaf::util::concurrent::SynchronousQueue< E >.

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

template<typename E>
virtual bool decaf::util::Queue< E >::peek ( E &  result) const
pure virtual
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::LinkedList< E >, 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< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, decaf::util::LinkedList< cms::Connection * >, and decaf::util::concurrent::SynchronousQueue< E >.

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


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