ACE  6.4.2
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, TIME_POLICY > Class Template Reference

A threaded message queueing facility, modeled after the queueing facilities in System V STREAMs which can enqueue multiple messages in one call. More...

#include <Message_Queue_T.h>

Inheritance diagram for ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, TIME_POLICY >:
Inheritance graph
[legend]
Collaboration diagram for ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, TIME_POLICY >:
Collaboration graph
[legend]

Public Member Functions

 ACE_Message_Queue_Ex_N (size_t high_water_mark=ACE_Message_Queue_Base::DEFAULT_HWM, size_t low_water_mark=ACE_Message_Queue_Base::DEFAULT_LWM, ACE_Notification_Strategy *ns=0)
 
virtual ~ACE_Message_Queue_Ex_N (void)
 Close down the message queue and release all resources. More...
 
virtual int enqueue_head (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *tv=0)
 
virtual int enqueue_tail (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *tv=0)
 
- Public Member Functions inherited from ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY >
virtual int close (void)
 
virtual ~ACE_Message_Queue_Ex (void)
 Releases all resources from the message queue and marks it deactivated. More...
 
virtual int flush (void)
 
virtual int flush_i (void)
 
virtual ACE_SYNCH_MUTEX_Tlock (void)
 Returns a reference to the lock used by the ACE_Message_Queue_Ex. More...
 
ACE_Time_Value_T< TIME_POLICY > gettimeofday ()
 
void set_time_policy (TIME_POLICY const &time_policy)
 
virtual void dump (void) const
 Dump the state of an object. More...
 
 ACE_Message_Queue_Ex (size_t high_water_mark=ACE_Message_Queue_Base::DEFAULT_HWM, size_t low_water_mark=ACE_Message_Queue_Base::DEFAULT_LWM, ACE_Notification_Strategy *ns=0)
 
virtual int open (size_t hwm=ACE_Message_Queue_Base::DEFAULT_HWM, size_t lwm=ACE_Message_Queue_Base::DEFAULT_LWM, ACE_Notification_Strategy *=0)
 
virtual int peek_dequeue_head (ACE_MESSAGE_TYPE *&first_item, ACE_Time_Value *timeout=0)
 
virtual int enqueue_prio (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout=0, unsigned long priority=DEFAULT_PRIORITY)
 
virtual int enqueue_deadline (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout=0)
 
virtual int enqueue (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout=0)
 
virtual int dequeue (ACE_MESSAGE_TYPE *&first_item, ACE_Time_Value *timeout=0)
 This method is an alias for the following <dequeue_head> method. More...
 
virtual int dequeue_head (ACE_MESSAGE_TYPE *&first_item, ACE_Time_Value *timeout=0)
 
virtual int dequeue_prio (ACE_MESSAGE_TYPE *&dequeued, ACE_Time_Value *timeout=0)
 
virtual int dequeue_tail (ACE_MESSAGE_TYPE *&dequeued, ACE_Time_Value *timeout=0)
 
virtual int dequeue_deadline (ACE_MESSAGE_TYPE *&dequeued, ACE_Time_Value *timeout=0)
 
virtual bool is_full (void)
 True if queue is full, else false. More...
 
virtual bool is_empty (void)
 True if queue is empty, else false. More...
 
virtual size_t message_bytes (void)
 
virtual void message_bytes (size_t new_size)
 
virtual size_t message_length (void)
 
virtual void message_length (size_t new_length)
 
virtual size_t message_count (void)
 
virtual size_t high_water_mark (void)
 
virtual void high_water_mark (size_t hwm)
 
virtual size_t low_water_mark (void)
 
virtual void low_water_mark (size_t lwm)
 
virtual int deactivate (void)
 
virtual int activate (void)
 
virtual int pulse (void)
 
virtual int state (void)
 
virtual int deactivated (void)
 
virtual int notify (void)
 
virtual ACE_Notification_Strategynotification_strategy (void)
 Get the notification strategy for the <Message_Queue> More...
 
virtual void notification_strategy (ACE_Notification_Strategy *s)
 Set the notification strategy for the <Message_Queue> More...
 

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...
 
- Public Attributes inherited from ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY >
 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...
 

Protected Member Functions

ACE_Message_Blockwrap_with_mbs_i (ACE_MESSAGE_TYPE *new_item)
 

Additional Inherited Members

- Public Types inherited from ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY >
enum  
 
typedef ACE_Message_Queue_Ex_Iterator< ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY > ITERATOR
 
typedef ACE_Message_Queue_Ex_Reverse_Iterator< ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY > REVERSE_ITERATOR
 
- Protected Attributes inherited from ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY >
ACE_Message_Queue< ACE_SYNCH_USE, TIME_POLICY > queue_
 Implement this via an ACE_Message_Queue. More...
 

Detailed Description

template<class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy>
class ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, TIME_POLICY >

A threaded message queueing facility, modeled after the queueing facilities in System V STREAMs which can enqueue multiple messages in one call.

As ACE_Message_Queue_Ex, ACE_Message_Queue_Ex_N is a strongly-typed version of the ACE_Message_Queue. If ACE_SYNCH_DECL is ACE_MT_SYNCH then all operations are thread-safe. Otherwise, if it's ACE_NULL_SYNCH then there's no locking overhead.

The ACE_MESSAGE_TYPE messages that are sent to this queue can be chained. Messages are expected to have a next method that returns the next message in the chain; ACE_Message_Queue_Ex_N uses this method to run through all the incoming messages and enqueue them in one call.

Constructor & Destructor Documentation

template<class ACE_MESSAGE_TYPE , ACE_SYNCH_DECL , class TIME_POLICY = ACE_System_Time_Policy>
class TIME_POLICY ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, TIME_POLICY >::ACE_Message_Queue_Ex_N ( size_t  high_water_mark = ACE_Message_Queue_Base::DEFAULT_HWM,
size_t  low_water_mark = ACE_Message_Queue_Base::DEFAULT_LWM,
ACE_Notification_Strategy ns = 0 
)

Initialize an ACE_Message_Queue_Ex_N. The high_water_mark determines how many bytes can be stored in a queue before it's considered "full." Supplier threads must block until the queue is no longer full. The low_water_mark determines how many bytes must be in the queue before supplier threads are allowed to enqueue additional messages. By default, the high_water_mark equals the low_water_mark, which means that suppliers will be able to enqueue new messages as soon as a consumer removes any message from the queue. Making the low_water_mark smaller than the high_water_mark forces consumers to drain more messages from the queue before suppliers can enqueue new messages, which can minimize the "silly window syndrome."

template<class ACE_MESSAGE_TYPE , ACE_SYNCH_DECL , class TIME_POLICY >
ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, TIME_POLICY >::~ACE_Message_Queue_Ex_N ( void  )
virtual

Close down the message queue and release all resources.

Member Function Documentation

template<class ACE_MESSAGE_TYPE , ACE_SYNCH_DECL , class TIME_POLICY >
int ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, TIME_POLICY >::enqueue_head ( ACE_MESSAGE_TYPE *  new_item,
ACE_Time_Value tv = 0 
)
virtual

Enqueue one or more ACE_MESSAGE_TYPE objects at the head of the queue. If the new_item next() pointer is non-zero, it is assumed to be the start of a series of ACE_MESSAGE_TYPE objects connected via their next() pointers. The series of blocks will be added to the queue in the same order they are passed in as.

Parameters
new_itemPointer to an ACE_MESSAGE_TYPE that will be added to the queue. If the block's next() pointer is non-zero, all blocks chained from the next() pointer are enqueued as well.
tvThe absolute time the caller will wait until for the block to be queued.
Return values
>0The number of ACE_MESSAGE_TYPE objects on the queue after adding the specified block(s).
-1On failure. errno holds the reason. Common errno values are:
  • EWOULDBLOCK: the timeout elapsed
  • ESHUTDOWN: the queue was deactivated or pulsed

Reimplemented from ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY >.

template<class ACE_MESSAGE_TYPE , ACE_SYNCH_DECL , class TIME_POLICY >
int ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, TIME_POLICY >::enqueue_tail ( ACE_MESSAGE_TYPE *  new_item,
ACE_Time_Value tv = 0 
)
virtual

Enqueue one or more ACE_MESSAGE_TYPE objects at the tail of the queue. If the new_item next() pointer is non-zero, it is assumed to be the start of a series of ACE_MESSAGE_TYPE objects connected via their next() pointers. The series of blocks will be added to the queue in the same order they are passed in as.

Parameters
new_itemPointer to an ACE_MESSAGE_TYPE that will be added to the queue. If the block's next() pointer is non-zero, all blocks chained from the next() pointer are enqueued as well.
tvThe absolute time the caller will wait until for the block to be queued.
Return values
>0The number of ACE_MESSAGE_TYPE objects on the queue after adding the specified block(s).
-1On failure. errno holds the reason. Common errno values are:
  • EWOULDBLOCK: the timeout elapsed
  • ESHUTDOWN: the queue was deactivated or pulsed

Reimplemented from ACE_Message_Queue_Ex< ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY >.

template<class ACE_MESSAGE_TYPE , ACE_SYNCH_DECL , class TIME_POLICY >
ACE_Message_Block * ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, TIME_POLICY >::wrap_with_mbs_i ( ACE_MESSAGE_TYPE *  new_item)
protected

An helper method that wraps the incoming chain messages with ACE_Message_Blocks.

Member Data Documentation

template<class ACE_MESSAGE_TYPE , ACE_SYNCH_DECL , class TIME_POLICY = ACE_System_Time_Policy>
ACE_Message_Queue_Ex_N< ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, TIME_POLICY >::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.


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