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

  1 martin 1.75 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.76 //
  3 martin 1.75 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.76 //
 10 martin 1.75 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.76 //
 17 martin 1.75 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.76 //
 20 martin 1.75 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.76 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.75 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.76 //
 28 martin 1.75 //////////////////////////////////////////////////////////////////////////
 29 mike   1.23 //
 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 kumpf  1.71 /**
 54                 The CIMInstance class represents the DMTF standard CIM instance definition.
 55             
 56                 <p>The CIMInstance class uses a shared representation model, such that
 57                 multiple CIMInstance objects may refer to the same data copy.  Assignment
 58                 and copy operators create new references to the same data, not distinct
 59                 copies.  An update to a CIMInstance object affects all the CIMInstance
 60                 objects that refer to the same data copy.  The data remains valid until
 61                 all the CIMInstance objects that refer to it are destructed.  A separate
 62                 copy of the data may be created using the clone method.
 63 mike   1.23 */
 64             class PEGASUS_COMMON_LINKAGE CIMInstance
 65             {
 66             public:
 67             
 68 kumpf  1.71     /**
 69                     Constructs an uninitialized CIMInstance object.  A method
 70                     invocation on an uninitialized object will result in the throwing
 71                     of an UninitializedObjectException.  An uninitialized object may
 72                     be converted into an initialized object only by using the assignment
 73                     operator with an initialized object.
 74 mike   1.23     */
 75 kumpf  1.36     CIMInstance();
 76 mike   1.23 
 77 kumpf  1.71     /**
 78                     Constructs a CIMInstance object from the value of a specified
 79                     CIMInstance object, so that both objects refer to the same data copy.
 80                     @param x The CIMInstance object from which to construct a new
 81                         CIMInstance object.
 82 mike   1.23     */
 83 kumpf  1.36     CIMInstance(const CIMInstance& x);
 84 mike   1.23 
 85 kumpf  1.71     /**
 86                     Constructs a CIMInstance object from the value of a specified
 87                     CIMObject object, so that both objects refer to the same data copy.
 88                     @param x The CIMObject object from which to construct the
 89                         CIMInstance object.
 90                     @exception DynamicCastFailedException If a CIMInstance can not be
 91                         created from the given CIMObject.
 92 kumpf  1.58     */
 93 kumpf  1.73     explicit CIMInstance(const CIMObject& x);
 94 mike   1.25 
 95 kumpf  1.71     /**
 96                     Constructs a CIMInstance object with the specified class name.
 97                     @param className A CIMName specifying the class name of the instance.
 98 mike   1.23     */
 99 kumpf  1.52     CIMInstance(const CIMName& className);
100 kumpf  1.36 
101 kumpf  1.71     /**
102                     Assigns the value of the specified CIMInstance object to this object,
103                     so that both objects refer to the same data copy.
104                     @param x The CIMInstance object from which to assign this CIMInstance
105                         object.
106                     @return A reference to this CIMInstance object.
107                 */
108 kumpf  1.36     CIMInstance& operator=(const CIMInstance& x);
109 mike   1.23 
110 kumpf  1.71     /**
111                     Destructs the CIMInstance object.
112                 */
113 kumpf  1.60     ~CIMInstance();
114 mike   1.23 
115 kumpf  1.71     /**
116                     Gets the class name of the instance.
117                     @return A CIMName containing the class name.
118                     @exception UninitializedObjectException If the object is not
119                         initialized.
120 mike   1.23     */
121 kumpf  1.52     const CIMName& getClassName() const;
122 mike   1.23 
123 kumpf  1.71     /**
124                     Gets the object path for the instance.
125                     @return A CIMObjectPath containing the object path.
126                     @exception UninitializedObjectException If the object is not
127                         initialized.
128                 */
129 kumpf  1.43     const CIMObjectPath& getPath() const;
130 kumpf  1.45 
131 kumpf  1.71     /**
132                     Sets the object path for the instance.
133                     @param path A CIMObjectPath containing the object path.
134                     @exception UninitializedObjectException If the object is not
135                         initialized.
136 kumpf  1.61     */
137 kumpf  1.45     void setPath (const CIMObjectPath & path);
138 chip   1.26 
139 kumpf  1.71     /**
140                     Adds a qualifier to the instance.
141                     @param qualifier The CIMQualifier to be added.
142                     @return A reference to this CIMInstance object.
143                     @exception AlreadyExistsException If a qualifier with the
144                         same name already exists in the CIMInstance.
145                     @exception UninitializedObjectException If the object is not
146                         initialized.
147 mike   1.23     */
148 kumpf  1.36     CIMInstance& addQualifier(const CIMQualifier& qualifier);
149 mike   1.23 
150 kumpf  1.71     /**
151                     Finds a qualifier by name.
152                     @param name A CIMName specifying the name of the qualifier to be found.
153                     @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
154                     @exception UninitializedObjectException If the object is not
155                         initialized.
156 mike   1.23     */
157 kumpf  1.52     Uint32 findQualifier(const CIMName& name) const;
158 mike   1.24 
159 kumpf  1.71     /**
160                     Gets the qualifier at the specified index.
161                     @param index The index of the qualifier to be retrieved.
162                     @return The CIMQualifier at the specified index.
163                     @exception IndexOutOfBoundsException If the index is outside
164                         the range of qualifiers available for the CIMInstance.
165                     @exception UninitializedObjectException If the object is not
166                         initialized.
167 mike   1.23     */
168 kumpf  1.57     CIMQualifier getQualifier(Uint32 index);
169 mike   1.23 
170 kumpf  1.71     /**
171                     Gets the qualifier at the specified index.
172                     @param index The index of the qualifier to be retrieved.
173                     @return The CIMConstQualifier at the specified index.
174                     @exception IndexOutOfBoundsException If the index is outside
175                         the range of qualifiers available for the CIMInstance.
176                     @exception UninitializedObjectException If the object is not
177                         initialized.
178 mike   1.23     */
179 kumpf  1.57     CIMConstQualifier getQualifier(Uint32 index) const;
180 mike   1.23 
181 kumpf  1.71     /**
182                     Removes a qualifier from the instance.
183                     @param index The index of the qualifier to remove.
184                     @exception IndexOutOfBoundsException If the index is
185                         outside the range of qualifiers available for the CIMInstance.
186                     @exception UninitializedObjectException If the object is not
187                         initialized.
188 kumpf  1.62     */
189                 void removeQualifier(Uint32 index);
190             
191 kumpf  1.71     /**
192                     Gets the number of qualifiers in the instance.
193                     @return An integer count of the qualifiers in the CIMInstance.
194                     @exception UninitializedObjectException If the object is not
195                         initialized.
196 mike   1.23     */
197 kumpf  1.36     Uint32 getQualifierCount() const;
198 mike   1.23 
199 kumpf  1.71     /**
200                     Adds a property to the instance.
201                     @param x The CIMProperty to be added.
202                     @return A reference to this CIMInstance object.
203                     @exception AlreadyExistsException If a property with the
204                         same name already exists in the CIMInstance.
205                     @exception UninitializedObjectException If the object is not
206                         initialized.
207 mike   1.23     */
208 kumpf  1.36     CIMInstance& addProperty(const CIMProperty& x);
209 mike   1.23 
210 kumpf  1.71     /**
211                     Finds a property by name.
212                     @param name A CIMName specifying the name of the property to be found.
213                     @return Index of the property if found or PEG_NOT_FOUND if not found.
214                     @exception UninitializedObjectException If the object is not
215                         initialized.
216 mike   1.23     */
217 kumpf  1.52     Uint32 findProperty(const CIMName& name) const;
218 mike   1.23 
219 kumpf  1.71     /**
220                     Gets the property at the specified index.
221                     @param index The index of the property to be retrieved.
222                     @return The CIMProperty at the specified index.
223                     @exception IndexOutOfBoundsException If the index is outside
224                         the range of properties available for the CIMInstance.
225                     @exception UninitializedObjectException If the object is not
226                         initialized.
227 mike   1.23     */
228 kumpf  1.58     CIMProperty getProperty(Uint32 index);
229 mike   1.23 
230 kumpf  1.71     /**
231                     Gets the property at the specified index.
232                     @param index The index of the property to be retrieved.
233                     @return The CIMConstProperty at the specified index.
234                     @exception IndexOutOfBoundsException If the index is outside
235                         the range of properties available for the CIMInstance.
236                     @exception UninitializedObjectException If the object is not
237                         initialized.
238 mike   1.23     */
239 kumpf  1.58     CIMConstProperty getProperty(Uint32 index) const;
240 mike   1.23 
241 kumpf  1.71     /**
242                     Removes a property from the instance.
243                     @param index The index of the property to remove.
244                     @exception IndexOutOfBoundsException If the index is
245                         outside the range of properties available for the CIMInstance.
246                     @exception UninitializedObjectException If the object is not
247                         initialized.
248 mike   1.23     */
249 kumpf  1.58     void removeProperty(Uint32 index);
250 mike   1.23 
251 kumpf  1.71     /**
252                     Gets the number of properties in the instance.
253                     @return An integer count of the properties in the CIMInstance.
254                     @exception UninitializedObjectException If the object is not
255                         initialized.
256 mike   1.23     */
257 kumpf  1.36     Uint32 getPropertyCount() const;
258 mike   1.23 
259 kumpf  1.71     /**
260                     Builds the object path for this instance, based on the class name
261                     and property values in the instance and the Key qualifiers on the
262                     properties in the class definition.  The returned object path does
263                     not include hostname and namespace attributes.
264                     Note that this method does not update the path attribute of the
265                     CIMInstance.
266                     @return A CIMObjectPath containing the object path for the instance.
267                     @exception UninitializedObjectException If the object is not
268                         initialized.
269 mike   1.23     */
270 kumpf  1.55     CIMObjectPath buildPath(const CIMConstClass& cimClass) const;
271 mike   1.23 
272 kumpf  1.71     /**
273                     Makes a deep copy of the instance.  This creates a new copy of all
274                     the instance attributes including qualifiers and properties.
275                     @return A new copy of the CIMInstance object.
276                     @exception UninitializedObjectException If the object is not
277                         initialized.
278                 */
279 kumpf  1.36     CIMInstance clone() const;
280             
281 kumpf  1.71     /**
282                     Compares the CIMInstance with a specified CIMConstInstance.
283                     @param x The CIMConstInstance to be compared.
284                     @return True if this instance is identical to the one specified,
285                         false otherwise.
286                     @exception UninitializedObjectException If the object is not
287                         initialized.
288 mike   1.23     */
289                 Boolean identical(const CIMConstInstance& x) const;
290             
291 kumpf  1.71     /**
292                     Determines whether the object has been initialized.
293                     @return True if the object has not been initialized, false otherwise.
294                 */
295 kumpf  1.54     Boolean isUninitialized() const;
296             
297 anusha.kandepu 1.78 #ifdef PEGASUS_USE_DEPRECATED_INTERFACES
298 kumpf          1.71 
299 anusha.kandepu 1.78 // This function has been deprecated. Property filtering is now done by the 
300                     // CIMOM infrastructure.
301 kumpf          1.71     void filter(
302                             Boolean includeQualifiers,
303                             Boolean includeClassOrigin,
304                             const CIMPropertyList & propertyList);
305 karl           1.67 #endif
306 karl           1.65 
307 anusha.kandepu 1.78 //This is a replacement function for filter(), it has   
308                     //added for backward compatability and it is not optimized 
309                     //for performance.
310                     void instanceFilter(
311                         Boolean includeQualifiers,
312                         Boolean includeClassOrigin,
313                         const CIMPropertyList & propertyList);         
314                     
315 mike           1.23 private:
316                     
317 kumpf          1.36     CIMInstanceRep* _rep;
318                     
319                         CIMInstance(CIMInstanceRep* rep);
320                     
321 mike           1.23     friend class CIMConstInstance;
322                         friend class CIMObject;
323 mike           1.25     friend class CIMConstObject;
324 kumpf          1.50     friend class Resolver;
325 kumpf          1.40     friend class XmlWriter;
326 kumpf          1.41     friend class MofWriter;
327 schuur         1.64     friend class BinaryStreamer;
328 r.kieninger    1.72     friend class CIMClassRep;
329 thilo.boehm    1.77     friend class SCMOInstance;
330                         friend class SCMOClass;
331 mike           1.23 };
332                     
333                     ////////////////////////////////////////////////////////////////////////////////
334                     //
335                     // CIMConstInstance
336                     //
337                     ////////////////////////////////////////////////////////////////////////////////
338                     
339 kumpf          1.71 /**
340                         The CIMConstInstance class provides a const interface to a CIMInstance
341                         object.  This class is needed because the shared representation model
342                         used by CIMInstance does not prevent modification to a const CIMInstance
343                         object.  Note that the value of a CIMConstInstance object could still be
344                         modified by a CIMInstance object that refers to the same data copy.
345                     */
346 mike           1.23 class PEGASUS_COMMON_LINKAGE CIMConstInstance
347                     {
348                     public:
349                     
350 kumpf          1.71     /**
351                             Constructs an uninitialized CIMConstInstance object.  A method
352                             invocation on an uninitialized object will result in the throwing
353                             of an UninitializedObjectException.  An uninitialized object may
354                             be converted into an initialized object only by using the assignment
355                             operator with an initialized object.
356                         */
357 kumpf          1.36     CIMConstInstance();
358 mike           1.23 
359 kumpf          1.71     /**
360                             Constructs a CIMConstInstance object from the value of a specified
361                             CIMConstInstance object, so that both objects refer to the same data
362                             copy.
363                             @param x The CIMConstInstance object from which to construct a new
364                                 CIMConstInstance object.
365                         */
366 kumpf          1.36     CIMConstInstance(const CIMConstInstance& x);
367 mike           1.23 
368 kumpf          1.71     /**
369                             Constructs a CIMConstInstance object from the value of a specified
370                             CIMInstance object, so that both objects refer to the same data
371                             copy.
372                             @param x The CIMInstance object from which to construct a new
373                                 CIMConstInstance object.
374                         */
375 kumpf          1.36     CIMConstInstance(const CIMInstance& x);
376 mike           1.23 
377 kumpf          1.71     /**
378                             Constructs a CIMConstInstance object from the value of a specified
379                             CIMObject object, so that both objects refer to the same data copy.
380                             @param x The CIMObject object from which to construct the
381                                 CIMConstInstance object.
382                             @exception DynamicCastFailedException If a CIMConstInstance can not be
383                                 created from the given CIMObject.
384                         */
385 kumpf          1.73     explicit CIMConstInstance(const CIMObject& x);
386 mike           1.25 
387 kumpf          1.71     /**
388                             Constructs a CIMConstInstance object from the value of a specified
389                             CIMConstObject object, so that both objects refer to the same data
390                             copy.
391                             @param x The CIMConstObject object from which to construct the
392                                 CIMConstInstance object.
393                             @exception DynamicCastFailedException If a CIMConstInstance can not be
394                                 created from the given CIMConstObject.
395                         */
396 kumpf          1.73     explicit CIMConstInstance(const CIMConstObject& x);
397 mike           1.25 
398 kumpf          1.71     /**
399                             Constructs a CIMConstInstance object with the specified class name.
400                             @param className A CIMName specifying the class name of the instance.
401                         */
402 kumpf          1.52     CIMConstInstance(const CIMName& className);
403 kumpf          1.36 
404 kumpf          1.71     /**
405                             Assigns the value of the specified CIMConstInstance object to this
406                             object, so that both objects refer to the same data copy.
407                             @param x The CIMConstInstance object from which to assign this
408                                 CIMConstInstance object.
409                             @return A reference to this CIMConstInstance object.
410                         */
411 kumpf          1.36     CIMConstInstance& operator=(const CIMConstInstance& x);
412                     
413 kumpf          1.71     /**
414                             Assigns the value of the specified CIMInstance object to this
415                             object, so that both objects refer to the same data copy.
416                             @param x The CIMInstance object from which to assign this
417                                 CIMConstInstance object.
418                             @return A reference to this CIMConstInstance object.
419                         */
420 kumpf          1.36     CIMConstInstance& operator=(const CIMInstance& x);
421                     
422 kumpf          1.71     /**
423                             Destructs the CIMConstInstance object.
424                         */
425 kumpf          1.36     ~CIMConstInstance();
426                     
427 kumpf          1.71     /**
428                             Gets the class name of the instance.
429                             @return A CIMName containing the class name.
430                             @exception UninitializedObjectException If the object is not
431                                 initialized.
432                         */
433 kumpf          1.52     const CIMName& getClassName() const;
434 kumpf          1.36 
435 kumpf          1.71     /**
436                             Gets the object path for the instance.
437                             @return A CIMObjectPath containing the object path.
438                             @exception UninitializedObjectException If the object is not
439                                 initialized.
440                         */
441 kumpf          1.43     const CIMObjectPath& getPath() const;
442 kumpf          1.36 
443 kumpf          1.71     /**
444                             Finds a qualifier by name.
445                             @param name A CIMName specifying the name of the qualifier to be found.
446                             @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
447                             @exception UninitializedObjectException If the object is not
448                                 initialized.
449                         */
450 kumpf          1.52     Uint32 findQualifier(const CIMName& name) const;
451 kumpf          1.36 
452 kumpf          1.71     /**
453                             Gets the qualifier at the specified index.
454                             @param index The index of the qualifier to be retrieved.
455                             @return The CIMConstQualifier at the specified index.
456                             @exception IndexOutOfBoundsException If the index is outside
457                                 the range of qualifiers available for the CIMConstInstance.
458                             @exception UninitializedObjectException If the object is not
459                                 initialized.
460                         */
461 kumpf          1.57     CIMConstQualifier getQualifier(Uint32 index) const;
462 kumpf          1.36 
463 kumpf          1.71     /**
464                             Gets the number of qualifiers in the instance.
465                             @return An integer count of the qualifiers in the CIMInstance.
466                             @exception UninitializedObjectException If the object is not
467                                 initialized.
468                         */
469 kumpf          1.36     Uint32 getQualifierCount() const;
470                     
471 kumpf          1.71     /**
472                             Finds a property by name.
473                             @param name A CIMName specifying the name of the property to be found.
474                             @return Index of the property if found or PEG_NOT_FOUND if not found.
475                             @exception UninitializedObjectException If the object is not
476                                 initialized.
477                         */
478 kumpf          1.52     Uint32 findProperty(const CIMName& name) const;
479 kumpf          1.36 
480 kumpf          1.71     /**
481                             Gets the property at the specified index.
482                             @param index The index of the property to be retrieved.
483                             @return The CIMConstProperty at the specified index.
484                             @exception IndexOutOfBoundsException If the index is outside
485                                 the range of properties available for the CIMConstInstance.
486                             @exception UninitializedObjectException If the object is not
487                                 initialized.
488                         */
489 kumpf          1.57     CIMConstProperty getProperty(Uint32 index) const;
490 mike           1.23 
491 kumpf          1.71     /**
492                             Gets the number of properties in the instance.
493                             @return An integer count of the properties in the CIMConstInstance.
494                             @exception UninitializedObjectException If the object is not
495                                 initialized.
496                         */
497 kumpf          1.36     Uint32 getPropertyCount() const;
498                     
499 kumpf          1.71     /**
500                             Builds the object path for this instance, based on the class name
501                             and property values in the instance and the Key qualifiers on the
502                             properties in the class definition.  The returned object path does
503                             not include hostname and namespace attributes.
504                             Note that this method does not update the path attribute of the
505                             CIMInstance.
506                             @return A CIMObjectPath containing the object path for the instance.
507                             @exception UninitializedObjectException If the object is not
508                                 initialized.
509                         */
510 kumpf          1.55     CIMObjectPath buildPath(const CIMConstClass& cimClass) const;
511 kumpf          1.36 
512 kumpf          1.71     /**
513                             Makes a deep copy of the instance.  This creates a new copy of all
514                             the instance attributes including qualifiers and properties.
515                             @return A CIMInstance object with a separate copy of the
516                                 CIMConstInstance object.
517                             @exception UninitializedObjectException If the object is not
518                                 initialized.
519                         */
520 kumpf          1.36     CIMInstance clone() const;
521                     
522 kumpf          1.71     /**
523                             Compares the CIMConstInstance with a specified CIMConstInstance.
524                             @param x The CIMConstInstance to be compared.
525                             @return True if this instance is identical to the one specified,
526                                 false otherwise.
527                             @exception UninitializedObjectException If the object is not
528                                 initialized.
529                         */
530 kumpf          1.36     Boolean identical(const CIMConstInstance& x) const;
531                     
532 kumpf          1.71     /**
533                             Determines whether the object has been initialized.
534                             @return True if the object has not been initialized, false otherwise.
535                         */
536 kumpf          1.54     Boolean isUninitialized() const;
537 mike           1.23 
538                     private:
539                     
540 kumpf          1.36     CIMInstanceRep* _rep;
541                     
542 mike           1.23     friend class CIMInstance;
543 mike           1.25     friend class CIMObject;
544                         friend class CIMConstObject;
545 kumpf          1.40     friend class XmlWriter;
546 kumpf          1.41     friend class MofWriter;
547 schuur         1.64     friend class BinaryStreamer;
548 thilo.boehm    1.77     friend class SCMOInstance;
549 mike           1.23 };
550                     
551                     #define PEGASUS_ARRAY_T CIMInstance
552 kumpf          1.46 # include <Pegasus/Common/ArrayInter.h>
553 mike           1.23 #undef PEGASUS_ARRAY_T
554                     
555                     PEGASUS_NAMESPACE_END
556                     
557 mike           1.25 #endif /* Pegasus_Instance_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2