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