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

  1 karl  1.71 //%2005////////////////////////////////////////////////////////////////////////
  2 mike  1.25 //
  3 karl  1.70 // 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.63 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.70 // 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.71 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 mike  1.25 //
 12            // Permission is hereby granted, free of charge, to any person obtaining a copy
 13 chip  1.29 // of this software and associated documentation files (the "Software"), to
 14            // deal in the Software without restriction, including without limitation the
 15            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 16 mike  1.25 // sell copies of the Software, and to permit persons to whom the Software is
 17            // furnished to do so, subject to the following conditions:
 18 kumpf 1.48 // 
 19 chip  1.29 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 20 mike  1.25 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 21            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 22 chip  1.29 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 23            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 24            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 25 mike  1.25 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 26            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27            //
 28            //==============================================================================
 29            //
 30            //%/////////////////////////////////////////////////////////////////////////////
 31            
 32            #ifndef Pegasus_CIMClass_h
 33            #define Pegasus_CIMClass_h
 34            
 35            #include <Pegasus/Common/Config.h>
 36 kumpf 1.53 #include <Pegasus/Common/Linkage.h>
 37            #include <Pegasus/Common/CIMName.h>
 38 mike  1.27 #include <Pegasus/Common/CIMObject.h>
 39 kumpf 1.37 #include <Pegasus/Common/CIMMethod.h>
 40 karl  1.66 #include <Pegasus/Common/CIMInstance.h>
 41 karl  1.65 #include <Pegasus/Common/CIMPropertyList.h>
 42 mike  1.25 
 43            PEGASUS_NAMESPACE_BEGIN
 44            
 45            class CIMConstClass;
 46 kumpf 1.37 class CIMClassRep;
 47 kumpf 1.51 class Resolver;
 48 mike  1.25 
 49 mike  1.28 
 50 kumpf 1.62 /** The CIMClass class is used to represent CIM classes in Pegasus.  
 51 mike  1.25 */
 52            class PEGASUS_COMMON_LINKAGE CIMClass
 53            {
 54            public:
 55            
 56 kumpf 1.62     /** Creates an uninitialized new CIM object representing a CIM class. 
 57                    The class object created by this constructor can only be used 
 58                    in an operation such as the copy constructor. It cannot be used 
 59                    to create a class by appending names, properties, etc. since it 
 60                    is uninitialized.
 61            
 62            	Use one of the other constructors to create an initialized new 
 63                    CIM class object.
 64                    @exception UninitializedObjectException if an attempt is made to
 65                    use the unitialized object.
 66 mike  1.25     */
 67 kumpf 1.37     CIMClass();
 68 mike  1.25 
 69 kumpf 1.62     /** Creates a new CIM object representing a CIMClass from the given
 70                    CIMClass object.
 71            	@param x  CIMClass Object from which to create the CIMClass
 72 mike  1.25     */
 73 kumpf 1.37     CIMClass(const CIMClass& x);
 74 mike  1.25 
 75 kumpf 1.62     /**	Creates a new CIMClass object representing a CIMClass from the given 
 76                    CIMObject Object.
 77            	@param x  CIMObject object from which to create the CIMClass object.
 78 kumpf 1.61 	@exception DynamicCastFailedException If a CIMClass can not be
 79 kumpf 1.62         created from the given CIMObject.
 80 kumpf 1.61     */
 81                PEGASUS_EXPLICIT CIMClass(const CIMObject& x);
 82 mike  1.27 
 83 kumpf 1.62     /**	Creates a new CIM object representing a CIMClass from inputs 
 84                    of a classname and SuperClassName.
 85            	@param className  CIMName representing name of the class being created.
 86            	@param superClassName CIMName representing name of the SuperClass.
 87 mike  1.25 	<pre>
 88 kumpf 1.55 	    CIMClass NewClass("MyClass", "YourClass");
 89 mike  1.25 	</pre>
 90                */
 91                CIMClass(
 92 kumpf 1.53 	const CIMName& className,
 93            	const CIMName& superClassName = CIMName());
 94 kumpf 1.37 
 95 kumpf 1.62     ///
 96 kumpf 1.37     CIMClass& operator=(const CIMClass& x);
 97 mike  1.25 
 98                /// Destructor
 99 kumpf 1.37     ~CIMClass();
100 mike  1.25 
101 kumpf 1.62     /** Identifies whether or not this CIM class is an association. An 
102                    association is a relationship between two (or more) classes or 
103                    instances of two classes. The properties of an association class 
104                    include pointers, or references, to the two (or more) instances. 
105                    All CIM classes can be included in one or more associations.
106            	@return  true if this CIM class is an association, false
107            	otherwise.
108 mike  1.25     */
109 kumpf 1.37     Boolean isAssociation() const;
110 mike  1.25 
111 kumpf 1.62     /** Tests if the CIMClass is abstract.
112            	@return true if the CIMClass Object is abstract, false otherwise.
113 mike  1.26     */
114 kumpf 1.37     Boolean isAbstract() const;
115 mike  1.25 
116 karl  1.65 
117 kumpf 1.62     /** Gets the name of the class represented by this CIM object.
118            	@return CIMName with the class name.
119 mike  1.25     */
120 kumpf 1.53     const CIMName& getClassName() const;
121 karl  1.32         
122 kumpf 1.62     ///
123 kumpf 1.44     const CIMObjectPath& getPath() const;
124 kumpf 1.46 
125 kumpf 1.62     /** Sets the object path for the class.
126                    @param  path  CIMObjectPath containing the object path.
127                */
128 kumpf 1.46     void setPath (const CIMObjectPath & path);
129 chip  1.29 
130 kumpf 1.62     /** Gets the name of the Parent class of this CIM Object.
131 kumpf 1.53 	@return CIMName with parent class name.
132 mike  1.25     */
133 kumpf 1.53     const CIMName& getSuperClassName() const;
134 mike  1.25 
135 kumpf 1.62     /**	Sets the name of the parent class from the input 
136                    parameter.
137            	@param superClassName - CIMName defining parent class name.
138 mike  1.25     */
139 kumpf 1.53     void setSuperClassName(const CIMName& superClassName);
140 mike  1.25 
141 kumpf 1.62     /** Adds the specified qualifier to the class and increments the 
142                    qualifier count. It is illegal to add the same qualifier more 
143                    than one time.
144            	@param qualifier  CIMQualifier object representing the qualifier 
145                    to be added.
146            	@return the CIMClass object.
147            	@exception AlreadyExistsException if the qualifier already exists.
148 mike  1.25     */
149 kumpf 1.37     CIMClass& addQualifier(const CIMQualifier& qualifier);
150 mike  1.25 
151 kumpf 1.62     /**	Searches for a qualifier with the specified input name if it 
152                    exists in the class.
153            	@param name  CIMName of the qualifier to be found 
154            	@return Index of the qualifier found or PEG_NOT_FOUND
155 mike  1.25 	if not found.
156                */
157 kumpf 1.53     Uint32 findQualifier(const CIMName& name) const;
158 kumpf 1.37 
159 kumpf 1.62     /**	Gets the CIMQualifier object defined by the input parameter.
160            	@param index  Index of the qualifier in the class from the
161            	findQualifier method.
162            	@return CIMQualifier object representing the qualifier found. 
163                    On error, CIMQualifier object will be null.
164                    @exception IndexOutOfBoundsException exception if the index is
165                    outside the range of parameters available from the CIMClass.
166 mike  1.25     */
167 kumpf 1.60     CIMQualifier getQualifier(Uint32 index);
168 mike  1.25 
169 kumpf 1.62     /** Gets the qualifier defined by the input parameter from the 
170                    qualifier list for this CIMClass.
171            	@param index  Index of the qualifier in the CIM class.
172            	@return CIMConstQualifier object representing the qualifier 
173                    found. On error, CIMConstQualifier object will be null.
174                    @exception IndexOutOfBoundsException exception if the index is
175                    outside the range of parameters available from the CIMClass.
176 kumpf 1.57     */
177 kumpf 1.60     CIMConstQualifier getQualifier(Uint32 index) const;
178 mike  1.25 
179 kumpf 1.62     /** Removes the qualifier defined by the index parameter.
180                    @param index  Defines the index of the qualifier to be removed.
181                    @exception IndexOutOfBoundsException if the index is outside
182                    the range of existing qualifier objects for this class.
183 mike  1.25     */
184 kumpf 1.60     void removeQualifier(Uint32 index);
185 mike  1.25 
186 kumpf 1.62     /** Gets the count of the number of qualifiers defined in the class.
187            	@return the number of qualifiers in the class definition (not
188 kumpf 1.49 	those on properties or methods)
189 mike  1.25     */
190 kumpf 1.37     Uint32 getQualifierCount() const;
191 mike  1.25 
192 kumpf 1.62     /**	Adds the specified property object to the properties in 
193                    the CIM class
194                    @param x  CIMProperty to be added to the CIM Class.
195                    @return CIMClass object after the specified property is added.
196 mike  1.25     */
197 kumpf 1.37     CIMClass& addProperty(const CIMProperty& x);
198 mike  1.25 
199 kumpf 1.62     /** Finds the property object with the name defined by the 
200                    input parameter in the class.
201            	@param name  CIMName with the property name to be found.
202            	@return Index of the property object found or
203 mike  1.25 	PEG_NOT_FOUND if the property is not found.
204                */
205 kumpf 1.53     Uint32 findProperty(const CIMName& name) const;
206 mike  1.25 
207 kumpf 1.62     /** Gets a property object from the CIMClass.
208            	@param index  Index for the property object to get.
209            	@return CIMProperty object requested.
210 kumpf 1.60         @exception IndexOutOfBoundsException if the index is outside
211 kumpf 1.62         the range of properties in this class.
212 mike  1.25     */
213 kumpf 1.60     CIMProperty getProperty(Uint32 index);
214 mike  1.25 
215 kumpf 1.62     /** Gets a property object from the CIMClass.
216            	@param index  Index for the property object to get.
217            	@return CIMProperty object requested.
218 kumpf 1.60         @exception IndexOutOfBoundsException if the index is outside
219 kumpf 1.62         the range of properties in this class.
220 mike  1.25     */
221 kumpf 1.60     CIMConstProperty getProperty(Uint32 index) const;
222 mike  1.25 
223 kumpf 1.62     /** Removes the specified property from the class.
224            	@param index  Index of the property to be removed.
225 kumpf 1.60         @exception IndexOutOfBoundsException if the index is outside
226 kumpf 1.62         the range of properties in this class.
227 mike  1.25     */
228 kumpf 1.60     void removeProperty(Uint32 index);
229 mike  1.25 
230 kumpf 1.62     /** Gets the count of the number of properties defined in the class.
231            	@return count of number of properties in the class.
232 mike  1.25     */
233 kumpf 1.37     Uint32 getPropertyCount() const;
234 mike  1.25 
235 kumpf 1.62     /** Adds the method object defined by the input parameter to the 
236                    class and increments the count of the number of methods in the class.
237            	@param name  CIMMethod object representing the method to be added.
238            	@return the CIMClass object to which the method was added.
239            	@exception AlreadyExistsException if the method already exists.
240            	@exception UninitializedObjectException if the object is not initialized.
241 mike  1.25     */
242 kumpf 1.37     CIMClass& addMethod(const CIMMethod& x);
243 mike  1.25 
244 kumpf 1.62     /** Locate the method object defined by the input parameter.
245            	@param name  CIMName representing the name of the method to be found.
246            	@return Position of the method object in the class.
247 mike  1.25     */
248 kumpf 1.53     Uint32 findMethod(const CIMName& name) const;
249 mike  1.25 
250 kumpf 1.62     /** Gets the method object defined by the input parameter.
251            	@param index  Index to the method object to get.
252            	@return CIMMethod object of the method requested.
253 kumpf 1.60         @exception IndexOutOfBoundsException if the index is outside
254 kumpf 1.62         the range of methods in this class.
255 mike  1.25     */
256 kumpf 1.60     CIMMethod getMethod(Uint32 index);
257 mike  1.25 
258 kumpf 1.62     /** Gets the method object defined by the input parameter.
259            	@param index  Index to the method object to get.
260            	@return CIMConstMethod object of the method requested.
261                    @exception IndexOutOfBoundsException if the index is outside
262                    the range of methods in this class.
263 mike  1.25     */
264 kumpf 1.60     CIMConstMethod getMethod(Uint32 index) const;
265 mike  1.25 
266 kumpf 1.62     /** Removes the method defined by the index parameter.
267                    @param index  Defines the index of the method to be removed.
268                    @exception IndexOutOfBoundsException if the index is outside
269                    the range of methods in this class.
270 mike  1.25     */
271 kumpf 1.60     void removeMethod(Uint32 index);
272 mike  1.25 
273 kumpf 1.62     /** Gets the count of the number of methods in the class.
274            	@return the count of the number of methods in the class object.
275 mike  1.25     */
276 kumpf 1.37     Uint32 getMethodCount() const;
277            
278 kumpf 1.62     /// Get names of all keys of this class.
279 kumpf 1.53     void getKeyNames(Array<CIMName>& keyNames) const;
280 kumpf 1.37 
281 kumpf 1.62     /** Determines if the object has keys.
282                    @return  true if the object has keys, false otherwise.
283                */
284 kumpf 1.37     Boolean hasKeys() const;
285 mike  1.25 
286 kumpf 1.62     /** Makes a deep copy (clone) of the given object. 
287                    @return copy of the CIMClass object.
288                */
289 kumpf 1.37     CIMClass clone() const;
290            
291 kumpf 1.62     /** Compares with another CIM class.
292            	@param x  Class object for the class to be compared.
293            	@return true if the classes are identical, false otherwise.
294 mike  1.25     */
295 kumpf 1.37     Boolean identical(const CIMConstClass& x) const;
296 mike  1.25 
297 kumpf 1.62     /** Determines if the object has not been initialized.
298                    @return  true if the object has not been initialized, 
299                    false otherwise.
300                */
301 kumpf 1.56     Boolean isUninitialized() const;
302 mike  1.25 
303 karl  1.69 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
304                /**  <I><B>Experimental Interface</B></I><BR>
305 karl  1.65     Build a CIMInstance based on this CIM Class.  Properties in the instance 
306                are initialized to the default values (if any) specified in the class 
307                definition.  The parameters of the call determine whether qualifiers are 
308                included, the class origin attributes are included and which properties 
309                are included in the new instance.  This method is designed specifically 
310                for providers to allow them to easily build instance objects using the 
311                parameters provided with the CIM instance operations such as getInstance, 
312                enumerateInstances.  
313                
314                @param includeQualifiers If true attaches the class level qualifiers from 
315                this class to the instance and all properties inserted in the instance.  
316                If false, no qualifiers are attached to the instance or to any properties 
317                included in the instance.  The TOINSTANCE flavor is ignored.  Because 
318                there is still confusion over the exact operation of this parameter in the 
319                CIM specifications and the concept of instance level qualifiers, the 
320                behavior of this function when the parameter is true MAY change in the 
321                future to match any future clarifications of interoperable behavior in the 
322                CIM specifications.  
323                
324                @param includeClassOrigin If true ClassOrigin attributes attached to 
325                properties inthe class object are transferred to the properties attached 
326 karl  1.65     to the instance object.  If false, any ClassOrigin attributes are ignored.  
327                
328                @param propertyList A CIMPropertyList defining the properties that are to 
329                be added to the created instance.  If propertyList is not NULL properties 
330                defined in the class and in this propertyList are added to the new 
331                instance.  If the propertyLlist is NULL, all properties are added to the 
332                instance.  If the propertyList exists but is empty, not properties are 
333                added.  Note that this function does NOT generate an error if a property 
334                name is supplied that is NOT in the class; it simply does not add that 
335                property to the instance.  
336                
337                @return CIMInstance of this class appropriately initialized.
338 karl  1.69     <p><b>Example:</b>
339                <pre>
340                    CIMClass myClass .. a defined and complete CIMClass.
341                    // create instance with qualifiers, class origin and all properties
342                    CIMInstance myInstance =
343                            myClass.buildInstance(true, true, CIMPropertyList());
344                </pre>
345 karl  1.65     */
346 karl  1.67     CIMInstance buildInstance(Boolean includeQualifiers,
347 karl  1.65         Boolean includeClassOrigin,
348                    const CIMPropertyList & propertyList) const;
349 karl  1.69 #endif
350 karl  1.65 
351 mike  1.25 private:
352            
353 kumpf 1.37     CIMClassRep* _rep;
354            
355                CIMClass(CIMClassRep* rep);
356            
357                void _checkRep() const;
358 mike  1.25 
359                friend class CIMConstClass;
360                friend class CIMObject;
361 mike  1.27     friend class CIMConstObject;
362 kumpf 1.51     friend class Resolver;
363 kumpf 1.42     friend class XmlWriter;
364 kumpf 1.43     friend class MofWriter;
365 schuur 1.64     friend class BinaryStreamer;
366 mike   1.25 };
367             
368             #define PEGASUS_ARRAY_T CIMClass
369 kumpf  1.47 #include <Pegasus/Common/ArrayInter.h>
370 mike   1.25 #undef PEGASUS_ARRAY_T
371             
372 kumpf  1.62 /// CIMConstClass
373 mike   1.25 class PEGASUS_COMMON_LINKAGE CIMConstClass
374             {
375             public:
376             
377 kumpf  1.62     ///
378 kumpf  1.37     CIMConstClass();
379             
380 kumpf  1.62     ///
381 kumpf  1.37     CIMConstClass(const CIMConstClass& x);
382             
383 kumpf  1.62     ///
384 kumpf  1.37     CIMConstClass(const CIMClass& x);
385 mike   1.25 
386 kumpf  1.62     ///
387 kumpf  1.61     PEGASUS_EXPLICIT CIMConstClass(const CIMObject& x);
388 mike   1.27 
389 kumpf  1.62     ///
390 kumpf  1.61     PEGASUS_EXPLICIT CIMConstClass(const CIMConstObject& x);
391 mike   1.27 
392 kumpf  1.62     ///
393 mike   1.25     CIMConstClass(
394 kumpf  1.53 	const CIMName& className,
395             	const CIMName& superClassName = CIMName());
396 kumpf  1.37 
397 kumpf  1.62     ///
398 kumpf  1.37     CIMConstClass& operator=(const CIMConstClass& x);
399             
400 kumpf  1.62     ///
401 kumpf  1.37     CIMConstClass& operator=(const CIMClass& x);
402             
403 kumpf  1.62     ///
404 kumpf  1.37     ~CIMConstClass();
405             
406 kumpf  1.62     ///
407 kumpf  1.37     Boolean isAssociation() const;
408             
409 kumpf  1.62     ///
410 kumpf  1.37     Boolean isAbstract() const;
411             
412 kumpf  1.62     ///
413 kumpf  1.53     const CIMName& getClassName() const;
414 kumpf  1.37 
415 kumpf  1.62     ///
416 kumpf  1.44     const CIMObjectPath& getPath() const;
417 kumpf  1.37 
418 kumpf  1.62     ///
419 kumpf  1.53     const CIMName& getSuperClassName() const;
420 kumpf  1.37 
421 kumpf  1.62     ///
422 kumpf  1.53     Uint32 findQualifier(const CIMName& name) const;
423 kumpf  1.37 
424 kumpf  1.62     ///
425 kumpf  1.60     CIMConstQualifier getQualifier(Uint32 index) const;
426 kumpf  1.37 
427 kumpf  1.62     ///
428 kumpf  1.37     Uint32 getQualifierCount() const;
429             
430 kumpf  1.62     ///
431 kumpf  1.53     Uint32 findProperty(const CIMName& name) const;
432 kumpf  1.37 
433 kumpf  1.62     ///
434 kumpf  1.60     CIMConstProperty getProperty(Uint32 index) const;
435 kumpf  1.37 
436 kumpf  1.62     ///
437 kumpf  1.37     Uint32 getPropertyCount() const;
438             
439 kumpf  1.62     ///
440 kumpf  1.53     Uint32 findMethod(const CIMName& name) const;
441 kumpf  1.37 
442 kumpf  1.62     ///
443 kumpf  1.60     CIMConstMethod getMethod(Uint32 index) const;
444 kumpf  1.37 
445 kumpf  1.62     ///
446 kumpf  1.37     Uint32 getMethodCount() const;
447             
448 kumpf  1.62     ///
449 kumpf  1.53     void getKeyNames(Array<CIMName>& keyNames) const;
450 kumpf  1.37 
451 kumpf  1.62     ///
452 kumpf  1.37     Boolean hasKeys() const;
453             
454 kumpf  1.62     ///
455 kumpf  1.37     CIMClass clone() const;
456             
457 kumpf  1.62     ///
458 kumpf  1.37     Boolean identical(const CIMConstClass& x) const;
459             
460 kumpf  1.62     ///
461 kumpf  1.56     Boolean isUninitialized() const;
462 mike   1.25 
463             private:
464             
465 kumpf  1.37     CIMClassRep* _rep;
466 mike   1.25 
467 kumpf  1.37     void _checkRep() const;
468 mike   1.25 
469                 friend class CIMClassRep;
470                 friend class CIMClass;
471                 friend class CIMInstanceRep;
472 mike   1.27     friend class CIMObject;
473                 friend class CIMConstObject;
474 kumpf  1.42     friend class XmlWriter;
475 kumpf  1.43     friend class MofWriter;
476 schuur 1.64     friend class BinaryStreamer;
477 mike   1.25 };
478             
479             PEGASUS_NAMESPACE_END
480             
481             #endif /* Pegasus_CIMClass_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2