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