NAME
ACE_Message_Queue_Base - Workaround HP/C++ compiler bug with enums in templates.
SYNOPSIS
#include <ace/Message_Queue.h>
class ACE_Message_Queue_Base
{
public:
enum{ DEFAULT_HWM = 16 * 1024,
DEFAULT_LWM = 16 * 1024,
WAS_ACTIVE = 1,
WAS_INACTIVE = 2 };
ACE_Message_Queue_Base (void);
virtual int close (void) = 0;
virtual ~ACE_Message_Queue_Base (void);
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;
virtual int is_empty (void) = 0;
virtual size_t message_bytes (void) = 0;
virtual size_t message_length (void) = 0;
virtual size_t message_count (void) = 0;
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 deactivated (void) = 0;
virtual void dump (void) const = 0;
ACE_ALLOC_HOOK_DECLARE;
private:
inline ACE_UNIMPLEMENTED_FUNC (
void operator= (const ACE_Message_Queue_Base &)
);
};
DESCRIPTION
The ever lamest HP/C++ compiler seems to fail if enums are defined inside a template, hence we have to move them into a base class.
Default high and low water marks.
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.
Enqueue and dequeue methods.
For the following enqueue and dequeue methods if timeout == 0, the caller will block until action is possible, else will wait until the absolute time specified in *timeout elapses). These calls will return, however, when queue is closed, deactivated, when a signal occurs, or if the time specified in timeout elapses, (in which case errno = EWOULDBLOCK).
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;
Enqueue a ACE_Message_Block * into the tail of the queue. Return -1 on failure, number of items in queue otherwise.
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;
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.
Check if queue is full/empty.
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.
Queue statistic methods.
virtual size_t message_bytes (void) = 0;
Number of total bytes on the queue, i.e., sum of the message block sizes.
virtual size_t message_length (void) = 0;
Number of total length on the queue, i.e., sum of the message block lengths.
virtual size_t message_count (void) = 0;
Number of total messages on the queue.
Manual changes to these stats (used when queued message blocks
change size or lengths).
virtual void message_bytes (size_t new_size) = 0;
New value of the number of total bytes on the queue, i.e., sum of the message block sizes.
virtual void message_length (size_t new_length) = 0;
New value of the number of total length on the queue, i.e., sum of the message block lengths.
Activation control methods.
virtual int deactivate (void) = 0;
Deactivate the queue and wakeup 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. Returns WAS_INACTIVE if queue was inactive before the call and WAS_ACTIVE if queue was active before the call.
virtual int activate (void) = 0;
Reactivate the queue so that threads can enqueue and dequeue messages again. Returns WAS_INACTIVE if queue was inactive before the call and WAS_ACTIVE if queue was active before the call.
virtual int deactivated (void) = 0;
Returns true if deactivated_ is enabled.
Notification hook.
virtual void dump (void) const = 0;
Dump the state of an object.
ACE_ALLOC_HOOK_DECLARE;
Declare the dynamic allocation hooks.
Disallow these operations.
inline ACE_UNIMPLEMENTED_FUNC (
void operator= (const ACE_Message_Queue_Base &)
);
AUTHOR
Doug Schmidt
LIBRARY
ace