1 mike 1.4 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to
7 // deal in the Software without restriction, including without limitation the
8 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 // sell copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
13 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
14 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
18 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
19 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 //
21 //==============================================================================
22 mike 1.4 //
23 // Author: Mike Brasher (mbrasher@bmc.com)
24 //
25 // Modified By:
26 //
27 //%/////////////////////////////////////////////////////////////////////////////
28
29 #ifndef Pegasus_Message_h
30 #define Pegasus_Message_h
31
32 #include <iostream>
|
90 mike 1.5
91 enum MessageType
92 {
93 DUMMY_MESSAGE,
94
95 // CIM Message types:
96
97 CIM_GET_CLASS_REQUEST_MESSAGE,
98 CIM_GET_INSTANCE_REQUEST_MESSAGE,
99 CIM_DELETE_CLASS_REQUEST_MESSAGE,
100 CIM_DELETE_INSTANCE_REQUEST_MESSAGE,
101 CIM_CREATE_CLASS_REQUEST_MESSAGE,
102 CIM_CREATE_INSTANCE_REQUEST_MESSAGE,
103 CIM_MODIFY_CLASS_REQUEST_MESSAGE,
104 CIM_MODIFY_INSTANCE_REQUEST_MESSAGE,
105 CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE,
106 CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE,
107 CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE,
108 CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE,
109 CIM_EXEC_QUERY_REQUEST_MESSAGE,
110 CIM_ASSOCIATORS_REQUEST_MESSAGE,
111 mike 1.5 CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE,
112 CIM_REFERENCES_REQUEST_MESSAGE,
113 CIM_REFERENCE_NAMES_REQUEST_MESSAGE,
114 CIM_GET_PROPERTY_REQUEST_MESSAGE,
115 CIM_SET_PROPERTY_REQUEST_MESSAGE,
116 CIM_GET_QUALIFIER_REQUEST_MESSAGE,
117 CIM_SET_QUALIFIER_REQUEST_MESSAGE,
118 CIM_DELETE_QUALIFIER_REQUEST_MESSAGE,
119 CIM_ENUMERATE_QUALIFIERS_REQUEST_MESSAGE,
120 CIM_INVOKE_METHOD_REQUEST_MESSAGE,
121 CIM_GET_CLASS_RESPONSE_MESSAGE,
122 CIM_GET_INSTANCE_RESPONSE_MESSAGE,
123 CIM_DELETE_CLASS_RESPONSE_MESSAGE,
124 CIM_DELETE_INSTANCE_RESPONSE_MESSAGE,
125 CIM_CREATE_CLASS_RESPONSE_MESSAGE,
126 CIM_CREATE_INSTANCE_RESPONSE_MESSAGE,
127 CIM_MODIFY_CLASS_RESPONSE_MESSAGE,
128 CIM_MODIFY_INSTANCE_RESPONSE_MESSAGE,
129 CIM_ENUMERATE_CLASSES_RESPONSE_MESSAGE,
130 CIM_ENUMERATE_CLASS_NAMES_RESPONSE_MESSAGE,
131 CIM_ENUMERATE_INSTANCES_RESPONSE_MESSAGE,
132 mike 1.5 CIM_ENUMERATE_INSTANCE_NAMES_RESPONSE_MESSAGE,
133 CIM_EXEC_QUERY_RESPONSE_MESSAGE,
134 CIM_ASSOCIATORS_RESPONSE_MESSAGE,
135 CIM_ASSOCIATOR_NAMES_RESPONSE_MESSAGE,
136 CIM_REFERENCES_RESPONSE_MESSAGE,
137 CIM_REFERENCE_NAMES_RESPONSE_MESSAGE,
138 CIM_GET_PROPERTY_RESPONSE_MESSAGE,
139 CIM_SET_PROPERTY_RESPONSE_MESSAGE,
140 CIM_GET_QUALIFIER_RESPONSE_MESSAGE,
141 CIM_SET_QUALIFIER_RESPONSE_MESSAGE,
142 CIM_DELETE_QUALIFIER_RESPONSE_MESSAGE,
143 CIM_ENUMERATE_QUALIFIERS_RESPONSE_MESSAGE,
144 CIM_INVOKE_METHOD_RESPONSE_MESSAGE,
145
|
162 mike 1.5.2.5
163 /** This class implements a stack of queue-ids. Many messages must keep a
164 stack of queue-ids of queues which they must be returned to. This provides
165 a light efficient stack for this purpose.
166 */
167 class QueueIdStack
168 {
169 public:
170
171 QueueIdStack() : _size(0)
172 {
173 }
174
175 QueueIdStack(const QueueIdStack& x) : _size(x._size)
176 {
177 memcpy(_items, x._items, sizeof(_items));
178 }
179
180 PEGASUS_EXPLICIT QueueIdStack(Uint32 x) : _size(0)
181 {
182 push(x);
183 mike 1.5.2.5 }
184
185 PEGASUS_EXPLICIT QueueIdStack(Uint32 x1, Uint32 x2) : _size(0)
186 {
187 push(x1);
188 push(x2);
189 }
190
191 ~QueueIdStack()
192 {
193 }
194
195 QueueIdStack& operator=(const QueueIdStack& x)
196 {
197 if (this != &x)
198 {
199 memcpy(_items, x._items, sizeof(_items));
200 _size = x._size;
201 }
202 return *this;
203 }
204 mike 1.5.2.5
205 Uint32 size() const
206 {
207 return _size;
208 }
209
210 Boolean isEmpty() const
211 {
212 return _size == 0;
213 }
214
215 void push(Uint32 x)
216 {
217 if (_size == MAX_SIZE)
218 throw StackOverflow();
219
220 _items[_size++] = x;
221 }
222
223 Uint32& top()
224 {
225 mike 1.5.2.5 if (_size == 0)
226 throw StackUnderflow();
227
228 return _items[_size-1];
229 }
230
231 Uint32 top() const
232 {
233 return ((QueueIdStack*)this)->top();
234 }
235
236 void pop()
237 {
238 if (_size == 0)
239 throw StackUnderflow();
240
241 _size--;
242 }
243
244 /** Make a copy of this stack and then pop the top element. */
245 QueueIdStack copyAndPop() const
246 mike 1.5.2.5 {
247 return QueueIdStack(*this, 0);
248 }
249
250 private:
251
252 // Copy the given stack but then pop the top element:
253 QueueIdStack(const QueueIdStack& x, int) : _size(x._size)
254 {
255 memcpy(_items, x._items, sizeof(_items));
256 pop();
257 }
258
259 enum { MAX_SIZE = 5 };
260 Uint32 _items[MAX_SIZE];
261 Uint32 _size;
262 };
|