1 karl 1.45 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.6 //
|
3 karl 1.42 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.39 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.42 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.44 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.45 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.6 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 chip 1.9 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
18 mike 1.6 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
|
20 kumpf 1.28 //
|
21 chip 1.9 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mike 1.6 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
24 chip 1.9 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
27 mike 1.6 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
|
34 mike 1.7 #ifndef Pegasus_Object_h
35 #define Pegasus_Object_h
|
36 mike 1.6
37 #include <Pegasus/Common/Config.h>
|
38 kumpf 1.32 #include <Pegasus/Common/Linkage.h>
|
39 kumpf 1.18 #include <Pegasus/Common/String.h>
|
40 kumpf 1.32 #include <Pegasus/Common/CIMName.h>
|
41 kumpf 1.18 #include <Pegasus/Common/Array.h>
42 #include <Pegasus/Common/CIMProperty.h>
43 #include <Pegasus/Common/CIMQualifier.h>
|
44 mike 1.6
45 PEGASUS_NAMESPACE_BEGIN
46
|
47 kumpf 1.18 class CIMConstObject;
48 class CIMObjectRep;
|
49 mike 1.7 class CIMClass;
50 class CIMConstClass;
51 class CIMInstance;
52 class CIMConstInstance;
|
53 dave.sudlik 1.43 class CIMProperty;
54 class CIMConstProperty;
55 class CIMQualifier;
56 class CIMConstQualifier;
|
57 mike 1.7
58 ////////////////////////////////////////////////////////////////////////////////
59 //
60 // CIMObject
61 //
62 ////////////////////////////////////////////////////////////////////////////////
63
|
64 kumpf 1.46 /**
65 The CIMObject class represents the DMTF standard CIM object definition,
66 which may represent a CIMClass or a CIMInstance.
|
67 mike 1.7
|
68 kumpf 1.46 <p>The CIMObject class uses a shared representation model, such that
69 multiple CIMObject objects may refer to the same data copy. Assignment
70 and copy operators create new references to the same data, not distinct
71 copies. An update to a CIMObject object affects all the CIMObject
72 objects that refer to the same data copy. The data remains valid until
73 all the CIMObject objects that refer to it are destructed. A separate
74 copy of the data may be created using the clone method.
|
75 mike 1.6 */
76 class PEGASUS_COMMON_LINKAGE CIMObject
77 {
78 public:
79
|
80 kumpf 1.46 /**
81 Constructs an uninitialized CIMObject object. A method
82 invocation on an uninitialized object will result in the throwing
83 of an UninitializedObjectException. An uninitialized object may
84 be converted into an initialized object only by using the assignment
85 operator with an initialized object.
|
86 mike 1.7 */
|
87 kumpf 1.18 CIMObject();
|
88 mike 1.6
|
89 kumpf 1.46 /**
90 Constructs a CIMObject object from the value of a specified
91 CIMObject object, so that both objects refer to the same data copy.
92 @param x The CIMObject object from which to construct a new
93 CIMObject object.
|
94 mike 1.7 */
|
95 kumpf 1.18 CIMObject(const CIMObject& x);
|
96 mike 1.6
|
97 kumpf 1.46 /**
98 Constructs a CIMObject object from the value of a specified
99 CIMClass object, so that both objects refer to the same data copy.
100 @param x The CIMClass object from which to construct the
101 CIMObject object.
|
102 mike 1.7 */
103 CIMObject(const CIMClass& x);
|
104 mike 1.6
|
105 kumpf 1.46 /**
106 Constructs a CIMObject object from the value of a specified
107 CIMInstance object, so that both objects refer to the same data copy.
108 @param x The CIMInstance object from which to construct the
109 CIMObject object.
|
110 mike 1.7 */
111 CIMObject(const CIMInstance& x);
|
112 mike 1.6
|
113 kumpf 1.46 /**
114 Assigns the value of the specified CIMObject object to this object,
115 so that both objects refer to the same data copy.
116 @param x The CIMObject object from which to assign this CIMObject
117 object.
118 @return A reference to this CIMObject object.
|
119 mike 1.7 */
|
120 kumpf 1.18 CIMObject& operator=(const CIMObject& x);
|
121 mike 1.6
|
122 kumpf 1.46 /**
123 Destructs the CIMObject object.
|
124 mike 1.7 */
|
125 kumpf 1.18 ~CIMObject();
|
126 mike 1.7
|
127 kumpf 1.46 /**
128 Gets the class name of the object.
129 @return A CIMName containing the class name.
130 @exception UninitializedObjectException If the object is not
131 initialized.
|
132 mike 1.7 */
|
133 kumpf 1.32 const CIMName& getClassName() const;
|
134 mike 1.7
|
135 kumpf 1.46 /**
136 Gets the object path for the object.
137 @return A CIMObjectPath containing the object path.
138 @exception UninitializedObjectException If the object is not
139 initialized.
|
140 karl 1.40 */
|
141 kumpf 1.22 const CIMObjectPath& getPath() const;
|
142 kumpf 1.24
|
143 kumpf 1.46 /**
144 Sets the object path for the object.
145 @param path A CIMObjectPath containing the object path.
146 @exception UninitializedObjectException If the object is not
147 initialized.
|
148 kumpf 1.38 */
|
149 kumpf 1.24 void setPath (const CIMObjectPath & path);
|
150 chip 1.12
|
151 kumpf 1.46 /**
152 Adds a qualifier to the object.
153 @param qualifier The CIMQualifier to be added.
154 @return A reference to this CIMObject object.
155 @exception AlreadyExistsException If a qualifier with the
156 same name already exists in the CIMObject.
157 @exception UninitializedObjectException If the object is not
158 initialized.
|
159 mike 1.7 */
|
160 kumpf 1.18 CIMObject& addQualifier(const CIMQualifier& qualifier);
|
161 mike 1.7
|
162 kumpf 1.46 /**
163 Finds a qualifier by name.
164 @param name A CIMName specifying the name of the qualifier to be found.
165 @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
166 @exception UninitializedObjectException If the object is not
167 initialized.
|
168 mike 1.7 */
|
169 kumpf 1.32 Uint32 findQualifier(const CIMName& name) const;
|
170 mike 1.7
|
171 kumpf 1.46 /**
172 Gets the qualifier at the specified index.
173 @param index The index of the qualifier to be retrieved.
174 @return The CIMQualifier at the specified index.
175 @exception IndexOutOfBoundsException If the index is outside
176 the range of qualifiers available for the CIMObject.
177 @exception UninitializedObjectException If the object is not
178 initialized.
|
179 mike 1.7 */
|
180 kumpf 1.36 CIMQualifier getQualifier(Uint32 index);
|
181 mike 1.7
|
182 kumpf 1.46 /**
183 Gets the qualifier at the specified index.
184 @param index The index of the qualifier to be retrieved.
185 @return The CIMConstQualifier at the specified index.
186 @exception IndexOutOfBoundsException If the index is outside
187 the range of qualifiers available for the CIMObject.
188 @exception UninitializedObjectException If the object is not
189 initialized.
|
190 mike 1.7 */
|
191 kumpf 1.36 CIMConstQualifier getQualifier(Uint32 index) const;
|
192 kumpf 1.18
|
193 kumpf 1.46 /**
194 Removes a qualifier from the object.
195 @param index The index of the qualifier to remove.
196 @exception IndexOutOfBoundsException If the index is
197 outside the range of qualifiers available for the CIMObject.
198 @exception UninitializedObjectException If the object is not
199 initialized.
|
200 karl 1.40 */
|
201 kumpf 1.36 void removeQualifier(Uint32 index);
|
202 kumpf 1.46
203 /**
204 Gets the number of qualifiers in the object.
205 @return An integer count of the qualifiers in the CIMObject.
206 @exception UninitializedObjectException If the object is not
207 initialized.
|
208 mike 1.7 */
|
209 kumpf 1.18 Uint32 getQualifierCount() const;
|
210 mike 1.7
|
211 kumpf 1.46 /**
212 Adds a property to the object.
213 @param x The CIMProperty to be added.
214 @return A reference to this CIMObject object.
215 @exception AlreadyExistsException If a property with the
216 same name already exists in the CIMObject.
217 @exception UninitializedObjectException If the object is not
218 initialized.
|
219 mike 1.7 */
|
220 kumpf 1.18 CIMObject& addProperty(const CIMProperty& x);
|
221 mike 1.7
|
222 kumpf 1.46 /**
223 Finds a property by name.
224 @param name A CIMName specifying the name of the property to be found.
225 @return Index of the property if found or PEG_NOT_FOUND if not found.
226 @exception UninitializedObjectException If the object is not
227 initialized.
|
228 mike 1.7 */
|
229 kumpf 1.32 Uint32 findProperty(const CIMName& name) const;
|
230 mike 1.7
|
231 kumpf 1.46 /**
232 Gets the property at the specified index.
233 @param index The index of the property to be retrieved.
234 @return The CIMProperty at the specified index.
235 @exception IndexOutOfBoundsException If the index is outside
236 the range of properties available for the CIMObject.
237 @exception UninitializedObjectException If the object is not
238 initialized.
|
239 mike 1.7 */
|
240 kumpf 1.36 CIMProperty getProperty(Uint32 index);
|
241 mike 1.7
|
242 kumpf 1.46 /**
243 Gets the property at the specified index.
244 @param index The index of the property to be retrieved.
245 @return The CIMConstProperty at the specified index.
246 @exception IndexOutOfBoundsException If the index is outside
247 the range of properties available for the CIMObject.
248 @exception UninitializedObjectException If the object is not
249 initialized.
|
250 kumpf 1.36 */
251 CIMConstProperty getProperty(Uint32 index) const;
252
|
253 kumpf 1.46 /**
254 Removes a property from the object.
255 @param index The index of the property to remove.
256 @exception IndexOutOfBoundsException If the index is
257 outside the range of properties available for the CIMObject.
258 @exception UninitializedObjectException If the object is not
259 initialized.
|
260 mike 1.7 */
|
261 kumpf 1.36 void removeProperty(Uint32 index);
|
262 mike 1.7
|
263 kumpf 1.46 /**
264 Gets the number of properties in the object.
265 @return An integer count of the properties in the CIMObject.
266 @exception UninitializedObjectException If the object is not
267 initialized.
|
268 mike 1.7 */
|
269 kumpf 1.18 Uint32 getPropertyCount() const;
|
270 mike 1.7
|
271 kumpf 1.46 /**
272 Makes a deep copy of the object. This creates a new copy of all
273 the object attributes including qualifiers and properties.
274 @return A new copy of the CIMObject object.
275 @exception UninitializedObjectException If the object is not
276 initialized.
|
277 kumpf 1.18 */
278 CIMObject clone() const;
|
279 mike 1.7
|
280 kumpf 1.46 /**
281 Compares the CIMObject with a specified CIMConstObject.
282 @param x The CIMConstObject to be compared.
283 @return True if this object is identical to the one specified,
284 false otherwise.
285 @exception UninitializedObjectException If the object is not
286 initialized.
|
287 mike 1.7 */
288 Boolean identical(const CIMConstObject& x) const;
289
|
290 kumpf 1.46 /**
291 Determines whether the object has been initialized.
292 @return True if the object has not been initialized, false otherwise.
293 */
|
294 kumpf 1.33 Boolean isUninitialized() const;
|
295 mike 1.7
|
296 kumpf 1.46 /**
297 Generates a human-readable String representing the value of the
298 CIMObject. The String may be in MOF format, but the format is not
299 guaranteed and may change without notice.
300 @return A human-readable String representing the CIMObject value.
301 @exception UninitializedObjectException If the object is not
302 initialized.
303 */
304 String toString() const;
305
306 /**
307 Indicates whether the object represents a CIMClass.
308 @return True if the object represents a CIMClass; false otherwise.
|
309 dave.sudlik 1.43 */
|
310 kumpf 1.46 Boolean isClass() const;
|
311 dave.sudlik 1.43
|
312 kumpf 1.46 /**
313 Indicates whether the object represents a CIMInstance.
314 @return True if the object represents a CIMInstance; false otherwise.
315 */
316 Boolean isInstance() const;
|
317 kumpf 1.34
|
318 mike 1.7 private:
319
|
320 kumpf 1.18 CIMObjectRep* _rep;
|
321 mike 1.7
|
322 kumpf 1.18 CIMObject(CIMObjectRep* rep);
|
323 mike 1.7
|
324 kumpf 1.18 void _checkRep() const;
|
325 mike 1.7
326 friend class CIMConstObject;
327 friend class CIMClass;
328 friend class CIMConstClass;
329 friend class CIMInstance;
330 friend class CIMConstInstance;
331 };
332
|
333 kumpf 1.25 #define PEGASUS_ARRAY_T CIMObject
334 # include <Pegasus/Common/ArrayInter.h>
335 #undef PEGASUS_ARRAY_T
336
|
337 kumpf 1.46
|
338 mike 1.7 ////////////////////////////////////////////////////////////////////////////////
339 //
340 // CIMConstObject
341 //
342 ////////////////////////////////////////////////////////////////////////////////
343
|
344 karl 1.40 /**
|
345 kumpf 1.46 The CIMConstObject class provides a const interface to a CIMObject
346 object. This class is needed because the shared representation model
347 used by CIMObject does not prevent modification to a const CIMObject
348 object. Note that the value of a CIMConstObject object could still be
349 modified by a CIMObject object that refers to the same data copy.
|
350 karl 1.40 */
|
351 mike 1.7 class PEGASUS_COMMON_LINKAGE CIMConstObject
352 {
353 public:
354
|
355 kumpf 1.46 /**
356 Constructs an uninitialized CIMConstObject object. A method
357 invocation on an uninitialized object will result in the throwing
358 of an UninitializedObjectException. An uninitialized object may
359 be converted into an initialized object only by using the assignment
360 operator with an initialized object.
|
361 karl 1.40 */
|
362 kumpf 1.18 CIMConstObject();
|
363 mike 1.7
|
364 kumpf 1.46 /**
365 Constructs a CIMConstObject object from the value of a specified
366 CIMConstObject object, so that both objects refer to the same data
367 copy.
368 @param x The CIMConstObject object from which to construct a new
369 CIMConstObject object.
|
370 karl 1.40 */
|
371 kumpf 1.18 CIMConstObject(const CIMConstObject& x);
|
372 mike 1.7
|
373 kumpf 1.46 /**
374 Constructs a CIMConstObject object from the value of a specified
375 CIMObject object, so that both objects refer to the same data copy.
376 @param x The CIMObject object from which to construct a new
377 CIMConstObject object.
|
378 karl 1.40 */
|
379 kumpf 1.18 CIMConstObject(const CIMObject& x);
|
380 mike 1.7
|
381 kumpf 1.46 /**
382 Constructs a CIMConstObject object from the value of a specified
383 CIMClass object, so that both objects refer to the same data copy.
384 @param x The CIMClass object from which to construct the
385 CIMConstObject object.
|
386 mike 1.7 */
387 CIMConstObject(const CIMClass& x);
388
|
389 kumpf 1.46 /**
390 Constructs a CIMConstObject object from the value of a specified
391 CIMInstance object, so that both objects refer to the same data copy.
392 @param x The CIMInstance object from which to construct the
393 CIMConstObject object.
|
394 mike 1.7 */
395 CIMConstObject(const CIMInstance& x);
396
|
397 kumpf 1.46 /**
398 Constructs a CIMConstObject object from the value of a specified
399 CIMConstClass object, so that both objects refer to the same data copy.
400 @param x The CIMConstClass object from which to construct the
401 CIMConstObject object.
|
402 mike 1.7 */
403 CIMConstObject(const CIMConstClass& x);
404
|
405 kumpf 1.46 /**
406 Constructs a CIMConstObject object from the value of a specified
407 CIMConstInstance object, so that both objects refer to the same data
408 copy.
409 @param x The CIMConstInstance object from which to construct the
410 CIMConstObject object.
|
411 mike 1.7 */
412 CIMConstObject(const CIMConstInstance& x);
413
|
414 kumpf 1.46 /**
415 Assigns the value of the specified CIMConstObject object to this
416 object, so that both objects refer to the same data copy.
417 @param x The CIMConstObject object from which to assign this
418 CIMConstObject object.
419 @return A reference to this CIMConstObject object.
|
420 karl 1.40 */
|
421 kumpf 1.18 CIMConstObject& operator=(const CIMConstObject& x);
|
422 mike 1.7
|
423 kumpf 1.46 /**
424 Destructs the CIMConstObject object.
|
425 karl 1.40 */
|
426 kumpf 1.18 ~CIMConstObject();
427
|
428 kumpf 1.46 /**
429 Gets the class name of the object.
430 @return A CIMName containing the class name.
431 @exception UninitializedObjectException If the object is not
432 initialized.
|
433 karl 1.40 */
|
434 kumpf 1.32 const CIMName& getClassName() const;
|
435 kumpf 1.18
|
436 kumpf 1.46 /**
437 Gets the object path for the object.
438 @return A CIMObjectPath containing the object path.
439 @exception UninitializedObjectException If the object is not
440 initialized.
|
441 karl 1.40 */
|
442 kumpf 1.22 const CIMObjectPath& getPath() const;
|
443 kumpf 1.18
|
444 kumpf 1.46 /**
445 Finds a qualifier by name.
446 @param name A CIMName specifying the name of the qualifier to be found.
447 @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
448 @exception UninitializedObjectException If the object is not
449 initialized.
|
450 karl 1.40 */
|
451 kumpf 1.32 Uint32 findQualifier(const CIMName& name) const;
|
452 kumpf 1.18
|
453 kumpf 1.46 /**
454 Gets the qualifier at the specified index.
455 @param index The index of the qualifier to be retrieved.
456 @return The CIMConstQualifier at the specified index.
457 @exception IndexOutOfBoundsException If the index is outside
458 the range of qualifiers available for the CIMConstObject.
459 @exception UninitializedObjectException If the object is not
460 initialized.
|
461 karl 1.40 */
|
462 kumpf 1.36 CIMConstQualifier getQualifier(Uint32 index) const;
|
463 kumpf 1.18
|
464 kumpf 1.46 /**
465 Gets the number of qualifiers in the object.
466 @return An integer count of the qualifiers in the CIMConstObject.
467 @exception UninitializedObjectException If the object is not
468 initialized.
|
469 karl 1.40 */
|
470 kumpf 1.18 Uint32 getQualifierCount() const;
471
|
472 kumpf 1.46 /**
473 Finds a property by name.
474 @param name A CIMName specifying the name of the property to be found.
475 @return Index of the property if found or PEG_NOT_FOUND if not found.
476 @exception UninitializedObjectException If the object is not
477 initialized.
|
478 karl 1.40 */
|
479 kumpf 1.32 Uint32 findProperty(const CIMName& name) const;
|
480 kumpf 1.18
|
481 kumpf 1.46 /**
482 Gets the property at the specified index.
483 @param index The index of the property to be retrieved.
484 @return The CIMConstProperty at the specified index.
485 @exception IndexOutOfBoundsException If the index is outside
486 the range of properties available for the CIMConstObject.
487 @exception UninitializedObjectException If the object is not
488 initialized.
|
489 karl 1.40 */
|
490 kumpf 1.36 CIMConstProperty getProperty(Uint32 index) const;
|
491 kumpf 1.18
|
492 kumpf 1.46 /**
493 Gets the number of properties in the object.
494 @return An integer count of the properties in the CIMConstObject.
495 @exception UninitializedObjectException If the object is not
496 initialized.
|
497 karl 1.40 */
|
498 kumpf 1.18 Uint32 getPropertyCount() const;
499
|
500 kumpf 1.46 /**
501 Makes a deep copy of the object. This creates a new copy of all
502 the object attributes including qualifiers and properties.
503 @return A CIMObject object with a separate copy of the
504 CIMConstObject object.
505 @exception UninitializedObjectException If the object is not
506 initialized.
|
507 karl 1.40 */
|
508 kumpf 1.18 CIMObject clone() const;
509
|
510 kumpf 1.46 /**
511 Compares the CIMConstObject with a specified CIMConstObject.
512 @param x The CIMConstObject to be compared.
513 @return True if this object is identical to the one specified,
514 false otherwise.
515 @exception UninitializedObjectException If the object is not
516 initialized.
|
517 karl 1.40 */
|
518 kumpf 1.18 Boolean identical(const CIMConstObject& x) const;
519
|
520 kumpf 1.46 /**
521 Determines whether the object has been initialized.
522 @return True if the object has not been initialized, false otherwise.
|
523 karl 1.40 */
|
524 kumpf 1.33 Boolean isUninitialized() const;
|
525 kumpf 1.35
|
526 kumpf 1.46 /**
527 Generates a human-readable String representing the value of the
528 CIMObject. The String may be in MOF format, but the format is not
529 guaranteed and may change without notice.
530 @return A human-readable String representing the CIMObject value.
531 @exception UninitializedObjectException If the object is not
532 initialized.
|
533 dave.sudlik 1.43 */
534 String toString () const;
535
|
536 kumpf 1.46 /**
537 Indicates whether the object represents a CIMConstClass.
538 @return True if the object represents a CIMConstClass; false otherwise.
|
539 karl 1.40 */
|
540 kumpf 1.35 Boolean isClass() const;
541
|
542 kumpf 1.46 /**
543 Indicates whether the object represents a CIMConstInstance.
544 @return True if the object represents a CIMConstInstance; false
545 otherwise.
|
546 karl 1.40 */
|
547 kumpf 1.35 Boolean isInstance() const;
|
548 mike 1.6
549 private:
550
|
551 kumpf 1.18 CIMObjectRep* _rep;
|
552 mike 1.6
|
553 kumpf 1.18 void _checkRep() const;
|
554 mike 1.6
|
555 mike 1.7 friend class CIMObject;
556 friend class CIMClass;
557 friend class CIMConstClass;
558 friend class CIMInstance;
559 friend class CIMConstInstance;
|
560 mike 1.6 };
561
562 PEGASUS_NAMESPACE_END
563
|
564 mike 1.7 #endif /* Pegasus_Object_h */
|