1 karl 1.69 //%2005////////////////////////////////////////////////////////////////////////
|
2 mike 1.23 //
|
3 karl 1.68 // 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.63 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.68 // 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.69 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 mike 1.23 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
13 chip 1.26 // of this software and associated documentation files (the "Software"), to
14 // deal in the Software without restriction, including without limitation the
15 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
16 mike 1.23 // sell copies of the Software, and to permit persons to whom the Software is
17 // furnished to do so, subject to the following conditions:
|
18 kumpf 1.47 //
|
19 chip 1.26 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
20 mike 1.23 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
22 chip 1.26 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
25 mike 1.23 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //==============================================================================
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
|
32 mike 1.25 #ifndef Pegasus_Instance_h
33 #define Pegasus_Instance_h
|
34 mike 1.23
35 #include <Pegasus/Common/Config.h>
|
36 kumpf 1.52 #include <Pegasus/Common/Linkage.h>
37 #include <Pegasus/Common/CIMName.h>
|
38 mike 1.25 #include <Pegasus/Common/CIMObject.h>
|
39 karl 1.65 #include <Pegasus/Common/CIMPropertyList.h>
|
40 mike 1.23
41 PEGASUS_NAMESPACE_BEGIN
42
43 ////////////////////////////////////////////////////////////////////////////////
44 //
45 // CIMInstance
46 //
47 ////////////////////////////////////////////////////////////////////////////////
48
49 class CIMConstInstance;
|
50 kumpf 1.36 class CIMInstanceRep;
|
51 kumpf 1.50 class Resolver;
|
52 mike 1.23
|
53 chip 1.35 /** This class represents the instance of a CIM class. It is used manipulate
|
54 kumpf 1.61 instances and their members.
|
55 mike 1.23 */
56 class PEGASUS_COMMON_LINKAGE CIMInstance
57 {
58 public:
59
|
60 kumpf 1.61 /** Creates a CIMInstance object.
|
61 mike 1.23 */
|
62 kumpf 1.36 CIMInstance();
|
63 mike 1.23
|
64 kumpf 1.61 /** Creates a CIMInstance object from another CIMInstance object.
65 @param x - CIMInstance object from which the new instance is created.
|
66 mike 1.23 */
|
67 kumpf 1.36 CIMInstance(const CIMInstance& x);
|
68 mike 1.23
|
69 kumpf 1.61 /** Creates a CIMInstance object from the given CIMObject.
70 @param x - CIMObject from which to create the CIMInstance.
|
71 kumpf 1.58 @exception DynamicCastFailedException If a CIMInstance can not be
|
72 kumpf 1.61 created from the given CIMObject.
|
73 kumpf 1.58 */
74 PEGASUS_EXPLICIT CIMInstance(const CIMObject& x);
|
75 mike 1.25
|
76 kumpf 1.61 /** Creates a CIMInstance object of the class specified by
77 the input parameter.
78 @param className - CIMName to be used with new instance object.
|
79 mike 1.23 */
|
80 kumpf 1.52 CIMInstance(const CIMName& className);
|
81 kumpf 1.36
|
82 kumpf 1.61 /** Copy Constructor. */
|
83 kumpf 1.36 CIMInstance& operator=(const CIMInstance& x);
|
84 mike 1.23
85 /** Destructor. */
|
86 kumpf 1.60 ~CIMInstance();
|
87 mike 1.23
|
88 kumpf 1.61 /** Gets the class name of the instance.
|
89 kumpf 1.52 @return CIMName with the class name.
|
90 mike 1.23 */
|
91 kumpf 1.52 const CIMName& getClassName() const;
|
92 mike 1.23
|
93 kumpf 1.61 ///
|
94 kumpf 1.43 const CIMObjectPath& getPath() const;
|
95 kumpf 1.45
|
96 kumpf 1.61 /** Sets the object path for the instance.
97 @param path - CIMObjectPath containing the object path.
98 */
|
99 kumpf 1.45 void setPath (const CIMObjectPath & path);
|
100 chip 1.26
|
101 kumpf 1.61 /** Adds the CIMQualifier object to the instance.
102 @param qualifier - CIMQualifier object to add to instance.
103 @return the resulting CIMInstance.
104 @exception AlreadyExistsException if the CIMQualifier
105 already exists in the instance.
|
106 mike 1.23 */
|
107 kumpf 1.36 CIMInstance& addQualifier(const CIMQualifier& qualifier);
|
108 mike 1.23
|
109 kumpf 1.61 /** Searches the instance for the qualifier object defined by
110 the input parameter.
111 @param name - CIMName defining the qualifier object to be found.
112 @return Position of the qualifier to be used in subsequent
|
113 mike 1.23 operations or PEG_NOT_FOUND if the qualifier is not found.
114 */
|
115 kumpf 1.52 Uint32 findQualifier(const CIMName& name) const;
|
116 mike 1.24
|
117 kumpf 1.61 /** Retrieves the qualifier object defined by the input parameter.
|
118 mike 1.23 The index to qualifier objects is zero-origin and continuous
119 so that incrementing loops can be used to get all qualifier
|
120 kumpf 1.61 objects in a CIMInstance.
121 @param index - Index for the qualifier object.
122 @return Qualifier object defined by index.
123 @exception IndexOutOfBoundsException exception if the index
124 is out of bounds.
|
125 mike 1.23 */
|
126 kumpf 1.57 CIMQualifier getQualifier(Uint32 index);
|
127 mike 1.23
|
128 kumpf 1.61 /** Retrieves the qualifier object defined by the input parameter.
|
129 mike 1.23 The index to qualifier objects is zero-origin and continuous
130 so that incrementing loops can be used to get all qualifier
|
131 kumpf 1.61 objects in a CIMInstance.
132 @param index - Index for the qualifier object.
133 @return Qualifier object defined by index.
134 @exception IndexOutOfBoundsException exception if the index
135 is out of bounds.
|
136 mike 1.23 */
|
137 kumpf 1.57 CIMConstQualifier getQualifier(Uint32 index) const;
|
138 mike 1.23
|
139 kumpf 1.62 /** Removes the qualifier defined by the index parameter.
140 @param index Defines the index of the qualifier to be removed.
141 @exception IndexOutOfBoundsException if the index is outside
142 the range of existing qualifier objects for this instance.
143 */
144 void removeQualifier(Uint32 index);
145
|
146 kumpf 1.61 /** Gets the count of the CIMQualifier objects defined
147 for this CIMInstance.
|
148 mike 1.23 @return Count of the number of CIMQalifier objects in the
149 CIMInstance.
150 */
|
151 kumpf 1.36 Uint32 getQualifierCount() const;
|
152 mike 1.23
|
153 kumpf 1.61 /** Adds a property object defined by the input parameter to
154 the CIMInstance.
155 @param x - Property Object to be added. See the CIMProperty
156 class for definition of the property object.
|
157 kumpf 1.48 @return the resulting CIMInstance.
|
158 kumpf 1.56 @exception AlreadyExistsException if the property already exists.
|
159 mike 1.23 */
|
160 kumpf 1.36 CIMInstance& addProperty(const CIMProperty& x);
|
161 mike 1.23
|
162 kumpf 1.61 /** Searches the CIMProperty objects in the CIMInstance for
163 property object with the name defined by the input parameter.
164 @param name - CIMName with the name of the property object to be found.
|
165 mike 1.23 @return Position in the CIM Instance to the property object if found or
166 PEG_NOT_FOUND if no property object found with the name defined by the
|
167 kumpf 1.61 input parameter.
|
168 mike 1.23 */
|
169 kumpf 1.52 Uint32 findProperty(const CIMName& name) const;
|
170 mike 1.23
|
171 kumpf 1.61 /** Gets the CIMProperty object in the CIMInstance defined
172 by the input parameter.
|
173 mike 1.23 The index to qualifier objects is zero-origin and continuous
174 so that incrementing loops can be used to get all qualifier
|
175 kumpf 1.61 objects in a CIMInstance.
176 @param index - Index to the property object in the CIMInstance.
|
177 mike 1.23 @return CIMProperty object corresponding to the index.
|
178 kumpf 1.58 @exception IndexOutOfBoundsException if index is outside the range of
|
179 kumpf 1.61 properties in this instance.
|
180 mike 1.23 */
|
181 kumpf 1.58 CIMProperty getProperty(Uint32 index);
|
182 mike 1.23
|
183 kumpf 1.61 /** Gets the CIMproperty object in the CIMInstance defined
184 by the input parameter.
|
185 mike 1.23 The index to qualifier objects is zero-origin and continuous
186 so that incrementing loops can be used to get all qualifier
|
187 kumpf 1.61 objects in a CIMInstance.
188 @param index - Index to the property object in the CIMInstance.
|
189 mike 1.23 @return CIMProperty object corresponding to the index.
|
190 kumpf 1.58 @exception IndexOutOfBoundsException if index is outside the range of
|
191 kumpf 1.61 properties in this instance.
|
192 mike 1.23 */
|
193 kumpf 1.58 CIMConstProperty getProperty(Uint32 index) const;
|
194 mike 1.23
|
195 kumpf 1.61 /** Removes the property defined by the input parameter
196 from the instance.
197 @param index - Index to the property to be removed from the
198 instance. Normally this is obtained by getProperty().
|
199 kumpf 1.57 @exception IndexOutOfBoundsException if index is outside the range of
|
200 kumpf 1.61 properties in this instance.
|
201 mike 1.23 */
|
202 kumpf 1.58 void removeProperty(Uint32 index);
|
203 mike 1.23
|
204 kumpf 1.61 /** Gets the count of CIMProperty objects defined for
205 this CIMInstance.
|
206 mike 1.23 @return Count of the number of CIMProperty objects in the
207 CIMInstance. Zero indicates that no CIMProperty objects
|
208 kumpf 1.61 are contained in the CIMInstance.
|
209 mike 1.23 */
|
210 kumpf 1.36 Uint32 getPropertyCount() const;
|
211 mike 1.23
|
212 kumpf 1.61 /** Builds the CIM object path for this instance. The class
|
213 kumpf 1.36 argument is used to determine which fields are keys. The instance
|
214 kumpf 1.55 name has this form:
|
215 mike 1.23
|
216 kumpf 1.36 <PRE>
217 ClassName.key1=value1,...,keyN=valueN
218 </PRE>
|
219 mike 1.23
|
220 kumpf 1.55 The object path is in standard form (the class name and key name
|
221 kumpf 1.61 are all lowercase; the key-value pairs appear in sorted order by
|
222 kumpf 1.36 key name).
|
223 kumpf 1.55
224 Note that the path attribute of the CIMInstanceRep object is not
225 modified.
|
226 mike 1.23 */
|
227 kumpf 1.55 CIMObjectPath buildPath(const CIMConstClass& cimClass) const;
|
228 mike 1.23
|
229 kumpf 1.61 /** Makes a deep copy (clone) of the CIMInstance object. */
|
230 kumpf 1.36 CIMInstance clone() const;
231
|
232 kumpf 1.61 /** Compares the CIMInstance with another CIMInstance
|
233 mike 1.23 defined by the input parameter for equality of all components.
|
234 kumpf 1.61 @param x - CIMInstance to be compared.
235 @return true if they are identical, false otherwise.
|
236 mike 1.23 */
237 Boolean identical(const CIMConstInstance& x) const;
238
|
239 kumpf 1.61 /** Determines if the object has not been initialized.
240 @return true if the object has not been initialized,
241 false otherwise.
|
242 kumpf 1.54 */
243 Boolean isUninitialized() const;
244
|
245 karl 1.67 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
246 /** <I><B>Experimental Interface</B></I><BR>
|
247 karl 1.65 Filter the properties, qualifiers and class origin attributes from this
248 instance based on filtering criteria defined in the input parameters.
249 Note that this function does not add anything that was not in the instance
250 at the beginning of the call. This function does NOT clone the instance
251 but modifies the existing instance. The function was defined specifically
252 for providers to allow creating instances for a specific instance
253 operation response corresponding to the parameters provided with the
254 operation call (includeQualifiers, etc.) from a more general instance
255 template.
256
257 @param includeQualifiers If false, qualifiers are removed from the
258 instance and any properties included in the instance; otherwise no
259 qualifiers are removed. Because there is still confusion over the exact
260 operation of this parameter in the CIM specifications and the concept of
261 instance level qualifiers, the behavior of this function when the
262 parameter is true MAY change in the future to match any future
263 clarifications of interoperable behavior in the CIM specifications.
264
265 @param includeClassOrigin If false, ClassOrigin attributes are removed from
266 all properties. Otherwise, ClassOrigin attributes are not filtered.
267
268 karl 1.65 @param propertyList This CIMPropertyList defines the list of properties that should be on the
269 instance after completion of the call. If not NULL, properties absent from this list will
270 be removed from the list. If NULL, no properties will be removed from the instance.
271 If empty, all properties will be removed from the instance.
272
273 @return The CIMInstance with properties and qualifiers from this
274 instance based on the filtering criteria.
|
275 karl 1.67 <p><b>Example:</b>
276 <pre>
277 CIMClass myClass .. a defined and complete CIMClass.
278 // create instance with qualifiers, class origin and all properties
279 CIMInstance myInstance =
280 myClass.buildInstance(true, true, CIMPropertyList());
281 // filter qualifiers off of the instance.
282 myInstance.filterInstance(false, true, CIMPropertyList());
283 </pre>
|
284 karl 1.65 */
285
286 void filter(Boolean includeQualifiers,
287 Boolean includeClassOrigin,
288 const CIMPropertyList & propertyList);
|
289 karl 1.67 #endif
|
290 karl 1.65
|
291 mike 1.23 private:
292
|
293 kumpf 1.36 CIMInstanceRep* _rep;
294
295 CIMInstance(CIMInstanceRep* rep);
296
297 void _checkRep() const;
|
298 mike 1.23
299 friend class CIMConstInstance;
300 friend class CIMObject;
|
301 mike 1.25 friend class CIMConstObject;
|
302 kumpf 1.50 friend class Resolver;
|
303 kumpf 1.40 friend class XmlWriter;
|
304 kumpf 1.41 friend class MofWriter;
|
305 schuur 1.64 friend class BinaryStreamer;
|
306 mike 1.23 };
307
308 ////////////////////////////////////////////////////////////////////////////////
309 //
310 // CIMConstInstance
311 //
312 ////////////////////////////////////////////////////////////////////////////////
313
|
314 kumpf 1.61 ///
|
315 mike 1.23 class PEGASUS_COMMON_LINKAGE CIMConstInstance
316 {
317 public:
318
|
319 kumpf 1.61 ///
|
320 kumpf 1.36 CIMConstInstance();
|
321 mike 1.23
|
322 kumpf 1.61 ///
|
323 kumpf 1.36 CIMConstInstance(const CIMConstInstance& x);
|
324 mike 1.23
|
325 kumpf 1.61 ///
|
326 kumpf 1.36 CIMConstInstance(const CIMInstance& x);
|
327 mike 1.23
|
328 kumpf 1.61 ///
|
329 kumpf 1.58 PEGASUS_EXPLICIT CIMConstInstance(const CIMObject& x);
|
330 mike 1.25
|
331 kumpf 1.61 ///
|
332 kumpf 1.58 PEGASUS_EXPLICIT CIMConstInstance(const CIMConstObject& x);
|
333 mike 1.25
|
334 kumpf 1.61 ///
|
335 kumpf 1.52 CIMConstInstance(const CIMName& className);
|
336 kumpf 1.36
|
337 kumpf 1.61 ///
|
338 kumpf 1.36 CIMConstInstance& operator=(const CIMConstInstance& x);
339
|
340 kumpf 1.61 ///
|
341 kumpf 1.36 CIMConstInstance& operator=(const CIMInstance& x);
342
|
343 kumpf 1.61 ///
|
344 kumpf 1.36 ~CIMConstInstance();
345
|
346 kumpf 1.61 ///
|
347 kumpf 1.52 const CIMName& getClassName() const;
|
348 kumpf 1.36
|
349 kumpf 1.61 ///
|
350 kumpf 1.43 const CIMObjectPath& getPath() const;
|
351 kumpf 1.36
|
352 kumpf 1.61 ///
|
353 kumpf 1.52 Uint32 findQualifier(const CIMName& name) const;
|
354 kumpf 1.36
|
355 kumpf 1.61 ///
|
356 kumpf 1.57 CIMConstQualifier getQualifier(Uint32 index) const;
|
357 kumpf 1.36
|
358 kumpf 1.61 ///
|
359 kumpf 1.36 Uint32 getQualifierCount() const;
360
|
361 kumpf 1.61 ///
|
362 kumpf 1.52 Uint32 findProperty(const CIMName& name) const;
|
363 kumpf 1.36
|
364 kumpf 1.61 ///
|
365 kumpf 1.57 CIMConstProperty getProperty(Uint32 index) const;
|
366 mike 1.23
|
367 kumpf 1.61 ///
|
368 kumpf 1.36 Uint32 getPropertyCount() const;
369
|
370 kumpf 1.61 ///
|
371 kumpf 1.55 CIMObjectPath buildPath(const CIMConstClass& cimClass) const;
|
372 kumpf 1.36
|
373 kumpf 1.61 ///
|
374 kumpf 1.36 CIMInstance clone() const;
375
|
376 kumpf 1.61 ///
|
377 kumpf 1.36 Boolean identical(const CIMConstInstance& x) const;
378
|
379 kumpf 1.61 ///
|
380 kumpf 1.54 Boolean isUninitialized() const;
|
381 mike 1.23
382 private:
383
|
384 kumpf 1.36 CIMInstanceRep* _rep;
385
386 void _checkRep() const;
|
387 mike 1.23
388 friend class CIMInstance;
|
389 mike 1.25 friend class CIMObject;
390 friend class CIMConstObject;
|
391 kumpf 1.40 friend class XmlWriter;
|
392 kumpf 1.41 friend class MofWriter;
|
393 schuur 1.64 friend class BinaryStreamer;
|
394 mike 1.23 };
395
396 #define PEGASUS_ARRAY_T CIMInstance
|
397 kumpf 1.46 # include <Pegasus/Common/ArrayInter.h>
|
398 mike 1.23 #undef PEGASUS_ARRAY_T
399
400 PEGASUS_NAMESPACE_END
401
|
402 mike 1.25 #endif /* Pegasus_Instance_h */
|