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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2