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 kumpf 1.20 /** isNull() - ATTN: */
261 Boolean isNull() const;
|
262 kumpf 1.18 #endif
|
263 mike 1.7
264 private:
265
|
266 kumpf 1.18 CIMObjectRep* _rep;
|
267 mike 1.7
|
268 kumpf 1.18 #ifdef PEGASUS_INTERNALONLY
269 CIMObject(CIMObjectRep* rep);
|
270 mike 1.7
|
271 kumpf 1.18 void _checkRep() const;
|
272 mike 1.7
273 friend class CIMConstObject;
274 friend class CIMClass;
275 friend class CIMConstClass;
276 friend class CIMInstance;
277 friend class CIMConstInstance;
|
278 kumpf 1.18 #endif
|
279 mike 1.7 };
280
281 ////////////////////////////////////////////////////////////////////////////////
282 //
283 // CIMConstObject
284 //
285 ////////////////////////////////////////////////////////////////////////////////
286
287 class PEGASUS_COMMON_LINKAGE CIMConstObject
288 {
289 public:
290
|
291 kumpf 1.18 CIMConstObject();
|
292 mike 1.7
|
293 kumpf 1.18 CIMConstObject(const CIMConstObject& x);
|
294 mike 1.7
|
295 kumpf 1.18 CIMConstObject(const CIMObject& x);
|
296 mike 1.7
297 /** Construction from CIMClass.
298 */
299 CIMConstObject(const CIMClass& x);
300
301 /** Construction from CIMInstance.
302 */
303 CIMConstObject(const CIMInstance& x);
304
305 /** Construction from CIMClass.
306 */
307 CIMConstObject(const CIMConstClass& x);
308
309 /** Construction from CIMInstance.
310 */
311 CIMConstObject(const CIMConstInstance& x);
312
|
313 kumpf 1.18 CIMConstObject& operator=(const CIMConstObject& x);
314
315 CIMConstObject& operator=(const CIMObject& x);
|
316 mike 1.6
|
317 mike 1.7 CIMConstObject& operator=(const CIMClass& x);
318
319 CIMConstObject& operator=(const CIMConstClass& x);
320
321 CIMConstObject& operator=(const CIMInstance& x);
322
323 CIMConstObject& operator=(const CIMConstInstance& x);
324
|
325 kumpf 1.18 ~CIMConstObject();
326
327 const String& getClassName() const;
328
329 const CIMReference& getPath() const;
330
331 Uint32 findQualifier(const String& name) const;
332
333 CIMConstQualifier getQualifier(Uint32 pos) const;
334
335 Uint32 getQualifierCount() const;
336
337 Uint32 findProperty(const String& name) const;
338
339 CIMConstProperty getProperty(Uint32 pos) const;
340
341 Uint32 getPropertyCount() const;
342
343 CIMObject clone() const;
344
345 Boolean identical(const CIMConstObject& x) const;
346 kumpf 1.18
347 #ifdef PEGASUS_INTERNALONLY
|
348 kumpf 1.20 Boolean isNull() const;
|
349 kumpf 1.18 #endif
|
350 mike 1.6
351 private:
352
|
353 kumpf 1.18 CIMObjectRep* _rep;
|
354 mike 1.6
|
355 kumpf 1.18 #ifdef PEGASUS_INTERNALONLY
356 void _checkRep() const;
|
357 mike 1.6
|
358 mike 1.7 friend class CIMObject;
359 friend class CIMClass;
360 friend class CIMConstClass;
361 friend class CIMInstance;
362 friend class CIMConstInstance;
|
363 kumpf 1.18 #endif
|
364 mike 1.6 };
365
366 /** The CIMObjectWithPath encapsulates a CIMReference and CIMObject.
367 Accessors are provided for getting the two parts. Constructors are
368 provided for initializing it from a CIMObject.
369 */
370 class PEGASUS_COMMON_LINKAGE CIMObjectWithPath
371 {
372 public:
373
374 /** Constructor
375 */
376 CIMObjectWithPath();
377
378 /** constructor
379 */
380 CIMObjectWithPath(const CIMReference& reference, const CIMObject& object);
381
382 /** Constructor - Constructs a CIMObjectWithPath Object from
383 another CimObjectWithPath
384 @param - ATTN
385 mike 1.6 */
386 CIMObjectWithPath(const CIMObjectWithPath& x);
387
388 ~CIMObjectWithPath();
389
390 CIMObjectWithPath& operator=(const CIMObjectWithPath& x);
391
|
392 chip 1.9 /** set -
|
393 mike 1.6 */
394 void set(const CIMReference& reference, const CIMObject& object);
395
396 /**
397 */
|
398 kumpf 1.18 const CIMReference& getReference() const;
|
399 mike 1.6
400 /**
401 */
|
402 kumpf 1.18 const CIMObject& getObject() const;
|
403 mike 1.6
404 /**
405 */
|
406 kumpf 1.18 CIMReference& getReference();
|
407 mike 1.6
408 /**
409 */
|
410 kumpf 1.18 CIMObject& getObject();
|
411 mike 1.6
412 private:
413
414 CIMReference _reference;
415 CIMObject _object;
416 };
417
418 PEGASUS_NAMESPACE_END
419
|
420 mike 1.7 #endif /* Pegasus_Object_h */
|