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

Diff for /pegasus/src/Pegasus/Common/CIMFlavor.cpp between version 1.16 and 1.18

version 1.16, 2002/08/08 18:30:00 version 1.18, 2002/08/17 00:59:36
Line 30 
Line 30 
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include "CIMFlavor.h" #include "CIMFlavor.h"
 #include <Pegasus/Common/Exception.h>  #include <Pegasus/Common/InternalException.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 const Uint32 CIMFlavor::NONE = 0;  const CIMFlavor CIMFlavor::NONE = 0;
 const Uint32 CIMFlavor::OVERRIDABLE = 1;  const CIMFlavor CIMFlavor::OVERRIDABLE = 1;
 const Uint32 CIMFlavor::ENABLEOVERRIDE = 1;  const CIMFlavor CIMFlavor::ENABLEOVERRIDE = 1;
 const Uint32 CIMFlavor::TOSUBCLASS = 2;  const CIMFlavor CIMFlavor::TOSUBCLASS = 2;
 const Uint32 CIMFlavor::TOINSTANCE = 4;  const CIMFlavor CIMFlavor::TOINSTANCE = 4;
 const Uint32 CIMFlavor::TRANSLATABLE = 8;  const CIMFlavor CIMFlavor::TRANSLATABLE = 8;
 const Uint32 CIMFlavor::TOSUBELEMENTS = TOSUBCLASS | TOINSTANCE;  const CIMFlavor CIMFlavor::TOSUBELEMENTS = TOSUBCLASS + TOINSTANCE;
 const Uint32 CIMFlavor::DISABLEOVERRIDE = 16;  const CIMFlavor CIMFlavor::DISABLEOVERRIDE = 16;
 const Uint32 CIMFlavor::RESTRICTED = 32;  const CIMFlavor CIMFlavor::RESTRICTED = 32;
 const Uint32 CIMFlavor::DEFAULTS = OVERRIDABLE | TOSUBCLASS;  const CIMFlavor CIMFlavor::DEFAULTS = OVERRIDABLE + TOSUBCLASS;
 // ATTN: P1 KS 24 March 2002 Change here to make TOINSTANCE part of the defaults // ATTN: P1 KS 24 March 2002 Change here to make TOINSTANCE part of the defaults
 //const Uint32 CIMFlavor::DEFAULTS = OVERRIDABLE | TOSUBCLASS| TOINSTANCE;  //const CIMFlavor CIMFlavor::DEFAULTS = OVERRIDABLE + TOSUBCLASS + TOINSTANCE;
 const Uint32 CIMFlavor::ALL =  const CIMFlavor CIMFlavor::ALL =
                  OVERRIDABLE | TOSUBCLASS | TOINSTANCE | TRANSLATABLE |                   OVERRIDABLE + TOSUBCLASS + TOINSTANCE + TRANSLATABLE +
                  DISABLEOVERRIDE | RESTRICTED;                   DISABLEOVERRIDE + RESTRICTED;
  
  
 CIMFlavor::CIMFlavor () CIMFlavor::CIMFlavor ()
     : cimFlavor (CIMFlavor::NONE)      : cimFlavor (CIMFlavor::NONE.cimFlavor)
 { {
 } }
  
Line 64 
Line 64 
 CIMFlavor::CIMFlavor (const Uint32 flavor) CIMFlavor::CIMFlavor (const Uint32 flavor)
     : cimFlavor (flavor)     : cimFlavor (flavor)
 { {
     _checkFlavor (flavor);      //
       //  Test that no undefined bits are set
       //
       //  Note that conflicting bits may be set in the Uint32 flavor
       //  For example, OVERRIDABLE and DISABLEOVERRIDE may both be set
       //  or TOSUBCLASS and RESTRICTED may both be set
       //  Currently, the flavor is not checked for these conflicts
       //  That is corrected later when a CIMQualifierDecl object is constructed
       //  with the CIMFlavor object
       //
       PEGASUS_ASSERT (flavor < 64);
 } }
  
 CIMFlavor & CIMFlavor::operator= (const CIMFlavor & flavor) CIMFlavor & CIMFlavor::operator= (const CIMFlavor & flavor)
Line 73 
Line 83 
     return *this;     return *this;
 } }
  
 void CIMFlavor::addFlavor (const Uint32 flavor)  
 {  
     _checkFlavor (flavor);  
     this->cimFlavor |= flavor;  
 }  
   
 void CIMFlavor::addFlavor (const CIMFlavor & flavor) void CIMFlavor::addFlavor (const CIMFlavor & flavor)
 { {
     this->cimFlavor |= flavor.cimFlavor;     this->cimFlavor |= flavor.cimFlavor;
 } }
  
 void CIMFlavor::removeFlavor (const Uint32 flavor)  void CIMFlavor::removeFlavor (const CIMFlavor & flavor)
 { {
     _checkFlavor (flavor);      this->cimFlavor &= (~flavor.cimFlavor);
     this->cimFlavor &= (~flavor);  
 }  
   
 Boolean CIMFlavor::hasFlavor (const Uint32 flavor) const  
 {  
     return ((this->cimFlavor & flavor) == flavor) ? true : false;  
 } }
  
 Boolean CIMFlavor::hasFlavor (const CIMFlavor & flavor) const Boolean CIMFlavor::hasFlavor (const CIMFlavor & flavor) const
Line 106 
Line 104 
     return (this->cimFlavor == flavor.cimFlavor) ? true : false;     return (this->cimFlavor == flavor.cimFlavor) ? true : false;
 } }
  
   CIMFlavor CIMFlavor::operator+ (const CIMFlavor & flavor) const
   {
       return CIMFlavor(this->cimFlavor | flavor.cimFlavor);
   }
   
 String CIMFlavor::toString () const String CIMFlavor::toString () const
 { {
     String tmp;     String tmp;
Line 134 
Line 137 
     return tmp;     return tmp;
 } }
  
 void CIMFlavor::_checkFlavor (Uint32 flavor)  
 {  
     //  
     //  Test that no undefined bits are set  
     //  
     //  Note that conflicting bits may be set in the Uint32 flavor  
     //  For example, OVERRIDABLE and DISABLEOVERRIDE may both be set  
     //  or TOSUBCLASS and RESTRICTED may both be set  
     //  Currently, the flavor is not checked for these conflicts  
     //  That is corrected later when a CIMQualifierDecl object is constructed  
     //  with the CIMFlavor object  
     //  
     if (flavor > CIMFlavor::ALL)  
     {  
         //  
         //  Invalid flavor value  
         //  
         String flavorString;  
         char buffer [32];  
         sprintf (buffer, "%lu", (unsigned long) flavor);  
         flavorString = buffer;  
         throw InvalidFlavor (flavorString);  
     }  
 }  
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.16  
changed lines
  Added in v.1.18

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2