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

  1 karl  1.46 //%2004////////////////////////////////////////////////////////////////////////
  2 mike  1.17 //
  3 karl  1.46 // 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.37 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.46 // 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.17 //
 10            // Permission is hereby granted, free of charge, to any person obtaining a copy
 11 kumpf 1.25 // 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.17 // 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            // 
 17 kumpf 1.25 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 18 mike  1.17 // 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 kumpf 1.25 // 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.17 // 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_Method_h
 31            #define Pegasus_Method_h
 32            
 33            #include <Pegasus/Common/Config.h>
 34 kumpf 1.30 #include <Pegasus/Common/Linkage.h>
 35 kumpf 1.20 #include <Pegasus/Common/String.h>
 36 kumpf 1.30 #include <Pegasus/Common/CIMName.h>
 37 kumpf 1.20 #include <Pegasus/Common/CIMParameter.h>
 38            #include <Pegasus/Common/CIMQualifier.h>
 39            #include <Pegasus/Common/CIMType.h>
 40 mike  1.17 
 41            PEGASUS_NAMESPACE_BEGIN
 42            
 43 kumpf 1.28 class Resolver;
 44 mike  1.17 class CIMConstMethod;
 45 kumpf 1.20 class CIMMethodRep;
 46 mike  1.17 
 47 kumpf 1.42 /** The CIMMethod class is used to represent CIM methods in Pegasus.
 48                A CIMMethod consists of the following entities:
 49 karl  1.38     <ul>
 50 kumpf 1.43         <li>Name of the method, a CIMName.
 51 kumpf 1.42 
 52 kumpf 1.43         <li>CIM type of the method return value, a CIMType.
 53 kumpf 1.42 
 54 kumpf 1.43         <li>Optional qualifiers (see CIMQualifier) for the method.
 55                    A method can contain zero or more CIMQualifier objects.
 56 kumpf 1.42 
 57 kumpf 1.43         <li>Optional parameters (see CIMParameter) for the method.
 58                    A CIMMethod may contain zero or more CIMParameter objects.
 59 karl  1.38     </ul>
 60 kumpf 1.42     In addition, a CIMMethod contains the following internal attributes:
 61 karl  1.38     <ul>
 62 kumpf 1.42         <li><b>propagated</b> - An attribute defining whether this CIMMethod is
 63                    propagated from a superclass.  Note that this is normally set as part
 64                    of completing the definition of objects (resolving) when they are
 65                    created as part of a CIM schema and is NOT automatically set when
 66                    creating a local object.  It can only be logically set in context of
 67                    the schema in which the CIMMethod is defined.
 68                    <li><b>classOrigin</b> - An attribute defining the class in which
 69                    this CIMMethod was originally defined.  This is normally set within the
 70                    context of the schema in which the CIMMethod is defined.
 71                    This attribute is available from objects retrieved from the CIM
 72                    Server, for example, and provides information on the defintion
 73                    of this method in the class hierarchy.  Together the
 74                    propagated and ClassOrigin attributes can be used to determine if
 75                    methods originated with the current object or were inherited from
 76                    higher levels in the hiearchy.
 77 karl  1.38     </ul>
 78 kumpf 1.43     A CIMMethod is generally defined in the context of a CIMClass.
 79 kumpf 1.42 
 80                CIMMethod uses shared representations, meaning that multiple
 81                CIMMethod objects may refer to the same copy of data. Assignment and copy
 82                operators create new references to the same data, not distinct copies.
 83                A distinct copy may be created using the clone method.
 84 karl  1.39     {@link Shared Classes}
 85 karl  1.38     @see CIMConstMethod
 86 kumpf 1.43     @see CIMParameter
 87                @see CIMQualifier
 88 karl  1.39     @see CIMType
 89 karl  1.41     @see CIMClass
 90 mike  1.17 */
 91            class PEGASUS_COMMON_LINKAGE CIMMethod
 92            {
 93            public:
 94            
 95 kumpf 1.42     /** Creates a new uninitialized CIMMethod object.
 96                    The only thing that can be done with this object is to copy another
 97                    object into it.  Other methods, such as setName, will fail with an
 98                    UninitializedObjectException.  The object has an uninitialized state,
 99                    which can be tested with the isUninitialized method.
100                    @see isUninitialized()
101                    @see UninitializedObjectException
102 karl  1.38     */
103 kumpf 1.20     CIMMethod();
104 mike  1.17 
105 karl  1.41     /** Creates a new CIMMethod object from another CIMMethod object.
106 kumpf 1.42         The new CIMMethod object references the same copy of data as the
107 karl  1.41         specified object; no copy is made.
108                    @param x CIMMethod object from which to create the new CIMMethod object.
109 kumpf 1.42         <p><b>Example:</b>
110 karl  1.38         <pre>
111                        CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
112                        const CIMMethod cm1(m1);
113                    </pre>
114 karl  1.41         {@link Shared Classes}
115 mike  1.17     */
116 kumpf 1.20     CIMMethod(const CIMMethod& x);
117 mike  1.17 
118 kumpf 1.42     /** Creates a CIMMethod object with the specified attributes.
119 karl  1.38         @param name CIMName defining the name for the method.
120 kumpf 1.42 
121                    @param type CIMType defining the method return type.
122            
123                    @param classOrigin (optional) CIMName representing the class origin.
124                        Note that this should normally not be used.  If not provided set to
125 karl  1.38             CIMName() (Null name).
126 kumpf 1.42         @param propagated Optional flag indicating whether the definition of
127                        the CIM Method is local to the CIM Class (respectively, Instance)
128                        in which it appears, or was propagated without modification from
129                        a superclass. Default is false. Note that this attribute is
130                        normally not set by CIM Clients but is used internally within the
131                        CIM Server.
132 karl  1.40         <p><b>Example:</b>
133 karl  1.38         <pre>
134 karl  1.39             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
135 karl  1.38         </pre>
136 mike  1.17     */
137                CIMMethod(
138 karl  1.38         const CIMName& name,
139                    CIMType type,
140                    const CIMName& classOrigin = CIMName(),
141                    Boolean propagated = false);
142            
143 kumpf 1.42     /** Destructor for the CIMMethod.  The shared data copy remains valid until
144                    all referring objects are destructed.
145 karl  1.41         {@link Shared Classes}
146 karl  1.38     */
147 kumpf 1.20     ~CIMMethod();
148            
149 kumpf 1.42     /** The assignment operator assigns one CIMMethod to another.
150 karl  1.41         After the assignment, both CIMMethod objects refer to the same
151                    data copy; a distinct copy is not created.
152 kumpf 1.42         @param x CIMMethod object from which to assign this CIMMethod object.
153            
154 karl  1.40         <p><b>Example:</b>
155 karl  1.39         <pre>
156                        CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
157 karl  1.41             CIMMethod m2;
158                        m2 = m1;
159 karl  1.39         </pre>
160 karl  1.38     */
161 kumpf 1.20     CIMMethod& operator=(const CIMMethod& x);
162 mike  1.17 
163 kumpf 1.36     /** Gets the name of the method.
164 karl  1.38         @return CIMName with the name of the method.
165 karl  1.40         <p><b>Example:</b>
166 karl  1.38         <pre>
167 karl  1.39             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
168 karl  1.38             assert(m1.getName() == CIMName ("getHostName"));
169                    </pre>
170 mike  1.17     */
171 kumpf 1.30     const CIMName& getName() const;
172 mike  1.17 
173 kumpf 1.36     /** Sets the method name.
174 karl  1.41         @param name CIMName for the method name. Replaces any
175 karl  1.38             previously defined name for this method object.
176 karl  1.40         <p><b>Example:</b>
177 karl  1.38         <pre>
178                        CIMMethod m2(CIMName ("test"), CIMTYPE_STRING);
179                        m2.setName(CIMName ("getVersion"));
180                    </pre>
181 mike  1.17     */
182 kumpf 1.30     void setName(const CIMName& name);
183 mike  1.17 
184 kumpf 1.42     /** Gets the method return type.
185                    @return A CIMType containing the method return type.
186                    @exception UninitializedObjectException Thrown if the object is not
187 karl  1.41         initialized.
188 karl  1.40         <p><b>Example:</b>
189 karl  1.38         <pre>
190 karl  1.39             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
191 karl  1.38             assert(m1.getType() == CIMTYPE_STRING);
192                    </pre>
193 mike  1.17     */
194 kumpf 1.20     CIMType getType() const;
195 mike  1.17 
196 kumpf 1.42     /** Sets the method return type to the specified CIMType.
197 karl  1.41         This is the type of the CIMValue
198 kumpf 1.42         that is returned on a CIM method invocation.
199 karl  1.41         @param type CIMType to be set into the CIMMethod object.
200 kumpf 1.42         @exception UninitializedObjectException Thrown if the object is not
201 karl  1.41         initialized.
202 karl  1.40         <p><b>Example:</b>
203 karl  1.38         <pre>
204 kumpf 1.42             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
205 karl  1.38             m1.setName(CIMName ("getVersion"));
206 kumpf 1.42             assert(m1.getName() == CIMName ("getVersion"));
207 karl  1.38         </pre>
208 mike  1.17     */
209 kumpf 1.20     void setType(CIMType type);
210 mike  1.17 
211 karl  1.38     /** Gets the class in which this method was defined. This information
212 kumpf 1.42         is normally available with methods that are part of a schema
213                    returned from a CIM Server.
214                    @return CIMName containing the classOrigin attribute.
215 mike  1.17     */
216 kumpf 1.30     const CIMName& getClassOrigin() const;
217 mike  1.17 
218 kumpf 1.42     /** Sets the classOrigin attribute with the specified class name.
219                    Normally this method is used internally by a CIM Server when
220                    defining methods in the context of a schema.
221 karl  1.41         @param classOrigin CIMName parameter defining the name
222 kumpf 1.42         of the origin class.
223                    @exception UninitializedObjectException Thrown if the object is not
224 karl  1.41         initialized.
225 kumpf 1.20     */
226 kumpf 1.30     void setClassOrigin(const CIMName& classOrigin);
227 mike  1.17 
228 kumpf 1.42     /** Tests the propagated attribute of the object.  The propagated
229                    attribute indicates whether this method was propagated from a
230                    higher-level class.  Normally this attribute is set as part of
231                    defining a method in the context of a schema.  It is set in
232                    methods retrieved from a CIM Server.
233                    @return True if method is propagated; otherwise, false.
234 kumpf 1.20     */
235                Boolean getPropagated() const;
236 mike  1.17 
237 kumpf 1.42     /** Sets the propagated attribute.  Normally this is used by a CIM Server
238                    when defining a method in the context of a schema.
239                    @param propagated Flag indicating whether the method is propagated
240                    from a superclass.
241                    @exception UninitializedObjectException Thrown if the object is not
242 karl  1.41         initialized.
243 kumpf 1.36     */
244 kumpf 1.20     void setPropagated(Boolean propagated);
245 mike  1.17 
246 kumpf 1.42     /** Adds the specified qualifier to the CIMMethod object.
247 karl  1.40         @param x CIMQualifier object representing the qualifier
248 kumpf 1.36         to be added.
249 karl  1.41         @return The CIMMethod object after adding the specified qualifier.
250 kumpf 1.42         @exception AlreadyExistsException Thrown if the qualifier already
251                    exists in this CIMMethod.
252 karl  1.40         <p><b>Example:</b>
253 karl  1.38         <pre>
254                        CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
255                        m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
256                    </pre>
257 mike  1.17     */
258 kumpf 1.20     CIMMethod& addQualifier(const CIMQualifier& x);
259 mike  1.17 
260 kumpf 1.36     /** Searches for a qualifier with the specified input name.
261 karl  1.40         @param name CIMName of the qualifier to be found.
262 karl  1.41         @return Zero origin index of the qualifier found or PEG_NOT_FOUND
263 kumpf 1.36         if not found.
264 kumpf 1.42         @exception UninitializedObjectException Thrown if the object is not
265 karl  1.41         initialized.
266 karl  1.40         <p><b>Example:</b>
267 karl  1.38         <pre>
268                        CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
269                        m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
270                        assert(m1.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
271                    </pre>
272 mike  1.17     */
273 kumpf 1.30     Uint32 findQualifier(const CIMName& name) const;
274 mike  1.17 
275 kumpf 1.36     /** Gets the CIMQualifier defined by the input parameter.
276 karl  1.41         @param index Zero origin index of the qualifier requested.
277 karl  1.38         @return CIMQualifier object representing the qualifier found.
278 kumpf 1.42         @exception IndexOutOfBoundsException Thrown if the index is
279 kumpf 1.34         outside the range of parameters available from the CIMMethod.
280 karl  1.40         <p><b>Example:</b>
281 karl  1.38         <pre>
282                        CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
283                        m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
284 kumpf 1.42             Uint32 posQualifier = m1.findQualifier(CIMName ("stuff"));
285                        if (posQualifier != PEG_NOT_FOUND)
286                        {
287                            CIMQualifier q = m1.getQualifier(posQualifier);
288                        }
289 karl  1.38         </pre>
290 mike  1.17     */
291 kumpf 1.35     CIMQualifier getQualifier(Uint32 index);
292 kumpf 1.20 
293 kumpf 1.36     /** Gets the CIMQualifier defined by the input parameter.
294 kumpf 1.42         @param index Zero origin index of the qualifier requested.
295                    @return CIMQualifier object representing the qualifier found.
296                    @exception IndexOutOfBoundsException Thrown if the index is
297 kumpf 1.36         outside the range of parameters available from the CIMMethod.
298 karl  1.40         <p><b>Example:</b>
299 karl  1.38         <pre>
300                        CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
301                        m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
302 kumpf 1.42             const CIMMethod m2 = m1;
303                        Uint32 posQualifier = m2.findQualifier(CIMName ("stuff"));
304                        if (posQualifier != PEG_NOT_FOUND)
305                        {
306                            CIMConstQualifier q = m2.getQualifier(posQualifier);
307                        }
308 karl  1.38         </pre>
309 kumpf 1.36     */
310 kumpf 1.35     CIMConstQualifier getQualifier(Uint32 index) const;
311 mike  1.17 
312 kumpf 1.42     /** Removes the specified qualifier from this method.
313 karl  1.40         @param index Index of the qualifier to remove.
314 kumpf 1.42         @exception IndexOutOfBoundsException Thrown if the index is
315 karl  1.38             outside the range of parameters available from the CIMMethod.
316 karl  1.41         <p><b>Example:</b>
317                    <pre>
318                        // remove all qualifiers from a class
319 kumpf 1.42             Uint32 count = 0;
320                        while((count = cimClass.getQualifierCount()) > 0)
321                            cimClass.removeQualifier(count - 1);
322 karl  1.41         </pre>
323 mike  1.17     */
324 kumpf 1.35     void removeQualifier(Uint32 index);
325 mike  1.17 
326 kumpf 1.36     /** Returns the number of Qualifiers attached to this CIMMethod object.
327 karl  1.41         @return The number of qualifiers attached to the CIM Method.
328 karl  1.40         <p><b>Example:</b>
329 karl  1.38         <pre>
330                        CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
331                        m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
332                        m1.addQualifier(CIMQualifier(CIMName ("stuff2"), true));
333                        assert(m1.getQualifierCount() == 2);
334                    </pre>
335 mike  1.17     */
336 kumpf 1.20     Uint32 getQualifierCount() const;
337 mike  1.17 
338 kumpf 1.36     /** Adds the parameter defined by the input to the CIMMethod.
339 karl  1.40         @param x CIMParameter to be added to the CIM Method.
340 kumpf 1.36         @return CIMMethod object after the specified parameter is added.
341 karl  1.40         <p><b>Example:</b>
342 kumpf 1.42         @exception UninitializedObjectException Thrown if the object is not
343 karl  1.41         initialized.
344 kumpf 1.42         @exception AlreadyExistsException Thrown if the parameter already
345                    exists in this CIMMethod.
346 karl  1.38         <pre>
347                        CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
348                        m1.addParameter(CIMParameter(CIMName ("ipaddress"), CIMTYPE_STRING));
349                    </pre>
350 mike  1.17     */
351 kumpf 1.20     CIMMethod& addParameter(const CIMParameter& x);
352 mike  1.17 
353 kumpf 1.36     /** Finds the parameter with the specified name.
354 karl  1.40         @param name CIMName of parameter to be found.
355 kumpf 1.42         @return Index of the parameter object found or PEG_NOT_FOUND
356 kumpf 1.36         if the property is not found.
357 karl  1.40         <p><b>Example:</b>
358 karl  1.38         <pre>
359                        Uint32 posParameter;
360                        posParameter = m1.findParameter(CIMName ("ipaddress"));
361                        if (posParameter != PEG_NOT_FOUND)
362                            ...
363                    </pre>
364 mike  1.17     */
365 kumpf 1.30     Uint32 findParameter(const CIMName& name) const;
366 mike  1.17 
367 kumpf 1.36     /** Gets the parameter defined by the specified index.
368 karl  1.40         @param index Index for the parameter to be returned.
369 karl  1.38         @return CIMParameter object requested.
370 kumpf 1.42         @exception IndexOutOfBoundsException Thrown if the index is outside
371 karl  1.38             the range of available parameters.
372 karl  1.40         <p><b>Example:</b>
373 karl  1.38         <pre>
374 kumpf 1.42             CIMParameter cp;
375                        Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
376                        if (parameterIndex != PEG_NOT_FOUND)
377                        {
378                            cp = m1.getParameter(parameterIndex);
379                        }
380 karl  1.38         </pre>
381 mike  1.17     */
382 kumpf 1.35     CIMParameter getParameter(Uint32 index);
383 kumpf 1.26 
384 kumpf 1.42     /** Gets the parameter defined by the specified index.
385 karl  1.40         @param index Index for the parameter to be returned.
386 kumpf 1.42         @return CIMParameter object requested.
387                    @exception IndexOutOfBoundsException Thrown if the index is outside
388                        the range of available parameters.
389                    <p><b>Example:</b>
390                    <pre>
391                        CIMConstParameter cp;
392                        Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
393                        if (parameterIndex != PEG_NOT_FOUND)
394                        {
395                            cp = m1.getParameter(parameterIndex);
396                        }
397                    </pre>
398 kumpf 1.36     */
399 kumpf 1.35     CIMConstParameter getParameter(Uint32 index) const;
400 kumpf 1.33 
401 kumpf 1.42     /** Removes the parameter defined by the specified index.
402 karl  1.40         @param index Index of the parameter to be removed.
403 kumpf 1.42         @exception IndexOutOfBoundsException Thrown if the index is outside the
404 karl  1.38             range of parameters available from the CIMMethod.
405 kumpf 1.33     */
406 kumpf 1.35     void removeParameter (Uint32 index);
407 mike  1.17 
408 kumpf 1.36     /** Gets the count of Parameters defined in the CIMMethod.
409 karl  1.40         @return Count of the number of parameters attached to the CIMMethod.
410 mike  1.17     */
411 kumpf 1.20     Uint32 getParameterCount() const;
412 mike  1.17 
413 kumpf 1.36     /** Determines if the object has not been initialized.
414 kumpf 1.42         @return True if the object has not been initialized;
415                            otherwise, false.
416 karl  1.41         <p><b>Example:</b>
417                    <pre>
418                        CIMMethod m1;
419 kumpf 1.42             assert(m1.isUninitialized());
420 karl  1.41         </pre>
421 kumpf 1.32      */
422                Boolean isUninitialized() const;
423 mike  1.17 
424 karl  1.41     /** Compares with a CIMConstMethod.
425 karl  1.40         @param x CIMConstMethod object for the method to be compared.
426 kumpf 1.42         @return True if this method is identical to the one specified;
427                            otherwise, false.
428 karl  1.40         <p><b>Example:</b>
429 karl  1.38         <pre>
430                        CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
431 karl  1.41             CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING);
432 karl  1.38             assert(!m1.identical(m2));
433                    </pre>
434 mike  1.17     */
435                Boolean identical(const CIMConstMethod& x) const;
436            
437 karl  1.40     /** Makes a clone (deep copy) of this method. This creates
438                    a new copy of all of the components of the method including
439                    parameters and qualifiers.
440 karl  1.41         @return Independent copy of the CIMMethod object.
441 kumpf 1.36     */
442 kumpf 1.20     CIMMethod clone() const;
443 mike  1.17 
444            private:
445            
446 kumpf 1.20     CIMMethod(CIMMethodRep* rep);
447 mike  1.17 
448 kumpf 1.42     /** This method is not implemented.  It is defined to explicitly disallow
449                    construction of a CIMMethod from a CIMConstMethod.  Because the
450                    CIMMethod class uses a shared representation model, allowing this
451                    construction would effectively allow modification of CIMConstMethod
452                    objects.
453                */
454 mike  1.17     PEGASUS_EXPLICIT CIMMethod(const CIMConstMethod& x);
455            
456 kumpf 1.20     void _checkRep() const;
457 mike  1.17 
458                CIMMethodRep* _rep;
459                friend class CIMConstMethod;
460 kumpf 1.28     friend class Resolver;
461 kumpf 1.22     friend class XmlWriter;
462 kumpf 1.23     friend class MofWriter;
463 schuur 1.44     friend class BinaryStreamer;
464 mike   1.17 };
465             
466 karl   1.38 /** The CIMConstMethod class is used to represent CIM methods in the
467                 same manner as the CIMMethod class except that the const attribute
468                 is applied to the objects created. This class includes equivalents
469 kumpf  1.42     to the methods from CIMMethod that are available in a const object,
470                 including constructors, accessor methods, and the destructor.
471             
472                 Because the CIMMethod class uses a shared representation model, allowing
473                 the construction of a 'CIMMethod' from a 'const CIMMethod' would
474                 effectively allow modification of a 'const CIMMethod'.  The CIMConstMethod
475                 class is used to represent constant CIMMethod objects.  Since a
476                 CIMConstMethod cannot be converted to a CIMMethod, its value remains
477                 constant.
478             
479 karl   1.41     @see CIMMethod()
480 karl   1.38 */
481 mike   1.17 class PEGASUS_COMMON_LINKAGE CIMConstMethod
482             {
483             public:
484             
485 kumpf  1.42     /** Creates a new uninitialized CIMConstMethod object.
486                     The only thing that can be done with this object is to copy another
487                     object into it.  Other methods, such as getName, will fail with an
488                     UninitializedObjectException.  The object has an uninitialized state,
489                     which can be tested with the isUninitialized method.
490                     @see isUninitialized()
491                     @see UninitializedObjectException
492 karl   1.38     */
493 kumpf  1.20     CIMConstMethod();
494 mike   1.17 
495 karl   1.41     /** Creates a new CIMConstMethod object from another CIMConstMethod object.
496 kumpf  1.42         The new CIMConstMethod object references the same copy of data as the
497                     specified object; no copy is made.
498                     @param x CIMConstMethod object from which to create the new
499                     CIMConstMethod object.
500                     <p><b>Example:</b>
501 karl   1.41         <pre>
502 kumpf  1.42             CIMConstMethod cm1(CIMName ("getHostName"), CIMTYPE_STRING);
503                         CIMConstMethod cm2(m1);
504 karl   1.41         </pre>
505                     {@link Shared Classes}
506                 */
507 kumpf  1.20     CIMConstMethod(const CIMConstMethod& x);
508 mike   1.17 
509 kumpf  1.42     /** Creates a new CIMConstMethod object from a CIMMethod object.
510                     The new CIMConstMethod object references the same copy of data as the
511                     specified object; no copy is made.
512                     @param x CIMMethod object from which to create the new
513                     CIMConstMethod object.
514                     <p><b>Example:</b>
515                     <pre>
516                         CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
517                         CIMConstMethod cm1(m1);
518                     </pre>
519                     {@link Shared Classes}
520 karl   1.38     */
521 kumpf  1.20     CIMConstMethod(const CIMMethod& x);
522 mike   1.17 
523 kumpf  1.42     /** Creates a CIMConstMethod object with the specified attributes.
524 karl   1.41         @param name CIMName defining the name for the method.
525 kumpf  1.42 
526                     @param type CIMType defining the method return type.
527             
528                     @param classOrigin (optional) CIMName representing the class origin.
529                         Note that this should normally not be used.  If not provided set to
530 karl   1.41             CIMName() (Null name).
531 kumpf  1.42         @param propagated Optional flag indicating whether the definition of
532                         the CIM Method is local to the CIM Class (respectively, Instance)
533                         in which it appears, or was propagated without modification from
534                         a superclass. Default is false. Note that this attribute is
535                         normally not set by CIM Clients but is used internally within the
536                         CIM Server.
537 karl   1.41         <p><b>Example:</b>
538                     <pre>
539                         CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
540                     </pre>
541                 */
542 mike   1.17     CIMConstMethod(
543 kumpf  1.42         const CIMName& name,
544                     CIMType type,
545                     const CIMName& classOrigin = CIMName(),
546                     Boolean propagated = false);
547 kumpf  1.20 
548 kumpf  1.42     /** Destructor for the CIMConstMethod.  The shared data copy remains valid
549                     until all referring objects are destructed.
550 karl   1.41         {@link Shared Classes}
551                 */
552 kumpf  1.20     ~CIMConstMethod();
553             
554 kumpf  1.42     /** The assignment operator assigns one CIMConstMethod to another.
555                     After the assignment, both CIMConstMethod objects refer to the same
556 karl   1.41         data copy; a distinct copy is not created.
557 kumpf  1.42         @param x CIMConstMethod object from which to assign this
558                     CIMConstMethod object.
559             
560 karl   1.41         <p><b>Example:</b>
561                     <pre>
562                         CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
563                         CIMConstMethod m2;
564                         m2 = m1;
565                     </pre>
566 karl   1.39     */
567 kumpf  1.20     CIMConstMethod& operator=(const CIMConstMethod& x);
568             
569 karl   1.41     /** The assignment operator assigns a CIMMethod object to a
570 kumpf  1.42         CIMConstMethod.
571 karl   1.41         After the assignment, both objects refer to the same
572                     data copy; a distinct copy is not created.
573 kumpf  1.42         @param x CIMConstMethod object from which to assign this
574                     CIMConstMethod object.
575             
576 karl   1.41         <p><b>Example:</b>
577                     <pre>
578                         CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
579                         CIMConstMethod m2;
580                         m2 = m1;
581                     </pre>
582                 */
583 kumpf  1.20     CIMConstMethod& operator=(const CIMMethod& x);
584             
585 karl   1.41     /** Gets the name of the method.
586                     @return CIMName with the name of the method.
587                     <p><b>Example:</b>
588                     <pre>
589                         CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
590                         assert(m1.getName() == CIMName ("getHostName"));
591                     </pre>
592 karl   1.38     */
593 kumpf  1.30     const CIMName& getName() const;
594 kumpf  1.20 
595 kumpf  1.42     /** Gets the method return type.
596                     @return A CIMType containing the method return type.
597                     @exception UninitializedObjectException Thrown if the object is not
598                     initialized.
599 karl   1.41         <p><b>Example:</b>
600                     <pre>
601                         CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
602                         assert(m1.getType() == CIMTYPE_STRING);
603                     </pre>
604 karl   1.38     */
605 kumpf  1.20     CIMType getType() const;
606             
607 karl   1.41     /** Gets the class in which this method was defined. This information
608 kumpf  1.42         is normally available with methods that are part of a schema
609                     returned from a CIM Server.
610                     @return CIMName containing the classOrigin attribute.
611 karl   1.38     */
612 kumpf  1.30     const CIMName& getClassOrigin() const;
613 kumpf  1.20 
614 kumpf  1.42     /** Tests the propagated attribute of the object.  The propagated
615                     attribute indicates whether this method was propagated from a
616                     higher-level class.  Normally this attribute is set as part of
617                     defining a method in the context of a schema.  It is set in
618                     methods retrieved from a CIM Server.
619                     @return True if method is propagated; otherwise, false.
620 karl   1.38     */
621 kumpf  1.20     Boolean getPropagated() const;
622             
623 karl   1.41     /** Searches for a qualifier with the specified input name.
624                     @param name CIMName of the qualifier to be found.
625 kumpf  1.42         @return Zero origin index of the qualifier found or PEG_NOT_FOUND
626 karl   1.41         if not found.
627 kumpf  1.42         @exception UninitializedObjectException Thrown if the object is not
628                     initialized.
629 karl   1.41         <p><b>Example:</b>
630                     <pre>
631 kumpf  1.42             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
632 karl   1.41             m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
633 kumpf  1.42             CIMConstMethod m2(m1);
634                         assert(m2.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
635 karl   1.41         </pre>
636 karl   1.38     */
637 kumpf  1.30     Uint32 findQualifier(const CIMName& name) const;
638 kumpf  1.20 
639 karl   1.41     /** Gets the CIMQualifier defined by the input parameter.
640 kumpf  1.42         @param index Zero origin index of the qualifier requested.
641 karl   1.41         @return CIMQualifier object representing the qualifier found.
642 kumpf  1.42         @exception IndexOutOfBoundsException Thrown if the index is
643 karl   1.41         outside the range of parameters available from the CIMMethod.
644                     <p><b>Example:</b>
645                     <pre>
646                         CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
647                         m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
648 kumpf  1.42             CIMConstMethod m2(m1);
649                         Uint32 posQualifier = m2.findQualifier(CIMName ("stuff"));
650                         if (posQualifier != PEG_NOT_FOUND)
651                         {
652                             CIMQualifier q = m2.getQualifier(posQualifier);
653                         }
654 karl   1.41         </pre>
655 karl   1.38     */
656 kumpf  1.35     CIMConstQualifier getQualifier(Uint32 index) const;
657 kumpf  1.20 
658 kumpf  1.42     /** Returns the number of Qualifiers attached to this CIMConstMethod
659                     object.
660                     @return The number of qualifiers attached to the CIM method.
661 karl   1.41         <p><b>Example:</b>
662                     <pre>
663 kumpf  1.42             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
664                         m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
665                         m1.addQualifier(CIMQualifier(CIMName ("stuff2"), true));
666                         CIMConstMethod m2(m1);
667                         assert(m2.getQualifierCount() == 2);
668 karl   1.41         </pre>
669 karl   1.38     */
670 kumpf  1.20     Uint32 getQualifierCount() const;
671             
672 karl   1.41     /** Finds the parameter with the specified name.
673                     @param name CIMName of parameter to be found.
674 kumpf  1.42         @return Index of the parameter object found or PEG_NOT_FOUND
675 karl   1.41         if the property is not found.
676                     <p><b>Example:</b>
677                     <pre>
678                         Uint32 posParameter;
679                         posParameter = m1.findParameter(CIMName ("ipaddress"));
680                         if (posParameter != PEG_NOT_FOUND)
681                             ...
682                     </pre>
683 karl   1.38     */
684 kumpf  1.30     Uint32 findParameter(const CIMName& name) const;
685 kumpf  1.20 
686 karl   1.41     /** Gets the parameter defined by the specified index.
687                     @param index Index for the parameter to be returned.
688 kumpf  1.42         @return CIMConstParameter object requested.
689                     @exception IndexOutOfBoundsException Thrown if the index is outside
690 karl   1.41             the range of available parameters.
691                     <p><b>Example:</b>
692                     <pre>
693 kumpf  1.42             CIMConstParameter cp;
694                         Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
695                         if (parameterIndex != PEG_NOT_FOUND)
696                         {
697                             cp = m1.getParameter(parameterIndex);
698                         }
699 karl   1.41         </pre>
700 karl   1.38     */
701 kumpf  1.35     CIMConstParameter getParameter(Uint32 index) const;
702 kumpf  1.20 
703 karl   1.41     /** Gets the count of Parameters defined in the CIMMethod.
704                     @return Count of the number of parameters attached to the CIMMethod.
705 karl   1.38     */
706 kumpf  1.20     Uint32 getParameterCount() const;
707             
708 karl   1.41     /** Determines if the object has not been initialized.
709 kumpf  1.42         @return True if the object has not been initialized;
710                             otherwise, false.
711                     <p><b>Example:</b>
712                     <pre>
713                         CIMConstMethod m1;
714                         assert(m1.isUninitialized());
715                     </pre>
716 karl   1.41      */
717 kumpf  1.32     Boolean isUninitialized() const;
718 kumpf  1.20 
719 karl   1.41     /** Compares with a CIMConstMethod.
720                     @param x CIMConstMethod object for the method to be compared.
721 kumpf  1.42         @return True if this method is identical to the one specified;
722                             otherwise, false.
723 karl   1.41         <p><b>Example:</b>
724                     <pre>
725 kumpf  1.42             CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
726 karl   1.41             CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING);
727                         assert(!m1.identical(m2));
728                     </pre>
729 karl   1.38     */
730 kumpf  1.20     Boolean identical(const CIMConstMethod& x) const;
731             
732 kumpf  1.42     /** Makes a clone (deep copy) of this CIMConstMethod. This creates
733 karl   1.41         a new copy of all of the components of the method including
734                     parameters and qualifiers.
735 kumpf  1.42         @return Independent copy of the CIMConstMethod object.  Note that
736                     the copy is a non-constant CIMMethod.
737 karl   1.38     */
738 kumpf  1.20     CIMMethod clone() const;
739 mike   1.17 
740             private:
741             
742 kumpf  1.20     void _checkRep() const;
743 mike   1.17 
744                 CIMMethodRep* _rep;
745             
746                 friend class CIMMethod;
747                 friend class CIMMethodRep;
748 kumpf  1.22     friend class XmlWriter;
749 kumpf  1.23     friend class MofWriter;
750 mike   1.17 };
751             
752             #define PEGASUS_ARRAY_T CIMMethod
753 kumpf  1.24 # include <Pegasus/Common/ArrayInter.h>
754 mike   1.17 #undef PEGASUS_ARRAY_T
755             
756             PEGASUS_NAMESPACE_END
757             
758             #endif /* Pegasus_Method_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2