1 mike 1.6 //%/////////////////////////////////////////////////////////////////////////////
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 chip 1.9 // 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 mike 1.6 // 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 chip 1.9 //
12 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
13 mike 1.6 // 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 chip 1.9 // 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 mike 1.6 // 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 //
23 // Author: Mike Brasher (mbrasher@bmc.com)
24 //
|
25 kumpf 1.19 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
26 kumpf 1.24 // Carol Ann Krug Graves, Hewlett-Packard Company
27 // (carolann_graves@hp.com)
|
28 mike 1.6 //
29 //%/////////////////////////////////////////////////////////////////////////////
30
|
31 mike 1.7 #ifndef Pegasus_Object_h
32 #define Pegasus_Object_h
|
33 mike 1.6
34 #include <Pegasus/Common/Config.h>
|
35 kumpf 1.18 #include <Pegasus/Common/String.h>
36 #include <Pegasus/Common/Array.h>
37 #include <Pegasus/Common/CIMProperty.h>
38 #include <Pegasus/Common/CIMQualifier.h>
|
39 mike 1.6
40 PEGASUS_NAMESPACE_BEGIN
41
|
42 kumpf 1.18 class CIMConstObject;
43 class CIMObjectRep;
|
44 mike 1.7 class CIMClass;
45 class CIMConstClass;
46 class CIMInstance;
47 class CIMConstInstance;
48
49 ////////////////////////////////////////////////////////////////////////////////
50 //
51 // CIMObject
52 //
53 ////////////////////////////////////////////////////////////////////////////////
54
|
55 chip 1.9 /** This class either refers to a CIMInstance or a CIMClass.
|
56 mike 1.7
57 The CIMObjectRep data member points to either a CIMInstanceRep or
58 CIMClassRep.
|
59 mike 1.6 */
60 class PEGASUS_COMMON_LINKAGE CIMObject
61 {
62 public:
63
|
64 mike 1.7 /** Constructor.
65 */
|
66 kumpf 1.18 CIMObject();
|
67 mike 1.6
|
68 mike 1.7 /** Copy constructor.
69 */
|
70 kumpf 1.18 CIMObject(const CIMObject& x);
|
71 mike 1.6
|
72 mike 1.7 /** Construction from CIMClass.
73 */
74 CIMObject(const CIMClass& x);
|
75 mike 1.6
|
76 mike 1.7 /** Construction from CIMInstance.
77 */
78 CIMObject(const CIMInstance& x);
|
79 mike 1.6
|
80 mike 1.7 /** Assignment operator.
81 */
|
82 kumpf 1.18 CIMObject& operator=(const CIMObject& x);
|
83 mike 1.6
|
84 mike 1.7 /** Assignment operator.
85 */
86 CIMObject& operator=(const CIMClass& x);
87
88 /** Assignment operator.
89 */
90 CIMObject& operator=(const CIMInstance& x);
91
|
92 chip 1.9 /** Destructor.
|
93 mike 1.7 */
|
94 kumpf 1.18 ~CIMObject();
|
95 mike 1.7
|
96 karl 1.13 /** Accessor for ClassName component of the object.
97 @return - Returns the ClassName of the object in
98 a String parameter.
99 <pre>
100 String className;
101 CIMClass myclass("myclass", "superclass");
102 className = myclass.getClassName;
103 </pre>
|
104 mike 1.7 */
|
105 kumpf 1.18 const String& getClassName() const;
|
106 mike 1.7
|
107 kumpf 1.22 const CIMObjectPath& getPath() const;
|
108 kumpf 1.24
109 /**
110 Sets the object path for the object
111 @param path CIMObjectPath containing the object path
112 */
113 void setPath (const CIMObjectPath & path);
|
114 chip 1.12
|
115 mike 1.7 /** addQualifier - Adds the CIMQualifier object to the instance.
116 Thows an exception of the CIMQualifier already exists in the instance
117 @param CIMQualifier object to add to instance
118 @return ATTN:
119 @exception Throws AlreadyExists.
120 */
|
121 kumpf 1.18 CIMObject& addQualifier(const CIMQualifier& qualifier);
|
122 mike 1.7
123 /** findQualifier - Searches the instance for the qualifier object
124 defined by the input parameter.
125 @param String defining the qualifier object to be found.
126 @return - Position of the qualifier to be used in subsequent
127 operations or PEG_NOT_FOUND if the qualifier is not found.
128 */
|
129 kumpf 1.18 Uint32 findQualifier(const String& name) const;
|
130 mike 1.7
131 /** existsQualifier - Searches the instance for the qualifier object
132 defined by the input parameter.
133 @param String defining the qualifier object to be found.
134 @return - Returns True if the qualifier object exists or false
135 if the qualifier is not found.
136 */
|
137 kumpf 1.18 Boolean existsQualifier(const String& name) const;
|
138 mike 1.7
139 /** getQualifier - Retrieves the qualifier object defined by the
140 index input parameter. @ index for the qualifier object.
141 The index to qualifier objects is zero-origin and continuous
142 so that incrementing loops can be used to get all qualifier
143 objects in a CIMInstnace.
144 @return: Returns qualifier object defined by index.
145 @exception Throws the OutOfBounds exception if the index
146 is out of bounds
147 */
|
148 kumpf 1.18 CIMQualifier getQualifier(Uint32 pos);
|
149 mike 1.7
150 /** getQualifier - Retrieves the qualifier object defined by the
151 index input parameter. @ index for the qualifier object.
152 The index to qualifier objects is zero-origin and continuous
153 so that incrementing loops can be used to get all qualifier
154 objects in a CIMInstnace.
155 @return: Returns qualifier object defined by index.
156 @exception Throws the OutOfBounds exception if the index
157 is out of bounds
158 ATTN: What is effect of out of range index???
159 ATTN: Is the above statement correct???
160 */
|
161 kumpf 1.18 CIMConstQualifier getQualifier(Uint32 pos) const;
162
163 void removeQualifier(Uint32 pos);
|
164 chip 1.11
|
165 kumpf 1.17 /** getQualifierCount - Gets the number of CIMQualifier objects
|
166 mike 1.7 defined for this CIMObject.
|
167 kumpf 1.17 @return Count of the number of CIMQualifier objects in the
|
168 mike 1.7 CIMObject.
169 @exception Throws the OutOfBounds exception if the index
170 is out of bounds
171 */
|
172 kumpf 1.18 Uint32 getQualifierCount() const;
|
173 mike 1.7
174 /** addProperty - Adds a property object defined by the input
175 parameter to the CIMObject
176 @param Property Object to be added. See the CIM Property
177 class for definition of the property object
178 @return ATTN:
179 @exception Throws the exception AlreadyExists if the property
180 already exists.
181 */
|
182 kumpf 1.18 CIMObject& addProperty(const CIMProperty& x);
|
183 mike 1.7
184 /** findProperty - Searches the CIMProperty objects installed in the
185 CIMObject for property objects with the name defined by the
186 input.
187 @param String with the name of the property object to be found
188 @return Position in the CIM object to the property object if found or
189 PEG_NOT_FOUND if no property object found with the name defined by the
190 input.
191 */
|
192 kumpf 1.18 Uint32 findProperty(const String& name) const;
|
193 mike 1.7
|
194 kumpf 1.17 /** existsProperty - Determines if a property object with the
|
195 mike 1.7 name defined by the input parameter exists in the class.
196 @parm String parameter with the property name.
197 @return True if the property object exists.
198 */
|
199 kumpf 1.18 Boolean existsProperty(const String& name) const;
|
200 mike 1.7
|
201 kumpf 1.17 /** getProperty - Gets the CIMProperty object in the CIMObject defined
|
202 mike 1.7 by the input index parameter.
203 @param Index to the property object in the CIMObject.
204 The index to qualifier objects is zero-origin and continuous
205 so that incrementing loops can be used to get all qualifier
206 objects in a CIMObject.
207 @return CIMProperty object corresponding to the index.
208 @exception Throws the OutOfBounds exception if the index
209 is out of bounds
210
211 ATTN: What is the effect of out of range?
212 */
|
213 kumpf 1.18 CIMProperty getProperty(Uint32 pos);
|
214 mike 1.7
215 /** getProperty - Gets the CIMproperty object in the CIMObject defined
216 by the input index parameter.
217 @param Index to the property object in the CIMObject.
218 The index to qualifier objects is zero-origin and continuous
219 so that incrementing loops can be used to get all qualifier
220 objects in a CIMInstnace.
221 @return CIMProperty object corresponding to the index.
222 @exception Throws the OutOfBounds exception if the index
223 is out of bounds
224
225 ATTN: What is the effect of out of range?
226 */
|
227 kumpf 1.18 CIMConstProperty getProperty(Uint32 pos) const;
|
228 mike 1.7
229 /** removeProperty - Removes the property represented
230 by the position input parameter from the instance.
231 @param pos Index to the property to be removed from the
232 instance. Normally this is obtained by getProperty();
233 @exception Throws OutofBounds if index is not a property object
234 */
|
235 kumpf 1.18 void removeProperty(Uint32 pos);
|
236 mike 1.7
|
237 kumpf 1.17 /** getPropertyCount - Gets the number of CIMProperty
|
238 mike 1.7 objects defined for this CIMObject.
239 @return Count of the number of CIMProperty objects in the
240 CIMObject. Zero indicates that no CIMProperty objects
241 are contained in the CIMObject
242 @exception Throws the OutOfBounds exception if the index
243 is out of bounds
244
245 */
|
246 kumpf 1.18 Uint32 getPropertyCount() const;
|
247 mike 1.7
|
248 kumpf 1.18 /** Clones the given object.
249 */
250 CIMObject clone() const;
|
251 mike 1.7
252 /** Returns true if the two classes are structurally identical.
253 */
254 Boolean identical(const CIMConstObject& x) const;
255
|
256 kumpf 1.18 #ifdef PEGASUS_INTERNALONLY
|
257 kumpf 1.20 /** isNull() - ATTN: */
258 Boolean isNull() const;
|
259 kumpf 1.18 #endif
|
260 mike 1.7
261 private:
262
|
263 kumpf 1.18 CIMObjectRep* _rep;
|
264 mike 1.7
|
265 kumpf 1.18 #ifdef PEGASUS_INTERNALONLY
266 CIMObject(CIMObjectRep* rep);
|
267 mike 1.7
|
268 kumpf 1.18 void _checkRep() const;
|
269 mike 1.7
270 friend class CIMConstObject;
271 friend class CIMClass;
272 friend class CIMConstClass;
273 friend class CIMInstance;
274 friend class CIMConstInstance;
|
275 kumpf 1.18 #endif
|
276 mike 1.7 };
277
|
278 kumpf 1.25 #define PEGASUS_ARRAY_T CIMObject
279 # include <Pegasus/Common/ArrayInter.h>
280 #undef PEGASUS_ARRAY_T
281
|
282 mike 1.7 ////////////////////////////////////////////////////////////////////////////////
283 //
284 // CIMConstObject
285 //
286 ////////////////////////////////////////////////////////////////////////////////
287
288 class PEGASUS_COMMON_LINKAGE CIMConstObject
289 {
290 public:
291
|
292 kumpf 1.18 CIMConstObject();
|
293 mike 1.7
|
294 kumpf 1.18 CIMConstObject(const CIMConstObject& x);
|
295 mike 1.7
|
296 kumpf 1.18 CIMConstObject(const CIMObject& x);
|
297 mike 1.7
298 /** Construction from CIMClass.
299 */
300 CIMConstObject(const CIMClass& x);
301
302 /** Construction from CIMInstance.
303 */
304 CIMConstObject(const CIMInstance& x);
305
306 /** Construction from CIMClass.
307 */
308 CIMConstObject(const CIMConstClass& x);
309
310 /** Construction from CIMInstance.
311 */
312 CIMConstObject(const CIMConstInstance& x);
313
|
314 kumpf 1.18 CIMConstObject& operator=(const CIMConstObject& x);
315
316 CIMConstObject& operator=(const CIMObject& x);
|
317 mike 1.6
|
318 mike 1.7 CIMConstObject& operator=(const CIMClass& x);
319
320 CIMConstObject& operator=(const CIMConstClass& x);
321
322 CIMConstObject& operator=(const CIMInstance& x);
323
324 CIMConstObject& operator=(const CIMConstInstance& x);
325
|
326 kumpf 1.18 ~CIMConstObject();
327
328 const String& getClassName() const;
329
|
330 kumpf 1.22 const CIMObjectPath& getPath() const;
|
331 kumpf 1.18
332 Uint32 findQualifier(const String& name) const;
333
334 CIMConstQualifier getQualifier(Uint32 pos) const;
335
336 Uint32 getQualifierCount() const;
337
338 Uint32 findProperty(const String& name) const;
339
340 CIMConstProperty getProperty(Uint32 pos) const;
341
342 Uint32 getPropertyCount() const;
343
344 CIMObject clone() const;
345
346 Boolean identical(const CIMConstObject& x) const;
347
348 #ifdef PEGASUS_INTERNALONLY
|
349 kumpf 1.20 Boolean isNull() const;
|
350 kumpf 1.18 #endif
|
351 mike 1.6
352 private:
353
|
354 kumpf 1.18 CIMObjectRep* _rep;
|
355 mike 1.6
|
356 kumpf 1.18 #ifdef PEGASUS_INTERNALONLY
357 void _checkRep() const;
|
358 mike 1.6
|
359 mike 1.7 friend class CIMObject;
360 friend class CIMClass;
361 friend class CIMConstClass;
362 friend class CIMInstance;
363 friend class CIMConstInstance;
|
364 kumpf 1.18 #endif
|
365 mike 1.6 };
366
|
367 kumpf 1.22 /** The CIMObjectWithPath encapsulates a CIMObjectPath and CIMObject.
|
368 mike 1.6 Accessors are provided for getting the two parts. Constructors are
369 provided for initializing it from a CIMObject.
370 */
371 class PEGASUS_COMMON_LINKAGE CIMObjectWithPath
372 {
373 public:
374
375 /** Constructor
376 */
377 CIMObjectWithPath();
378
379 /** constructor
380 */
|
381 kumpf 1.22 CIMObjectWithPath(const CIMObjectPath& reference, const CIMObject& object);
|
382 mike 1.6
383 /** Constructor - Constructs a CIMObjectWithPath Object from
384 another CimObjectWithPath
385 @param - ATTN
386 */
387 CIMObjectWithPath(const CIMObjectWithPath& x);
388
389 ~CIMObjectWithPath();
390
391 CIMObjectWithPath& operator=(const CIMObjectWithPath& x);
392
|
393 chip 1.9 /** set -
|
394 mike 1.6 */
|
395 kumpf 1.22 void set(const CIMObjectPath& reference, const CIMObject& object);
|
396 mike 1.6
397 /**
398 */
|
399 kumpf 1.22 const CIMObjectPath& getReference() const;
|
400 mike 1.6
401 /**
402 */
|
403 kumpf 1.18 const CIMObject& getObject() const;
|
404 mike 1.6
405 /**
406 */
|
407 kumpf 1.22 CIMObjectPath& getReference();
|
408 mike 1.6
409 /**
410 */
|
411 kumpf 1.18 CIMObject& getObject();
|
412 mike 1.6
413 private:
414
|
415 kumpf 1.22 CIMObjectPath _reference;
|
416 mike 1.6 CIMObject _object;
417 };
|
418 kumpf 1.25
419 #define PEGASUS_ARRAY_T CIMObjectWithPath
420 # include "ArrayInter.h"
421 #undef PEGASUS_ARRAY_T
|
422 mike 1.6
423 PEGASUS_NAMESPACE_END
424
|
425 mike 1.7 #endif /* Pegasus_Object_h */
|