(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 mike           1.17     */
184 kumpf          1.30     void setName(const CIMName& name);
185 mike           1.17 
186 kumpf          1.51     /**
187                             Gets the method return type.
188 karl           1.40         <p><b>Example:</b>
189 karl           1.38         <pre>
190 karl           1.39             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
191 jim.wunderlich 1.49             assert(m1.getType() == CIMTYPE_STRING);
192 karl           1.38         </pre>
193 kumpf          1.51         @return A CIMType containing the method return type.
194                             @exception UninitializedObjectException If the object is not
195                                 initialized.
196 mike           1.17     */
197 kumpf          1.20     CIMType getType() const;
198 mike           1.17 
199 kumpf          1.51     /**
200                             Sets the method return type to the specified CIMType.
201 karl           1.41         This is the type of the CIMValue
202 kumpf          1.42         that is returned on a CIM method invocation.
203 karl           1.40         <p><b>Example:</b>
204 karl           1.38         <pre>
205 kumpf          1.42             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
206 karl           1.38             m1.setName(CIMName ("getVersion"));
207 jim.wunderlich 1.49             assert(m1.getName() == CIMName ("getVersion"));
208 karl           1.38         </pre>
209 kumpf          1.51         @param type CIMType to be set into the CIMMethod object.
210                             @exception UninitializedObjectException If the object is not
211                                 initialized.
212 mike           1.17     */
213 kumpf          1.20     void setType(CIMType type);
214 mike           1.17 
215 kumpf          1.51     /**
216                             Gets the class in which this method is locally defined.  This
217                             information is normally available with methods that are part of
218                             schema returned from a CIM Server.
219 kumpf          1.42         @return CIMName containing the classOrigin attribute.
220 kumpf          1.51         @exception UninitializedObjectException If the object is not
221                                 initialized.
222 mike           1.17     */
223 kumpf          1.30     const CIMName& getClassOrigin() const;
224 mike           1.17 
225 kumpf          1.51     /**
226                             Sets the classOrigin attribute with the specified class name.
227 kumpf          1.42         Normally this method is used internally by a CIM Server when
228                             defining methods in the context of a schema.
229 kumpf          1.51         @param classOrigin A CIMName specifying the name of the class of
230                                 origin for the method.
231                             @exception UninitializedObjectException If the object is not
232                                 initialized.
233 kumpf          1.20     */
234 kumpf          1.30     void setClassOrigin(const CIMName& classOrigin);
235 mike           1.17 
236 kumpf          1.51     /**
237                             Tests the propagated attribute of the object.  The propagated
238 kumpf          1.42         attribute indicates whether this method was propagated from a
239                             higher-level class.  Normally this attribute is set as part of
240                             defining a method in the context of a schema.  It is set in
241                             methods retrieved from a CIM Server.
242                             @return True if method is propagated; otherwise, false.
243 kumpf          1.51         @exception UninitializedObjectException If the object is not
244                                 initialized.
245 kumpf          1.20     */
246                         Boolean getPropagated() const;
247 mike           1.17 
248 kumpf          1.51     /**
249                             Sets the propagated attribute.  Normally this is used by a CIM Server
250 kumpf          1.42         when defining a method in the context of a schema.
251 kumpf          1.51         @param propagated A Boolean indicating whether the method is
252                                 propagated from a superclass.
253                             @exception UninitializedObjectException If the object is not
254                                 initialized.
255 kumpf          1.36     */
256 kumpf          1.20     void setPropagated(Boolean propagated);
257 mike           1.17 
258 kumpf          1.51     /**
259                             Adds a qualifier to the method.
260 karl           1.40         <p><b>Example:</b>
261 karl           1.38         <pre>
262                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
263                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
264                             </pre>
265 kumpf          1.51         @param x The CIMQualifier to be added.
266                             @return A reference to this CIMMethod object.
267                             @exception AlreadyExistsException If a qualifier with the
268                                 same name already exists in the CIMMethod.
269                             @exception UninitializedObjectException If the object is not
270                                 initialized.
271 mike           1.17     */
272 kumpf          1.20     CIMMethod& addQualifier(const CIMQualifier& x);
273 mike           1.17 
274 kumpf          1.51     /**
275                             Finds a qualifier by name.
276 karl           1.40         <p><b>Example:</b>
277 karl           1.38         <pre>
278                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
279                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
280 jim.wunderlich 1.49             assert(m1.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
281 karl           1.38         </pre>
282 kumpf          1.51         @param name A CIMName specifying the name of the qualifier to be found.
283                             @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
284                             @exception UninitializedObjectException If the object is not
285                                 initialized.
286 mike           1.17     */
287 kumpf          1.30     Uint32 findQualifier(const CIMName& name) const;
288 mike           1.17 
289 kumpf          1.51     /**
290                             Gets the qualifier at the specified index.
291 karl           1.40         <p><b>Example:</b>
292 karl           1.38         <pre>
293                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
294                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
295 kumpf          1.42             Uint32 posQualifier = m1.findQualifier(CIMName ("stuff"));
296                                 if (posQualifier != PEG_NOT_FOUND)
297                                 {
298                                     CIMQualifier q = m1.getQualifier(posQualifier);
299                                 }
300 karl           1.38         </pre>
301 kumpf          1.51         @param index The index of the qualifier to be retrieved.
302                             @return The CIMQualifier object at the specified index.
303                             @exception IndexOutOfBoundsException If the index is
304                                 outside the range of qualifiers available for the CIMMethod.
305                             @exception UninitializedObjectException If the object is not
306                                 initialized.
307 mike           1.17     */
308 kumpf          1.35     CIMQualifier getQualifier(Uint32 index);
309 kumpf          1.20 
310 kumpf          1.51     /**
311                             Gets the qualifier at the specified index.
312 karl           1.40         <p><b>Example:</b>
313 karl           1.38         <pre>
314                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
315                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
316 kumpf          1.42             const CIMMethod m2 = m1;
317                                 Uint32 posQualifier = m2.findQualifier(CIMName ("stuff"));
318                                 if (posQualifier != PEG_NOT_FOUND)
319                                 {
320                                     CIMConstQualifier q = m2.getQualifier(posQualifier);
321                                 }
322 karl           1.38         </pre>
323 kumpf          1.51         @param index The index of the qualifier to be retrieved.
324                             @return The CIMConstQualifier object at the specified index.
325                             @exception IndexOutOfBoundsException If the index is
326                                 outside the range of qualifiers available for the CIMMethod.
327                             @exception UninitializedObjectException If the object is not
328                                 initialized.
329 kumpf          1.36     */
330 kumpf          1.35     CIMConstQualifier getQualifier(Uint32 index) const;
331 mike           1.17 
332 kumpf          1.51     /**
333                             Removes a qualifier from the method.
334 karl           1.41         <p><b>Example:</b>
335                             <pre>
336                                 // remove all qualifiers from a class
337 kumpf          1.42             Uint32 count = 0;
338 kumpf          1.52             while ((count = cimClass.getQualifierCount()) > 0)
339 kumpf          1.42                 cimClass.removeQualifier(count - 1);
340 karl           1.41         </pre>
341 kumpf          1.51         @param index The index of the qualifier to remove.
342                             @exception IndexOutOfBoundsException If the index is
343                                 outside the range of qualifiers available for the CIMMethod.
344                             @exception UninitializedObjectException If the object is not
345                                 initialized.
346 mike           1.17     */
347 kumpf          1.35     void removeQualifier(Uint32 index);
348 mike           1.17 
349 kumpf          1.51     /**
350                             Gets the number of qualifiers in the method.
351 karl           1.40         <p><b>Example:</b>
352 karl           1.38         <pre>
353                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
354                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
355                                 m1.addQualifier(CIMQualifier(CIMName ("stuff2"), true));
356 jim.wunderlich 1.49             assert(m1.getQualifierCount() == 2);
357 karl           1.38         </pre>
358 kumpf          1.51         @return An integer count of the qualifiers in the CIMMethod.
359                             @exception UninitializedObjectException If the object is not
360                                 initialized.
361 mike           1.17     */
362 kumpf          1.20     Uint32 getQualifierCount() const;
363 mike           1.17 
364 kumpf          1.51     /**
365                             Adds a parameter to the method.
366 karl           1.40         <p><b>Example:</b>
367 karl           1.38         <pre>
368                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
369 kumpf          1.51             m1.addParameter(CIMParameter(CIMName("ipaddress"), CIMTYPE_STRING));
370 karl           1.38         </pre>
371 kumpf          1.51         @param x The CIMParameter to be added.
372                             @return A reference to this CIMMethod object.
373                             @exception AlreadyExistsException If a parameter with the
374                                 same name already exists in the CIMMethod.
375                             @exception UninitializedObjectException If the object is not
376                                 initialized.
377 mike           1.17     */
378 kumpf          1.20     CIMMethod& addParameter(const CIMParameter& x);
379 mike           1.17 
380 kumpf          1.51     /**
381                             Finds a parameter by name.
382 karl           1.40         <p><b>Example:</b>
383 karl           1.38         <pre>
384                                 Uint32 posParameter;
385                                 posParameter = m1.findParameter(CIMName ("ipaddress"));
386                                 if (posParameter != PEG_NOT_FOUND)
387                                     ...
388                             </pre>
389 kumpf          1.51         @param name A CIMName specifying the name of the parameter to be found.
390                             @return Index of the parameter if found or PEG_NOT_FOUND if not found.
391                             @exception UninitializedObjectException If the object is not
392                                 initialized.
393 mike           1.17     */
394 kumpf          1.30     Uint32 findParameter(const CIMName& name) const;
395 mike           1.17 
396 kumpf          1.51     /**
397                             Gets the parameter at the specified index.
398 karl           1.40         <p><b>Example:</b>
399 karl           1.38         <pre>
400 kumpf          1.42             CIMParameter cp;
401                                 Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
402                                 if (parameterIndex != PEG_NOT_FOUND)
403                                 {
404                                     cp = m1.getParameter(parameterIndex);
405                                 }
406 karl           1.38         </pre>
407 kumpf          1.51         @param index The index of the parameter to be retrieved.
408                             @return The CIMParameter at the specified index.
409                             @exception IndexOutOfBoundsException If the index is outside
410                                 the range of parameters available for the CIMMethod.
411                             @exception UninitializedObjectException If the object is not
412                                 initialized.
413 mike           1.17     */
414 kumpf          1.35     CIMParameter getParameter(Uint32 index);
415 kumpf          1.26 
416 kumpf          1.51     /**
417                             Gets the parameter at the specified index.
418 kumpf          1.42         <p><b>Example:</b>
419                             <pre>
420                                 CIMConstParameter cp;
421                                 Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
422                                 if (parameterIndex != PEG_NOT_FOUND)
423                                 {
424                                     cp = m1.getParameter(parameterIndex);
425                                 }
426                             </pre>
427 kumpf          1.51         @param index The index of the parameter to be retrieved.
428                             @return The CIMConstParameter at the specified index.
429                             @exception IndexOutOfBoundsException If the index is outside
430                                 the range of parameters available for the CIMMethod.
431                             @exception UninitializedObjectException If the object is not
432                                 initialized.
433 kumpf          1.36     */
434 kumpf          1.35     CIMConstParameter getParameter(Uint32 index) const;
435 kumpf          1.33 
436 kumpf          1.51     /**
437                             Removes a parameter from the method.
438 karl           1.40         @param index Index of the parameter to be removed.
439 kumpf          1.51         @exception IndexOutOfBoundsException If the index is outside the
440 karl           1.38             range of parameters available from the CIMMethod.
441 kumpf          1.51         @exception UninitializedObjectException If the object is not
442                                 initialized.
443 kumpf          1.33     */
444 kumpf          1.35     void removeParameter (Uint32 index);
445 mike           1.17 
446 kumpf          1.51     /**
447                             Gets the number of parameters in the method.
448                             @return An integer count of the CIMParameters in the CIMMethod.
449                             @exception UninitializedObjectException If the object is not
450                                 initialized.
451 mike           1.17     */
452 kumpf          1.20     Uint32 getParameterCount() const;
453 mike           1.17 
454 kumpf          1.51     /**
455                             Determines whether the object has been initialized.
456 karl           1.41         <p><b>Example:</b>
457                             <pre>
458                                 CIMMethod m1;
459 jim.wunderlich 1.49             assert(m1.isUninitialized());
460 karl           1.41         </pre>
461 kumpf          1.51         @return True if the object has not been initialized, false otherwise.
462                         */
463 kumpf          1.32     Boolean isUninitialized() const;
464 mike           1.17 
465 kumpf          1.51     /**
466                             Compares the method with another method.
467 karl           1.40         <p><b>Example:</b>
468 karl           1.38         <pre>
469                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
470 karl           1.41             CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING);
471 jim.wunderlich 1.49             assert(!m1.identical(m2));
472 karl           1.38         </pre>
473 kumpf          1.51         @param x The CIMConstMethod to be compared.
474                             @return True if this method is identical to the one specified,
475                                 false otherwise.
476                             @exception UninitializedObjectException If either of the objects
477                                 is not initialized.
478 mike           1.17     */
479                         Boolean identical(const CIMConstMethod& x) const;
480                     
481 kumpf          1.51     /**
482                             Makes a deep copy of the method.  This creates a new copy
483                             of all the method attributes including parameters and qualifiers.
484                             @return A new copy of the CIMMethod object.
485                             @exception UninitializedObjectException If the object is not
486                                 initialized.
487 kumpf          1.36     */
488 kumpf          1.20     CIMMethod clone() const;
489 mike           1.17 
490                     private:
491                     
492 kumpf          1.20     CIMMethod(CIMMethodRep* rep);
493 mike           1.17 
494 kumpf          1.51     /**
495                             This method is not implemented.  It is defined to explicitly disallow
496 kumpf          1.42         construction of a CIMMethod from a CIMConstMethod.  Because the
497                             CIMMethod class uses a shared representation model, allowing this
498                             construction would effectively allow modification of CIMConstMethod
499                             objects.
500                         */
501 kumpf          1.53     explicit CIMMethod(const CIMConstMethod& x);
502 mike           1.17 
503 kumpf          1.20     void _checkRep() const;
504 mike           1.17 
505                         CIMMethodRep* _rep;
506                         friend class CIMConstMethod;
507 kumpf          1.28     friend class Resolver;
508 kumpf          1.22     friend class XmlWriter;
509 kumpf          1.23     friend class MofWriter;
510 schuur         1.44     friend class BinaryStreamer;
511 mike           1.17 };
512                     
513 kumpf          1.51 /**
514                         The CIMConstMethod class provides a const interface to a CIMMethod
515                         object.  This class is needed because the shared representation model
516                         used by CIMMethod does not prevent modification to a const CIMMethod
517                         object.  Note that the value of a CIMConstMethod object could still be
518                         modified by a CIMMethod object that refers to the same data copy.
519 karl           1.38 */
520 mike           1.17 class PEGASUS_COMMON_LINKAGE CIMConstMethod
521                     {
522                     public:
523                     
524 kumpf          1.51     /**
525                             Constructs an uninitialized CIMConstMethod object.  A method
526                             invocation on an uninitialized object will result in the throwing
527                             of an UninitializedObjectException.  An uninitialized object may
528                             be converted into an initialized object only by using the assignment
529                             operator with an initialized object.
530 karl           1.38     */
531 kumpf          1.20     CIMConstMethod();
532 mike           1.17 
533 kumpf          1.51     /**
534                             Constructs a CIMConstMethod object from the value of a specified
535                             CIMConstMethod object, so that both objects refer to the same data
536                             copy.
537                     
538 kumpf          1.42         <p><b>Example:</b>
539 karl           1.41         <pre>
540 kumpf          1.42             CIMConstMethod cm1(CIMName ("getHostName"), CIMTYPE_STRING);
541                                 CIMConstMethod cm2(m1);
542 karl           1.41         </pre>
543 kumpf          1.51 
544                             @param x The CIMConstMethod object from which to construct a new
545                             CIMConstMethod object.
546 karl           1.41     */
547 kumpf          1.20     CIMConstMethod(const CIMConstMethod& x);
548 mike           1.17 
549 kumpf          1.51     /**
550                             Constructs a CIMConstMethod object from the value of a specified
551                             CIMMethod object, so that both objects refer to the same data
552                             copy.
553                     
554 kumpf          1.42         <p><b>Example:</b>
555                             <pre>
556                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
557                                 CIMConstMethod cm1(m1);
558                             </pre>
559 kumpf          1.51 
560                             @param x The CIMMethod object from which to construct a new
561                                 CIMConstMethod object.
562 karl           1.38     */
563 kumpf          1.20     CIMConstMethod(const CIMMethod& x);
564 mike           1.17 
565 kumpf          1.51     /**
566                             Constructs a CIMConstMethod object with the specified attributes.
567                             <p><b>Example:</b>
568                             <pre>
569                                 CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
570                             </pre>
571                     
572 karl           1.41         @param name CIMName defining the name for the method.
573 kumpf          1.42         @param type CIMType defining the method return type.
574                             @param classOrigin (optional) CIMName representing the class origin.
575                                 Note that this should normally not be used.  If not provided set to
576 karl           1.41             CIMName() (Null name).
577 kumpf          1.42         @param propagated Optional flag indicating whether the definition of
578                                 the CIM Method is local to the CIM Class (respectively, Instance)
579                                 in which it appears, or was propagated without modification from
580                                 a superclass. Default is false. Note that this attribute is
581                                 normally not set by CIM Clients but is used internally within the
582                                 CIM Server.
583 kumpf          1.51         @exception UninitializedObjectException If the method name is null.
584 karl           1.41     */
585 mike           1.17     CIMConstMethod(
586 kumpf          1.42         const CIMName& name,
587                             CIMType type,
588                             const CIMName& classOrigin = CIMName(),
589                             Boolean propagated = false);
590 kumpf          1.20 
591 kumpf          1.51     /**
592                             Destructs the CIMConstMethod object.
593 karl           1.41     */
594 kumpf          1.20     ~CIMConstMethod();
595                     
596 kumpf          1.51     /**
597                             Assigns the value of the specified CIMConstMethod object to this
598                             object, so that both objects refer to the same data copy.
599 kumpf          1.42 
600 karl           1.41         <p><b>Example:</b>
601                             <pre>
602                                 CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
603                                 CIMConstMethod m2;
604                                 m2 = m1;
605                             </pre>
606 kumpf          1.51 
607                             @param x The CIMConstMethod object from which to assign this
608                                 CIMConstMethod object.
609                             @return A reference to this CIMConstMethod object.
610 karl           1.39     */
611 kumpf          1.20     CIMConstMethod& operator=(const CIMConstMethod& x);
612                     
613 kumpf          1.51     /**
614                             Assigns the value of the specified CIMMethod object to this
615                             object, so that both objects refer to the same data copy.
616 kumpf          1.42 
617 karl           1.41         <p><b>Example:</b>
618                             <pre>
619                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
620                                 CIMConstMethod m2;
621                                 m2 = m1;
622                             </pre>
623 kumpf          1.51 
624                             @param x The CIMMethod object from which to assign this
625                                 CIMConstMethod object.
626                             @return A reference to this CIMConstMethod object.
627 karl           1.41     */
628 kumpf          1.20     CIMConstMethod& operator=(const CIMMethod& x);
629                     
630 kumpf          1.51     /**
631                             Gets the name of the method.
632 karl           1.41         <p><b>Example:</b>
633                             <pre>
634                                 CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
635 jim.wunderlich 1.49             assert(m1.getName() == CIMName ("getHostName"));
636 karl           1.41         </pre>
637 kumpf          1.51         @return CIMName with the name of the method.
638                             @exception UninitializedObjectException If the object is not
639                                 initialized.
640 karl           1.38     */
641 kumpf          1.30     const CIMName& getName() const;
642 kumpf          1.20 
643 kumpf          1.51     /**
644                             Gets the method return type.
645 karl           1.41         <p><b>Example:</b>
646                             <pre>
647                                 CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
648 jim.wunderlich 1.49             assert(m1.getType() == CIMTYPE_STRING);
649 karl           1.41         </pre>
650 kumpf          1.51         @return A CIMType containing the method return type.
651                             @exception UninitializedObjectException If the object is not
652                                 initialized.
653 karl           1.38     */
654 kumpf          1.20     CIMType getType() const;
655                     
656 kumpf          1.51     /**
657                             Gets the class in which this method was defined. This information
658 kumpf          1.42         is normally available with methods that are part of a schema
659                             returned from a CIM Server.
660                             @return CIMName containing the classOrigin attribute.
661 kumpf          1.51         @exception UninitializedObjectException If the object is not
662                                 initialized.
663 karl           1.38     */
664 kumpf          1.30     const CIMName& getClassOrigin() const;
665 kumpf          1.20 
666 kumpf          1.51     /**
667                             Tests the propagated attribute of the object.  The propagated
668 kumpf          1.42         attribute indicates whether this method was propagated from a
669                             higher-level class.  Normally this attribute is set as part of
670                             defining a method in the context of a schema.  It is set in
671                             methods retrieved from a CIM Server.
672                             @return True if method is propagated; otherwise, false.
673 kumpf          1.51         @exception UninitializedObjectException If the object is not
674                                 initialized.
675 karl           1.38     */
676 kumpf          1.20     Boolean getPropagated() const;
677                     
678 kumpf          1.51     /**
679                             Finds a qualifier by name.
680 karl           1.41         <p><b>Example:</b>
681                             <pre>
682 kumpf          1.42             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
683 karl           1.41             m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
684 kumpf          1.42             CIMConstMethod m2(m1);
685 jim.wunderlich 1.49             assert(m2.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
686 karl           1.41         </pre>
687 kumpf          1.51         @param name A CIMName specifying the name of the qualifier to be found.
688                             @return Index of the qualifier if found or PEG_NOT_FOUND if not found.
689                             @exception UninitializedObjectException If the object is not
690                                 initialized.
691 karl           1.38     */
692 kumpf          1.30     Uint32 findQualifier(const CIMName& name) const;
693 kumpf          1.20 
694 kumpf          1.51     /**
695                             Gets the qualifier at the specified index.
696 karl           1.41         <p><b>Example:</b>
697                             <pre>
698                                 CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
699                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
700 kumpf          1.42             CIMConstMethod m2(m1);
701                                 Uint32 posQualifier = m2.findQualifier(CIMName ("stuff"));
702                                 if (posQualifier != PEG_NOT_FOUND)
703                                 {
704                                     CIMQualifier q = m2.getQualifier(posQualifier);
705                                 }
706 karl           1.41         </pre>
707 kumpf          1.51         @param index The index of the qualifier to be retrieved.
708                             @return The CIMConstQualifier at the specified index.
709                             @exception IndexOutOfBoundsException If the index is
710                                 outside the range of qualifiers available for the CIMMethod.
711                             @exception UninitializedObjectException If the object is not
712                                 initialized.
713 karl           1.38     */
714 kumpf          1.35     CIMConstQualifier getQualifier(Uint32 index) const;
715 kumpf          1.20 
716 kumpf          1.51     /**
717                             Gets the number of qualifiers in the method.
718 karl           1.41         <p><b>Example:</b>
719                             <pre>
720 kumpf          1.42             CIMMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
721                                 m1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
722                                 m1.addQualifier(CIMQualifier(CIMName ("stuff2"), true));
723                                 CIMConstMethod m2(m1);
724 jim.wunderlich 1.49             assert(m2.getQualifierCount() == 2);
725 karl           1.41         </pre>
726 kumpf          1.51         @return An integer count of the CIMQualifiers in the CIMMethod.
727                             @exception UninitializedObjectException If the object is not
728                                 initialized.
729 karl           1.38     */
730 kumpf          1.20     Uint32 getQualifierCount() const;
731                     
732 kumpf          1.51     /**
733                             Finds a parameter by name.
734 karl           1.41         <p><b>Example:</b>
735                             <pre>
736                                 Uint32 posParameter;
737                                 posParameter = m1.findParameter(CIMName ("ipaddress"));
738                                 if (posParameter != PEG_NOT_FOUND)
739                                     ...
740                             </pre>
741 kumpf          1.51         @param name A CIMName specifying the name of the parameter to be found.
742                             @return Index of the parameter if found or PEG_NOT_FOUND if not found.
743                             @exception UninitializedObjectException If the object is not
744                                 initialized.
745 karl           1.38     */
746 kumpf          1.30     Uint32 findParameter(const CIMName& name) const;
747 kumpf          1.20 
748 kumpf          1.51     /**
749                             Gets the parameter at the specified index.
750 karl           1.41         <p><b>Example:</b>
751                             <pre>
752 kumpf          1.42             CIMConstParameter cp;
753                                 Uint32 parameterIndex = m1.findParameter(CIMName ("ipaddress"));
754                                 if (parameterIndex != PEG_NOT_FOUND)
755                                 {
756                                     cp = m1.getParameter(parameterIndex);
757                                 }
758 karl           1.41         </pre>
759 kumpf          1.51         @param index The index of the parameter to be retrieved.
760                             @return The CIMConstParameter at the specified index.
761                             @exception IndexOutOfBoundsException If the index is
762                                 outside the range of parameters available for the CIMMethod.
763                             @exception UninitializedObjectException If the object is not
764                                 initialized.
765 karl           1.38     */
766 kumpf          1.35     CIMConstParameter getParameter(Uint32 index) const;
767 kumpf          1.20 
768 kumpf          1.51     /**
769                             Gets the number of parameters in the method.
770                             @return An integer count of the CIMParameters in the CIMMethod.
771                             @exception UninitializedObjectException If the object is not
772                                 initialized.
773 karl           1.38     */
774 kumpf          1.20     Uint32 getParameterCount() const;
775                     
776 kumpf          1.51     /**
777                             Determines whether the object has been initialized.
778 kumpf          1.42         <p><b>Example:</b>
779                             <pre>
780                                 CIMConstMethod m1;
781 jim.wunderlich 1.49             assert(m1.isUninitialized());
782 kumpf          1.42         </pre>
783 kumpf          1.51         @return True if the object has not been initialized, false otherwise.
784 karl           1.41      */
785 kumpf          1.32     Boolean isUninitialized() const;
786 kumpf          1.20 
787 kumpf          1.51     /**
788                             Compares the method with another method.
789 karl           1.41         <p><b>Example:</b>
790                             <pre>
791 kumpf          1.42             CIMConstMethod m1(CIMName ("getHostName"), CIMTYPE_STRING);
792 karl           1.41             CIMConstMethod m2(CIMName ("test"), CIMTYPE_STRING);
793 jim.wunderlich 1.49             assert(!m1.identical(m2));
794 karl           1.41         </pre>
795 kumpf          1.51         @param x The CIMConstMethod to be compared.
796                             @return True if this method is identical to the one specified,
797                                 false otherwise.
798                             @exception UninitializedObjectException If either of the objects
799                                 is not initialized.
800 karl           1.38     */
801 kumpf          1.20     Boolean identical(const CIMConstMethod& x) const;
802                     
803 kumpf          1.51     /**
804                             Makes a deep copy of the method.  This creates a new copy
805                             of all the method attributes including parameters and qualifiers.
806                             @return A CIMMethod object with a separate copy of the
807                                 CIMConstMethod object.
808                             @exception UninitializedObjectException If the object is not
809                                 initialized.
810 karl           1.38     */
811 kumpf          1.20     CIMMethod clone() const;
812 mike           1.17 
813                     private:
814                     
815 kumpf          1.20     void _checkRep() const;
816 mike           1.17 
817                         CIMMethodRep* _rep;
818                     
819                         friend class CIMMethod;
820                         friend class CIMMethodRep;
821 kumpf          1.22     friend class XmlWriter;
822 kumpf          1.23     friend class MofWriter;
823 mike           1.17 };
824                     
825                     #define PEGASUS_ARRAY_T CIMMethod
826 kumpf          1.24 # include <Pegasus/Common/ArrayInter.h>
827 mike           1.17 #undef PEGASUS_ARRAY_T
828                     
829                     PEGASUS_NAMESPACE_END
830                     
831                     #endif /* Pegasus_Method_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2