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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2