[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / Message_Queue_Vx.h
blobb93330ac02b610ebfbeabea77d3065f6d948e3ae
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Message_Queue_Vx.h
7 * $Id: Message_Queue_Vx.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
11 //=============================================================================
13 #ifndef ACE_MESSAGE_QUEUE_VX_H
14 #define ACE_MESSAGE_QUEUE_VX_H
15 #include /**/ "ace/pre.h"
17 #include "ace/Message_Block.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #if defined (ACE_VXWORKS)
25 // Include the templates here.
26 #include "ace/Message_Queue_T.h"
28 # include /**/ <msgQLib.h>
29 # include "ace/Null_Mutex.h"
30 # include "ace/Null_Condition.h"
32 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
34 /**
35 * @class ACE_Message_Queue_Vx
37 * @brief Wrapper for VxWorks message queues.
39 * Specialization of ACE_Message_Queue to simply wrap VxWorks
40 * MsgQ. It does not use any synchronization, because it relies
41 * on the native MsgQ implementation to take care of that. The
42 * only system calls that it uses are VxWorks msgQLib calls, so
43 * it is suitable for use in interrupt service routines.
44 * @note *Many* ACE_Message_Queue features are not supported with
45 * this specialization, including:
46 * * The two size arguments to the constructor and <open> are
47 * interpreted differently. The first is interpreted as the
48 * maximum number of bytes in a message. The second is
49 * interpreted as the maximum number of messages that can be
50 * queued.
51 * * <dequeue_head> *requires* that the ACE_Message_Block
52 * pointer argument point to an ACE_Message_Block that was
53 * allocated by the caller. It must be big enough to support
54 * the received message, without using continuation. The
55 * pointer argument is not modified.
56 * * Message priority. MSG_Q_FIFO is hard-coded.
57 * * enqueue method timeouts.
58 * * <peek_dequeue_head>.
59 * * <ACE_Message_Queue_Iterators>.
60 * * The ability to change low and high water marks after creation.
61 * * <Message_Block> chains. The continuation field of ACE_Message_Block
62 * * is ignored; only the first block of a fragment chain is
63 * * recognized.
65 class ACE_Message_Queue_Vx : public ACE_Message_Queue<ACE_NULL_SYNCH>
67 public:
68 // = Initialization and termination methods.
69 ACE_Message_Queue_Vx (size_t max_messages,
70 size_t max_message_length,
71 ACE_Notification_Strategy * = 0);
73 // Create a message queue with all the defaults.
74 /// Create a message queue with all the defaults.
75 virtual int open (size_t max_messages,
76 size_t max_message_length,
77 ACE_Notification_Strategy * = 0);
79 /// Close down the message queue and release all resources.
80 virtual int close (void);
82 /// Close down the message queue and release all resources.
83 virtual ~ACE_Message_Queue_Vx (void);
85 // = Queue statistic methods.
86 /**
87 * Number of total bytes on the queue, i.e., sum of the message
88 * block sizes.
90 virtual size_t message_bytes (void);
92 /**
93 * Number of total length on the queue, i.e., sum of the message
94 * block lengths.
96 virtual size_t message_length (void);
98 /**
99 * Number of total messages on the queue.
101 virtual size_t message_count (void);
103 // = Manual changes to these stats (used when queued message blocks
104 // change size or lengths).
106 * New value of the number of total bytes on the queue, i.e., sum of
107 * the message block sizes.
109 virtual void message_bytes (size_t new_size);
111 * New value of the number of total length on the queue, i.e., sum
112 * of the message block lengths.
114 virtual void message_length (size_t new_length);
116 // = Flow control routines
118 /// Get high watermark.
119 virtual size_t high_water_mark (void);
121 /// Set high watermark.
122 virtual void high_water_mark (size_t hwm);
124 /// Get low watermark.
125 virtual size_t low_water_mark (void);
127 /// Set low watermark.
128 virtual void low_water_mark (size_t lwm);
130 // = Activation control methods.
132 /// Dump the state of an object.
133 void dump (void) const;
135 /// Declare the dynamic allocation hooks.
136 ACE_ALLOC_HOOK_DECLARE;
138 protected:
139 /// Enqueue an <ACE_Message_Block *> in accordance with its priority.
140 virtual int enqueue_i (ACE_Message_Block *new_item);
142 /// Enqueue an <ACE_Message_Block *> in accordance with its deadline time.
143 virtual int enqueue_deadline_i (ACE_Message_Block *new_item);
145 /// Enqueue an <ACE_Message_Block *> at the end of the queue.
146 virtual int enqueue_tail_i (ACE_Message_Block *new_item);
148 /// Enqueue an <ACE_Message_Block *> at the head of the queue.
149 virtual int enqueue_head_i (ACE_Message_Block *new_item);
151 /// Dequeue and return the <ACE_Message_Block *> at the head of the
152 /// queue.
153 virtual int dequeue_head_i (ACE_Message_Block *&first_item);
155 /// Dequeue and return the <ACE_Message_Block *> with the lowest
156 /// priority.
157 virtual int dequeue_prio_i (ACE_Message_Block *&dequeued);
159 /// Dequeue and return the <ACE_Message_Block *> at the tail of the
160 /// queue.
161 virtual int dequeue_tail_i (ACE_Message_Block *&dequeued);
163 /// Dequeue and return the <ACE_Message_Block *> that has the lowest
164 /// deadline time.
165 virtual int dequeue_deadline_i (ACE_Message_Block *&dequeued);
167 // = Check the boundary conditions (assumes locks are held).
168 /// True if queue is full, else false.
169 virtual bool is_full_i (void);
171 /// True if queue is empty, else false.
172 virtual bool is_empty_i (void);
174 // = Implementation of public <activate>/<deactivate> methods above.
176 // These methods assume locks are held.
178 // = Helper methods to factor out common #ifdef code.
179 /// Wait for the queue to become non-full.
180 virtual int wait_not_full_cond (ACE_Guard<ACE_Null_Mutex> &mon,
181 ACE_Time_Value *tv);
183 /// Wait for the queue to become non-empty.
184 virtual int wait_not_empty_cond (ACE_Guard<ACE_Null_Mutex> &mon,
185 ACE_Time_Value *tv);
187 /// Inform any threads waiting to enqueue that they can procede.
188 virtual int signal_enqueue_waiters (void);
190 /// Inform any threads waiting to dequeue that they can procede.
191 virtual int signal_dequeue_waiters (void);
193 /// Access the underlying msgQ.
194 MSG_Q_ID msgq (void);
196 private:
198 // Disallow copying and assignment.
199 ACE_Message_Queue_Vx (const ACE_Message_Queue_Vx &);
200 void operator= (const ACE_Message_Queue_Vx &);
202 ACE_UNIMPLEMENTED_FUNC (virtual int peek_dequeue_head
203 (ACE_Message_Block *&first_item,
204 ACE_Time_Value *tv = 0))
206 private:
207 /// Maximum number of messages that can be queued.
208 int max_messages_;
210 /// Maximum message size, in bytes.
211 int max_message_length_;
213 /// Native message queue options.
214 int options_;
218 ACE_END_VERSIONED_NAMESPACE_DECL
220 #endif /* ACE_VXWORKS */
222 #if defined (__ACE_INLINE__)
223 #include "ace/Message_Queue_Vx.inl"
224 #endif /* __ACE_INLINE__ */
226 #include /**/ "ace/post.h"
227 #endif /* ACE_MESSAGE_QUEUE_VX_H */