(file) Return to CIMInstance.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2