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

Diff for /pegasus/src/Pegasus/Common/CIMScope.cpp between version 1.14 and 1.21

version 1.14, 2002/08/05 16:14:41 version 1.21, 2005/02/05 22:59:23
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2005////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // The Open Group, Tivoli Systems  // 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.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; VERITAS Software Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 25 
Line 31 
 // //
 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
 //                (carolann_graves@hp.com) //                (carolann_graves@hp.com)
   //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <cstring> #include <cstring>
 #include <Pegasus/Common/Exception.h>  #include <Pegasus/Common/InternalException.h>
 #include "CIMScope.h" #include "CIMScope.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 const Uint32 CIMScope::NONE = 0;  const CIMScope CIMScope::NONE = 0;
 const Uint32 CIMScope::CLASS = 1;  const CIMScope CIMScope::CLASS = 1;
 const Uint32 CIMScope::ASSOCIATION = 2;  const CIMScope CIMScope::ASSOCIATION = 2;
 const Uint32 CIMScope::INDICATION = 4;  const CIMScope CIMScope::INDICATION = 4;
 const Uint32 CIMScope::PROPERTY = 8;  const CIMScope CIMScope::PROPERTY = 8;
 const Uint32 CIMScope::REFERENCE = 16;  const CIMScope CIMScope::REFERENCE = 16;
 const Uint32 CIMScope::METHOD = 32;  const CIMScope CIMScope::METHOD = 32;
 const Uint32 CIMScope::PARAMETER = 64;  const CIMScope CIMScope::PARAMETER = 64;
 const Uint32 CIMScope::ANY = (1 | 2 | 4 | 8 | 16 | 32 | 64);  const CIMScope CIMScope::ANY = CIMScope::CLASS + CIMScope::ASSOCIATION +
                                  CIMScope::INDICATION + CIMScope::PROPERTY +
                                  CIMScope::REFERENCE + CIMScope::METHOD +
                                  CIMScope::PARAMETER;
  
 CIMScope::CIMScope () CIMScope::CIMScope ()
     : cimScope (CIMScope::NONE)      : cimScope (CIMScope::NONE.cimScope)
 { {
 } }
  
Line 57 
Line 67 
 CIMScope::CIMScope (const Uint32 scope) CIMScope::CIMScope (const Uint32 scope)
     : cimScope (scope)     : cimScope (scope)
 { {
     if (scope > CIMScope::ANY)      PEGASUS_ASSERT (scope < 128);
     {  
         //  
         //  Invalid scope value  
         //  
         String scopeString;  
         char buffer [32];  
         sprintf (buffer, "%lu", (unsigned long) scope);  
         scopeString = buffer;  
         throw InvalidScope (scopeString);  
     }  
 } }
  
 CIMScope & CIMScope::operator= (const CIMScope & scope) CIMScope & CIMScope::operator= (const CIMScope & scope)
Line 76 
Line 76 
     return *this;     return *this;
 } }
  
 void CIMScope::addScope (const Uint32 scope)  void CIMScope::addScope (const CIMScope & scope)
 {  
     if (scope > CIMScope::ANY)  
     {  
         //  
         //  Invalid scope value  
         //  
         String scopeString;  
         char buffer [32];  
         sprintf (buffer, "%lu", (unsigned long) scope);  
         scopeString = buffer;  
         throw InvalidScope (scopeString);  
     }  
   
     this->cimScope |= scope;  
 }  
   
 Boolean CIMScope::hasScope (const Uint32 scope) const  
 {  
     if ((this->cimScope & scope) == scope)  
     {  
         return true;  
     }  
     else  
     {     {
         return false;      this->cimScope |= scope.cimScope;
     }  
 } }
  
 Boolean CIMScope::hasScope (const CIMScope & scope) const Boolean CIMScope::hasScope (const CIMScope & scope) const
 { {
     if ((this->cimScope & scope.cimScope) == scope.cimScope)      return ((this->cimScope & scope.cimScope) == scope.cimScope);
     {  
         return true;  
     }  
     else  
     {  
         return false;  
     }  
 } }
  
 Boolean CIMScope::equal (const CIMScope & scope) const Boolean CIMScope::equal (const CIMScope & scope) const
 { {
     if (this->cimScope == scope.cimScope)      return (this->cimScope == scope.cimScope);
     {  
         return true;  
     }     }
     else  
   CIMScope CIMScope::operator+ (const CIMScope & scope) const
     {     {
         return false;      return CIMScope(this->cimScope | scope.cimScope);
     }  
 } }
  
 String CIMScope::toString () const String CIMScope::toString () const
Line 134 
Line 101 
     String tmp;     String tmp;
  
     if (this->hasScope (CIMScope::CLASS))     if (this->hasScope (CIMScope::CLASS))
         tmp += "CLASS ";          tmp.append("CLASS ");
  
     if (this->hasScope (CIMScope::ASSOCIATION))     if (this->hasScope (CIMScope::ASSOCIATION))
         tmp += "ASSOCIATION ";          tmp.append("ASSOCIATION ");
  
     if (this->hasScope (CIMScope::INDICATION))     if (this->hasScope (CIMScope::INDICATION))
         tmp += "INDICATION ";          tmp.append("INDICATION ");
  
     if (this->hasScope (CIMScope::PROPERTY))     if (this->hasScope (CIMScope::PROPERTY))
         tmp += "PROPERTY ";          tmp.append("PROPERTY ");
  
     if (this->hasScope (CIMScope::REFERENCE))     if (this->hasScope (CIMScope::REFERENCE))
         tmp += "REFERENCE ";          tmp.append("REFERENCE ");
  
     if (this->hasScope (CIMScope::METHOD))     if (this->hasScope (CIMScope::METHOD))
         tmp += "METHOD ";          tmp.append("METHOD ");
  
     if (this->hasScope (CIMScope::PARAMETER))     if (this->hasScope (CIMScope::PARAMETER))
         tmp += "PARAMETER ";          tmp.append("PARAMETER ");
  
     if (tmp.size())     if (tmp.size())
         tmp.remove(tmp.size() - 1);         tmp.remove(tmp.size() - 1);


Legend:
Removed from v.1.14  
changed lines
  Added in v.1.21

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2