# ACE_Message_Queue_Base Class Reference

Base class for ACE_Message_Queue, which is the central queueing facility for messages in the ACE framework. More...

`#include <Message_Queue.h>`

Inheritance diagram for ACE_Message_Queue_Base:

[legend]
List of all members.

## Public Types

enum | { DEFAULT_HWM = 16 * 1024, DEFAULT_LWM = 16 * 1024, WAS_ACTIVE = 1, ACTIVATED = 1, WAS_INACTIVE = 2, DEACTIVATED = 2, PULSED = 3 }

## Public Member Functions

| ACE_Message_Queue_Base (void)
virtual int | close (void)=0
| Close down the message queue and release all resources.
virtual | ~ACE_Message_Queue_Base (void)
| Close down the message queue and release all resources.
virtual int | peek_dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout=0)=0
virtual int | enqueue_tail (ACE_Message_Block *new_item, ACE_Time_Value *timeout=0)=0
virtual int | enqueue (ACE_Message_Block *new_item, ACE_Time_Value *timeout=0)=0
virtual int | dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout=0)=0
virtual int | dequeue (ACE_Message_Block *&first_item, ACE_Time_Value *timeout=0)=0
virtual int | is_full (void)=0
| True if queue is full, else false.
virtual int | is_empty (void)=0
| True if queue is empty, else false.
virtual size_t | message_bytes (void)=0
virtual size_t | message_length (void)=0
virtual size_t | message_count (void)=0
| Number of total messages on the queue.
virtual void | message_bytes (size_t new_size)=0
virtual void | message_length (size_t new_length)=0
virtual int | deactivate (void)=0
virtual int | activate (void)=0
virtual int | pulse (void)=0
virtual int | state (void)
| Returns the current state of the queue.
virtual int | deactivated (void)=0
virtual ACE_Notification_Strategy * | notification_strategy (void)=0
| Get the notification strategy for the <message_queue>.
virtual void | notification_strategy (ACE_Notification_Strategy *s)=0
| Set the notification strategy for the <message_queue>.
virtual void | dump (void) const =0
| Dump the state of an object.

## Public Attributes

| ACE_ALLOC_HOOK_DECLARE
| Declare the dynamic allocation hooks.

## Protected Attributes

int | state_

## Private Member Functions

| ACE_Message_Queue_Base (const ACE_Message_Queue_Base &)
void | operator= (const ACE_Message_Queue_Base &)

## Detailed Description

Base class for ACE_Message_Queue, which is the central queueing facility for messages in the ACE framework.

For all the <ace_time_value> pointer parameters the caller will block until action is possible if <timeout> == 0. Otherwise, it will wait until the absolute time specified in *<timeout> elapses.

A queue is always in one of three states: . ACTIVATED . DEACTIVATED . PULSED

## Member Enumeration Documentation

anonymous enum

Enumeration values:

  DEFAULT_HWM | Default high watermark (16 K).
  DEFAULT_LWM | Default low watermark (same as high water mark).

  WAS_ACTIVE

  Deprecated:
    Use ACTIVATED instead.

  ACTIVATED | Message queue is active and processing normally.

  WAS_INACTIVE

  Deprecated:
    Use DEACTIVATED instead.

  DEACTIVATED | Queue is deactivated; no enqueue or dequeue operations allowed.
  PULSED | Message queue was pulsed; enqueue and dequeue may proceed normally.

## Constructor & Destructor Documentation

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Message_Queue_Base::ACE_Message_Queue_Base | ( | void |  | ) |

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Message_Queue_Base::~ACE_Message_Queue_Base | ( | void |  | ) | `[virtual]`

| Close down the message queue and release all resources.

ACE_Message_Queue_Base::ACE_Message_Queue_Base | ( | const ACE_Message_Queue_Base & |  | ) | `[private]`

## Member Function Documentation

virtual int ACE_Message_Queue_Base::activate | ( | void |  | ) | `[pure virtual]`

Reactivate the queue so that threads can enqueue and dequeue messages again.

Return values:

  | The | queue's state before this call.

Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual int ACE_Message_Queue_Base::close | ( | void |  | ) | `[pure virtual]`

| Close down the message queue and release all resources. Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual int ACE_Message_Queue_Base::deactivate | ( | void |  | ) | `[pure virtual]`

Deactivate the queue and wake up all threads waiting on the queue so they can continue. No messages are removed from the queue, however. Any other operations called until the queue is activated again will immediately return -1 with `errno` ESHUTDOWN.

Return values:

  | The | queue's state before this call.

Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual int ACE_Message_Queue_Base::deactivated | ( | void |  | ) | `[pure virtual]`

| Returns 1 if the state of the queue is DEACTIVATED, and 0 if the queue's state is ACTIVATED or PULSED. Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual int ACE_Message_Queue_Base::dequeue | ( | ACE_Message_Block *& | first_item,
|  | ACE_Time_Value * | timeout = `0`
| ) | `[pure virtual]`

| Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual int ACE_Message_Queue_Base::dequeue_head | ( | ACE_Message_Block *& | first_item,
|  | ACE_Time_Value * | timeout = `0`
| ) | `[pure virtual]`

Dequeue and return the <ACE_Message_Block *> at the head of the queue. Returns number of items in queue if the call succeeds or -1 otherwise. These calls return -1 when queue is closed, deactivated (in which case <errno> == <eshutdown>), when a signal occurs (in which case <errno> == <eintr>, or if the time specified in timeout elapses (in which case <errno> == <ewouldblock>).

Implemented in ACE_Message_Queue<>, ACE_Dynamic_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual void ACE_Message_Queue_Base::dump | ( | void |  | ) | const`[pure virtual]`

| Dump the state of an object. Implemented in ACE_Message_Queue<>, ACE_Dynamic_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual int ACE_Message_Queue_Base::enqueue | ( | ACE_Message_Block * | new_item,
|  | ACE_Time_Value * | timeout = `0`
| ) | `[pure virtual]`

| Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual int ACE_Message_Queue_Base::enqueue_tail | ( | ACE_Message_Block * | new_item,
|  | ACE_Time_Value * | timeout = `0`
| ) | `[pure virtual]`

Enqueue a <ACE_Message_Block *> into the tail of the queue. Returns number of items in queue if the call succeeds or -1 otherwise. These calls return -1 when queue is closed, deactivated (in which case <errno> == <eshutdown>), when a signal occurs (in which case <errno> == <eintr>, or if the time specified in timeout elapses (in which case <errno> == <ewouldblock>).

Implemented in ACE_Message_Queue<>, ACE_Dynamic_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual int ACE_Message_Queue_Base::is_empty | ( | void |  | ) | `[pure virtual]`

| True if queue is empty, else false. Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual int ACE_Message_Queue_Base::is_full | ( | void |  | ) | `[pure virtual]`

| True if queue is full, else false. Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual void ACE_Message_Queue_Base::message_bytes | ( | size_t | new_size | ) | `[pure virtual]`

| New value of the number of total bytes on the queue, i.e., sum of the message block sizes. Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual size_t ACE_Message_Queue_Base::message_bytes | ( | void |  | ) | `[pure virtual]`

| Number of total bytes on the queue, i.e., sum of the message block sizes. Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual size_t ACE_Message_Queue_Base::message_count | ( | void |  | ) | `[pure virtual]`

| Number of total messages on the queue. Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual void ACE_Message_Queue_Base::message_length | ( | size_t | new_length | ) | `[pure virtual]`

| New value of the number of total length on the queue, i.e., sum of the message block lengths. Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual size_t ACE_Message_Queue_Base::message_length | ( | void |  | ) | `[pure virtual]`

| Number of total length on the queue, i.e., sum of the message block lengths. Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual void ACE_Message_Queue_Base::notification_strategy | ( | ACE_Notification_Strategy * | s | ) | `[pure virtual]`

| Set the notification strategy for the <message_queue>. Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual ACE_Notification_Strategy* ACE_Message_Queue_Base::notification_strategy | ( | void |  | ) | `[pure virtual]`

| Get the notification strategy for the <message_queue>. Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

void ACE_Message_Queue_Base::operator= | ( | const ACE_Message_Queue_Base & |  | ) | `[private]`

virtual int ACE_Message_Queue_Base::peek_dequeue_head | ( | ACE_Message_Block *& | first_item,
|  | ACE_Time_Value * | timeout = `0`
| ) | `[pure virtual]`

Retrieve the first ACE_Message_Block without removing it. Note that <timeout> uses <{absolute}> time rather than <{relative}> time. If the <timeout> elapses without receiving a message -1 is returned and <errno> is set to <ewouldblock>. If the queue is deactivated -1 is returned and <errno> is set to <eshutdown>. Otherwise, returns -1 on failure, else the number of items still on the queue.

Implemented in ACE_Message_Queue<>, ACE_Dynamic_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

virtual int ACE_Message_Queue_Base::pulse | ( | void |  | ) | `[pure virtual]`

Pulse the queue to wake up any waiting threads. Changes the queue state to PULSED; future enqueue/dequeue operations proceed as in ACTIVATED state.

Return values:

  | The | queue's state before this call.

Implemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

int ACE_Message_Queue_Base::state | ( | void |  | ) | `[virtual]`

| Returns the current state of the queue. Reimplemented in ACE_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

## Member Data Documentation

ACE_Message_Queue_Base::ACE_ALLOC_HOOK_DECLARE

| Declare the dynamic allocation hooks. Reimplemented in ACE_Message_Queue<>, ACE_Dynamic_Message_Queue<>, ACE_Message_Queue< ACE_SYNCH >, ACE_Message_Queue< ACE_SYNCH_USE >, and ACE_Message_Queue< ACE_MT_SYNCH >.

int ACE_Message_Queue_Base::state_ `[protected]`

| Indicates the state of the queue, which can be <activated>, <deactivated>, or <pulsed>.

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

- Message_Queue.h
- Message_Queue.cpp
- Message_Queue.inl