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

Diff for /pegasus/src/Pegasus/Common/CIMMethod.h between version 1.3 and 1.30

version 1.3, 2001/03/04 21:57:34 version 1.30, 2002/07/30 16:14:53
Line 1 
Line 1 
 //BEGIN_LICENSE  //%/////////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
   // The Open Group, Tivoli Systems
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a  // Permission is hereby granted, free of charge, to any person obtaining a copy
 // copy of this software and associated documentation files (the "Software"),  // of this software and associated documentation files (the "Software"), to
 // to deal in the Software without restriction, including without limitation  // deal in the Software without restriction, including without limitation the
 // the rights to use, copy, modify, merge, publish, distribute, sublicense,  // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // and/or sell copies of the Software, and to permit persons to whom the  // sell copies of the Software, and to permit persons to whom the Software is
 // Software is furnished to do so, subject to the following conditions:  // furnished to do so, subject to the following conditions:
   //
   // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
   // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
   // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
   // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
   // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
   // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
   // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   //
   //==============================================================================
   //
   // Author: Mike Brasher (mbrasher@bmc.com)
   //
   // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
   //              Carol Ann Krug Graves, Hewlett-Packard Company
   //                (carolann_graves@hp.com)
 // //
 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  //%/////////////////////////////////////////////////////////////////////////////
 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL  
 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING  
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER  
 // DEALINGS IN THE SOFTWARE.  
 //  
 //END_LICENSE  
 //BEGIN_HISTORY  
 //  
 // Author:  
 //  
 // $Log$  
 // Revision 1.3  2001/03/04 21:57:34  bob  
 // Changed print methods to take a stream instead of hardcoded cout  
 //  
 // Revision 1.2  2001/02/19 01:47:16  mike  
 // Renamed names of the form CIMConst to ConstCIM.  
 //  
 // Revision 1.1  2001/02/18 18:39:06  mike  
 // new  
 //  
 // Revision 1.2  2001/02/18 03:56:01  mike  
 // Changed more class names (e.g., ConstClassDecl -> ConstCIMClass)  
 //  
 // Revision 1.1  2001/02/16 02:07:06  mike  
 // Renamed many classes and headers (using new CIM prefixes).  
 //  
 // Revision 1.5  2001/02/16 00:34:17  mike  
 // added ATTN  
 //  
 // Revision 1.4  2001/02/06 17:04:03  karl  
 // add documentation  
 //  
 // Revision 1.3  2001/01/28 19:07:07  karl  
 // add DOC++ comments  
 //  
 // Revision 1.2  2001/01/15 04:31:44  mike  
 // worked on resolve scheme  
 //  
 // Revision 1.1.1.1  2001/01/14 19:52:57  mike  
 // Pegasus import  
 //  
 //  
 //END_HISTORY  
   
 /*  
  CIMMethod.h - This header file defines the method class.  
 */  
  
 #ifndef Pegasus_Method_h #ifndef Pegasus_Method_h
 #define Pegasus_Method_h #define Pegasus_Method_h
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/CIMMethodRep.h>  #include <Pegasus/Common/Linkage.h>
   #include <Pegasus/Common/String.h>
   #include <Pegasus/Common/CIMName.h>
   #include <Pegasus/Common/CIMParameter.h>
   #include <Pegasus/Common/CIMQualifier.h>
   #include <Pegasus/Common/CIMType.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   class Resolver;
 class CIMConstMethod; class CIMConstMethod;
   class CIMMethodRep;
  
       // ATTN: remove the classOrigin and propagated parameters.
 /** Class CIMMethod - This class defines the operations associated with /** Class CIMMethod - This class defines the operations associated with
 manipulation of the Pegasus implementation of the CIM CIMMethod.  Within this      manipulation of the Pegasus implementation of the CIM CIMMethod. Within
 class, methods are provides for creation, deletion, and manipulation of method      this class, methods are provides for creation, deletion, and manipulation
 declarations.      of method declarations.
   
 */ */
   
 class PEGASUS_COMMON_LINKAGE CIMMethod class PEGASUS_COMMON_LINKAGE CIMMethod
 { {
 public: public:
     /// Creates and instantiates a CIM method.  
     CIMMethod() : _rep(0)  
     {  
  
     }      /** Creates and instantiates a CIM method. */
       CIMMethod();
   
     /** Creates and instantiates a CIM method from another method instance     /** Creates and instantiates a CIM method from another method instance
     @return pointer to the new method instance     @return pointer to the new method instance
     */     */
     CIMMethod(const CIMMethod& x)      CIMMethod(const CIMMethod& x);
     {  
         Inc(_rep = x._rep);  
     }  
     ///  
     CIMMethod& operator=(const CIMMethod& x)  
     {  
         if (x._rep != _rep)  
         {  
             Dec(_rep);  
             Inc(_rep = x._rep);  
         }  
         return *this;  
     }  
   
     // ATTN: remove the classOrigin and propagated parameters.  
  
     /**  Creates a CIM method with the specified name, type, and classOrigin     /**  Creates a CIM method with the specified name, type, and classOrigin
     @param name for the method     @param name for the method
     @param type ATTN          @param type CIM data type of method to create
     @param classOrigin     @param classOrigin
     @param propagated     @param propagated
     @return  Throws IllegalName if name argument not legal CIM identifier.     @return  Throws IllegalName if name argument not legal CIM identifier.
     */     */
     CIMMethod(     CIMMethod(
         const String& name,          const CIMName& name,
         CIMType type,         CIMType type,
         const String& classOrigin = String(),          const CIMName& classOrigin = CIMName(),
         Boolean propagated = false)          Boolean propagated = false);
     {  
         _rep = new CIMMethodRep(name, type, classOrigin, propagated);  
     }  
  
     /// CIMMethod desctructor      /** Desctructor. */
     ~CIMMethod()      ~CIMMethod();
     {  
         Dec(_rep);      /** Assignment operator */
     }      CIMMethod& operator=(const CIMMethod& x);
     /** CIMMethod getName - Gets the name of the method  
     @return String with the name of the method      /** getName - Gets the name of the method
           @return CIMName with the name of the method
     */     */
     const String& getName() const      const CIMName& getName() const;
     {  
         _checkRep();  
         return _rep->getName();  
     }  
  
     /** CIMMethod setName - Set the method name      /** setName - Set the method name
     @parm name ATTN (make reference to name defintion here)          @param name
     @return Throws IllegalName if name argument not legal CIM identifier.          @exception IllegalName if name argument not legal CIM identifier.
     */     */
     void setName(const String& name)      void setName(const CIMName& name);
     {  
         _checkRep();      /** getType - gets the method type
         _rep->setName(name);  
     }  
     /** CIMMethod getType - gets the method type  
     @return The CIM method type for this method.     @return The CIM method type for this method.
     */     */
       CIMType getType() const;
  
     CIMType getType() const      /** setType - Sets the method type to the specified CIM method
     {  
         _checkRep();  
         return _rep->getType();  
     }  
     /** CIMMethod setType - Sets the method type to the specified CIM method  
     type as defined in CIMType /Ref{TYPE}     type as defined in CIMType /Ref{TYPE}
     */     */
     void setType(CIMType type)      void setType(CIMType type);
     {  
         _checkRep();      /** getClassOrigin - Returns the class in which this method
         _rep->setType(type);  
     }  
     /** CIMMethod getClassOrigin - Returns the class in which this method  
      was defined.      was defined.
     @return ATTN:          @return CIMName containing the classOrigin field.
     */     */
     const String& getClassOrigin() const      const CIMName& getClassOrigin() const;
     {  
         _checkRep();      /** setClassOrigin - Set the ClassOrigin attribute with
         return _rep->getClassOrigin();          the classname defined on input
     }          @param classOrigin - CIMName parameter defining the name
     /** CIMMethod setClassOrigin - ATTN:          of the class origin
     */     */
     void setClassOrigin(const String& classOrigin)      void setClassOrigin(const CIMName& classOrigin);
     {  
         _checkRep();      /** getPropagated - Tests the propogated qualifier
         _rep->setClassOrigin(classOrigin);          @return - returns True if method is propogated
     }  
     /// method getPropagated - ATTN:  
     Boolean getPropagated() const  
     {  
         _checkRep();  
         return _rep->getPropagated();  
     }  
     /// method setPropagated - ATTN:  
     void setPropagated(Boolean propagated)  
     {  
         _checkRep();  
         _rep->setPropagated(propagated);  
     }  
     /** CIMMethod addQualifier -  
     @parm CIMQualifier to add  
     @param CIMQualifier to be added  
     @return Throws AlreadyExists excetpion if the qualifier already exists in  
     the method  
     @exception  AlreadyExists exception of CIMQualifier already exists.  
     */     */
     CIMMethod& addQualifier(const CIMQualifier& x)      Boolean getPropagated() const;
     {  
         _checkRep();      /** setPropagated - Sets the Propagaged Qualifier */
         _rep->addQualifier(x);      void setPropagated(Boolean propagated);
         return *this;  
     }      /** addQualifier - Adds a Qualifier to the method object.
     /** CIMMethod findQualifier - Finds the CIMQualifier named by the input string.          @param CIMQualifier to be added
     @param String defining the name of the parameter to be found          @return Throws AlreadyExists excetpion if the qualifier already exists
     @return Index to the parameter found or -1 if not found          in the method
     The -1 must be converted to a Unit32 as follows:          @exception AlreadyExists exception
     <PRE>  
         Uint32 pos = myClass.findProperty("name");  
         if (pos == Uint32(-1))  
         {  
             // Not found!  
         }  
     </PRE>  
     */     */
     Uint32 findQualifier(const String& name)      CIMMethod& addQualifier(const CIMQualifier& x);
     {  
         _checkRep();      /** findQualifier - returns the position of the qualifier with
         return _rep->findQualifier(name);          the given name.
     }          @param name Name of qualifier to be found.
     /** CIMMethod findQualifier - Find the qualifier with the name defined on          @return index of the parameter if found; otherwise PEG_NOT_FOUND.
     input  
     @param String with the name of the parameter to be found.  
     @return - index to the qualifier found or -1 if no qualifier found.  
     */     */
     Uint32 findQualifier(const String& name) const      Uint32 findQualifier(const CIMName& name) const;
     {  
         _checkRep();      /** getQualifier - Gets the CIMQualifier defined by the index
         return _rep->findQualifier(name);          input as a parameter.
     }  
     /** CIMMethod getQualifier - Gets the CIMQualifier defined by the index input  
     as a parameter.  
     @param Index of the qualifier requested.     @param Index of the qualifier requested.
     @return CIMQualifier object or exception     @return CIMQualifier object or exception
     @exception OutOfBounds exception if the index is outside the range of     @exception OutOfBounds exception if the index is outside the range of
     parameters available from the CIMMethod.     parameters available from the CIMMethod.
     */     */
     CIMQualifier getQualifier(Uint32 pos)      CIMQualifier getQualifier(Uint32 pos);
     {  
         _checkRep();  
         return _rep->getQualifier(pos);  
     }  
  
     CIMConstQualifier getQualifier(Uint32 pos) const      CIMConstQualifier getQualifier(Uint32 pos) const;
     {  
         _checkRep();      /** removeQualifier - Removes the CIMQualifier defined by the
         return _rep->getQualifier(pos);          position input as a parameter.
     }          @param Position of the qualifier requested.
     /** CIMMethod getQualifierCount - Returns count of the number of Qualifiers          @return CIMQualifier object or exception
     attached to the CIMMethod          @exception OutOfBounds exception if the index is outside the range of
           parameters available from the CIMMethod.
       */
       void removeQualifier(Uint32 pos);
   
       /** getQualifierCount - Returns the number of Qualifiers attached
           to this CIMMethod object.
     @return integer representing number of Qualifiers.     @return integer representing number of Qualifiers.
     */     */
     Uint32 getQualifierCount() const      Uint32 getQualifierCount() const;
     {  
         _checkRep();      /** addParameter - Adds the parameter defined by the input
         return _rep->getQualifierCount();          to the CIMMethod
     }  
     /** CIMMethod addParameter - Adds the parameter defined by the input to the  
     CIMMethod  
     Param - ATTN:  
     */     */
     CIMMethod& addParameter(const CIMParameter& x)      CIMMethod& addParameter(const CIMParameter& x);
     {  
         _checkRep();      /** findParameter - Finds the parameter whose name is given
         _rep->addParameter(x);          by the name parameter.
         return *this;          @param name Name of parameter to be found.
     }          @return index of the parameter if found; otherwise PEG_NOT_FOUND.
     /// CIMMethod findParameter - ATTN:  
     Uint32 findParameter(const String& name)  
     {  
         _checkRep();  
         return _rep->findParameter(name);  
     }  
   
     /** CIMMethod findParameter - Finds the parameter defined by the name input  
     and returns an index to the CIMParameter  
     @param String defining the parameter to be found  
     @return index to the parameter if found.  Returns -1 if parameter not  
     found  
     */     */
      Uint32 findParameter(const String& name) const      Uint32 findParameter(const CIMName& name) const;
     {  
         _checkRep();  
         return _rep->findParameter(name);  
     }  
     /// CIMMethod getParameter - ATTN:  
     CIMParameter getParameter(Uint32 pos)  
     {  
         _checkRep();  
         return _rep->getParameter(pos);  
     }  
  
     /** CIMMethod getParameter - Gets the parameter defined by the index      /** getParameter - Gets the parameter defined by the index
     input as a parameter.     input as a parameter.
     @param index for the parameter to be returned.     @param index for the parameter to be returned.
     @return CIMParameter requested.     @return CIMParameter requested.
     @Exception OutOfBounds exception is thrown if the index is outside the     @Exception OutOfBounds exception is thrown if the index is outside the
     range of available parameters     range of available parameters
     */     */
     CIMConstParameter getParameter(Uint32 pos) const      CIMParameter getParameter(Uint32 pos);
     {  
         _checkRep();  
         return _rep->getParameter(pos);  
     }  
  
     /** CIMMethod getParameterCount - Gets the count of the numbeer of Parameters      /** getParameter - const form */
     attached to the CIMMethod.      CIMConstParameter getParameter(Uint32 pos) const;
   
       /** getParameterCount - Gets the count of the numbeer of
           Parameters attached to the CIMMethod.
     @retrun - count of the number of parameters attached to the CIMMethod.     @retrun - count of the number of parameters attached to the CIMMethod.
     */     */
     Uint32 getParameterCount() const      Uint32 getParameterCount() const;
     {  
         _checkRep();  #ifdef PEGASUS_INTERNALONLY
         return _rep->getParameterCount();      /** Returns true if CIMMethod refers to a null pointer */
     }      Boolean isNull() const;
     /// method resolve - ATTN:  #endif
     void resolve(  
         DeclContext* declContext,      /** identical - Returns true if this method is identical to the
         const String& nameSpace,          one given by the argument x.
         const CIMConstMethod& method)      */
     {  
         _checkRep();  
         _rep->resolve(declContext, nameSpace, method);  
     }  
     /// CIMMethod resolve  
     void resolve(  
         DeclContext* declContext,  
         const String& nameSpace)  
     {  
         _checkRep();  
         _rep->resolve(declContext, nameSpace);  
     }  
     /// operator  
     operator int() const { return _rep != 0; }  
     /// method toXML - ATTN:  
     void toXml(Array<Sint8>& out) const  
     {  
         _checkRep();  
         _rep->toXml(out);  
     }  
     /// method print - ATTN:  
     void print(std::ostream &o=std::cout) const  
     {  
         _checkRep();  
         _rep->print(o);  
     }  
     /// CIMMethod identical - ATTN  
     Boolean identical(const CIMConstMethod& x) const;     Boolean identical(const CIMConstMethod& x) const;
     /// CIMMethod clone - ATTN  
     CIMMethod clone() const      /** CIMMethod clone - makes a distinct replica of this method */
     {      CIMMethod clone() const;
         return CIMMethod(_rep->clone());  
     }  
  
 private: private:
  
     CIMMethod(CIMMethodRep* rep) : _rep(rep)      CIMMethod(CIMMethodRep* rep);
     {  
     }  
  
     explicit CIMMethod(const CIMConstMethod& x);      PEGASUS_EXPLICIT CIMMethod(const CIMConstMethod& x);
  
     void _checkRep() const      void _checkRep() const;
     {  
         if (!_rep)  
             throw UnitializedHandle();  
     }  
  
     CIMMethodRep* _rep;     CIMMethodRep* _rep;
     friend class CIMConstMethod;     friend class CIMConstMethod;
     friend class CIMClassRep;      friend class Resolver;
       friend class XmlWriter;
       friend class MofWriter;
 }; };
  
 ////////////////////////////////////////////////////////////////////////////////  
 //  
 // CIMConstMethod  
 //  
 ////////////////////////////////////////////////////////////////////////////////  
   
 class PEGASUS_COMMON_LINKAGE CIMConstMethod class PEGASUS_COMMON_LINKAGE CIMConstMethod
 { {
 public: public:
  
     CIMConstMethod() : _rep(0)      CIMConstMethod();
     {  
   
     }  
   
     CIMConstMethod(const CIMConstMethod& x)  
     {  
         Inc(_rep = x._rep);  
     }  
  
     CIMConstMethod(const CIMMethod& x)      CIMConstMethod(const CIMConstMethod& x);
     {  
         Inc(_rep = x._rep);  
     }  
  
     CIMConstMethod& operator=(const CIMConstMethod& x)      CIMConstMethod(const CIMMethod& x);
     {  
         if (x._rep != _rep)  
         {  
             Dec(_rep);  
             Inc(_rep = x._rep);  
         }  
         return *this;  
     }  
   
     CIMConstMethod& operator=(const CIMMethod& x)  
     {  
         if (x._rep != _rep)  
         {  
             Dec(_rep);  
             Inc(_rep = x._rep);  
         }  
         return *this;  
     }  
  
     // Throws IllegalName if name argument not legal CIM identifier.     // Throws IllegalName if name argument not legal CIM identifier.
   
     CIMConstMethod(     CIMConstMethod(
         const String& name,          const CIMName& name,
         CIMType type,         CIMType type,
         const String& classOrigin = String(),          const CIMName& classOrigin = CIMName(),
         Boolean propagated = false)          Boolean propagated = false);
     {  
         _rep = new CIMMethodRep(name, type, classOrigin, propagated);  
     }  
  
     ~CIMConstMethod()      ~CIMConstMethod();
     {  
         Dec(_rep);  
     }  
  
     const String& getName() const      CIMConstMethod& operator=(const CIMConstMethod& x);
     {  
         _checkRep();  
         return _rep->getName();  
     }  
  
     CIMType getType() const      CIMConstMethod& operator=(const CIMMethod& x);
     {  
         _checkRep();  
         return _rep->getType();  
     }  
  
     const String& getClassOrigin() const      const CIMName& getName() const;
     {  
         _checkRep();  
         return _rep->getClassOrigin();  
     }  
  
     Boolean getPropagated() const      CIMType getType() const;
     {  
         _checkRep();  
         return _rep->getPropagated();  
     }  
  
     Uint32 findQualifier(const String& name) const      const CIMName& getClassOrigin() const;
     {  
         _checkRep();  
         return _rep->findQualifier(name);  
     }  
  
     Uint32 getQualifier(Uint32 pos) const      Boolean getPropagated() const;
     {  
         _checkRep();  
         return _rep->getQualifier(pos);  
     }  
  
     Uint32 getQualifierCount() const      Uint32 findQualifier(const CIMName& name) const;
     {  
         _checkRep();  
         return _rep->getQualifierCount();  
     }  
  
     Uint32 findParameter(const String& name) const      CIMConstQualifier getQualifier(Uint32 pos) const;
     {  
         _checkRep();  
         return _rep->findParameter(name);  
     }  
  
     CIMConstParameter getParameter(Uint32 pos) const      Uint32 getQualifierCount() const;
     {  
         _checkRep();  
         return _rep->getParameter(pos);  
     }  
  
     Uint32 getParameterCount() const      Uint32 findParameter(const CIMName& name) const;
     {  
         _checkRep();  
         return _rep->getParameterCount();  
     }  
  
     operator int() const { return _rep != 0; }      CIMConstParameter getParameter(Uint32 pos) const;
  
     void toXml(Array<Sint8>& out) const      Uint32 getParameterCount() const;
     {  
         _checkRep();  
         _rep->toXml(out);  
     }  
  
     void print(std::ostream &o=std::cout) const  #ifdef PEGASUS_INTERNALONLY
     {      Boolean isNull() const;
         _checkRep();  #endif
         _rep->print(o);  
     }  
  
     Boolean identical(const CIMConstMethod& x) const      Boolean identical(const CIMConstMethod& x) const;
     {  
         x._checkRep();  
         _checkRep();  
         return _rep->identical(x._rep);  
     }  
  
     CIMMethod clone() const      CIMMethod clone() const;
     {  
         return CIMMethod(_rep->clone());  
     }  
  
 private: private:
  
     void _checkRep() const      void _checkRep() const;
     {  
         if (!_rep)  
             throw UnitializedHandle();  
     }  
  
     CIMMethodRep* _rep;     CIMMethodRep* _rep;
  
     friend class CIMMethod;     friend class CIMMethod;
     friend class CIMMethodRep;     friend class CIMMethodRep;
       friend class XmlWriter;
       friend class MofWriter;
 }; };
  
   #define PEGASUS_ARRAY_T CIMMethod
   # include <Pegasus/Common/ArrayInter.h>
   #undef PEGASUS_ARRAY_T
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  
 #endif /* Pegasus_Method_h */ #endif /* Pegasus_Method_h */


Legend:
Removed from v.1.3  
changed lines
  Added in v.1.30

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2