activemq-cpp-3.4.0
|
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>
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. |
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.
virtual decaf::util::Queue< E >::~Queue | ( | ) | [inline, virtual] |
virtual E decaf::util::Queue< E >::element | ( | ) | const [pure virtual] |
Gets but not removes the element in the head of the queue.
Throws a NoSuchElementException if there is no element in the queue.
NoSuchElementException | if there is no element in the queue. |
Implemented in decaf::util::AbstractQueue< E >, decaf::util::LinkedList< 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 * >.
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.
value | the specified element to insert into the queue. |
NullPointerException | if the Queue implementation does not allow Null values to be inserted into the Queue. |
IllegalArgumentException | if 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().
virtual bool decaf::util::Queue< E >::peek | ( | E & | result | ) | const [pure virtual] |
Gets but not removes the element in the head of the queue.
The result if successful is assigned to the result parameter.
result | Reference to an instance of the contained type to assigned the removed value to. |
Implemented in decaf::util::concurrent::LinkedBlockingQueue< 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 >::element().
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.
result | Reference to an instance of the contained type to assigned the removed value to. |
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().
virtual E decaf::util::Queue< E >::remove | ( | ) | [pure virtual] |
Gets and removes the element in the head of the queue.
Throws a NoSuchElementException if there is no element in the queue.
NoSuchElementException | if there is no element in the queue. |
Implemented in decaf::util::AbstractQueue< 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 * >.