(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.5 and 1.36

version 1.5, 2001/04/25 22:20:53 version 1.36, 2003/03/12 21:02:53
Line 1 
Line 1 
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
 // //
 // 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL  // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING  // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER  // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 // DEALINGS IN THE SOFTWARE.  // 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) // Author: Mike Brasher (mbrasher@bmc.com)
 // //
 // Modified By:  // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
   //              Carol Ann Krug Graves, Hewlett-Packard Company
   //                (carolann_graves@hp.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 /*  
  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;
  
 /** Class CIMMethod - This class defines the operations associated with  /** The CIMMethod class is used to represent CIM methods in Pegasus.
 manipulation of the Pegasus implementation of the CIM CIMMethod.  Within this  
 class, methods are provides for creation, deletion, and manipulation 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 a new CIMMethod object. */
     /** Creates and instantiates a CIM method from another method instance      CIMMethod();
     @return pointer to the new method instance  
       /** Creates a new CIMMethod object from another method instance.
           @param x - CIMMethod instance from which to create CIMMethod object.
     */     */
     CIMMethod(const CIMMethod& x)      CIMMethod(const CIMMethod& x);
     {  
         Inc(_rep = x._rep);      /** Creates a CIMMethod with the specified name, type, and classOrigin.
     }          @param name - CIMName representing the name for the method.
     ///          @param type - CIMType representing data type of method to create.
     CIMMethod& operator=(const CIMMethod& x)          @param classOrigin - CIMName representing the class origin.
     {          @param propagated - Flag indicating whether the definition of the
         if (x._rep != _rep)          CIM Method is local to the CIM Class (respectively, Instance) in which
         {          it appears, or was propagated without modification from the underlying
             Dec(_rep);          Subclass (respectively, Class).
             Inc(_rep = x._rep);  
         }  
         return *this;  
     }  
   
     // ATTN: remove the classOrigin and propagated parameters.  
   
     /**  Creates a CIM method with the specified name, type, and classOrigin  
     @param name for the method  
     @param type ATTN  
     @param classOrigin  
     @param propagated  
     @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      /** Gets the name of the method.
           @return CIMName with the name of the method.
     */     */
     const String& getName() const      const CIMName& getName() const;
     {  
         _checkRep();      /** Sets the method name.
         return _rep->getName();          @param name - CIMName with method name.
     }  
   
     /** CIMMethod setName - Set the method name  
     @parm name ATTN (make reference to name defintion here)  
     @return Throws IllegalName if name argument not legal CIM identifier.  
     */     */
     void setName(const String& name)      void setName(const CIMName& name);
     {  
         _checkRep();      /** Gets the method type.
         _rep->setName(name);          @return The CIMType containing the method type for this method.
     }  
     /** CIMMethod getType - gets the method type  
     @return The CIM method type for this method.  
     */     */
       CIMType getType() const;
  
     CIMType getType() const      /** Sets the method type to the specified CIM method type
     {          as defined in CIMType.
         _checkRep();  
         return _rep->getType();  
     }  
     /** CIMMethod setType - Sets the method type to the specified CIM method  
     type as defined in CIMType /Ref{TYPE}  
     */     */
     void setType(CIMType type)      void setType(CIMType type);
     {  
         _checkRep();      /** Gets the class in which this method was defined.
         _rep->setType(type);          @return CIMName containing the classOrigin field.
     }  
     /** CIMMethod getClassOrigin - Returns the class in which this method  
      was defined.  
     @return ATTN:  
     */     */
     const String& getClassOrigin() const      const CIMName& getClassOrigin() const;
     {  
         _checkRep();      /** Sets the ClassOrigin attribute with the classname defined on
         return _rep->getClassOrigin();          the input parameter.
     }          @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();      /** Tests the propagated qualifier.
         _rep->setClassOrigin(classOrigin);          @return true if method is propagated, false otherwise.
     }  
     /// 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();      /** Sets the Propagaged Qualifier
         _rep->addQualifier(x);          @param propagated - Flag indicating propagation.
         return *this;  
     }  
     /** CIMMethod findQualifier - Finds the CIMQualifier named by the input string.  
     @param String defining the name of the parameter to be found  
     @return Index to the parameter found or -1 if not found  
     The -1 must be converted to a Unit32 as follows:  
     <PRE>  
         Uint32 pos = myClass.findProperty("name");  
         if (pos == Uint32(-1))  
         {  
             // Not found!  
         }  
     </PRE>  
     */     */
     Uint32 findQualifier(const String& name)      void setPropagated(Boolean propagated);
     {  
         _checkRep();      /** Adds the specified qualifier to the method and increments the
         return _rep->findQualifier(name);          qualifier count.
     }          @param x - CIMQualifier object representing the qualifier
     /** CIMMethod findQualifier - Find the qualifier with the name defined on          to be added.
     input          @return the CIMMethod object after adding the specified qualifier.
     @param String with the name of the parameter to be found.          @exception AlreadyExistsException if the qualifier already exists.
     @return - index to the qualifier found or -1 if no qualifier found.  
     */     */
     Uint32 findQualifier(const String& name) const      CIMMethod& addQualifier(const CIMQualifier& x);
     {  
         _checkRep();      /** Searches for a qualifier with the specified input name.
         return _rep->findQualifier(name);          @param name - CIMName of the qualifier to be found.
     }          @return Index of the qualifier found or PEG_NOT_FOUND
     /** CIMMethod getQualifier - Gets the CIMQualifier defined by the index input          if not found.
     as a parameter.  
     @param Index of the qualifier requested.  
     @return CIMQualifier object or exception  
     @exception OutOfBounds exception if the index is outside the range of  
     parameters available from the CIMMethod.  
     */     */
     CIMQualifier getQualifier(Uint32 pos)      Uint32 findQualifier(const CIMName& name) const;
     {  
         _checkRep();  
         return _rep->getQualifier(pos);  
     }  
  
     CIMConstQualifier getQualifier(Uint32 pos) const      /** Gets the CIMQualifier defined by the input parameter.
     {          @param index - Index of the qualifier requested.
         _checkRep();          @return CIMQualifier object representing the qualifier found.
         return _rep->getQualifier(pos);          @exception IndexOutOfBoundsException exception if the index is
     }          outside the range of parameters available from the CIMMethod.
     /** CIMMethod getQualifierCount - Returns count of the number of Qualifiers  
     attached to the CIMMethod  
     @return integer representing number of Qualifiers.  
     */     */
     Uint32 getQualifierCount() const      CIMQualifier getQualifier(Uint32 index);
     {  
         _checkRep();      /** Gets the CIMQualifier defined by the input parameter.
         return _rep->getQualifierCount();          @param index - Index of the qualifier requested.
     }          @return CIMConstQualifier object representing the qualifier found.
     /** CIMMethod addParameter - Adds the parameter defined by the input to the          @exception IndexOutOfBoundsException exception if the index is
     CIMMethod          outside the range of parameters available from the CIMMethod.
     Param - ATTN:  
     */     */
     CIMMethod& addParameter(const CIMParameter& x)      CIMConstQualifier getQualifier(Uint32 index) const;
     {  
         _checkRep();      /** Removes the specified CIMQualifier from this method.
         _rep->addParameter(x);          @param index - Index of the qualifier to remove.
         return *this;          @exception IndexOutOfBoundsException exception if the index is
     }          outside the range of parameters available from the CIMMethod.
     /// 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      void removeQualifier(Uint32 index);
     {  
         _checkRep();      /** Returns the number of Qualifiers attached to this CIMMethod object.
         return _rep->findParameter(name);          @return the number of qualifiers in the CIM Method.
     }  
     /// CIMMethod getParameter - ATTN:  
     CIMParameter getParameter(Uint32 pos)  
     {  
         _checkRep();  
         return _rep->getParameter(pos);  
     }  
   
     /** CIMMethod getParameter - Gets the parameter defined by the index  
     input as a parameter.  
     @param index for the parameter to be returned.  
     @return CIMParameter requested.  
     @Exception OutOfBounds exception is thrown if the index is outside the  
     range of available parameters  
     */     */
     CIMConstParameter getParameter(Uint32 pos) const      Uint32 getQualifierCount() const;
     {  
         _checkRep();      /** Adds the parameter defined by the input to the CIMMethod.
         return _rep->getParameter(pos);          @param x - CIMParameter to be added to the CIM Method.
     }          @return CIMMethod object after the specified parameter is added.
       */
     /** CIMMethod getParameterCount - Gets the count of the numbeer of Parameters      CIMMethod& addParameter(const CIMParameter& x);
     attached to the CIMMethod.  
     @retrun - count of the number of parameters attached to the CIMMethod.      /** Finds the parameter with the specified name.
           @param name - Name of parameter to be found.
           @return Index of the parameter object found or PEG_NOT_FOUND
           if the property is not found.
       */
       Uint32 findParameter(const CIMName& name) const;
   
       /** Gets the parameter defined by the specified index.
           @param index - Index for the parameter to be returned.
           @return CIMParameter object requested.
           @exception IndexOutOfBoundsException if the index is outside
           the range of available parameters
       */
       CIMParameter getParameter(Uint32 index);
   
       /** Gets the parameter defined for the specified index.
           @param index - Index for the parameter to be returned.
           @return CIMConstParameter object requested.
           @exception IndexOutOfBoundsException if the index is outside
           the range of available parameters
       */
       CIMConstParameter getParameter(Uint32 index) const;
   
       /** Removes the CIMParameter defined by the specified index.
           @param index - Index of the parameter to be removed.
           @exception IndexOutOfBoundsException if the index is outside the
           range of parameters available from the CIMMethod.
       */
       void removeParameter (Uint32 index);
   
       /** Gets the count of Parameters defined in the CIMMethod.
           @return - count of the number of parameters attached to the CIMMethod.
       */
       Uint32 getParameterCount() const;
   
       /** Determines if the object has not been initialized.
           @return  true if the object has not been initialized,
                    false otherwise
        */
       Boolean isUninitialized() const;
   
       /** Compares with another CIMConstMethod.
           @param x - CIMConstMethod object for the method to be compared.
           @return true if this method is identical to the one specified.
     */     */
     Uint32 getParameterCount() const  
     {  
         _checkRep();  
         return _rep->getParameterCount();  
     }  
     /// method resolve - ATTN:  
     void resolve(  
         DeclContext* declContext,  
         const String& nameSpace,  
         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      /** Makes a deep copy (clone) of this method.
     {          @return copy of the CIMMethod object.
         return CIMMethod(_rep->clone());      */
     }      CIMMethod clone() const;
  
 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)  
     {  
         Inc(_rep = x._rep);  
     }  
   
     CIMConstMethod& operator=(const CIMConstMethod& x)  
     {  
         if (x._rep != _rep)  
         {  
             Dec(_rep);  
             Inc(_rep = x._rep);  
         }  
         return *this;  
     }  
  
     CIMConstMethod& operator=(const CIMMethod& x)      ///
     {      CIMConstMethod(const CIMConstMethod& x);
         if (x._rep != _rep)  
         {  
             Dec(_rep);  
             Inc(_rep = x._rep);  
         }  
         return *this;  
     }  
  
     // Throws IllegalName if name argument not legal CIM identifier.      ///
       CIMConstMethod(const CIMMethod& x);
  
       ///
     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 index) 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 index) const;
  
     void toXml(Array<Sint8>& out) const      ///
     {      Uint32 getParameterCount() const;
         _checkRep();  
         _rep->toXml(out);  
     }  
  
     void print(std::ostream &o=std::cout) const      ///
     {      Boolean isUninitialized() const;
         _checkRep();  
         _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.5  
changed lines
  Added in v.1.36

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2