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