Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# ACE_Dynamic_Message_Queue<> Class Template Reference

A derived class which adapts the <ACE_Message_Queue> class in order to maintain dynamic priorities for enqueued <ACE_Message_Blocks> and manage the queue order according to these dynamic priorities. More...

`#include <Message_Queue_T.h>`

Inheritance diagram for ACE_Dynamic_Message_Queue<>:

[legend]
Collaboration diagram for ACE_Dynamic_Message_Queue<>:

[legend]
List of all members.

## Public Methods

| ACE_Dynamic_Message_Queue (ACE_Dynamic_Message_Strategy &message_strategy, size_t hwm=ACE_Message_Queue_Base::DEFAULT_HWM, size_t lwm=ACE_Message_Queue_Base::DEFAULT_LWM, ACE_Notification_Strategy *=0)
virtual | ~ACE_Dynamic_Message_Queue (void)
| Close down the message queue and release all resources.
virtual int | remove_messages (ACE_Message_Block *&list_head, ACE_Message_Block *&list_tail, u_int status_flags)
virtual int | dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout=0)
virtual void | dump (void) const
| Dump the state of the queue.
virtual int | enqueue_tail (ACE_Message_Block *new_item, ACE_Time_Value *timeout=0)
virtual int | enqueue_head (ACE_Message_Block *new_item, ACE_Time_Value *timeout=0)

## Public Attributes

| ACE_ALLOC_HOOK_DECLARE
| Declare the dynamic allocation hooks.

## Protected Methods

virtual int | enqueue_i (ACE_Message_Block *new_item)
virtual int | sublist_enqueue_i (ACE_Message_Block *new_item, const ACE_Time_Value &current_time, ACE_Message_Block *&sublist_head, ACE_Message_Block *&sublist_tail, ACE_Dynamic_Message_Strategy::Priority_Status status)
| Enqueue a message in priority order within a given priority status sublist.
virtual int | dequeue_head_i (ACE_Message_Block *&first_item)
virtual int | refresh_queue (const ACE_Time_Value &current_time)
virtual int | refresh_pending_queue (const ACE_Time_Value &current_time)
virtual int | refresh_late_queue (const ACE_Time_Value &current_time)

## Protected Attributes

ACE_Message_Block * | pending_head_
| Pointer to head of the pending messages.
ACE_Message_Block * | pending_tail_
| Pointer to tail of the pending messages.
ACE_Message_Block * | late_head_
| Pointer to head of the late messages.
ACE_Message_Block * | late_tail_
| Pointer to tail of the late messages.
ACE_Message_Block * | beyond_late_head_
| Pointer to head of the beyond late messages.
ACE_Message_Block * | beyond_late_tail_
| Pointer to tail of the beyond late messages.
ACE_Dynamic_Message_Strategy & | message_strategy_
| Pointer to a dynamic priority evaluation function.

## Private Methods

void | operator= (const ACE_Dynamic_Message_Queue< _ACE_SYNCH > &)
| ACE_Dynamic_Message_Queue (const ACE_Dynamic_Message_Queue< _ACE_SYNCH > &)
virtual int | peek_dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout=0)
| Private method to hide public base class method: just calls base class method.

## Detailed Description

### template<ACE_SYNCH_DECL>
class ACE_Dynamic_Message_Queue<>

A derived class which adapts the <ACE_Message_Queue> class in order to maintain dynamic priorities for enqueued <ACE_Message_Blocks> and manage the queue order according to these dynamic priorities.

The messages in the queue are managed so as to preserve a logical ordering with minimal overhead per enqueue and dequeue operation. For this reason, the actual order of messages in the linked list of the queue may differ from their priority order. As time passes, a message may change from pending status to late status, and eventually to beyond late status. To minimize reordering overhead under this design force, three separate boundaries are maintained within the linked list of messages. Messages are dequeued preferentially from the head of the pending portion, then the head of the late portion, and finally from the head of the beyond late portion. In this way, only the boundaries need to be maintained (which can be done efficiently, as aging messages maintain the same linked list order as they progress from one status to the next), with no reordering of the messages themselves, while providing correct priority ordered dequeueing semantics. Head and tail enqueue methods inherited from ACE_Message_Queue are made private to prevent out-of-order messages from confusing management of the various portions of the queue. Messages in the pending portion of the queue whose priority becomes late (according to the specific dynamic strategy) advance into the late portion of the queue. Messages in the late portion of the queue whose priority becomes later than can be represented advance to the beyond_late portion of the queue. These behaviors support a limited schedule overrun, with pending messages prioritized ahead of late messages, and late messages ahead of beyond late messages. These behaviors can be modified in derived classes by providing alternative definitions for the appropriate virtual methods. When filled with messages, the queue's linked list should look like: H T | | B - B - B - B - L - L - L - P - P - P - P - P | | | | | | BH BT LH LT PH PT Where the symbols are as follows: H = Head of the entire list T = Tail of the entire list B = Beyond late message BH = Beyond late messages Head BT = Beyond late messages Tail L = Late message LH = Late messages Head LT = Late messages Tail P = Pending message PH = Pending messages Head PT = Pending messages Tail Caveat: the virtual methods enqueue_tail, enqueue_head, and peek_dequeue_head have semantics for the static message queues that cannot be guaranteed for dynamic message queues. The peek_dequeue_head method just calls the base class method, while the two enqueue methods call the priority enqueue method. The order of messages in the dynamic queue is a function of message deadlines and how long they are in the queues. You can manipulate these in some cases to ensure the correct semantics, but that is not a very stable or portable approach (discouraged).

## Constructor & Destructor Documentation

template<ACE_SYNCH_DECL >
ACE_Dynamic_Message_Queue<>::ACE_Dynamic_Message_Queue | ( | ACE_Dynamic_Message_Strategy & | message_strategy,
|  | size_t | hwm = ACE_Message_Queue_Base::DEFAULT_HWM,
|  | size_t | lwm = ACE_Message_Queue_Base::DEFAULT_LWM,
|  | ACE_Notification_Strategy * | = 0
| ) |

template<ACE_SYNCH_DECL >
ACE_Dynamic_Message_Queue<>::~ACE_Dynamic_Message_Queue | ( | void |  | ) | `[virtual]`

| Close down the message queue and release all resources.

template<ACE_SYNCH_DECL >
ACE_Dynamic_Message_Queue<>::ACE_Dynamic_Message_Queue | ( | const ACE_Dynamic_Message_Queue< _ACE_SYNCH > & |  | ) | `[private]`

## Member Function Documentation

template<ACE_SYNCH_DECL >
int ACE_Dynamic_Message_Queue<>::dequeue_head | ( | ACE_Message_Block *& | first_item,
|  | ACE_Time_Value * | timeout = 0
| ) | `[virtual]`

| Dequeue and return the <ACE_Message_Block *> at the head of the queue. Returns -1 on failure, else the number of items still on the queue. Reimplemented from ACE_Message_Queue< ACE_SYNCH_USE >.

template<ACE_SYNCH_DECL >
int ACE_Dynamic_Message_Queue<>::dequeue_head_i | ( | ACE_Message_Block *& | first_item | ) | `[protected, virtual]`

| Dequeue and return the <ACE_Message_Block *> at the head of the logical queue. Attempts first to dequeue from the pending portion of the queue, or if that is empty from the late portion, or if that is empty from the beyond late portion, or if that is empty just sets the passed pointer to zero and returns -1. Reimplemented from ACE_Message_Queue< ACE_SYNCH_USE >.

template<ACE_SYNCH_DECL >
void ACE_Dynamic_Message_Queue<>::dump | ( | void |  | ) | const`[virtual]`

| Dump the state of the queue. Reimplemented from ACE_Message_Queue< ACE_SYNCH_USE >.

template<ACE_SYNCH_DECL >
int ACE_Dynamic_Message_Queue<>::enqueue_head | ( | ACE_Message_Block * | new_item,
|  | ACE_Time_Value * | timeout = 0
| ) | `[virtual]`

| Just call priority enqueue method: head enqueue semantics for dynamic message queues are unstable: the message may or may not be where it was placed after the queue is refreshed prior to the next enqueue or dequeue operation. Reimplemented from ACE_Message_Queue< ACE_SYNCH_USE >.

template<ACE_SYNCH_DECL >
int ACE_Dynamic_Message_Queue<>::enqueue_i | ( | ACE_Message_Block * | new_item | ) | `[protected, virtual]`

| Enqueue an <ACE_Message_Block *> in accordance with its priority. priority may be *dynamic* or *static* or a combination or *both* It calls the priority evaluation function passed into the Dynamic Message Queue constructor to update the priorities of all enqueued messages. Reimplemented from ACE_Message_Queue< ACE_SYNCH_USE >.

template<ACE_SYNCH_DECL >
int ACE_Dynamic_Message_Queue<>::enqueue_tail | ( | ACE_Message_Block * | new_item,
|  | ACE_Time_Value * | timeout = 0
| ) | `[virtual]`

| Just call priority enqueue method: tail enqueue semantics for dynamic message queues are unstable: the message may or may not be where it was placed after the queue is refreshed prior to the next enqueue or dequeue operation. Reimplemented from ACE_Message_Queue< ACE_SYNCH_USE >.

template<ACE_SYNCH_DECL >
void ACE_Dynamic_Message_Queue<>::operator= | ( | const ACE_Dynamic_Message_Queue< _ACE_SYNCH > & |  | ) | `[private]`

template<ACE_SYNCH_DECL >
int ACE_Dynamic_Message_Queue<>::peek_dequeue_head | ( | ACE_Message_Block *& | first_item,
|  | ACE_Time_Value * | timeout = 0
| ) | `[private, virtual]`

| Private method to hide public base class method: just calls base class method. Reimplemented from ACE_Message_Queue< ACE_SYNCH_USE >.

template<ACE_SYNCH_DECL >
int ACE_Dynamic_Message_Queue<>::refresh_late_queue | ( | const ACE_Time_Value & | current_time | ) | `[protected, virtual]`

| Refresh the late queue using the strategy specific priority status function.

template<ACE_SYNCH_DECL >
int ACE_Dynamic_Message_Queue<>::refresh_pending_queue | ( | const ACE_Time_Value & | current_time | ) | `[protected, virtual]`

| Refresh the pending queue using the strategy specific priority status function.

template<ACE_SYNCH_DECL >
int ACE_Dynamic_Message_Queue<>::refresh_queue | ( | const ACE_Time_Value & | current_time | ) | `[protected, virtual]`

| Refresh the queue using the strategy specific priority status function.

template<ACE_SYNCH_DECL >
int ACE_Dynamic_Message_Queue<>::remove_messages | ( | ACE_Message_Block *& | list_head,
|  | ACE_Message_Block *& | list_tail,
|  | u_int | status_flags
| ) | `[virtual]`

Detach all messages with status given in the passed flags from the queue and return them by setting passed head and tail pointers to the linked list they comprise. This method is intended primarily as a means of periodically harvesting messages that have missed their deadlines, but is available in its most general form. All messages are returned in priority order, from head to tail, as of the time this method was called.

template<ACE_SYNCH_DECL >
int ACE_Dynamic_Message_Queue<>::sublist_enqueue_i | ( | ACE_Message_Block * | new_item,
|  | const ACE_Time_Value & | current_time,
|  | ACE_Message_Block *& | sublist_head,
|  | ACE_Message_Block *& | sublist_tail,
|  | ACE_Dynamic_Message_Strategy::Priority_Status | status
| ) | `[protected, virtual]`

| Enqueue a message in priority order within a given priority status sublist.

## Member Data Documentation

template<ACE_SYNCH_DECL >
ACE_Dynamic_Message_Queue<>::ACE_ALLOC_HOOK_DECLARE

| Declare the dynamic allocation hooks. Reimplemented from ACE_Message_Queue< ACE_SYNCH_USE >.

template<ACE_SYNCH_DECL >
ACE_Message_Block* ACE_Dynamic_Message_Queue<>::beyond_late_head_`[protected]`

| Pointer to head of the beyond late messages.

template<ACE_SYNCH_DECL >
ACE_Message_Block* ACE_Dynamic_Message_Queue<>::beyond_late_tail_`[protected]`

| Pointer to tail of the beyond late messages.

template<ACE_SYNCH_DECL >
ACE_Message_Block* ACE_Dynamic_Message_Queue<>::late_head_`[protected]`

| Pointer to head of the late messages.

template<ACE_SYNCH_DECL >
ACE_Message_Block* ACE_Dynamic_Message_Queue<>::late_tail_`[protected]`

| Pointer to tail of the late messages.

template<ACE_SYNCH_DECL >
ACE_Dynamic_Message_Strategy& ACE_Dynamic_Message_Queue<>::message_strategy_`[protected]`

| Pointer to a dynamic priority evaluation function.

template<ACE_SYNCH_DECL >
ACE_Message_Block* ACE_Dynamic_Message_Queue<>::pending_head_`[protected]`

| Pointer to head of the pending messages.

template<ACE_SYNCH_DECL >
ACE_Message_Block* ACE_Dynamic_Message_Queue<>::pending_tail_`[protected]`

| Pointer to tail of the pending messages.

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

- /export2/deucetmp/bala/release_try/ACE_wrappers/ace/Message_Queue_T.h
- /export2/deucetmp/bala/release_try/ACE_wrappers/ace/Message_Queue_T.cpp