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

  1 mike  1.1 //BEGIN_LICENSE
  2           //
  3           // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
  4           //
  5           // Permission is hereby granted, free of charge, to any person obtaining a
  6           // copy of this software and associated documentation files (the "Software"),
  7           // to deal in the Software without restriction, including without limitation
  8           // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9           // and/or sell copies of the Software, and to permit persons to whom the
 10           // Software is furnished to do so, subject to the following conditions:
 11           //
 12           // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 13           // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 14           // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 15           // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 16           // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 17           // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 18           // DEALINGS IN THE SOFTWARE.
 19           //
 20           //END_LICENSE
 21           //BEGIN_HISTORY
 22 mike  1.1 //
 23           // Author:
 24           //
 25           // $Log: CIMMethod.h,v $
 26 mike  1.2 // Revision 1.1  2001/02/18 18:39:06  mike
 27           // new
 28           //
 29 mike  1.1 // Revision 1.2  2001/02/18 03:56:01  mike
 30 mike  1.2 // Changed more class names (e.g., ConstClassDecl -> ConstCIMClass)
 31 mike  1.1 //
 32           // Revision 1.1  2001/02/16 02:07:06  mike
 33           // Renamed many classes and headers (using new CIM prefixes).
 34           //
 35           // Revision 1.5  2001/02/16 00:34:17  mike
 36           // added ATTN
 37           //
 38           // Revision 1.4  2001/02/06 17:04:03  karl
 39           // add documentation
 40           //
 41           // Revision 1.3  2001/01/28 19:07:07  karl
 42           // add DOC++ comments
 43           //
 44           // Revision 1.2  2001/01/15 04:31:44  mike
 45           // worked on resolve scheme
 46           //
 47           // Revision 1.1.1.1  2001/01/14 19:52:57  mike
 48           // Pegasus import
 49           //
 50           //
 51           //END_HISTORY
 52 mike  1.1 
 53           /*
 54            CIMMethod.h - This header file defines the method class.
 55           */
 56           
 57           #ifndef Pegasus_Method_h
 58           #define Pegasus_Method_h
 59           
 60           #include <Pegasus/Common/Config.h>
 61           #include <Pegasus/Common/CIMMethodRep.h>
 62           
 63           PEGASUS_NAMESPACE_BEGIN
 64           
 65           
 66           class CIMConstMethod;
 67           
 68           /** Class CIMMethod - This class defines the operations associated with
 69           manipulation of the Pegasus implementation of the CIM CIMMethod.  Within this
 70           class, methods are provides for creation, deletion, and manipulation of method
 71           declarations.
 72           
 73 mike  1.1 */
 74           
 75           class PEGASUS_COMMON_LINKAGE CIMMethod
 76           {
 77           public:
 78               /// Creates and instantiates a CIM method.
 79               CIMMethod() : _rep(0)
 80               {
 81           
 82               }
 83               /** Creates and instantiates a CIM method from another method instance
 84               @return pointer to the new method instance
 85               */
 86               CIMMethod(const CIMMethod& x)
 87               {
 88           	Inc(_rep = x._rep);
 89               }
 90               ///
 91               CIMMethod& operator=(const CIMMethod& x)
 92               {
 93           	if (x._rep != _rep)
 94 mike  1.1 	{
 95           	    Dec(_rep);
 96           	    Inc(_rep = x._rep);
 97           	}
 98           	return *this;
 99               }
100           
101               // ATTN: remove the classOrigin and propagated parameters.
102           
103               /**	 Creates a CIM method with the specified name, type, and classOrigin
104               @param name for the method
105               @param type ATTN
106               @param classOrigin
107               @param propagated
108               @return  Throws IllegalName if name argument not legal CIM identifier.
109               */
110               CIMMethod(
111           	const String& name,
112           	CIMType type,
113           	const String& classOrigin = String(),
114           	Boolean propagated = false)
115 mike  1.1     {
116           	_rep = new CIMMethodRep(name, type, classOrigin, propagated);
117               }
118           
119               /// CIMMethod desctructor
120               ~CIMMethod()
121               {
122           	Dec(_rep);
123               }
124               /** CIMMethod getName - Gets the name of the method
125               @return String with the name of the method
126               */
127               const String& getName() const
128               {
129           	_checkRep();
130           	return _rep->getName();
131               }
132           
133               /** CIMMethod setName - Set the method name
134               @parm name ATTN (make reference to name defintion here)
135               @return Throws IllegalName if name argument not legal CIM identifier.
136 mike  1.1     */
137               void setName(const String& name)
138               {
139           	_checkRep();
140           	_rep->setName(name);
141               }
142               /** CIMMethod getType - gets the method type
143               @return The CIM method type for this method.
144               */
145           
146               CIMType getType() const
147               {
148           	_checkRep();
149           	return _rep->getType();
150               }
151               /** CIMMethod setType - Sets the method type to the specified CIM method
152               type as defined in CIMType /Ref{TYPE}
153               */
154               void setType(CIMType type)
155               {
156           	_checkRep();
157 mike  1.1 	_rep->setType(type);
158               }
159               /** CIMMethod getClassOrigin - Returns the class in which this method
160                was defined.
161               @return ATTN:
162               */
163               const String& getClassOrigin() const
164               {
165           	_checkRep();
166           	return _rep->getClassOrigin();
167               }
168               /** CIMMethod setClassOrigin - ATTN:
169               */
170               void setClassOrigin(const String& classOrigin)
171               {
172           	_checkRep();
173           	_rep->setClassOrigin(classOrigin);
174               }
175               /// method getPropagated - ATTN:
176               Boolean getPropagated() const
177               {
178 mike  1.1 	_checkRep();
179           	return _rep->getPropagated();
180               }
181               /// method setPropagated - ATTN:
182               void setPropagated(Boolean propagated)
183               {
184           	_checkRep();
185           	_rep->setPropagated(propagated);
186               }
187               /** CIMMethod addQualifier -
188               @parm CIMQualifier to add
189               @param CIMQualifier to be added
190               @return Throws AlreadyExists excetpion if the qualifier already exists in
191               the method
192               @exception 	AlreadyExists exception of CIMQualifier already exists.
193               */
194               CIMMethod& addQualifier(const CIMQualifier& x)
195               {
196           	_checkRep();
197           	_rep->addQualifier(x);
198           	return *this;
199 mike  1.1     }
200               /** CIMMethod findQualifier - Finds the CIMQualifier named by the input string.
201               @param String defining the name of the parameter to be found
202               @return Index to the parameter found or -1 if not found
203               The -1 must be converted to a Unit32 as follows:
204               <PRE>
205           	Uint32 pos = myClass.findProperty("name");
206           	if (pos == Uint32(-1))
207           	{
208           	    // Not found!
209           	}
210               </PRE>
211               */
212               Uint32 findQualifier(const String& name)
213               {
214           	_checkRep();
215           	return _rep->findQualifier(name);
216               }
217               /** CIMMethod findQualifier - Find the qualifier with the name defined on
218               input
219               @param String with the name of the parameter to be found.
220 mike  1.1     @return - index to the qualifier found or -1 if no qualifier found.
221               */
222               Uint32 findQualifier(const String& name) const
223               {
224           	_checkRep();
225           	return _rep->findQualifier(name);
226               }
227               /** CIMMethod getQualifier - Gets the CIMQualifier defined by the index input
228               as a parameter.
229               @param Index of the qualifier requested.
230               @return CIMQualifier object or exception
231               @exception OutOfBounds exception if the index is outside the range of
232               parameters available from the CIMMethod.
233               */
234               CIMQualifier getQualifier(Uint32 pos)
235               {
236           	_checkRep();
237           	return _rep->getQualifier(pos);
238               }
239           
240               CIMConstQualifier getQualifier(Uint32 pos) const
241 mike  1.1     {
242           	_checkRep();
243           	return _rep->getQualifier(pos);
244               }
245               /** CIMMethod getQualifierCount - Returns count of the number of Qualifiers
246               attached to the CIMMethod
247               @return integer representing number of Qualifiers.
248               */
249               Uint32 getQualifierCount() const
250               {
251           	_checkRep();
252           	return _rep->getQualifierCount();
253               }
254               /** CIMMethod addParameter - Adds the parameter defined by the input to the
255               CIMMethod
256               Param - ATTN:
257               */
258               CIMMethod& addParameter(const CIMParameter& x)
259               {
260           	_checkRep();
261           	_rep->addParameter(x);
262 mike  1.1 	return *this;
263               }
264               /// CIMMethod findParameter - ATTN:
265               Uint32 findParameter(const String& name)
266               {
267           	_checkRep();
268           	return _rep->findParameter(name);
269               }
270           
271               /** CIMMethod findParameter - Finds the parameter defined by the name input
272               and returns an index to the CIMParameter
273               @param String defining the parameter to be found
274               @return index to the parameter if found.  Returns -1 if parameter not
275               found
276               */
277                Uint32 findParameter(const String& name) const
278               {
279           	_checkRep();
280           	return _rep->findParameter(name);
281               }
282               /// CIMMethod getParameter - ATTN:
283 mike  1.1     CIMParameter getParameter(Uint32 pos)
284               {
285           	_checkRep();
286           	return _rep->getParameter(pos);
287               }
288           
289               /** CIMMethod getParameter - Gets the parameter defined by the index
290               input as a parameter.
291               @param index for the parameter to be returned.
292               @return CIMParameter requested.
293               @Exception OutOfBounds exception is thrown if the index is outside the
294               range of available parameters
295               */
296               CIMConstParameter getParameter(Uint32 pos) const
297               {
298           	_checkRep();
299           	return _rep->getParameter(pos);
300               }
301           
302               /** CIMMethod getParameterCount - Gets the count of the numbeer of Parameters
303               attached to the CIMMethod.
304 mike  1.1     @retrun - count of the number of parameters attached to the CIMMethod.
305               */
306               Uint32 getParameterCount() const
307               {
308           	_checkRep();
309           	return _rep->getParameterCount();
310               }
311               /// method resolve - ATTN:
312               void resolve(
313           	DeclContext* declContext,
314           	const String& nameSpace,
315           	const CIMConstMethod& method)
316               {
317           	_checkRep();
318           	_rep->resolve(declContext, nameSpace, method);
319               }
320               /// CIMMethod resolve
321               void resolve(
322           	DeclContext* declContext,
323           	const String& nameSpace)
324               {
325 mike  1.1 	_checkRep();
326           	_rep->resolve(declContext, nameSpace);
327               }
328               /// operator
329               operator int() const { return _rep != 0; }
330               /// method toXML - ATTN:
331               void toXml(Array<Sint8>& out) const
332               {
333           	_checkRep();
334           	_rep->toXml(out);
335               }
336               /// method print - ATTN:
337               void print() const
338               {
339           	_checkRep();
340           	_rep->print();
341               }
342               /// CIMMethod identical - ATTN
343               Boolean identical(const CIMConstMethod& x) const;
344               /// CIMMethod clone - ATTN
345               CIMMethod clone() const
346 mike  1.1     {
347           	return CIMMethod(_rep->clone());
348               }
349           
350           private:
351           
352               CIMMethod(CIMMethodRep* rep) : _rep(rep)
353               {
354               }
355           
356               explicit CIMMethod(const CIMConstMethod& x);
357           
358               void _checkRep() const
359               {
360           	if (!_rep)
361           	    throw UnitializedHandle();
362               }
363           
364               CIMMethodRep* _rep;
365               friend class CIMConstMethod;
366               friend class CIMClassRep;
367 mike  1.1 };
368           
369           ////////////////////////////////////////////////////////////////////////////////
370           //
371           // CIMConstMethod
372           //
373           ////////////////////////////////////////////////////////////////////////////////
374           
375           class PEGASUS_COMMON_LINKAGE CIMConstMethod
376           {
377           public:
378           
379               CIMConstMethod() : _rep(0)
380               {
381           
382               }
383           
384               CIMConstMethod(const CIMConstMethod& x)
385               {
386           	Inc(_rep = x._rep);
387               }
388 mike  1.1 
389               CIMConstMethod(const CIMMethod& x)
390               {
391           	Inc(_rep = x._rep);
392               }
393           
394               CIMConstMethod& operator=(const CIMConstMethod& x)
395               {
396           	if (x._rep != _rep)
397           	{
398           	    Dec(_rep);
399           	    Inc(_rep = x._rep);
400           	}
401           	return *this;
402               }
403           
404               CIMConstMethod& operator=(const CIMMethod& x)
405               {
406           	if (x._rep != _rep)
407           	{
408           	    Dec(_rep);
409 mike  1.1 	    Inc(_rep = x._rep);
410           	}
411           	return *this;
412               }
413           
414               // Throws IllegalName if name argument not legal CIM identifier.
415           
416               CIMConstMethod(
417           	const String& name,
418           	CIMType type,
419           	const String& classOrigin = String(),
420           	Boolean propagated = false)
421               {
422           	_rep = new CIMMethodRep(name, type, classOrigin, propagated);
423               }
424           
425               ~CIMConstMethod()
426               {
427           	Dec(_rep);
428               }
429           
430 mike  1.1     const String& getName() const
431               {
432           	_checkRep();
433           	return _rep->getName();
434               }
435           
436               CIMType getType() const
437               {
438           	_checkRep();
439           	return _rep->getType();
440               }
441           
442               const String& getClassOrigin() const
443               {
444           	_checkRep();
445           	return _rep->getClassOrigin();
446               }
447           
448               Boolean getPropagated() const
449               {
450           	_checkRep();
451 mike  1.1 	return _rep->getPropagated();
452               }
453           
454               Uint32 findQualifier(const String& name) const
455               {
456           	_checkRep();
457           	return _rep->findQualifier(name);
458               }
459           
460               Uint32 getQualifier(Uint32 pos) const
461               {
462           	_checkRep();
463           	return _rep->getQualifier(pos);
464               }
465           
466               Uint32 getQualifierCount() const
467               {
468           	_checkRep();
469           	return _rep->getQualifierCount();
470               }
471           
472 mike  1.1     Uint32 findParameter(const String& name) const
473               {
474           	_checkRep();
475           	return _rep->findParameter(name);
476               }
477           
478               CIMConstParameter getParameter(Uint32 pos) const
479               {
480           	_checkRep();
481           	return _rep->getParameter(pos);
482               }
483           
484               Uint32 getParameterCount() const
485               {
486           	_checkRep();
487           	return _rep->getParameterCount();
488               }
489           
490               operator int() const { return _rep != 0; }
491           
492               void toXml(Array<Sint8>& out) const
493 mike  1.1     {
494           	_checkRep();
495           	_rep->toXml(out);
496               }
497           
498               void print() const
499               {
500           	_checkRep();
501           	_rep->print();
502               }
503           
504               Boolean identical(const CIMConstMethod& x) const
505               {
506           	x._checkRep();
507           	_checkRep();
508           	return _rep->identical(x._rep);
509               }
510           
511               CIMMethod clone() const
512               {
513           	return CIMMethod(_rep->clone());
514 mike  1.1     }
515           
516           private:
517           
518               void _checkRep() const
519               {
520           	if (!_rep)
521           	    throw UnitializedHandle();
522               }
523           
524               CIMMethodRep* _rep;
525           
526               friend class CIMMethod;
527               friend class CIMMethodRep;
528           };
529           
530           PEGASUS_NAMESPACE_END
531           
532           #endif /* Pegasus_Method_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2