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

  1 mike  1.25 //%/////////////////////////////////////////////////////////////////////////////
  2            //
  3 kumpf 1.48 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
  4            // The Open Group, Tivoli Systems
  5 mike  1.25 //
  6            // Permission is hereby granted, free of charge, to any person obtaining a copy
  7 chip  1.29 // of this software and associated documentation files (the "Software"), to
  8            // deal in the Software without restriction, including without limitation the
  9            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 10 mike  1.25 // sell copies of the Software, and to permit persons to whom the Software is
 11            // furnished to do so, subject to the following conditions:
 12 kumpf 1.48 // 
 13 chip  1.29 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 14 mike  1.25 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 15            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 16 chip  1.29 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 17            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 18            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 19 mike  1.25 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 20            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 21            //
 22            //==============================================================================
 23            //
 24            // Author: Mike Brasher (mbrasher@bmc.com)
 25            //
 26 kumpf 1.38 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 27 kumpf 1.46 //              Carol Ann Krug Graves, Hewlett-Packard Company
 28            //                  (carolann_graves@hp.com)
 29 mike  1.25 //
 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 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 // REVIEW: redocument.
 48            
 49 mike  1.25 /** The CIMClass class is used to represent CIM classes in Pegasus.  In CIM,
 50                a class object may be a class or an associator.  A CIM class must contain a
 51                name and may contain methods, properties, and qualifiers.  It is a template
 52                for creating a CIM instance.  A CIM class represents a collection of CIM
 53                instances, all of which support a common type (for example, a set of
 54                properties, methods, and associations).
 55            */
 56            class PEGASUS_COMMON_LINKAGE CIMClass
 57            {
 58            public:
 59            
 60                /** Constructor - Creates an uninitiated a new CIM object
 61            	reprenting a CIM class. The class object created by this
 62            	constructor can only be used in an operation such as the
 63            	copy constructor.  It cannot be used to create a class by
 64            	appending names, properties, etc. since it is unitiated.
 65            
 66            	Use one of the other constructors to create an initiated new CIM class
 67            	object.
 68 kumpf 1.49 	@exception "unitialized handle" if this
 69 mike  1.25 	unitialized handle is used
 70                */
 71 kumpf 1.37     CIMClass();
 72 mike  1.25 
 73                /** Constructor - Creates a class from a previous class
 74                */
 75 kumpf 1.37     CIMClass(const CIMClass& x);
 76 mike  1.25 
 77 kumpf 1.39     PEGASUS_EXPLICIT CIMClass(const CIMObject& x)
 78 kumpf 1.58         throw(DynamicCastFailedException);
 79 mike  1.27 
 80 mike  1.28     /**	Constructor - Creates a Class from inputs of a classname and
 81 mike  1.25 	SuperClassName
 82 kumpf 1.55 	@param className CIMName representing name of the class being created
 83 kumpf 1.53 	@param superClassName CIMName representing name of the SuperClass
 84 mike  1.25 	<pre>
 85 kumpf 1.55 	    CIMClass NewClass("MyClass", "YourClass");
 86 mike  1.25 	</pre>
 87            
 88                */
 89                CIMClass(
 90 kumpf 1.53 	const CIMName& className,
 91            	const CIMName& superClassName = CIMName());
 92 kumpf 1.37 
 93                /** Assignment operator.
 94                */
 95                CIMClass& operator=(const CIMClass& x);
 96 mike  1.25 
 97                /// Destructor
 98 kumpf 1.37     ~CIMClass();
 99 mike  1.25 
100                /** isAssociation - Identifies whether or not this CIM class
101            	is an association. An association is a relationship between two
102            	(or more) classes or instances of two classes.  The properties of an
103            	association class include pointers, or references, to the two (or
104            	more) instances. All CIM classes can be included in one or more
105            	associations.
106            	@return  Boolean True if this CIM class belongs to an association;
107            	otherwise, false.
108                */
109 kumpf 1.37     Boolean isAssociation() const;
110 mike  1.25 
111 mike  1.26     /** isAbstract Test if the CIMClass is abstract.
112            	@return - True if the CIMClass Object is abstract
113            	SeeAlso: Abstract
114                */
115 kumpf 1.37     Boolean isAbstract() const;
116 mike  1.25 
117 kumpf 1.49     // ATTN: COMMENT. Why not just get name so we have common method for all.
118 mike  1.25     /** getClassName Gets the name of the class
119 kumpf 1.56 	@return Returns CIMName with the class name.
120 mike  1.25     */
121 kumpf 1.53     const CIMName& getClassName() const;
122 karl  1.32         
123 kumpf 1.44     const CIMObjectPath& getPath() const;
124 kumpf 1.46 
125                /**
126                  Sets the object path for the class
127                  @param  path  CIMObjectPath containing the object path
128                 */
129                void setPath (const CIMObjectPath & path);
130 chip  1.29 
131 mike  1.26     /** getSuperClassName - Gets the name of the Parent
132 kumpf 1.53 	@return CIMName with parent class name.
133 mike  1.25     */
134 kumpf 1.53     const CIMName& getSuperClassName() const;
135 mike  1.25 
136 mike  1.26     /**	setSuperClassName - Sets the name of the parent class from
137 kumpf 1.49 	the input parameter. \REF{CLASSNAME}.
138 kumpf 1.53 	@param CIMName defining parent name.
139 mike  1.25     */
140 kumpf 1.53     void setSuperClassName(const CIMName& superClassName);
141 mike  1.25 
142                /** addQualifier - Adds the specified qualifier to the class
143            	and increments the qualifier count. It is illegal to add the same
144            	qualifier more than one time.
145            	@param qualifier CIMQualifier object representing the qualifier to be
146            	added
147            	@return Returns handle of the class object
148 kumpf 1.58 	@exception AlreadyExistsException.
149 mike  1.25     */
150 kumpf 1.37     CIMClass& addQualifier(const CIMQualifier& qualifier);
151 mike  1.25 
152                /**	findQualifier - Searches for a qualifier with the specified `
153                    input name if it exists in the class
154            	@param name CIMName of the qualifier
155            	to be found @return Position of the qualifier in the Class.
156            	@return Returns index of the qualifier found or PEG_NOT_FOUND
157            	if not found.
158                */
159 kumpf 1.53     Uint32 findQualifier(const CIMName& name) const;
160 kumpf 1.37 
161 kumpf 1.57     /**	getQualifier - Gets the CIMQualifier object defined
162 mike  1.25 	by the input parameter
163            	@param pos defines the position of the qualifier in the class from the
164            	findQualifier method
165 mike  1.28 	@return CIMQualifier object representing the qualifier found. On error,
166            	    CIMQualifier handle will be null.
167 mike  1.25     */
168 kumpf 1.37     CIMQualifier getQualifier(Uint32 pos);
169 mike  1.25 
170 karl  1.31     /** getQualifier - Gets the qualifier defined by the input parameter
171 kumpf 1.57 	from the qualifier list for this CIMClass.
172                */
173 kumpf 1.37     CIMConstQualifier getQualifier(Uint32 pos) const;
174 mike  1.25 
175                /** removeQualifier - Removes the qualifier defined by the
176                index parameter.
177                @param Defines the index of the qualifier to be removed.
178                @return There is no return.
179                @exception Throw OutOfBound exception if the index is outside
180                the range of existing qualifier objects for this class
181                */
182 kumpf 1.37     void removeQualifier(Uint32 pos);
183 mike  1.25 
184                /** getQualifierCount - Returns the number of qualifiers
185            	in the class.
186 kumpf 1.49 	@return the number of qualifiers on the class definition (not
187            	those on properties or methods)
188 mike  1.25     */
189 kumpf 1.37     Uint32 getQualifierCount() const;
190 mike  1.25 
191                /**	addProperty - Adds the specified property object to the
192            	properties in the CIM class
193                */
194 kumpf 1.37     CIMClass& addProperty(const CIMProperty& x);
195 mike  1.25 
196 mike  1.26     /** findProperty - Finds the property object with the
197 mike  1.25 	name defined by the input parameter in the class.
198 kumpf 1.53 	@param CIMName parameter with the property name.
199 mike  1.25 	@return position representing the property object found or
200            	PEG_NOT_FOUND if the property is not found.
201                */
202 kumpf 1.53     Uint32 findProperty(const CIMName& name) const;
203 mike  1.25 
204 kumpf 1.49     // ATTN: Should we not use something like handle for position???
205                // ATTN: what is error return?
206 mike  1.25     /** getProperty - Returns a property representing the property
207            	defined by the input parameter
208            	@param position for this property
209            	@return CIMProperty object
210                */
211 kumpf 1.37     CIMProperty getProperty(Uint32 pos);
212 mike  1.25 
213                /**getProperty Gets a property object from the CIMClass
214                	@param pos The index of the property object to get.
215                	@return Returns handle of the property object requested
216                	@exception Throws OutofBounds if the size field is greather than the
217                	bunber of properties in the class.
218                */
219 kumpf 1.37     CIMConstProperty getProperty(Uint32 pos) const;
220 mike  1.25 
221                /** removeProperty - Removes the property represented
222            	by the position input parameter from the class
223            	@param pos Index to the property to be removed from the
224            	findPropety method
225            	@exception Throws OutofBounds if index is not a property object
226                */
227 kumpf 1.37     void removeProperty(Uint32 pos);
228 mike  1.25 
229                /** getPropertyCount -   Gets the count of the number of properties
230            	defined in the class.
231            	@return count of number of proerties in the class
232                */
233 kumpf 1.37     Uint32 getPropertyCount() const;
234 mike  1.25 
235                /** addMethod - Adds the method object defined by the input
236            	parameter to the class and increments the count of the number of
237            	methods in the class
238            	@param method object representing the method to be added
239            	@return Returns the CIMClass object to which the method was added.
240 kumpf 1.58 	@exception AlreadyExistsException if the method already exists
241            	@exception UninitializedObjectException if the object is not initialized
242 mike  1.25     */
243 kumpf 1.37     CIMClass& addMethod(const CIMMethod& x);
244 mike  1.25 
245                /** findMethod - Locate the method object defined by the
246            	name input
247 kumpf 1.53 	@param CIMName representing the name of the method to be found
248 mike  1.25 	@return Position of the method object in the class to be used in
249            	subsequent getmethod, etc. operations
250                */
251 kumpf 1.53     Uint32 findMethod(const CIMName& name) const;
252 mike  1.25 
253                /** getMethod - Gets the method object defined by the
254            	input parameter.
255 mike  1.26 	@param pos Index to the method object to get
256            	@return Returns handle of the method requested
257 mike  1.25 	@exception Throws OutofBounds if the index represented by pos is greater
258            	than the number of methods defined in the class object
259                */
260 kumpf 1.37     CIMMethod getMethod(Uint32 pos);
261 mike  1.25 
262                /** getMethod Gets the method object defined by the input
263                parameter. This is the const version.
264                */
265            
266 kumpf 1.37     CIMConstMethod getMethod(Uint32 pos) const;
267 mike  1.25 
268                /** removeMethod - Removes the method defined by the
269                index parameter.
270                @param Defines the index of the method to be removed.
271                @return There is no return.
272                @exception Throw OutOfBound exception if the index is outside
273                the range of existing method objects for this class
274                */
275 kumpf 1.37     void removeMethod(Uint32 pos);
276 mike  1.25 
277 mike  1.26     /** getMethodCount - Count of the number of methods in the class
278 mike  1.25 	@return integer representing the number of methods in the class object.
279                */
280 kumpf 1.37     Uint32 getMethodCount() const;
281            
282                /** Get names of all keys of this class. */
283 kumpf 1.53     void getKeyNames(Array<CIMName>& keyNames) const;
284 kumpf 1.37 
285                Boolean hasKeys() const;
286 mike  1.25 
287 kumpf 1.37     /** Makes a deep copy (clone) of the given object. */
288                CIMClass clone() const;
289            
290 kumpf 1.49     // ATTN: Clarify exactly what identical means
291 kumpf 1.37     /** identical -  Compares with another class
292            	@param Class object for the class to be compared
293            	@return True if the classes are identical
294 mike  1.25     */
295 kumpf 1.37     Boolean identical(const CIMConstClass& x) const;
296 mike  1.25 
297 kumpf 1.56     /**
298                    Determines if the object has not been initialized.
299            
300                    @return  True if the object has not been initialized,
301                             False otherwise
302                 */
303                Boolean isUninitialized() const;
304 mike  1.25 
305            private:
306            
307 kumpf 1.37     CIMClassRep* _rep;
308            
309                CIMClass(CIMClassRep* rep);
310            
311                void _checkRep() const;
312 mike  1.25 
313                friend class CIMConstClass;
314                friend class CIMObject;
315 mike  1.27     friend class CIMConstObject;
316 kumpf 1.51     friend class Resolver;
317 kumpf 1.42     friend class XmlWriter;
318 kumpf 1.43     friend class MofWriter;
319 mike  1.25 };
320            
321            #define PEGASUS_ARRAY_T CIMClass
322 kumpf 1.47 #include <Pegasus/Common/ArrayInter.h>
323 mike  1.25 #undef PEGASUS_ARRAY_T
324            
325 kumpf 1.49 // ATTN document this
326            /** CIMConstClass
327 mike  1.25 */
328            class PEGASUS_COMMON_LINKAGE CIMConstClass
329            {
330            public:
331            
332 kumpf 1.37     CIMConstClass();
333            
334                CIMConstClass(const CIMConstClass& x);
335            
336                CIMConstClass(const CIMClass& x);
337 mike  1.25 
338 kumpf 1.39     PEGASUS_EXPLICIT CIMConstClass(const CIMObject& x)
339 kumpf 1.58         throw(DynamicCastFailedException);
340 mike  1.27 
341 kumpf 1.39     PEGASUS_EXPLICIT CIMConstClass(const CIMConstObject& x)
342 kumpf 1.58         throw(DynamicCastFailedException);
343 mike  1.27 
344 mike  1.25     CIMConstClass(
345 kumpf 1.53 	const CIMName& className,
346            	const CIMName& superClassName = CIMName());
347 kumpf 1.37 
348                CIMConstClass& operator=(const CIMConstClass& x);
349            
350                CIMConstClass& operator=(const CIMClass& x);
351            
352                ~CIMConstClass();
353            
354                Boolean isAssociation() const;
355            
356                Boolean isAbstract() const;
357            
358 kumpf 1.53     const CIMName& getClassName() const;
359 kumpf 1.37 
360 kumpf 1.44     const CIMObjectPath& getPath() const;
361 kumpf 1.37 
362 kumpf 1.53     const CIMName& getSuperClassName() const;
363 kumpf 1.37 
364 kumpf 1.53     Uint32 findQualifier(const CIMName& name) const;
365 kumpf 1.37 
366                CIMConstQualifier getQualifier(Uint32 pos) const;
367            
368                Uint32 getQualifierCount() const;
369            
370 kumpf 1.53     Uint32 findProperty(const CIMName& name) const;
371 kumpf 1.37 
372                CIMConstProperty getProperty(Uint32 pos) const;
373            
374                Uint32 getPropertyCount() const;
375            
376 kumpf 1.53     Uint32 findMethod(const CIMName& name) const;
377 kumpf 1.37 
378                CIMConstMethod getMethod(Uint32 pos) const;
379            
380                Uint32 getMethodCount() const;
381            
382 kumpf 1.53     void getKeyNames(Array<CIMName>& keyNames) const;
383 kumpf 1.37 
384                Boolean hasKeys() const;
385            
386                CIMClass clone() const;
387            
388                Boolean identical(const CIMConstClass& x) const;
389            
390 kumpf 1.56     Boolean isUninitialized() const;
391 mike  1.25 
392            private:
393            
394 kumpf 1.37     CIMClassRep* _rep;
395 mike  1.25 
396 kumpf 1.37     void _checkRep() const;
397 mike  1.25 
398                friend class CIMClassRep;
399                friend class CIMClass;
400                friend class CIMInstanceRep;
401 mike  1.27     friend class CIMObject;
402                friend class CIMConstObject;
403 kumpf 1.42     friend class XmlWriter;
404 kumpf 1.43     friend class MofWriter;
405 mike  1.25 };
406            
407            PEGASUS_NAMESPACE_END
408            
409            #endif /* Pegasus_CIMClass_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2