(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.10 and 1.37

version 1.10, 2001/05/20 21:30:25 version 1.37, 2003/10/22 14:26:02
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2003////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development
   // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
   // IBM Corp.; EMC Corporation, The Open Group.
 // //
 // 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)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 29 
Line 35 
 #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.  
   
     // ATTN: remove the classOrigin and propagated parameters.  
 */ */
 class PEGASUS_COMMON_LINKAGE CIMMethod class PEGASUS_COMMON_LINKAGE CIMMethod
 { {
 public: public:
  
     /** Creates and instantiates a CIM method. */      /** Creates a new CIMMethod object. */
     CIMMethod() : _rep(0)      CIMMethod();
     {  
   
     }  
  
     /** Creates and instantiates a CIM method from another method instance      /** Creates a new CIMMethod object from another method instance.
         @return pointer to the new method instance          @param x - CIMMethod instance from which to create CIMMethod object.
     */     */
     CIMMethod(const CIMMethod& x)      CIMMethod(const CIMMethod& x);
     {  
         Inc(_rep = x._rep);  
     }  
  
     /** Assignment operator */      /** Creates a CIMMethod with the specified name, type, and classOrigin.
     CIMMethod& operator=(const CIMMethod& x)          @param name - CIMName representing the name for the method.
     {          @param type - CIMType representing data type of method to create.
         if (x._rep != _rep)          @param classOrigin - CIMName representing the class origin.
         {          @param propagated - Flag indicating whether the definition of the
             Dec(_rep);          CIM Method is local to the CIM Class (respectively, Instance) in which
             Inc(_rep = x._rep);          it appears, or was propagated without modification from the underlying
         }          Subclass (respectively, Class).
         return *this;  
     }  
   
     /**  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);  
     }  
  
     /** Desctructor. */     /** Desctructor. */
     ~CIMMethod()      ~CIMMethod();
     {  
         Dec(_rep);  
     }  
  
     /** CIMMethod getName - Gets the name of the method      /** Assignment operator */
         @return String with the name of the method      CIMMethod& operator=(const CIMMethod& x);
     */  
     const String& getName() const  
     {  
         _checkRep();  
         return _rep->getName();  
     }  
   
     /** CIMMethod setName - Set the method name  
         @param name  
         @exception IllegalName if name argument not legal CIM identifier.  
     */  
     void setName(const String& name)  
     {  
         _checkRep();  
         _rep->setName(name);  
     }  
  
     /** CIMMethod getType - gets the method type      /** Gets the name of the method.
         @return The CIM method type for this method.          @return CIMName with the name of the method.
     */     */
     CIMType getType() const      const CIMName& getName() const;
     {  
         _checkRep();  
         return _rep->getType();  
     }  
  
     /** CIMMethod setType - Sets the method type to the specified CIM method      /** Sets the method name.
         type as defined in CIMType /Ref{TYPE}          @param name - CIMName with method name.
     */     */
     void setType(CIMType type)      void setName(const CIMName& name);
     {  
         _checkRep();  
         _rep->setType(type);  
     }  
   
     /** CIMMethod getClassOrigin - Returns the class in which this method  
         was defined.  
         @return ATTN:  
     */  
     const String& getClassOrigin() const  
     {  
         _checkRep();  
         return _rep->getClassOrigin();  
     }  
  
     /** CIMMethod setClassOrigin - ATTN: */      /** Gets the method type.
     void setClassOrigin(const String& classOrigin)          @return The CIMType containing the method type for this method.
     {      */
         _checkRep();      CIMType getType() const;
         _rep->setClassOrigin(classOrigin);  
     }  
  
     /** method getPropagated - ATTN: */      /** Sets the method type to the specified CIM method type
     Boolean getPropagated() const          as defined in CIMType.
     {      */
         _checkRep();      void setType(CIMType type);
         return _rep->getPropagated();  
     }  
  
     /** method setPropagated - ATTN: */      /** Gets the class in which this method was defined.
     void setPropagated(Boolean propagated)          @return CIMName containing the classOrigin field.
     {  
         _checkRep();  
         _rep->setPropagated(propagated);  
     }  
   
     /** CIMMethod addQualifier - Adds a Qualifier to the method object.  
         @param CIMQualifier to be added  
         @return Throws AlreadyExists excetpion if the qualifier already exists  
         in the method  
         @exception AlreadyExists exception  
     */     */
     CIMMethod& addQualifier(const CIMQualifier& x)      const CIMName& getClassOrigin() const;
     {  
         _checkRep();      /** Sets the ClassOrigin attribute with the classname defined on
         _rep->addQualifier(x);          the input parameter.
         return *this;          @param classOrigin - CIMName parameter defining the name
     }          of the class origin.
   
     /** CIMMethod findQualifier - returns the position of the qualifier with  
         the given name.  
         @param name Name of qualifier to be found.  
         @return index of the parameter if found; otherwise Uint32(-1).  
     */     */
     Uint32 findQualifier(const String& name)      void setClassOrigin(const CIMName& classOrigin);
     {  
         _checkRep();  
         return _rep->findQualifier(name);  
     }  
  
     Uint32 findQualifier(const String& name) const      /** Tests the propagated qualifier.
     {          @return true if method is propagated, false otherwise.
         _checkRep();  
         return _rep->findQualifier(name);  
     }  
   
     /** CIMMethod existsQualifier - returns the position of the qualifier with  
         the given name.  
         @param name Name of qualifier to be found.  
         @return index of the parameter if found; otherwise Uint32(-1).  
     */     */
     Boolean existsQualifier(const String& name)      Boolean getPropagated() const;
     {  
         _checkRep();  
         return _rep->existsQualifier(name);  
     }  
  
     Boolean existsQualifier(const String& name) const      /** Sets the Propagaged Qualifier
     {          @param propagated - Flag indicating propagation.
         _checkRep();      */
         return _rep->existsQualifier(name);      void setPropagated(Boolean propagated);
     }  
  
       /** Adds the specified qualifier to the method and increments the
           qualifier count.
           @param x - CIMQualifier object representing the qualifier
           to be added.
           @return the CIMMethod object after adding the specified qualifier.
           @exception AlreadyExistsException if the qualifier already exists.
       */
       CIMMethod& addQualifier(const CIMQualifier& x);
  
     /** CIMMethod getQualifier - Gets the CIMQualifier defined by the index      /** Searches for a qualifier with the specified input name.
         input as a parameter.          @param name - CIMName of the qualifier to be found.
         @param Index of the qualifier requested.          @return Index of the qualifier found or PEG_NOT_FOUND
         @return CIMQualifier object or exception          if not found.
         @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 removeQualifier - Removes the CIMQualifier defined by the  
         position input as a parameter.  
         @param Position 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.  
     */     */
     void removeQualifier(Uint32 pos)      CIMQualifier getQualifier(Uint32 index);
     {  
         _checkRep();  
         _rep->removeQualifier(pos);  
     }  
  
       /** Gets the CIMQualifier defined by the input parameter.
           @param index - Index of the qualifier requested.
           @return CIMConstQualifier object representing the qualifier found.
           @exception IndexOutOfBoundsException exception if the index is
           outside the range of parameters available from the CIMMethod.
       */
       CIMConstQualifier getQualifier(Uint32 index) const;
  
     /** CIMMethod getQualifierCount - Returns the number of Qualifiers attached      /** Removes the specified CIMQualifier from this method.
         to this method.          @param index - Index of the qualifier to remove.
         @return integer representing number of Qualifiers.          @exception IndexOutOfBoundsException exception if the index is
           outside the range of parameters available from the CIMMethod.
     */     */
     Uint32 getQualifierCount() const      void removeQualifier(Uint32 index);
     {  
         _checkRep();  
         return _rep->getQualifierCount();  
     }  
  
     /** CIMMethod addParameter - Adds the parameter defined by the input      /** Returns the number of Qualifiers attached to this CIMMethod object.
         to the CIMMethod          @return the number of qualifiers in the CIM Method.
     */     */
     CIMMethod& addParameter(const CIMParameter& x)      Uint32 getQualifierCount() const;
     {  
         _checkRep();      /** Adds the parameter defined by the input to the CIMMethod.
         _rep->addParameter(x);          @param x - CIMParameter to be added to the CIM Method.
         return *this;          @return CIMMethod object after the specified parameter is added.
     }  
   
     /** CIMMethod findParameter - Finds the parameter whose name is given  
         by the name parameter.  
         @param name Name of parameter to be found.  
         @return index of the parameter if found; otherwise Uint32(-1).  
     */     */
     Uint32 findParameter(const String& name)      CIMMethod& addParameter(const CIMParameter& x);
     {  
         _checkRep();  
         return _rep->findParameter(name);  
     }  
  
     Uint32 findParameter(const String& name) const      /** Finds the parameter with the specified name.
     {          @param name - Name of parameter to be found.
         _checkRep();          @return Index of the parameter object found or PEG_NOT_FOUND
         return _rep->findParameter(name);          if the property is not found.
     }      */
       Uint32 findParameter(const CIMName& name) const;
  
     /** CIMMethod getParameter - ATTN: */      /** Gets the parameter defined by the specified index.
     CIMParameter getParameter(Uint32 pos)          @param index - Index for the parameter to be returned.
     {          @return CIMParameter object requested.
         _checkRep();          @exception IndexOutOfBoundsException if the index is outside
         return _rep->getParameter(pos);          the range of available parameters
     }  
   
     /** 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      CIMParameter getParameter(Uint32 index);
     {  
         _checkRep();      /** Gets the parameter defined for the specified index.
         return _rep->getParameter(pos);          @param index - Index for the parameter to be returned.
     }          @return CIMConstParameter object requested.
           @exception IndexOutOfBoundsException if the index is outside
     /** CIMMethod getParameterCount - Gets the count of the numbeer of          the range of available parameters
         Parameters attached to the CIMMethod.  
         @retrun - count of the number of parameters attached to the CIMMethod.  
     */     */
     Uint32 getParameterCount() const      CIMConstParameter getParameter(Uint32 index) 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);  
     }  
  
     /** Returns zero if CIMMethod refers to a null pointer */      /** Removes the CIMParameter defined by the specified index.
     operator int() const          @param index - Index of the parameter to be removed.
     {          @exception IndexOutOfBoundsException if the index is outside the
         return _rep != 0;          range of parameters available from the CIMMethod.
     }      */
       void removeParameter (Uint32 index);
  
     /** method toXML - placing XML encoding of this object into out arguemnt. */      /** Gets the count of Parameters defined in the CIMMethod.
     void toXml(Array<Sint8>& out) const          @return - count of the number of parameters attached to the CIMMethod.
     {      */
         _checkRep();      Uint32 getParameterCount() const;
         _rep->toXml(out);  
     }  
  
     /** method print - prints this method (in CIM encoded form). */      /** Determines if the object has not been initialized.
     void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const          @return  true if the object has not been initialized,
     {                   false otherwise
         _checkRep();       */
         _rep->print(o);      Boolean isUninitialized() const;
     }  
  
     /** CIMMethod identical - Returns true if this method is identical to the      /** Compares with another CIMConstMethod.
         one given by the argument x.          @param x - CIMConstMethod object for the method to be compared.
           @return true if this method is identical to the one specified.
     */     */
     Boolean identical(const CIMConstMethod& x) const;     Boolean identical(const CIMConstMethod& x) const;
  
     /** CIMMethod clone - makes a distinct replica of this method */      /** Makes a deep copy (clone) of this method.
     CIMMethod clone() const          @return copy of the CIMMethod object.
     {      */
         return CIMMethod(_rep->clone());      CIMMethod clone() const;
     }  
  
 private: private:
  
     CIMMethod(CIMMethodRep* rep) : _rep(rep)      CIMMethod(CIMMethodRep* rep);
     {  
     }  
  
     PEGASUS_EXPLICIT CIMMethod(const CIMConstMethod& x);     PEGASUS_EXPLICIT CIMMethod(const CIMConstMethod& x);
  
     void _checkRep() const      void _checkRep() const;
     {  
         if (!_rep)  
             ThrowUnitializedHandle();  
     }  
  
     CIMMethodRep* _rep;     CIMMethodRep* _rep;
     friend class CIMConstMethod;     friend class CIMConstMethod;
     friend class CIMClassRep;      friend class Resolver;
       friend class XmlWriter;
       friend class MofWriter;
 }; };
  
   ///
 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(PEGASUS_STD(ostream) &o=PEGASUS_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)  
             ThrowUnitializedHandle();  
     }  
  
     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.10  
changed lines
  Added in v.1.37

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2