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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2