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

  1 karl  1.50 //%2006////////////////////////////////////////////////////////////////////////
  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 karl  1.47 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.50 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 mike  1.17 //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15 kumpf 1.25 // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18 mike  1.17 // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20            // 
 21 kumpf 1.25 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 mike  1.17 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24 kumpf 1.25 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27 mike  1.17 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30            //==============================================================================
 31            //
 32            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34            #ifndef Pegasus_Method_h
 35            #define Pegasus_Method_h
 36            
 37            #include <Pegasus/Common/Config.h>
 38 kumpf 1.30 #include <Pegasus/Common/Linkage.h>
 39 kumpf 1.20 #include <Pegasus/Common/String.h>
 40 kumpf 1.30 #include <Pegasus/Common/CIMName.h>
 41 kumpf 1.20 #include <Pegasus/Common/CIMParameter.h>
 42            #include <Pegasus/Common/CIMQualifier.h>
 43            #include <Pegasus/Common/CIMType.h>
 44 mike  1.17 
 45            PEGASUS_NAMESPACE_BEGIN
 46            
 47 kumpf 1.28 class Resolver;
 48 mike  1.17 class CIMConstMethod;
 49 kumpf 1.20 class CIMMethodRep;
 50 mike  1.17 
 51 kumpf 1.51 /**
 52                The CIMMethod class represents the DMTF standard CIM method definition.
 53                A CIMMethod is generally defined in the context of a CIMClass.
 54                A CIMMethod consists of:
 55 karl  1.38     <ul>
 56 kumpf 1.51         <li>A CIMName containing the name of the method
 57                    <li>A CIMType defining the method return type
 58                    <li>Zero or more CIMQualifier objects
 59                    <li>Zero or more CIMParameter objects defining the method parameters
 60 karl  1.38     </ul>
 61 kumpf 1.51     In addition, a CIMMethod has these internal attributes:
 62 karl  1.38     <ul>
 63 kumpf 1.51         <li><b>propagated</b> - An attribute defining whether this CIMMethod
 64                        is propagated from a superclass.  Note that this is normally set
 65                        as part of completing the definition of objects (resolving) when
 66                        they are created as part of a CIM schema and is NOT automatically
 67                        set when creating a method object.  It can only be logically set
 68                        in context of the schema in which the CIMMethod is defined.
 69 kumpf 1.42         <li><b>classOrigin</b> - An attribute defining the class in which
 70 kumpf 1.51             this CIMMethod was originally defined.  This is normally set
 71                        within the context of the schema in which the CIMMethod is
 72                        defined.  This attribute is available from objects retrieved
 73                        from the CIM Server, for example, and provides information on
 74                        the defintion of this method in the class hierarchy.  The
 75                        propagated and ClassOrigin attributes can be used together to
 76                        determine if methods originated with this object or were
 77                        inherited from higher levels of the hiearchy.
 78 karl  1.38     </ul>
 79 kumpf 1.42 
 80 kumpf 1.51     <p>The CIMMethod class uses a shared representation model, such that
 81                multiple CIMMethod objects may refer to the same data copy.  Assignment
 82                and copy operators create new references to the same data, not distinct
 83                copies.  An update to a CIMMethod object affects all the CIMMethod
 84                objects that refer to the same data copy.  The data remains valid until
 85                all the CIMMethod objects that refer to it are destructed.  A separate
 86                copy of the data may be created using the clone method.
 87 mike  1.17 */
 88            class PEGASUS_COMMON_LINKAGE CIMMethod
 89            {
 90            public:
 91            
 92 kumpf 1.51     /**
 93                    Constructs an uninitialized CIMMethod object.  A method
 94                    invocation on an uninitialized object will result in the throwing
 95                    of an UninitializedObjectException.  An uninitialized object may
 96                    be converted into an initialized object only by using the assignment
 97                    operator with an initialized object.
 98 karl  1.38     */
 99 kumpf 1.20     CIMMethod();
100 mike  1.17 
101 kumpf 1.51     /**
102                    Constructs a CIMMethod object from the value of a specified
103                    CIMMethod object, so that both objects refer to the same data copy.
104            
105 kumpf 1.42         <p><b>Example:</b>
106 karl  1.38         <pre>
107                        CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
108                        const CIMMethod cm1(m1);
109                    </pre>
110 kumpf 1.51 
111                    @param x The CIMMethod object from which to construct a new
112                        CIMMethod object.
113 mike  1.17     */
114 kumpf 1.20     CIMMethod(const CIMMethod& x);
115 mike  1.17 
116 kumpf 1.51     /**
117                    Constructs a CIMMethod object with the specified attributes.
118 karl  1.40         <p><b>Example:</b>
119 karl  1.38         <pre>
120 karl  1.39             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
121 karl  1.38         </pre>
122 kumpf 1.51 
123                    @param name A CIMName specifying the name of the method.
124                    @param type A CIMType defining the method return type.
125                    @param classOrigin A CIMName indicating the class in which the
126                        method is locally defined (optional).
127                    @param propagated A Boolean indicating whether the method definition
128                        is local to the CIMClass in which it appears or was propagated
129                        (without modification) from a superclass.
130                    @exception UninitializedObjectException If the method name is null.
131 mike  1.17     */
132                CIMMethod(
133 karl  1.38         const CIMName& name,
134                    CIMType type,
135                    const CIMName& classOrigin = CIMName(),
136                    Boolean propagated = false);
137            
138 kumpf 1.51     /**
139                    Destructs the CIMMethod object.
140 karl  1.38     */
141 kumpf 1.20     ~CIMMethod();
142            
143 kumpf 1.51     /**
144                    Assigns the value of the specified CIMMethod object to this object,
145                    so that both objects refer to the same data copy.
146 kumpf 1.42 
147 karl  1.40         <p><b>Example:</b>
148 karl  1.39         <pre>
149                        CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
150 karl  1.41             CIMMethod m2;
151                        m2 = m1;
152 karl  1.39         </pre>
153 kumpf 1.51 
154                    @param x The CIMMethod object from which to assign this CIMMethod
155                        object.
156                    @return A reference to this CIMMethod object.
157 karl  1.38     */
158 kumpf 1.20     CIMMethod& operator=(const CIMMethod& x);
159 mike  1.17 
160 kumpf 1.51     /**
161                    Gets the name of the method.
162 karl  1.40         <p><b>Example:</b>
163 karl  1.38         <pre>
164 karl  1.39             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
165 jim.wunderlich 1.49             assert(m1.getName() == CIMName ("getHostName"));
166 karl           1.38         </pre>
167 kumpf          1.51         @return A CIMName containing the name of the method.
168                             @exception UninitializedObjectException If the object is not
169                                 initialized.
170 mike           1.17     */
171 kumpf          1.30     const CIMName& getName() const;
172 mike           1.17 
173 kumpf          1.51     /**
174                             Sets the method name.
175 karl           1.40         <p><b>Example:</b>
176 karl           1.38         <pre>
177                                 CIMMethod m2(CIMName ("test"), CIMTYPE_STRING);
178                                 m2.setName(CIMName ("getVersion"));
179                             </pre>
180 kumpf          1.51         @return A CIMName containing the new name of the method.
181                             @exception UninitializedObjectException If the object is not
182                                 initialized.
183 marek          1.56         @exception Exception If the object is already contained by CIMClass
184 mike           1.17     */
185 kumpf          1.30     void setName(const CIMName& name);
186 mike           1.17 
187 kumpf          1.51     /**
188                             Gets the method return type.
189 karl           1.40         <p><b>Example:</b>
190 karl           1.38         <pre>
191 karl           1.39             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
192 jim.wunderlich 1.49             assert(m1.getType() == CIMTYPE_STRING);
193 karl           1.38         </pre>
194 kumpf          1.51         @return A CIMType containing the method return type.
195                             @exception UninitializedObjectException If the object is not
196                                 initialized.
197 mike           1.17     */
198 kumpf          1.20     CIMType getType() const;
199 mike           1.17 
200 kumpf          1.51     /**
201                             Sets the method return type to the specified CIMType.
202 karl           1.41         This is the type of the CIMValue
203 kumpf          1.42         that is returned on a CIM method invocation.
204 karl           1.40         <p><b>Example:</b>
205 karl           1.38         <pre>
206 kumpf          1.42             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
207 karl           1.38             m1.setName(CIMName ("getVersion"));
208 jim.wunderlich 1.49             assert(m1.getName() == CIMName ("getVersion"));
209 karl           1.38         </pre>
210 kumpf          1.51         @param type CIMType to be set into the CIMMethod object.
211                             @exception UninitializedObjectException If the object is not
212                                 initialized.
213 mike           1.17     */
214 kumpf          1.20     void setType(CIMType type);
215 mike           1.17 
216 kumpf          1.51     /**
217                             Gets the class in which this method is locally defined.  This
218                             information is normally available with methods that are part of
219                             schema returned from a CIM Server.
220 kumpf          1.42         @return CIMName containing the classOrigin attribute.
221 kumpf          1.51         @exception UninitializedObjectException If the object is not
222                                 initialized.
223 mike           1.17     */
224 kumpf          1.30     const CIMName& getClassOrigin() const;
225 mike           1.17 
226 kumpf          1.51     /**
227                             Sets the classOrigin attribute with the specified class name.
228 kumpf          1.42         Normally this method is used internally by a CIM Server when
229                             defining methods in the context of a schema.
230 kumpf          1.51         @param classOrigin A CIMName specifying the name of the class of
231                                 origin for the method.
232                             @exception UninitializedObjectException If the object is not
233                                 initialized.
234 kumpf          1.20     */
235 kumpf          1.30     void setClassOrigin(const CIMName& classOrigin);
236 mike           1.17 
237 kumpf          1.51     /**
238                             Tests the propagated attribute of the object.  The propagated
239 kumpf          1.42         attribute indicates whether this method was propagated from a
240                             higher-level class.  Normally this attribute is set as part of
241                             defining a method in the context of a schema.  It is set in
242                             methods retrieved from a CIM Server.
243                             @return True if method is propagated; otherwise, false.
244 kumpf          1.51         @exception UninitializedObjectException If the object is not
245                                 initialized.
246 kumpf          1.20     */
247                         Boolean getPropagated() const;
248 mike           1.17 
249 kumpf          1.51     /**
250                             Sets the propagated attribute.  Normally this is used by a CIM Server
251 kumpf          1.42         when defining a method in the context of a schema.
252 kumpf          1.51         @param propagated A Boolean indicating whether the method is
253                                 propagated from a superclass.
254                             @exception UninitializedObjectException If the object is not
255                                 initialized.
256 kumpf          1.36     */
257 kumpf          1.20     void setPropagated(Boolean propagated);
258 mike           1.17 
259 kumpf          1.51     /**
260                             Adds a qualifier to the method.
261 karl           1.40         <p><b>Example:</b>
262 karl           1.38         <pre>
263                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
264                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
265                             </pre>
266 kumpf          1.51         @param x The CIMQualifier to be added.
267                             @return A reference to this CIMMethod object.
268                             @exception AlreadyExistsException If a qualifier with the
269                                 same name already exists in the CIMMethod.
270                             @exception UninitializedObjectException If the object is not
271                                 initialized.
272 mike           1.17     */
273 kumpf          1.20     CIMMethod& addQualifier(const CIMQualifier& x);
274 mike           1.17 
275 kumpf          1.51     /**
276                             Finds a qualifier by name.
277 karl           1.40         <p><b>Example:</b>
278 karl           1.38         <pre>
279                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
280                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
281 jim.wunderlich 1.49             assert(m1.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
282 karl           1.38         </pre>
283 kumpf          1.51         @param name A CIMName specifying the name of the qualifier to be found.
284                             @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
285                             @exception UninitializedObjectException If the object is not
286                                 initialized.
287 mike           1.17     */
288 kumpf          1.30     Uint32 findQualifier(const CIMName& name) const;
289 mike           1.17 
290 kumpf          1.51     /**
291                             Gets the qualifier at the specified index.
292 karl           1.40         <p><b>Example:</b>
293 karl           1.38         <pre>
294                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
295                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
296 kumpf          1.42             Uint32 posQualifier = m1.findQualifier(CIMName ("stuff"));
297                                 if (posQualifier != PEG_NOT_FOUND)
298                                 {
299                                     CIMQualifier q = m1.getQualifier(posQualifier);
300                                 }
301 karl           1.38         </pre>
302 kumpf          1.51         @param index The index of the qualifier to be retrieved.
303                             @return The CIMQualifier object at the specified index.
304                             @exception IndexOutOfBoundsException If the index is
305                                 outside the range of qualifiers available for the CIMMethod.
306                             @exception UninitializedObjectException If the object is not
307                                 initialized.
308 mike           1.17     */
309 kumpf          1.35     CIMQualifier getQualifier(Uint32 index);
310 kumpf          1.20 
311 kumpf          1.51     /**
312                             Gets the qualifier at the specified index.
313 karl           1.40         <p><b>Example:</b>
314 karl           1.38         <pre>
315                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
316                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
317 kumpf          1.42             const CIMMethod m2 = m1;
318                                 Uint32 posQualifier = m2.findQualifier(CIMName ("stuff"));
319                                 if (posQualifier != PEG_NOT_FOUND)
320                                 {
321                                     CIMConstQualifier q = m2.getQualifier(posQualifier);
322                                 }
323 karl           1.38         </pre>
324 kumpf          1.51         @param index The index of the qualifier to be retrieved.
325                             @return The CIMConstQualifier object at the specified index.
326                             @exception IndexOutOfBoundsException If the index is
327                                 outside the range of qualifiers available for the CIMMethod.
328                             @exception UninitializedObjectException If the object is not
329                                 initialized.
330 kumpf          1.36     */
331 kumpf          1.35     CIMConstQualifier getQualifier(Uint32 index) const;
332 mike           1.17 
333 kumpf          1.51     /**
334                             Removes a qualifier from the method.
335 karl           1.41         <p><b>Example:</b>
336                             <pre>
337                                 // remove all qualifiers from a class
338 kumpf          1.42             Uint32 count = 0;
339 kumpf          1.52             while ((count = cimClass.getQualifierCount()) > 0)
340 kumpf          1.42                 cimClass.removeQualifier(count - 1);
341 karl           1.41         </pre>
342 kumpf          1.51         @param index The index of the qualifier to remove.
343                             @exception IndexOutOfBoundsException If the index is
344                                 outside the range of qualifiers available for the CIMMethod.
345                             @exception UninitializedObjectException If the object is not
346                                 initialized.
347 mike           1.17     */
348 kumpf          1.35     void removeQualifier(Uint32 index);
349 mike           1.17 
350 kumpf          1.51     /**
351                             Gets the number of qualifiers in the method.
352 karl           1.40         <p><b>Example:</b>
353 karl           1.38         <pre>
354                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
355                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
356                                 m1.addQualifier(CIMQualifier(CIMName ("stuff2"), true));
357 jim.wunderlich 1.49             assert(m1.getQualifierCount() == 2);
358 karl           1.38         </pre>
359 kumpf          1.51         @return An integer count of the qualifiers in the CIMMethod.
360                             @exception UninitializedObjectException If the object is not
361                                 initialized.
362 mike           1.17     */
363 kumpf          1.20     Uint32 getQualifierCount() const;
364 mike           1.17 
365 kumpf          1.51     /**
366                             Adds a parameter to the method.
367 karl           1.40         <p><b>Example:</b>
368 karl           1.38         <pre>
369                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
370 kumpf          1.51             m1.addParameter(CIMParameter(CIMName("ipaddress"), CIMTYPE_STRING));
371 karl           1.38         </pre>
372 kumpf          1.51         @param x The CIMParameter to be added.
373                             @return A reference to this CIMMethod object.
374                             @exception AlreadyExistsException If a parameter with the
375                                 same name already exists in the CIMMethod.
376                             @exception UninitializedObjectException If the object is not
377                                 initialized.
378 mike           1.17     */
379 kumpf          1.20     CIMMethod& addParameter(const CIMParameter& x);
380 mike           1.17 
381 kumpf          1.51     /**
382                             Finds a parameter by name.
383 karl           1.40         <p><b>Example:</b>
384 karl           1.38         <pre>
385                                 Uint32 posParameter;
386                                 posParameter = m1.findParameter(CIMName ("ipaddress"));
387                                 if (posParameter != PEG_NOT_FOUND)
388                                     ...
389                             </pre>
390 kumpf          1.51         @param name A CIMName specifying the name of the parameter to be found.
391                             @return Index of the parameter if found or PEG_NOT_FOUND if not found.
392                             @exception UninitializedObjectException If the object is not
393                                 initialized.
394 mike           1.17     */
395 kumpf          1.30     Uint32 findParameter(const CIMName& name) const;
396 mike           1.17 
397 kumpf          1.51     /**
398                             Gets the parameter at the specified index.
399 karl           1.40         <p><b>Example:</b>
400 karl           1.38         <pre>
401 kumpf          1.42             CIMParameter cp;
402                                 Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
403                                 if (parameterIndex != PEG_NOT_FOUND)
404                                 {
405                                     cp = m1.getParameter(parameterIndex);
406                                 }
407 karl           1.38         </pre>
408 kumpf          1.51         @param index The index of the parameter to be retrieved.
409                             @return The CIMParameter at the specified index.
410                             @exception IndexOutOfBoundsException If the index is outside
411                                 the range of parameters available for the CIMMethod.
412                             @exception UninitializedObjectException If the object is not
413                                 initialized.
414 mike           1.17     */
415 kumpf          1.35     CIMParameter getParameter(Uint32 index);
416 kumpf          1.26 
417 kumpf          1.51     /**
418                             Gets the parameter at the specified index.
419 kumpf          1.42         <p><b>Example:</b>
420                             <pre>
421                                 CIMConstParameter cp;
422                                 Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
423                                 if (parameterIndex != PEG_NOT_FOUND)
424                                 {
425                                     cp = m1.getParameter(parameterIndex);
426                                 }
427                             </pre>
428 kumpf          1.51         @param index The index of the parameter to be retrieved.
429                             @return The CIMConstParameter at the specified index.
430                             @exception IndexOutOfBoundsException If the index is outside
431                                 the range of parameters available for the CIMMethod.
432                             @exception UninitializedObjectException If the object is not
433                                 initialized.
434 kumpf          1.36     */
435 kumpf          1.35     CIMConstParameter getParameter(Uint32 index) const;
436 kumpf          1.33 
437 kumpf          1.51     /**
438                             Removes a parameter from the method.
439 karl           1.40         @param index Index of the parameter to be removed.
440 kumpf          1.51         @exception IndexOutOfBoundsException If the index is outside the
441 karl           1.38             range of parameters available from the CIMMethod.
442 kumpf          1.51         @exception UninitializedObjectException If the object is not
443                                 initialized.
444 kumpf          1.33     */
445 kumpf          1.35     void removeParameter (Uint32 index);
446 mike           1.17 
447 kumpf          1.51     /**
448                             Gets the number of parameters in the method.
449                             @return An integer count of the CIMParameters in the CIMMethod.
450                             @exception UninitializedObjectException If the object is not
451                                 initialized.
452 mike           1.17     */
453 kumpf          1.20     Uint32 getParameterCount() const;
454 mike           1.17 
455 kumpf          1.51     /**
456                             Determines whether the object has been initialized.
457 karl           1.41         <p><b>Example:</b>
458                             <pre>
459                                 CIMMethod m1;
460 jim.wunderlich 1.49             assert(m1.isUninitialized());
461 karl           1.41         </pre>
462 kumpf          1.51         @return True if the object has not been initialized, false otherwise.
463                         */
464 kumpf          1.32     Boolean isUninitialized() const;
465 mike           1.17 
466 kumpf          1.51     /**
467                             Compares the method with another method.
468 karl           1.40         <p><b>Example:</b>
469 karl           1.38         <pre>
470                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
471 karl           1.41             CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING);
472 jim.wunderlich 1.49             assert(!m1.identical(m2));
473 karl           1.38         </pre>
474 kumpf          1.51         @param x The CIMConstMethod to be compared.
475                             @return True if this method is identical to the one specified,
476                                 false otherwise.
477                             @exception UninitializedObjectException If either of the objects
478                                 is not initialized.
479 mike           1.17     */
480                         Boolean identical(const CIMConstMethod& x) const;
481                     
482 kumpf          1.51     /**
483                             Makes a deep copy of the method.  This creates a new copy
484                             of all the method attributes including parameters and qualifiers.
485                             @return A new copy of the CIMMethod object.
486                             @exception UninitializedObjectException If the object is not
487                                 initialized.
488 kumpf          1.36     */
489 kumpf          1.20     CIMMethod clone() const;
490 mike           1.17 
491                     private:
492                     
493 kumpf          1.20     CIMMethod(CIMMethodRep* rep);
494 mike           1.17 
495                         CIMMethodRep* _rep;
496                         friend class CIMConstMethod;
497 kumpf          1.28     friend class Resolver;
498 kumpf          1.22     friend class XmlWriter;
499 kumpf          1.23     friend class MofWriter;
500 schuur         1.44     friend class BinaryStreamer;
501 mike           1.17 };
502                     
503 kumpf          1.51 /**
504                         The CIMConstMethod class provides a const interface to a CIMMethod
505                         object.  This class is needed because the shared representation model
506                         used by CIMMethod does not prevent modification to a const CIMMethod
507                         object.  Note that the value of a CIMConstMethod object could still be
508                         modified by a CIMMethod object that refers to the same data copy.
509 karl           1.38 */
510 mike           1.17 class PEGASUS_COMMON_LINKAGE CIMConstMethod
511                     {
512                     public:
513                     
514 kumpf          1.51     /**
515                             Constructs an uninitialized CIMConstMethod object.  A method
516                             invocation on an uninitialized object will result in the throwing
517                             of an UninitializedObjectException.  An uninitialized object may
518                             be converted into an initialized object only by using the assignment
519                             operator with an initialized object.
520 karl           1.38     */
521 kumpf          1.20     CIMConstMethod();
522 mike           1.17 
523 kumpf          1.51     /**
524                             Constructs a CIMConstMethod object from the value of a specified
525                             CIMConstMethod object, so that both objects refer to the same data
526                             copy.
527                     
528 kumpf          1.42         <p><b>Example:</b>
529 karl           1.41         <pre>
530 kumpf          1.42             CIMConstMethod cm1(CIMName ("getHostName"), CIMTYPE_STRING);
531                                 CIMConstMethod cm2(m1);
532 karl           1.41         </pre>
533 kumpf          1.51 
534                             @param x The CIMConstMethod object from which to construct a new
535                             CIMConstMethod object.
536 karl           1.41     */
537 kumpf          1.20     CIMConstMethod(const CIMConstMethod& x);
538 mike           1.17 
539 kumpf          1.51     /**
540                             Constructs a CIMConstMethod object from the value of a specified
541                             CIMMethod object, so that both objects refer to the same data
542                             copy.
543                     
544 kumpf          1.42         <p><b>Example:</b>
545                             <pre>
546                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
547                                 CIMConstMethod cm1(m1);
548                             </pre>
549 kumpf          1.51 
550                             @param x The CIMMethod object from which to construct a new
551                                 CIMConstMethod object.
552 karl           1.38     */
553 kumpf          1.20     CIMConstMethod(const CIMMethod& x);
554 mike           1.17 
555 kumpf          1.51     /**
556                             Constructs a CIMConstMethod object with the specified attributes.
557                             <p><b>Example:</b>
558                             <pre>
559                                 CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
560                             </pre>
561                     
562 karl           1.41         @param name CIMName defining the name for the method.
563 kumpf          1.42         @param type CIMType defining the method return type.
564                             @param classOrigin (optional) CIMName representing the class origin.
565                                 Note that this should normally not be used.  If not provided set to
566 karl           1.41             CIMName() (Null name).
567 kumpf          1.42         @param propagated Optional flag indicating whether the definition of
568                                 the CIM Method is local to the CIM Class (respectively, Instance)
569                                 in which it appears, or was propagated without modification from
570                                 a superclass. Default is false. Note that this attribute is
571                                 normally not set by CIM Clients but is used internally within the
572                                 CIM Server.
573 kumpf          1.51         @exception UninitializedObjectException If the method name is null.
574 karl           1.41     */
575 mike           1.17     CIMConstMethod(
576 kumpf          1.42         const CIMName& name,
577                             CIMType type,
578                             const CIMName& classOrigin = CIMName(),
579                             Boolean propagated = false);
580 kumpf          1.20 
581 kumpf          1.51     /**
582                             Destructs the CIMConstMethod object.
583 karl           1.41     */
584 kumpf          1.20     ~CIMConstMethod();
585                     
586 kumpf          1.51     /**
587                             Assigns the value of the specified CIMConstMethod object to this
588                             object, so that both objects refer to the same data copy.
589 kumpf          1.42 
590 karl           1.41         <p><b>Example:</b>
591                             <pre>
592                                 CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
593                                 CIMConstMethod m2;
594                                 m2 = m1;
595                             </pre>
596 kumpf          1.51 
597                             @param x The CIMConstMethod object from which to assign this
598                                 CIMConstMethod object.
599                             @return A reference to this CIMConstMethod object.
600 karl           1.39     */
601 kumpf          1.20     CIMConstMethod& operator=(const CIMConstMethod& x);
602                     
603 kumpf          1.51     /**
604                             Assigns the value of the specified CIMMethod object to this
605                             object, so that both objects refer to the same data copy.
606 kumpf          1.42 
607 karl           1.41         <p><b>Example:</b>
608                             <pre>
609                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
610                                 CIMConstMethod m2;
611                                 m2 = m1;
612                             </pre>
613 kumpf          1.51 
614                             @param x The CIMMethod object from which to assign this
615                                 CIMConstMethod object.
616                             @return A reference to this CIMConstMethod object.
617 karl           1.41     */
618 kumpf          1.20     CIMConstMethod& operator=(const CIMMethod& x);
619                     
620 kumpf          1.51     /**
621                             Gets the name of the method.
622 karl           1.41         <p><b>Example:</b>
623                             <pre>
624                                 CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
625 jim.wunderlich 1.49             assert(m1.getName() == CIMName ("getHostName"));
626 karl           1.41         </pre>
627 kumpf          1.51         @return CIMName with the name of the method.
628                             @exception UninitializedObjectException If the object is not
629                                 initialized.
630 karl           1.38     */
631 kumpf          1.30     const CIMName& getName() const;
632 kumpf          1.20 
633 kumpf          1.51     /**
634                             Gets the method return type.
635 karl           1.41         <p><b>Example:</b>
636                             <pre>
637                                 CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
638 jim.wunderlich 1.49             assert(m1.getType() == CIMTYPE_STRING);
639 karl           1.41         </pre>
640 kumpf          1.51         @return A CIMType containing the method return type.
641                             @exception UninitializedObjectException If the object is not
642                                 initialized.
643 karl           1.38     */
644 kumpf          1.20     CIMType getType() const;
645                     
646 kumpf          1.51     /**
647                             Gets the class in which this method was defined. This information
648 kumpf          1.42         is normally available with methods that are part of a schema
649                             returned from a CIM Server.
650                             @return CIMName containing the classOrigin attribute.
651 kumpf          1.51         @exception UninitializedObjectException If the object is not
652                                 initialized.
653 karl           1.38     */
654 kumpf          1.30     const CIMName& getClassOrigin() const;
655 kumpf          1.20 
656 kumpf          1.51     /**
657                             Tests the propagated attribute of the object.  The propagated
658 kumpf          1.42         attribute indicates whether this method was propagated from a
659                             higher-level class.  Normally this attribute is set as part of
660                             defining a method in the context of a schema.  It is set in
661                             methods retrieved from a CIM Server.
662                             @return True if method is propagated; otherwise, false.
663 kumpf          1.51         @exception UninitializedObjectException If the object is not
664                                 initialized.
665 karl           1.38     */
666 kumpf          1.20     Boolean getPropagated() const;
667                     
668 kumpf          1.51     /**
669                             Finds a qualifier by name.
670 karl           1.41         <p><b>Example:</b>
671                             <pre>
672 kumpf          1.42             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
673 karl           1.41             m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
674 kumpf          1.42             CIMConstMethod m2(m1);
675 jim.wunderlich 1.49             assert(m2.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
676 karl           1.41         </pre>
677 kumpf          1.51         @param name A CIMName specifying the name of the qualifier to be found.
678                             @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
679                             @exception UninitializedObjectException If the object is not
680                                 initialized.
681 karl           1.38     */
682 kumpf          1.30     Uint32 findQualifier(const CIMName& name) const;
683 kumpf          1.20 
684 kumpf          1.51     /**
685                             Gets the qualifier at the specified index.
686 karl           1.41         <p><b>Example:</b>
687                             <pre>
688                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
689                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
690 kumpf          1.42             CIMConstMethod m2(m1);
691                                 Uint32 posQualifier = m2.findQualifier(CIMName ("stuff"));
692                                 if (posQualifier != PEG_NOT_FOUND)
693                                 {
694                                     CIMQualifier q = m2.getQualifier(posQualifier);
695                                 }
696 karl           1.41         </pre>
697 kumpf          1.51         @param index The index of the qualifier to be retrieved.
698                             @return The CIMConstQualifier at the specified index.
699                             @exception IndexOutOfBoundsException If the index is
700                                 outside the range of qualifiers available for the CIMMethod.
701                             @exception UninitializedObjectException If the object is not
702                                 initialized.
703 karl           1.38     */
704 kumpf          1.35     CIMConstQualifier getQualifier(Uint32 index) const;
705 kumpf          1.20 
706 kumpf          1.51     /**
707                             Gets the number of qualifiers in the method.
708 karl           1.41         <p><b>Example:</b>
709                             <pre>
710 kumpf          1.42             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
711                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
712                                 m1.addQualifier(CIMQualifier(CIMName ("stuff2"), true));
713                                 CIMConstMethod m2(m1);
714 jim.wunderlich 1.49             assert(m2.getQualifierCount() == 2);
715 karl           1.41         </pre>
716 kumpf          1.51         @return An integer count of the CIMQualifiers in the CIMMethod.
717                             @exception UninitializedObjectException If the object is not
718                                 initialized.
719 karl           1.38     */
720 kumpf          1.20     Uint32 getQualifierCount() const;
721                     
722 kumpf          1.51     /**
723                             Finds a parameter by name.
724 karl           1.41         <p><b>Example:</b>
725                             <pre>
726                                 Uint32 posParameter;
727                                 posParameter = m1.findParameter(CIMName ("ipaddress"));
728                                 if (posParameter != PEG_NOT_FOUND)
729                                     ...
730                             </pre>
731 kumpf          1.51         @param name A CIMName specifying the name of the parameter to be found.
732                             @return Index of the parameter if found or PEG_NOT_FOUND if not found.
733                             @exception UninitializedObjectException If the object is not
734                                 initialized.
735 karl           1.38     */
736 kumpf          1.30     Uint32 findParameter(const CIMName& name) const;
737 kumpf          1.20 
738 kumpf          1.51     /**
739                             Gets the parameter at the specified index.
740 karl           1.41         <p><b>Example:</b>
741                             <pre>
742 kumpf          1.42             CIMConstParameter cp;
743                                 Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
744                                 if (parameterIndex != PEG_NOT_FOUND)
745                                 {
746                                     cp = m1.getParameter(parameterIndex);
747                                 }
748 karl           1.41         </pre>
749 kumpf          1.51         @param index The index of the parameter to be retrieved.
750                             @return The CIMConstParameter at the specified index.
751                             @exception IndexOutOfBoundsException If the index is
752                                 outside the range of parameters available for the CIMMethod.
753                             @exception UninitializedObjectException If the object is not
754                                 initialized.
755 karl           1.38     */
756 kumpf          1.35     CIMConstParameter getParameter(Uint32 index) const;
757 kumpf          1.20 
758 kumpf          1.51     /**
759                             Gets the number of parameters in the method.
760                             @return An integer count of the CIMParameters in the CIMMethod.
761                             @exception UninitializedObjectException If the object is not
762                                 initialized.
763 karl           1.38     */
764 kumpf          1.20     Uint32 getParameterCount() const;
765                     
766 kumpf          1.51     /**
767                             Determines whether the object has been initialized.
768 kumpf          1.42         <p><b>Example:</b>
769                             <pre>
770                                 CIMConstMethod m1;
771 jim.wunderlich 1.49             assert(m1.isUninitialized());
772 kumpf          1.42         </pre>
773 kumpf          1.51         @return True if the object has not been initialized, false otherwise.
774 karl           1.41      */
775 kumpf          1.32     Boolean isUninitialized() const;
776 kumpf          1.20 
777 kumpf          1.51     /**
778                             Compares the method with another method.
779 karl           1.41         <p><b>Example:</b>
780                             <pre>
781 kumpf          1.42             CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
782 karl           1.41             CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING);
783 jim.wunderlich 1.49             assert(!m1.identical(m2));
784 karl           1.41         </pre>
785 kumpf          1.51         @param x The CIMConstMethod to be compared.
786                             @return True if this method is identical to the one specified,
787                                 false otherwise.
788                             @exception UninitializedObjectException If either of the objects
789                                 is not initialized.
790 karl           1.38     */
791 kumpf          1.20     Boolean identical(const CIMConstMethod& x) const;
792                     
793 kumpf          1.51     /**
794                             Makes a deep copy of the method.  This creates a new copy
795                             of all the method attributes including parameters and qualifiers.
796                             @return A CIMMethod object with a separate copy of the
797                                 CIMConstMethod object.
798                             @exception UninitializedObjectException If the object is not
799                                 initialized.
800 karl           1.38     */
801 kumpf          1.20     CIMMethod clone() const;
802 mike           1.17 
803                     private:
804                     
805                         CIMMethodRep* _rep;
806                     
807                         friend class CIMMethod;
808                         friend class CIMMethodRep;
809 kumpf          1.22     friend class XmlWriter;
810 kumpf          1.23     friend class MofWriter;
811 mike           1.17 };
812                     
813                     #define PEGASUS_ARRAY_T CIMMethod
814 kumpf          1.24 # include <Pegasus/Common/ArrayInter.h>
815 mike           1.17 #undef PEGASUS_ARRAY_T
816                     
817                     PEGASUS_NAMESPACE_END
818                     
819                     #endif /* Pegasus_Method_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2