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