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