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

  1 martin 1.48 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.49 //
  3 martin 1.48 // 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.49 //
 10 martin 1.48 // 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.49 //
 17 martin 1.48 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.49 //
 20 martin 1.48 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.49 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.48 // 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.49 //
 28 martin 1.48 //////////////////////////////////////////////////////////////////////////
 29 mike   1.6  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32 mike   1.7  #ifndef Pegasus_Object_h
 33             #define Pegasus_Object_h
 34 mike   1.6  
 35             #include <Pegasus/Common/Config.h>
 36 kumpf  1.32 #include <Pegasus/Common/Linkage.h>
 37 kumpf  1.18 #include <Pegasus/Common/String.h>
 38 kumpf  1.32 #include <Pegasus/Common/CIMName.h>
 39 kumpf  1.18 #include <Pegasus/Common/Array.h>
 40             #include <Pegasus/Common/CIMProperty.h>
 41             #include <Pegasus/Common/CIMQualifier.h>
 42 marek  1.50 #include <Pegasus/Common/CIMPropertyList.h>
 43 mike   1.6  
 44             PEGASUS_NAMESPACE_BEGIN
 45             
 46 kumpf  1.18 class CIMConstObject;
 47             class CIMObjectRep;
 48 mike   1.7  class CIMClass;
 49             class CIMConstClass;
 50             class CIMInstance;
 51             class CIMConstInstance;
 52 dave.sudlik 1.43 class CIMProperty;
 53                  class CIMConstProperty;
 54                  class CIMQualifier;
 55                  class CIMConstQualifier;
 56 mike        1.7  
 57                  ////////////////////////////////////////////////////////////////////////////////
 58                  //
 59                  // CIMObject
 60                  //
 61                  ////////////////////////////////////////////////////////////////////////////////
 62                  
 63 kumpf       1.46 /**
 64                      The CIMObject class represents the DMTF standard CIM object definition,
 65                      which may represent a CIMClass or a CIMInstance.
 66 mike        1.7  
 67 kumpf       1.46     <p>The CIMObject class uses a shared representation model, such that
 68                      multiple CIMObject objects may refer to the same data copy.  Assignment
 69                      and copy operators create new references to the same data, not distinct
 70                      copies.  An update to a CIMObject object affects all the CIMObject
 71                      objects that refer to the same data copy.  The data remains valid until
 72                      all the CIMObject objects that refer to it are destructed.  A separate
 73                      copy of the data may be created using the clone method.
 74 mike        1.6  */
 75                  class PEGASUS_COMMON_LINKAGE CIMObject
 76                  {
 77                  public:
 78                  
 79 kumpf       1.46     /**
 80                          Constructs an uninitialized CIMObject object.  A method
 81                          invocation on an uninitialized object will result in the throwing
 82                          of an UninitializedObjectException.  An uninitialized object may
 83                          be converted into an initialized object only by using the assignment
 84                          operator with an initialized object.
 85 mike        1.7      */
 86 kumpf       1.18     CIMObject();
 87 mike        1.6  
 88 kumpf       1.46     /**
 89                          Constructs a CIMObject object from the value of a specified
 90                          CIMObject object, so that both objects refer to the same data copy.
 91                          @param x The CIMObject object from which to construct a new
 92                              CIMObject object.
 93 mike        1.7      */
 94 kumpf       1.18     CIMObject(const CIMObject& x);
 95 mike        1.6  
 96 kumpf       1.46     /**
 97                          Constructs a CIMObject object from the value of a specified
 98                          CIMClass object, so that both objects refer to the same data copy.
 99                          @param x The CIMClass object from which to construct the
100                              CIMObject object.
101 mike        1.7      */
102                      CIMObject(const CIMClass& x);
103 mike        1.6  
104 kumpf       1.46     /**
105                          Constructs a CIMObject object from the value of a specified
106                          CIMInstance object, so that both objects refer to the same data copy.
107                          @param x The CIMInstance object from which to construct the
108                              CIMObject object.
109 mike        1.7      */
110                      CIMObject(const CIMInstance& x);
111 mike        1.6  
112 kumpf       1.46     /**
113                          Assigns the value of the specified CIMObject object to this object,
114                          so that both objects refer to the same data copy.
115                          @param x The CIMObject object from which to assign this CIMObject
116                              object.
117                          @return A reference to this CIMObject object.
118 mike        1.7      */
119 kumpf       1.18     CIMObject& operator=(const CIMObject& x);
120 mike        1.6  
121 kumpf       1.46     /**
122                          Destructs the CIMObject object.
123 mike        1.7      */
124 kumpf       1.18     ~CIMObject();
125 mike        1.7  
126 kumpf       1.46     /**
127                          Gets the class name of the object.
128                          @return A CIMName containing the class name.
129                          @exception UninitializedObjectException If the object is not
130                              initialized.
131 mike        1.7      */
132 kumpf       1.32     const CIMName& getClassName() const;
133 mike        1.7  
134 kumpf       1.46     /**
135                          Gets the object path for the object.
136                          @return A CIMObjectPath containing the object path.
137                          @exception UninitializedObjectException If the object is not
138                              initialized.
139 karl        1.40     */
140 kumpf       1.22     const CIMObjectPath& getPath() const;
141 kumpf       1.24 
142 kumpf       1.46     /**
143                          Sets the object path for the object.
144                          @param path A CIMObjectPath containing the object path.
145                          @exception UninitializedObjectException If the object is not
146                              initialized.
147 kumpf       1.38     */
148 kumpf       1.24     void setPath (const CIMObjectPath & path);
149 chip        1.12 
150 kumpf       1.46     /**
151                          Adds a qualifier to the object.
152                          @param qualifier The CIMQualifier to be added.
153                          @return A reference to this CIMObject object.
154                          @exception AlreadyExistsException If a qualifier with the
155                              same name already exists in the CIMObject.
156                          @exception UninitializedObjectException If the object is not
157                              initialized.
158 mike        1.7      */
159 kumpf       1.18     CIMObject& addQualifier(const CIMQualifier& qualifier);
160 mike        1.7  
161 kumpf       1.46     /**
162                          Finds a qualifier by name.
163                          @param name A CIMName specifying the name of the qualifier to be found.
164                          @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
165                          @exception UninitializedObjectException If the object is not
166                              initialized.
167 mike        1.7      */
168 kumpf       1.32     Uint32 findQualifier(const CIMName& name) const;
169 mike        1.7  
170 kumpf       1.46     /**
171                          Gets the qualifier at the specified index.
172                          @param index The index of the qualifier to be retrieved.
173                          @return The CIMQualifier at the specified index.
174                          @exception IndexOutOfBoundsException If the index is outside
175                              the range of qualifiers available for the CIMObject.
176                          @exception UninitializedObjectException If the object is not
177                              initialized.
178 mike        1.7      */
179 kumpf       1.36     CIMQualifier getQualifier(Uint32 index);
180 mike        1.7  
181 kumpf       1.46     /**
182                          Gets the qualifier at the specified index.
183                          @param index The index of the qualifier to be retrieved.
184                          @return The CIMConstQualifier at the specified index.
185                          @exception IndexOutOfBoundsException If the index is outside
186                              the range of qualifiers available for the CIMObject.
187                          @exception UninitializedObjectException If the object is not
188                              initialized.
189 mike        1.7      */
190 kumpf       1.36     CIMConstQualifier getQualifier(Uint32 index) const;
191 kumpf       1.18 
192 kumpf       1.46     /**
193                          Removes a qualifier from the object.
194                          @param index The index of the qualifier to remove.
195                          @exception IndexOutOfBoundsException If the index is
196                              outside the range of qualifiers available for the CIMObject.
197                          @exception UninitializedObjectException If the object is not
198                              initialized.
199 karl        1.40     */
200 kumpf       1.36     void removeQualifier(Uint32 index);
201 kumpf       1.46 
202                      /**
203                          Gets the number of qualifiers in the object.
204                          @return An integer count of the qualifiers in the CIMObject.
205                          @exception UninitializedObjectException If the object is not
206                              initialized.
207 mike        1.7      */
208 kumpf       1.18     Uint32 getQualifierCount() const;
209 mike        1.7  
210 kumpf       1.46     /**
211                          Adds a property to the object.
212                          @param x The CIMProperty to be added.
213                          @return A reference to this CIMObject object.
214                          @exception AlreadyExistsException If a property with the
215                              same name already exists in the CIMObject.
216                          @exception UninitializedObjectException If the object is not
217                              initialized.
218 mike        1.7      */
219 kumpf       1.18     CIMObject& addProperty(const CIMProperty& x);
220 mike        1.7  
221 kumpf       1.46     /**
222                          Finds a property by name.
223                          @param name A CIMName specifying the name of the property to be found.
224                          @return Index of the property if found or PEG_NOT_FOUND if not found.
225                          @exception UninitializedObjectException If the object is not
226                              initialized.
227 mike        1.7      */
228 kumpf       1.32     Uint32 findProperty(const CIMName& name) const;
229 mike        1.7  
230 kumpf       1.46     /**
231                          Gets the property at the specified index.
232                          @param index The index of the property to be retrieved.
233                          @return The CIMProperty at the specified index.
234                          @exception IndexOutOfBoundsException If the index is outside
235                              the range of properties available for the CIMObject.
236                          @exception UninitializedObjectException If the object is not
237                              initialized.
238 mike        1.7      */
239 kumpf       1.36     CIMProperty getProperty(Uint32 index);
240 mike        1.7  
241 kumpf       1.46     /**
242                          Gets the property at the specified index.
243                          @param index The index of the property to be retrieved.
244                          @return The CIMConstProperty at the specified index.
245                          @exception IndexOutOfBoundsException If the index is outside
246                              the range of properties available for the CIMObject.
247                          @exception UninitializedObjectException If the object is not
248                              initialized.
249 kumpf       1.36     */
250                      CIMConstProperty getProperty(Uint32 index) const;
251                  
252 kumpf       1.46     /**
253                          Removes a property from the object.
254                          @param index The index of the property to remove.
255                          @exception IndexOutOfBoundsException If the index is
256                              outside the range of properties available for the CIMObject.
257                          @exception UninitializedObjectException If the object is not
258                              initialized.
259 mike        1.7      */
260 kumpf       1.36     void removeProperty(Uint32 index);
261 mike        1.7  
262 kumpf       1.46     /**
263                          Gets the number of properties in the object.
264                          @return An integer count of the properties in the CIMObject.
265                          @exception UninitializedObjectException If the object is not
266                              initialized.
267 mike        1.7      */
268 kumpf       1.18     Uint32 getPropertyCount() const;
269 mike        1.7  
270 kumpf       1.46     /**
271                          Makes a deep copy of the object.  This creates a new copy of all
272                          the object attributes including qualifiers and properties.
273                          @return A new copy of the CIMObject object.
274                          @exception UninitializedObjectException If the object is not
275                              initialized.
276 kumpf       1.18     */
277                      CIMObject clone() const;
278 mike        1.7  
279 kumpf       1.46     /**
280                          Compares the CIMObject with a specified CIMConstObject.
281                          @param x The CIMConstObject to be compared.
282                          @return True if this object is identical to the one specified,
283                              false otherwise.
284                          @exception UninitializedObjectException If the object is not
285                              initialized.
286 mike        1.7      */
287                      Boolean identical(const CIMConstObject& x) const;
288                  
289 kumpf       1.46     /**
290                          Determines whether the object has been initialized.
291                          @return True if the object has not been initialized, false otherwise.
292                      */
293 kumpf       1.33     Boolean isUninitialized() const;
294 mike        1.7  
295 kumpf       1.46     /**
296                          Generates a human-readable String representing the value of the
297                          CIMObject.  The String may be in MOF format, but the format is not
298                          guaranteed and may change without notice.
299                          @return A human-readable String representing the CIMObject value.
300                          @exception UninitializedObjectException If the object is not
301                              initialized.
302                      */
303                      String toString() const;
304                  
305                      /**
306                          Indicates whether the object represents a CIMClass.
307                          @return True if the object represents a CIMClass; false otherwise.
308 dave.sudlik 1.43     */
309 kumpf       1.46     Boolean isClass() const;
310 dave.sudlik 1.43 
311 kumpf       1.46     /**
312                          Indicates whether the object represents a CIMInstance.
313                          @return True if the object represents a CIMInstance; false otherwise.
314                      */
315                      Boolean isInstance() const;
316 kumpf       1.34 
317 marek       1.50     void instanceFilter(
318                          Boolean includeQualifiers,
319                          Boolean includeClassOrigin,
320                          const CIMPropertyList & propertyList);
321                  
322 mike        1.7  private:
323                  
324 kumpf       1.18     CIMObjectRep* _rep;
325 mike        1.7  
326 kumpf       1.18     CIMObject(CIMObjectRep* rep);
327 mike        1.7  
328                      friend class CIMConstObject;
329                      friend class CIMClass;
330                      friend class CIMConstClass;
331                      friend class CIMInstance;
332                      friend class CIMConstInstance;
333                  };
334                  
335 kumpf       1.25 #define PEGASUS_ARRAY_T CIMObject
336                  # include <Pegasus/Common/ArrayInter.h>
337                  #undef PEGASUS_ARRAY_T
338                  
339 kumpf       1.46 
340 mike        1.7  ////////////////////////////////////////////////////////////////////////////////
341                  //
342                  // CIMConstObject
343                  //
344                  ////////////////////////////////////////////////////////////////////////////////
345                  
346 karl        1.40 /**
347 kumpf       1.46     The CIMConstObject class provides a const interface to a CIMObject
348                      object.  This class is needed because the shared representation model
349                      used by CIMObject does not prevent modification to a const CIMObject
350                      object.  Note that the value of a CIMConstObject object could still be
351                      modified by a CIMObject object that refers to the same data copy.
352 karl        1.40 */
353 mike        1.7  class PEGASUS_COMMON_LINKAGE CIMConstObject
354                  {
355                  public:
356                  
357 kumpf       1.46     /**
358                          Constructs an uninitialized CIMConstObject object.  A method
359                          invocation on an uninitialized object will result in the throwing
360                          of an UninitializedObjectException.  An uninitialized object may
361                          be converted into an initialized object only by using the assignment
362                          operator with an initialized object.
363 karl        1.40     */
364 kumpf       1.18     CIMConstObject();
365 mike        1.7  
366 kumpf       1.46     /**
367                          Constructs a CIMConstObject object from the value of a specified
368                          CIMConstObject object, so that both objects refer to the same data
369                          copy.
370                          @param x The CIMConstObject object from which to construct a new
371                              CIMConstObject object.
372 karl        1.40     */
373 kumpf       1.18     CIMConstObject(const CIMConstObject& x);
374 mike        1.7  
375 kumpf       1.46     /**
376                          Constructs a CIMConstObject object from the value of a specified
377                          CIMObject object, so that both objects refer to the same data copy.
378                          @param x The CIMObject object from which to construct a new
379                              CIMConstObject object.
380 karl        1.40     */
381 kumpf       1.18     CIMConstObject(const CIMObject& x);
382 mike        1.7  
383 kumpf       1.46     /**
384                          Constructs a CIMConstObject object from the value of a specified
385                          CIMClass object, so that both objects refer to the same data copy.
386                          @param x The CIMClass object from which to construct the
387                              CIMConstObject object.
388 mike        1.7      */
389                      CIMConstObject(const CIMClass& x);
390                  
391 kumpf       1.46     /**
392                          Constructs a CIMConstObject object from the value of a specified
393                          CIMInstance object, so that both objects refer to the same data copy.
394                          @param x The CIMInstance object from which to construct the
395                              CIMConstObject object.
396 mike        1.7      */
397                      CIMConstObject(const CIMInstance& x);
398                  
399 kumpf       1.46     /**
400                          Constructs a CIMConstObject object from the value of a specified
401                          CIMConstClass object, so that both objects refer to the same data copy.
402                          @param x The CIMConstClass object from which to construct the
403                              CIMConstObject object.
404 mike        1.7      */
405                      CIMConstObject(const CIMConstClass& x);
406                  
407 kumpf       1.46     /**
408                          Constructs a CIMConstObject object from the value of a specified
409                          CIMConstInstance object, so that both objects refer to the same data
410                          copy.
411                          @param x The CIMConstInstance object from which to construct the
412                              CIMConstObject object.
413 mike        1.7      */
414                      CIMConstObject(const CIMConstInstance& x);
415                  
416 kumpf       1.46     /**
417                          Assigns the value of the specified CIMConstObject object to this
418                          object, so that both objects refer to the same data copy.
419                          @param x The CIMConstObject object from which to assign this
420                              CIMConstObject object.
421                          @return A reference to this CIMConstObject object.
422 karl        1.40     */
423 kumpf       1.18     CIMConstObject& operator=(const CIMConstObject& x);
424 mike        1.7  
425 kumpf       1.46     /**
426                          Destructs the CIMConstObject object.
427 karl        1.40     */
428 kumpf       1.18     ~CIMConstObject();
429                  
430 kumpf       1.46     /**
431                          Gets the class name of the object.
432                          @return A CIMName containing the class name.
433                          @exception UninitializedObjectException If the object is not
434                              initialized.
435 karl        1.40     */
436 kumpf       1.32     const CIMName& getClassName() const;
437 kumpf       1.18 
438 kumpf       1.46     /**
439                          Gets the object path for the object.
440                          @return A CIMObjectPath containing the object path.
441                          @exception UninitializedObjectException If the object is not
442                              initialized.
443 karl        1.40     */
444 kumpf       1.22     const CIMObjectPath& getPath() const;
445 kumpf       1.18 
446 kumpf       1.46     /**
447                          Finds a qualifier by name.
448                          @param name A CIMName specifying the name of the qualifier to be found.
449                          @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
450                          @exception UninitializedObjectException If the object is not
451                              initialized.
452 karl        1.40     */
453 kumpf       1.32     Uint32 findQualifier(const CIMName& name) const;
454 kumpf       1.18 
455 kumpf       1.46     /**
456                          Gets the qualifier at the specified index.
457                          @param index The index of the qualifier to be retrieved.
458                          @return The CIMConstQualifier at the specified index.
459                          @exception IndexOutOfBoundsException If the index is outside
460                              the range of qualifiers available for the CIMConstObject.
461                          @exception UninitializedObjectException If the object is not
462                              initialized.
463 karl        1.40     */
464 kumpf       1.36     CIMConstQualifier getQualifier(Uint32 index) const;
465 kumpf       1.18 
466 kumpf       1.46     /**
467                          Gets the number of qualifiers in the object.
468                          @return An integer count of the qualifiers in the CIMConstObject.
469                          @exception UninitializedObjectException If the object is not
470                              initialized.
471 karl        1.40     */
472 kumpf       1.18     Uint32 getQualifierCount() const;
473                  
474 kumpf       1.46     /**
475                          Finds a property by name.
476                          @param name A CIMName specifying the name of the property to be found.
477                          @return Index of the property if found or PEG_NOT_FOUND if not found.
478                          @exception UninitializedObjectException If the object is not
479                              initialized.
480 karl        1.40     */
481 kumpf       1.32     Uint32 findProperty(const CIMName& name) const;
482 kumpf       1.18 
483 kumpf       1.46     /**
484                          Gets the property at the specified index.
485                          @param index The index of the property to be retrieved.
486                          @return The CIMConstProperty at the specified index.
487                          @exception IndexOutOfBoundsException If the index is outside
488                              the range of properties available for the CIMConstObject.
489                          @exception UninitializedObjectException If the object is not
490                              initialized.
491 karl        1.40     */
492 kumpf       1.36     CIMConstProperty getProperty(Uint32 index) const;
493 kumpf       1.18 
494 kumpf       1.46     /**
495                          Gets the number of properties in the object.
496                          @return An integer count of the properties in the CIMConstObject.
497                          @exception UninitializedObjectException If the object is not
498                              initialized.
499 karl        1.40     */
500 kumpf       1.18     Uint32 getPropertyCount() const;
501                  
502 kumpf       1.46     /**
503                          Makes a deep copy of the object.  This creates a new copy of all
504                          the object attributes including qualifiers and properties.
505                          @return A CIMObject object with a separate copy of the
506                              CIMConstObject object.
507                          @exception UninitializedObjectException If the object is not
508                              initialized.
509 karl        1.40     */
510 kumpf       1.18     CIMObject clone() const;
511                  
512 kumpf       1.46     /**
513                          Compares the CIMConstObject with a specified CIMConstObject.
514                          @param x The CIMConstObject to be compared.
515                          @return True if this object is identical to the one specified,
516                              false otherwise.
517                          @exception UninitializedObjectException If the object is not
518                              initialized.
519 karl        1.40     */
520 kumpf       1.18     Boolean identical(const CIMConstObject& x) const;
521                  
522 kumpf       1.46     /**
523                          Determines whether the object has been initialized.
524                          @return True if the object has not been initialized, false otherwise.
525 karl        1.40     */
526 kumpf       1.33     Boolean isUninitialized() const;
527 kumpf       1.35 
528 kumpf       1.46     /**
529                          Generates a human-readable String representing the value of the
530                          CIMObject.  The String may be in MOF format, but the format is not
531                          guaranteed and may change without notice.
532                          @return A human-readable String representing the CIMObject value.
533                          @exception UninitializedObjectException If the object is not
534                              initialized.
535 dave.sudlik 1.43     */
536                      String toString () const;
537                  
538 kumpf       1.46     /**
539                          Indicates whether the object represents a CIMConstClass.
540                          @return True if the object represents a CIMConstClass; false otherwise.
541 karl        1.40     */
542 kumpf       1.35     Boolean isClass() const;
543                  
544 kumpf       1.46     /**
545                          Indicates whether the object represents a CIMConstInstance.
546                          @return True if the object represents a CIMConstInstance; false
547                              otherwise.
548 karl        1.40     */
549 kumpf       1.35     Boolean isInstance() const;
550 mike        1.6  
551                  private:
552                  
553 kumpf       1.18     CIMObjectRep* _rep;
554 mike        1.6  
555 mike        1.7      friend class CIMObject;
556                      friend class CIMClass;
557                      friend class CIMConstClass;
558                      friend class CIMInstance;
559                      friend class CIMConstInstance;
560 mike        1.6  };
561                  
562                  PEGASUS_NAMESPACE_END
563                  
564 mike        1.7  #endif /* Pegasus_Object_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2