activemq::util::Queue< T > Class Template Reference
#include <Queue.h>
Inheritance diagram for activemq::util::Queue< T >:
List of all members.
|
Public Member Functions |
| Queue (void) |
virtual | ~Queue (void) |
T & | front (void) |
const T & | front (void) const |
T & | back (void) |
const T & | back (void) const |
void | push (const T &t) |
T | pop (void) |
size_t | size (void) const |
bool | empty (void) const |
virtual void | lock () throw ( exceptions::ActiveMQException ) |
virtual void | unlock () throw ( exceptions::ActiveMQException ) |
virtual void | wait () throw ( exceptions::ActiveMQException ) |
virtual void | wait (unsigned long millisecs) throw ( exceptions::ActiveMQException ) |
virtual void | notify () throw ( exceptions::ActiveMQException ) |
virtual void | notifyAll () throw ( exceptions::ActiveMQException ) |
Static Public Member Functions |
static const T & | getSafeValue (void) |
Private Attributes |
std::queue< T > | queue |
concurrent::Mutex | mutex |
Static Private Attributes |
static T | safe |
Detailed Description
template<typename T>
class activemq::util::Queue< T >
The Queue class accepts messages with an psuh(m) command where m is the message to be queued. It destructively returns the message with pop(). pop() returns messages in the order they were enqueued.
Queue is implemented with an instance of the STL queue object. The interface is essentially the same as that of the STL queue except that the pop method actually reaturns a reference to the element popped. This frees the app from having to call the front
method before calling pop.
Queue<string> sq; // make a queue to hold string messages sq.push(s); // enqueues a message m string s = sq.pop(); // dequeues a message
= DESIGN CONSIDERATIONS
The Queue class inherits from the Synchronizable interface and provides methods for locking and unlocking this queue as well as waiting on this queue. In a multi-threaded app this can allow for multiple threads to be reading from and writing to the same Queue.
Clients should consider that in a multiple threaded app it is possible that items could be placed on the queue faster than you are taking them off, so protection should be placed in your polling loop to ensure that you don't get stuck there.
Constructor & Destructor Documentation
Member Function Documentation
|
Returns a Reference to the element at the tail of the queue - Returns:
- reference to a queue type object or (safe)
|
|
Returns a Reference to the element at the tail of the queue - Returns:
- reference to a queue type object or (safe)
|
|
Checks if this Queue is currently empty - Returns:
- boolean indicating queue emptiness
|
|
Returns a Reference to the element at the head of the queue - Returns:
- reference to a queue type object or (safe)
|
|
Returns a Reference to the element at the head of the queue - Returns:
- reference to a queue type object or (safe)
|
|
Fetch a reference to the safe value this object will return when there is nothing to fetch from the queue. - Returns:
- Reference to this Queues safe object
|
|
Removes and returns the element that is at the Head of the queue - Returns:
- reference to a queue type object or (safe)
|
|
Places a new Object at the Tail of the queue - Parameters:
-
| t | - Queue Object Type reference. |
|
|
Waits on a signal from this object, which is generated by a call to Notify. Must have this object locked before calling. This wait will timeout after the specified time interval. - Parameters:
-
| millisecs | time to wait, or WAIT_INIFINITE |
- Exceptions:
-
Implements activemq::concurrent::Synchronizable. |
Member Data Documentation
The documentation for this class was generated from the following file:
- activemq-cpp/src/main/activemq/util/Queue.h
Generated on Thu Aug 3 18:03:33 2006 for activemq-cpp by
1.4.5