(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 mike  1.27 #include <Pegasus/Common/CIMObject.h>
 37 kumpf 1.37 #include <Pegasus/Common/CIMMethod.h>
 38 kumpf 1.52 #include <Pegasus/Common/Linkage.h>
 39 mike  1.25 
 40            PEGASUS_NAMESPACE_BEGIN
 41            
 42            class CIMConstClass;
 43 kumpf 1.37 class CIMClassRep;
 44 kumpf 1.51 class Resolver;
 45 mike  1.25 
 46 mike  1.28 // REVIEW: redocument.
 47            
 48 mike  1.25 /** The CIMClass class is used to represent CIM classes in Pegasus.  In CIM,
 49                a class object may be a class or an associator.  A CIM class must contain a
 50                name and may contain methods, properties, and qualifiers.  It is a template
 51                for creating a CIM instance.  A CIM class represents a collection of CIM
 52                instances, all of which support a common type (for example, a set of
 53                properties, methods, and associations).
 54            */
 55            class PEGASUS_COMMON_LINKAGE CIMClass
 56            {
 57            public:
 58            
 59                /** Constructor - Creates an uninitiated a new CIM object
 60            	reprenting a CIM class. The class object created by this
 61            	constructor can only be used in an operation such as the
 62            	copy constructor.  It cannot be used to create a class by
 63            	appending names, properties, etc. since it is unitiated.
 64            
 65            	Use one of the other constructors to create an initiated new CIM class
 66            	object.
 67 kumpf 1.49 	@exception "unitialized handle" if this
 68 mike  1.25 	unitialized handle is used
 69                */
 70 kumpf 1.37     CIMClass();
 71 mike  1.25 
 72                /** Constructor - Creates a class from a previous class
 73                */
 74 kumpf 1.37     CIMClass(const CIMClass& x);
 75 mike  1.25 
 76 kumpf 1.39     PEGASUS_EXPLICIT CIMClass(const CIMObject& x)
 77                    throw(DynamicCastFailed);
 78 mike  1.27 
 79 kumpf 1.49     // ATTN define what makes up a legal CIM class name
 80 mike  1.28     /**	Constructor - Creates a Class from inputs of a classname and
 81 mike  1.25 	SuperClassName
 82 kumpf 1.44 	@param className CIMObjectPath representing name of the class being created
 83 mike  1.25 	@param superClassName String representing name of the SuperClass
 84            	@return Throws IllegalName if className argument illegal CIM identifier.
 85            	<pre>
 86            	    CIMClass NewCass("MyClass", "YourClass");
 87            	</pre>
 88            
 89                */
 90                CIMClass(
 91 kumpf 1.44 	const CIMObjectPath& reference,
 92 kumpf 1.37 	const String& superClassName = String::EMPTY);
 93            
 94                /** Assignment operator.
 95                */
 96                CIMClass& operator=(const CIMClass& x);
 97 mike  1.25 
 98                /// Destructor
 99 kumpf 1.37     ~CIMClass();
100 mike  1.25 
101                /** isAssociation - Identifies whether or not this CIM class
102            	is an association. An association is a relationship between two
103            	(or more) classes or instances of two classes.  The properties of an
104            	association class include pointers, or references, to the two (or
105            	more) instances. All CIM classes can be included in one or more
106            	associations.
107            	@return  Boolean True if this CIM class belongs to an association;
108            	otherwise, false.
109                */
110 kumpf 1.37     Boolean isAssociation() const;
111 mike  1.25 
112 mike  1.26     /** isAbstract Test if the CIMClass is abstract.
113            	@return - True if the CIMClass Object is abstract
114            	SeeAlso: Abstract
115                */
116 kumpf 1.37     Boolean isAbstract() const;
117 mike  1.25 
118 kumpf 1.49     // ATTN: COMMENT. Why not just get name so we have common method for all.
119 mike  1.25     /** getClassName Gets the name of the class
120            	@return Returns string with the class name.
121                */
122 kumpf 1.37     const String& getClassName() const;
123 karl  1.32         
124 kumpf 1.44     const CIMObjectPath& getPath() const;
125 kumpf 1.46 
126                /**
127                  Sets the object path for the class
128                  @param  path  CIMObjectPath containing the object path
129                 */
130                void setPath (const CIMObjectPath & path);
131 chip  1.29 
132 mike  1.26     /** getSuperClassName - Gets the name of the Parent
133 mike  1.25 	@return String with parent class name.
134                */
135 kumpf 1.37     const String& getSuperClassName() const;
136 mike  1.25 
137 kumpf 1.49     // ATTN define what's a legal class name
138 mike  1.26     /**	setSuperClassName - Sets the name of the parent class from
139 kumpf 1.49 	the input parameter. \REF{CLASSNAME}.
140 mike  1.25 	@param String defining parent name.
141            	@return Throws IllegalName if superClassName argument not legal CIM
142            	identifier
143            	@exception throws IllegalName if the name is not correct. See
144            	\URL[ClassNames]{DefinitionofTerms.html#CLASSNAME}
145                */
146 kumpf 1.37     void setSuperClassName(const String& superClassName);
147 mike  1.25 
148                /** addQualifier - Adds the specified qualifier to the class
149            	and increments the qualifier count. It is illegal to add the same
150            	qualifier more than one time.
151            	@param qualifier CIMQualifier object representing the qualifier to be
152            	added
153            	@return Returns handle of the class object
154            	@exception Throws AlreadyExists.
155                */
156 kumpf 1.37     CIMClass& addQualifier(const CIMQualifier& qualifier);
157 mike  1.25 
158                /**	findQualifier - Searches for a qualifier with the specified `
159                    input name if it exists in the class
160            	@param name CIMName of the qualifier
161            	to be found @return Position of the qualifier in the Class.
162            	@return Returns index of the qualifier found or PEG_NOT_FOUND
163            	if not found.
164                */
165 kumpf 1.37     Uint32 findQualifier(const String& name) const;
166            
167 karl  1.31     /** isTrueQualifier - Determines if the qualifier defined by
168            	the input parameter exists for the class, is Boolean, and
169            	has a value of true.
170            	This function is useful to quickly determine the state of a
171            	qualifier.
172            	@param String containing the qualifier  name.
173            	@return Boolean True if the qualifier exists, 
174                */
175 kumpf 1.37     Boolean isTrueQualifier(const String& name) const;
176 karl  1.31 
177            /**	getQualifier - Gets the CIMQualifier object defined
178 mike  1.25 	by the input parameter
179            	@param pos defines the position of the qualifier in the class from the
180            	findQualifier method
181 mike  1.28 	@return CIMQualifier object representing the qualifier found. On error,
182            	    CIMQualifier handle will be null.
183 mike  1.25     */
184 kumpf 1.37     CIMQualifier getQualifier(Uint32 pos);
185 mike  1.25 
186 karl  1.31     /** getQualifier - Gets the qualifier defined by the input parameter
187            		from the qualifier list for this CIMClass.
188            	*/
189 kumpf 1.37     CIMConstQualifier getQualifier(Uint32 pos) const;
190 mike  1.25 
191                /** removeQualifier - Removes the qualifier defined by the
192                index parameter.
193                @param Defines the index of the qualifier to be removed.
194                @return There is no return.
195                @exception Throw OutOfBound exception if the index is outside
196                the range of existing qualifier objects for this class
197                */
198 kumpf 1.37     void removeQualifier(Uint32 pos);
199 mike  1.25 
200                /** getQualifierCount - Returns the number of qualifiers
201            	in the class.
202 kumpf 1.49 	@return the number of qualifiers on the class definition (not
203            	those on properties or methods)
204 mike  1.25     */
205 kumpf 1.37     Uint32 getQualifierCount() const;
206 mike  1.25 
207                /**	addProperty - Adds the specified property object to the
208            	properties in the CIM class
209                */
210 kumpf 1.37     CIMClass& addProperty(const CIMProperty& x);
211 mike  1.25 
212 mike  1.26     /** findProperty - Finds the property object with the
213 mike  1.25 	name defined by the input parameter in the class.
214            	@param String parameter with the property name.
215            	@return position representing the property object found or
216            	PEG_NOT_FOUND if the property is not found.
217                */
218 kumpf 1.37     Uint32 findProperty(const String& name) const;
219 mike  1.25 
220 kumpf 1.49     // ATTN: Should we not use something like handle for position???
221                // ATTN: what is error return?
222 mike  1.25     /** getProperty - Returns a property representing the property
223            	defined by the input parameter
224            	@param position for this property
225            	@return CIMProperty object
226                */
227 kumpf 1.37     CIMProperty getProperty(Uint32 pos);
228 mike  1.25 
229                /**getProperty Gets a property object from the CIMClass
230                	@param pos The index of the property object to get.
231                	@return Returns handle of the property object requested
232                	@exception Throws OutofBounds if the size field is greather than the
233                	bunber of properties in the class.
234                */
235 kumpf 1.37     CIMConstProperty getProperty(Uint32 pos) const;
236 mike  1.25 
237                /** removeProperty - Removes the property represented
238            	by the position input parameter from the class
239            	@param pos Index to the property to be removed from the
240            	findPropety method
241            	@exception Throws OutofBounds if index is not a property object
242                */
243 kumpf 1.37     void removeProperty(Uint32 pos);
244 mike  1.25 
245                /** getPropertyCount -   Gets the count of the number of properties
246            	defined in the class.
247            	@return count of number of proerties in the class
248                */
249 kumpf 1.37     Uint32 getPropertyCount() const;
250 mike  1.25 
251                /** addMethod - Adds the method object defined by the input
252            	parameter to the class and increments the count of the number of
253            	methods in the class
254            	@param method object representing the method to be added
255            	@return Returns the CIMClass object to which the method was added.
256            	@exception Throws AlreadyExists if the method already exists and throws
257 kumpf 1.40 	UninitializedHandle if the handle is not initialized
258 mike  1.25     */
259 kumpf 1.37     CIMClass& addMethod(const CIMMethod& x);
260 mike  1.25 
261                /** findMethod - Locate the method object defined by the
262            	name input
263            	@param String representing the name of the method to be found
264            	@return Position of the method object in the class to be used in
265            	subsequent getmethod, etc. operations
266                */
267 kumpf 1.37     Uint32 findMethod(const String& name) const;
268 mike  1.25 
269                /** getMethod - Gets the method object defined by the
270            	input parameter.
271 mike  1.26 	@param pos Index to the method object to get
272            	@return Returns handle of the method requested
273 mike  1.25 	@exception Throws OutofBounds if the index represented by pos is greater
274            	than the number of methods defined in the class object
275                */
276 kumpf 1.37     CIMMethod getMethod(Uint32 pos);
277 mike  1.25 
278                /** getMethod Gets the method object defined by the input
279                parameter. This is the const version.
280                */
281            
282 kumpf 1.37     CIMConstMethod getMethod(Uint32 pos) const;
283 mike  1.25 
284                /** removeMethod - Removes the method defined by the
285                index parameter.
286                @param Defines the index of the method to be removed.
287                @return There is no return.
288                @exception Throw OutOfBound exception if the index is outside
289                the range of existing method objects for this class
290                */
291 kumpf 1.37     void removeMethod(Uint32 pos);
292 mike  1.25 
293 mike  1.26     /** getMethodCount - Count of the number of methods in the class
294 mike  1.25 	@return integer representing the number of methods in the class object.
295                */
296 kumpf 1.37     Uint32 getMethodCount() const;
297            
298                /** Get names of all keys of this class. */
299                void getKeyNames(Array<String>& keyNames) const;
300            
301                Boolean hasKeys() const;
302 mike  1.25 
303 kumpf 1.37     /** Makes a deep copy (clone) of the given object. */
304                CIMClass clone() const;
305            
306 kumpf 1.49     // ATTN: Clarify exactly what identical means
307 kumpf 1.37     /** identical -  Compares with another class
308            	@param Class object for the class to be compared
309            	@return True if the classes are identical
310 mike  1.25     */
311 kumpf 1.37     Boolean identical(const CIMConstClass& x) const;
312 mike  1.25 
313 kumpf 1.37 #ifdef PEGASUS_INTERNALONLY
314 kumpf 1.49     // isNull - ATTN:
315 kumpf 1.41     Boolean isNull() const;
316 kumpf 1.37 #endif
317 mike  1.25 
318            private:
319            
320 kumpf 1.37     CIMClassRep* _rep;
321            
322                CIMClass(CIMClassRep* rep);
323            
324                void _checkRep() const;
325 mike  1.25 
326                friend class CIMConstClass;
327                friend class CIMObject;
328 mike  1.27     friend class CIMConstObject;
329 kumpf 1.51     friend class Resolver;
330 kumpf 1.42     friend class XmlWriter;
331 kumpf 1.43     friend class MofWriter;
332 mike  1.25 };
333            
334            #define PEGASUS_ARRAY_T CIMClass
335 kumpf 1.47 #include <Pegasus/Common/ArrayInter.h>
336 mike  1.25 #undef PEGASUS_ARRAY_T
337            
338 kumpf 1.49 // ATTN document this
339            /** CIMConstClass
340 mike  1.25 */
341            class PEGASUS_COMMON_LINKAGE CIMConstClass
342            {
343            public:
344            
345 kumpf 1.37     CIMConstClass();
346            
347                CIMConstClass(const CIMConstClass& x);
348            
349                CIMConstClass(const CIMClass& x);
350 mike  1.25 
351 kumpf 1.39     PEGASUS_EXPLICIT CIMConstClass(const CIMObject& x)
352                    throw(DynamicCastFailed);
353 mike  1.27 
354 kumpf 1.39     PEGASUS_EXPLICIT CIMConstClass(const CIMConstObject& x)
355                    throw(DynamicCastFailed);
356 mike  1.27 
357 mike  1.25     // Throws IllegalName if className argument not legal CIM identifier.
358                CIMConstClass(
359 kumpf 1.44 	const CIMObjectPath& reference,
360 kumpf 1.37 	const String& superClassName = String::EMPTY);
361            
362                CIMConstClass& operator=(const CIMConstClass& x);
363            
364                CIMConstClass& operator=(const CIMClass& x);
365            
366                ~CIMConstClass();
367            
368                Boolean isAssociation() const;
369            
370                Boolean isAbstract() const;
371            
372                const String& getClassName() const;
373            
374 kumpf 1.44     const CIMObjectPath& getPath() const;
375 kumpf 1.37 
376                const String& getSuperClassName() const;
377            
378                Uint32 findQualifier(const String& name) const;
379            
380                CIMConstQualifier getQualifier(Uint32 pos) const;
381            
382                Boolean isTrueQualifier(const String& name) const;
383            
384                Uint32 getQualifierCount() const;
385            
386                Uint32 findProperty(const String& name) const;
387            
388                CIMConstProperty getProperty(Uint32 pos) const;
389            
390                Uint32 getPropertyCount() const;
391            
392                Uint32 findMethod(const String& name) const;
393            
394                CIMConstMethod getMethod(Uint32 pos) const;
395            
396 kumpf 1.37     Uint32 getMethodCount() const;
397            
398                void getKeyNames(Array<String>& keyNames) const;
399            
400                Boolean hasKeys() const;
401            
402                CIMClass clone() const;
403            
404                Boolean identical(const CIMConstClass& x) const;
405            
406            #ifdef PEGASUS_INTERNALONLY
407 kumpf 1.41     Boolean isNull() const;
408 kumpf 1.37 #endif
409 mike  1.25 
410            private:
411            
412 kumpf 1.37     CIMClassRep* _rep;
413 mike  1.25 
414 kumpf 1.37     void _checkRep() const;
415 mike  1.25 
416                friend class CIMClassRep;
417                friend class CIMClass;
418                friend class CIMInstanceRep;
419 mike  1.27     friend class CIMObject;
420                friend class CIMConstObject;
421 kumpf 1.42     friend class XmlWriter;
422 kumpf 1.43     friend class MofWriter;
423 mike  1.25 };
424            
425            PEGASUS_NAMESPACE_END
426            
427            #endif /* Pegasus_CIMClass_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2