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

Diff for /pegasus/src/Pegasus/Common/CIMClass.h between version 1.11 and 1.30

version 1.11, 2001/05/06 13:16:16 version 1.30, 2002/03/24 13:33:07
Line 1 
Line 1 
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
 // //
 // 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.
 // //
 //============================================================================== //==============================================================================
 // //
Line 29 
Line 30 
 #define Pegasus_CIMClass_h #define Pegasus_CIMClass_h
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
   #include <Pegasus/Common/CIMObject.h>
 #include <Pegasus/Common/CIMClassRep.h> #include <Pegasus/Common/CIMClassRep.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 class CIMConstClass; class CIMConstClass;
   class CIMObject;
   class CIMConstObject;
   
   // REVIEW: redocument.
  
 /** The CIMClass class is used to represent CIM classes in Pegasus.  In CIM, /** The CIMClass class is used to represent CIM classes in Pegasus.  In CIM,
     a class object may be a class or an associator.  A CIM class must contain a     a class object may be a class or an associator.  A CIM class must contain a
Line 42 
Line 48 
     instances, all of which support a common type (for example, a set of     instances, all of which support a common type (for example, a set of
     properties, methods, and associations).     properties, methods, and associations).
 */ */
   
 class PEGASUS_COMMON_LINKAGE CIMClass class PEGASUS_COMMON_LINKAGE CIMClass
 { {
 public: public:
Line 61 
Line 66 
     */     */
     CIMClass() : _rep(0)     CIMClass() : _rep(0)
     {     {
   
     }     }
  
     /** Constructor - Creates a class from a previous class     /** Constructor - Creates a class from a previous class
Line 71 
Line 75 
         Inc(_rep = x._rep);         Inc(_rep = x._rep);
     }     }
  
     /// Operator = Assigns the CIM Class constructor.      PEGASUS_EXPLICIT CIMClass(const CIMObject& x);
   
       PEGASUS_EXPLICIT CIMClass(const CIMObject& x, NoThrow&);
   
       /** Assignment operator.
       */
     CIMClass& operator=(const CIMClass& x)     CIMClass& operator=(const CIMClass& x)
     {     {
         if (x._rep != _rep)         if (x._rep != _rep)
Line 94 
Line 103 
  
     */     */
     CIMClass(     CIMClass(
         const String& className,          const CIMReference& reference,
         const String& superClassName = String())         const String& superClassName = String())
     {     {
         _rep = new CIMClassRep(className, superClassName);          _rep = new CIMClassRep(reference, superClassName);
     }     }
  
     /// Destructor     /// Destructor
Line 112 
Line 121 
         association class include pointers, or references, to the two (or         association class include pointers, or references, to the two (or
         more) instances. All CIM classes can be included in one or more         more) instances. All CIM classes can be included in one or more
         associations.         associations.
         ATTN: Move the association definition elsewhere  
         @return  Boolean True if this CIM class belongs to an association;         @return  Boolean True if this CIM class belongs to an association;
         otherwise, false.         otherwise, false.
     */     */
Line 122 
Line 130 
         return _rep->isAssociation();         return _rep->isAssociation();
     }     }
  
     ///  CIMMethod isAbstract      /** isAbstract Test if the CIMClass is abstract.
           @return - True if the CIMClass Object is abstract
           SeeAlso: Abstract
       */
     Boolean isAbstract() const     Boolean isAbstract() const
     {     {
         _checkRep();         _checkRep();
Line 139 
Line 150 
         return _rep->getClassName();         return _rep->getClassName();
     }     }
  
     /** CIMMethod getSuperClassName - Gets the name of the Parent      const CIMReference& getPath() const
       {
           _checkRep();
           return _rep->getPath();
       }
   
       /** getSuperClassName - Gets the name of the Parent
         @return String with parent class name.         @return String with parent class name.
     */     */
     const String& getSuperClassName() const     const String& getSuperClassName() const
Line 148 
Line 165 
         return _rep->getSuperClassName();         return _rep->getSuperClassName();
     }     }
  
     /** CIMMethod setSuperClassName - Sets the name of the parent class from      /** setSuperClassName - Sets the name of the parent class from
         the input parameter. \REF{CLASSNAME}. ATTN: Define legal classnames         the input parameter. \REF{CLASSNAME}. ATTN: Define legal classnames
         @param String defining parent name.         @param String defining parent name.
         @return Throws IllegalName if superClassName argument not legal CIM         @return Throws IllegalName if superClassName argument not legal CIM
Line 181 
Line 198 
         input name if it exists in the class         input name if it exists in the class
         @param name CIMName of the qualifier         @param name CIMName of the qualifier
         to be found @return Position of the qualifier in the Class.         to be found @return Position of the qualifier in the Class.
         @return Returns index of the qualifier found or -1 if not found.          @return Returns index of the qualifier found or PEG_NOT_FOUND
           if not found.
     */     */
     Uint32 findQualifier(const String& name)     Uint32 findQualifier(const String& name)
     {     {
Line 194 
Line 212 
         _checkRep();         _checkRep();
         return _rep->findQualifier(name);         return _rep->findQualifier(name);
     }     }
       /** existsQualifier - Returns true if the qualifier with the
       specified name exists in the class
       @param name String name of the qualifier object being tested.
       @return True if the qualifier exits.  Otherwise false is returned.
       */
       Boolean existsQualifier(const String& name)
       {
           _checkRep();
           return _rep->existsQualifier(name);
       }
       ///
       Boolean existsQualifier(const String& name) const
       {
           _checkRep();
           return _rep->existsQualifier(name);
       }
  
     /** getQualifier - Gets the CIMQualifier object defined     /** getQualifier - Gets the CIMQualifier object defined
         by the input parameter         by the input parameter
         @param pos defines the position of the qualifier in the class from the         @param pos defines the position of the qualifier in the class from the
         findQualifier method         findQualifier method
         @return CIMQualifier object representing the qualifier found.          @return CIMQualifier object representing the qualifier found. On error,
         ATTN: what is error return here?              CIMQualifier handle will be null.
     */     */
     CIMQualifier getQualifier(Uint32 pos)     CIMQualifier getQualifier(Uint32 pos)
     {     {
Line 215 
Line 249 
         return _rep->getQualifier(pos);         return _rep->getQualifier(pos);
     }     }
  
       /** removeQualifier - Removes the qualifier defined by the
       index parameter.
       @param Defines the index of the qualifier to be removed.
       @return There is no return.
       @exception Throw OutOfBound exception if the index is outside
       the range of existing qualifier objects for this class
       */
       void removeQualifier(Uint32 pos) const
       {
           _checkRep();
           _rep->removeQualifier(pos);
       }
   
     /** getQualifierCount - Returns the number of qualifiers     /** getQualifierCount - Returns the number of qualifiers
         in the class.         in the class.
         @return ATTN:         @return ATTN:
Line 235 
Line 282 
         return *this;         return *this;
     }     }
  
     /** removeProperty - Removes the property represented      /** findProperty - Finds the property object with the
         by the position input parameter from the class  
         @param pos Index to the property to be removed from the  
         findPropety method  
         @exception Throws OutofBounds if index is not a property object  
     */  
     void removeProperty(Uint32 pos)  
     {  
         _checkRep();  
         _rep->removeProperty(pos);  
     }  
   
     /** CIMMethod findProperty - Finds the property object with the  
         name defined by the input parameter in the class.         name defined by the input parameter in the class.
         @param String parameter with the property name.         @param String parameter with the property name.
         @return position representing the property object found or -1 if the          @return position representing the property object found or
         property is not found.          PEG_NOT_FOUND if the property is not found.
     */     */
     Uint32 findProperty(const String& name)     Uint32 findProperty(const String& name)
     {     {
Line 265 
Line 300 
         return _rep->findProperty(name);         return _rep->findProperty(name);
     }     }
  
       /** existsPropery - Determines if a property object with the
           name defined by the input parameter exists in the class.
           @parm String parameter with the property name.
           @return True if the property object exists.
       */
       Boolean existsProperty(const String& name)
       {
           _checkRep();
           return _rep->existsProperty(name);
       }
   
           Boolean existsProperty(const String& name) const
       {
          _checkRep();
          return _rep->existsProperty(name);
       }
   
     /** getProperty - Returns a property representing the property     /** getProperty - Returns a property representing the property
         defined by the input parameter         defined by the input parameter
         @param position for this property         @param position for this property
Line 290 
Line 342 
         return _rep->getProperty(pos);         return _rep->getProperty(pos);
     }     }
  
     /** getProperty -   Gets the count of the number of properties      /** removeProperty - Removes the property represented
           by the position input parameter from the class
           @param pos Index to the property to be removed from the
           findPropety method
           @exception Throws OutofBounds if index is not a property object
       */
       void removeProperty(Uint32 pos)
       {
           _checkRep();
           _rep->removeProperty(pos);
       }
   
       /** getPropertyCount -   Gets the count of the number of properties
         defined in the class.         defined in the class.
         @return count of number of proerties in the class         @return count of number of proerties in the class
     */     */
Line 315 
Line 379 
         return *this;         return *this;
     }     }
  
     /** findMethod - Located the method object defined by the      /** findMethod - Locate the method object defined by the
         name input         name input
         @param String representing the name of the method to be found         @param String representing the name of the method to be found
         @return Position of the method object in the class to be used in         @return Position of the method object in the class to be used in
Line 333 
Line 397 
         return _rep->findMethod(name);         return _rep->findMethod(name);
     }     }
  
        /** existsMethod - Determine if the method object defined by the
           name input exists
           @param String representing the name of the method to be found
           @return True if the method exists
       */
       Boolean existsMethod(const String& name)
       {
           _checkRep();
           return _rep->existsMethod(name);
       }
   
       Boolean existsMethod(const String& name) const
       {
           _checkRep();
           return _rep->existsMethod(name);
       }
   
     /** getMethod - Gets the method object defined by the     /** getMethod - Gets the method object defined by the
         input parameter.         input parameter.
         @param pos Index to the CIMMethod object to get          @param pos Index to the method object to get
         @return Returns handle of the CIMMethod requested          @return Returns handle of the method requested
         @exception Throws OutofBounds if the index represented by pos is greater         @exception Throws OutofBounds if the index represented by pos is greater
         than the number of methods defined in the class object         than the number of methods defined in the class object
     */     */
Line 356 
Line 437 
         return _rep->getMethod(pos);         return _rep->getMethod(pos);
     }     }
  
     /** CIMMethod getMethodCount - Count of the number of methods in the class      /** removeMethod - Removes the method defined by the
       index parameter.
       @param Defines the index of the method to be removed.
       @return There is no return.
       @exception Throw OutOfBound exception if the index is outside
       the range of existing method objects for this class
       */
       void removeMethod(Uint32 pos) const
       {
           _checkRep();
           _rep->removeMethod(pos);
       }
   
       /** getMethodCount - Count of the number of methods in the class
         @return integer representing the number of methods in the class object.         @return integer representing the number of methods in the class object.
     */     */
     Uint32 getMethodCount() const     Uint32 getMethodCount() const
Line 382 
Line 476 
     /// operator - ATTN:     /// operator - ATTN:
     operator int() const { return _rep != 0; }     operator int() const { return _rep != 0; }
  
     /// CIMMethod toXML      /** toXML  - prepares an XML representation of the CIMClass object
           in the provided Sint8 variable.
           @param out Sint8 array for the XML representation
       */
     void toXml(Array<Sint8>& out) const     void toXml(Array<Sint8>& out) const
     {     {
         _checkRep();         _checkRep();
         _rep->toXml(out);         _rep->toXml(out);
     }     }
  
     /// CIMMethod print      /** print -  Prints the toXML output to cout
     void print(std::ostream &o=std::cout) const      */
       void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const
     {     {
         _checkRep();         _checkRep();
         _rep->print(o);         _rep->print(o);
     }     }
  
     /** CIMMethod identical -  Compares with another class      /** toMof  - prepares a MOF representation of the CIMClass object
           in the provided Sint8 variable.
           @param out Sint8 array for the XML representation
       */
       void toMof(Array<Sint8>& out) const
       {
           _checkRep();
           _rep->toMof(out);
       }
       /** printMof -  Prints the toMof output to cout
       */
       void printMof(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const
       {
           _checkRep();
           _rep->printMof(o);
       }
   
       /** identical -  Compares with another class
         ATTN: Clarify exactly what identical means         ATTN: Clarify exactly what identical means
         @param Class object for the class to be compared         @param Class object for the class to be compared
         @return True if the classes are identical         @return True if the classes are identical
     */     */
     Boolean identical(const CIMConstClass& x) const;     Boolean identical(const CIMConstClass& x) const;
  
     /// CIMMethod clone - ATTN:      /** Makes a deep copy (clone) of the given object. */
     CIMClass clone() const     CIMClass clone() const
     {     {
         return CIMClass(_rep->clone());          return CIMClass((CIMClassRep*)(_rep->clone()));
     }     }
  
       /** Get names of all keys of this class. */
     void getKeyNames(Array<String>& keyNames) const     void getKeyNames(Array<String>& keyNames) const
     {     {
         _checkRep();         _checkRep();
         _rep->getKeyNames(keyNames);         _rep->getKeyNames(keyNames);
     }     }
  
       Boolean hasKeys() const
       {
           _checkRep();
           return _rep->hasKeys();
       }
   
 private: private:
  
     CIMClass(CIMClassRep* rep) : _rep(rep)     CIMClass(CIMClassRep* rep) : _rep(rep)
Line 424 
Line 546 
     void _checkRep() const     void _checkRep() const
     {     {
         if (!_rep)         if (!_rep)
             throw UnitializedHandle();              ThrowUnitializedHandle();
     }     }
  
     CIMClassRep* _rep;     CIMClassRep* _rep;
     friend class CIMConstClass;     friend class CIMConstClass;
       friend class CIMObject;
       friend class CIMConstObject;
 }; };
  
   #define PEGASUS_ARRAY_T CIMClass
   # include "ArrayInter.h"
   #undef PEGASUS_ARRAY_T
   
 /** CIMConstClass - ATTN: define this. /** CIMConstClass - ATTN: define this.
  
 */ */
   
 class PEGASUS_COMMON_LINKAGE CIMConstClass class PEGASUS_COMMON_LINKAGE CIMConstClass
 { {
 public: public:
  
     CIMConstClass() : _rep(0)     CIMConstClass() : _rep(0)
     {     {
   
     }     }
  
     CIMConstClass(const CIMConstClass& x)     CIMConstClass(const CIMConstClass& x)
Line 454 
Line 580 
         Inc(_rep = x._rep);         Inc(_rep = x._rep);
     }     }
  
       PEGASUS_EXPLICIT CIMConstClass(const CIMObject& x);
   
       PEGASUS_EXPLICIT CIMConstClass(const CIMConstObject& x);
   
       PEGASUS_EXPLICIT CIMConstClass(const CIMObject& x, NoThrow&);
   
       PEGASUS_EXPLICIT CIMConstClass(const CIMConstObject& x, NoThrow&);
   
     CIMConstClass& operator=(const CIMConstClass& x)     CIMConstClass& operator=(const CIMConstClass& x)
     {     {
         if (x._rep != _rep)         if (x._rep != _rep)
Line 477 
Line 611 
     // Throws IllegalName if className argument not legal CIM identifier.     // Throws IllegalName if className argument not legal CIM identifier.
  
     CIMConstClass(     CIMConstClass(
         const String& className,          const CIMReference& reference,
         const String& superClassName = String())         const String& superClassName = String())
     {     {
         _rep = new CIMClassRep(className, superClassName);          _rep = new CIMClassRep(reference, superClassName);
     }     }
  
     ~CIMConstClass()     ~CIMConstClass()
Line 506 
Line 640 
         return _rep->getClassName();         return _rep->getClassName();
     }     }
  
       const CIMReference& getPath() const
       {
           _checkRep();
           return _rep->getPath();
       }
   
     const String& getSuperClassName() const     const String& getSuperClassName() const
     {     {
         _checkRep();         _checkRep();
Line 574 
Line 714 
         _rep->toXml(out);         _rep->toXml(out);
     }     }
  
     void print(std::ostream &o=std::cout) const      void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const
     {     {
         _checkRep();         _checkRep();
         _rep->print(o);         _rep->print(o);
Line 589 
Line 729 
  
     CIMClass clone() const     CIMClass clone() const
     {     {
         return CIMClass(_rep->clone());          return CIMClass((CIMClassRep*)(_rep->clone()));
     }     }
  
     void getKeyNames(Array<String>& keyNames) const     void getKeyNames(Array<String>& keyNames) const
Line 598 
Line 738 
         _rep->getKeyNames(keyNames);         _rep->getKeyNames(keyNames);
     }     }
  
       Boolean hasKeys() const
       {
           _checkRep();
           return _rep->hasKeys();
       }
   
 private: private:
  
     void _checkRep() const     void _checkRep() const
     {     {
         if (!_rep)         if (!_rep)
             throw UnitializedHandle();              ThrowUnitializedHandle();
     }     }
  
     CIMClassRep* _rep;     CIMClassRep* _rep;
Line 611 
Line 757 
     friend class CIMClassRep;     friend class CIMClassRep;
     friend class CIMClass;     friend class CIMClass;
     friend class CIMInstanceRep;     friend class CIMInstanceRep;
       friend class CIMObject;
       friend class CIMConstObject;
 }; };
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  
 #endif /* Pegasus_CIMClass_h */ #endif /* Pegasus_CIMClass_h */
   
   


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2