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

  1 mike  1.9 //%/////////////////////////////////////////////////////////////////////////////
  2           //
  3 kumpf 1.13 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
  4            // The Open Group, Tivoli Systems
  5 mike  1.9  //
  6            // Permission is hereby granted, free of charge, to any person obtaining a copy
  7 kumpf 1.13 // of this software and associated documentation files (the "Software"), to
  8            // deal in the Software without restriction, including without limitation the
  9            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 10 mike  1.9  // sell copies of the Software, and to permit persons to whom the Software is
 11            // furnished to do so, subject to the following conditions:
 12            // 
 13 kumpf 1.13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 14 mike  1.9  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 15            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 16 kumpf 1.13 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 17            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 18            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 19 mike  1.9  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 20            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 21            //
 22            //==============================================================================
 23            //
 24            // Author: Mike Brasher (mbrasher@bmc.com)
 25            //
 26 kumpf 1.14 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
 27            //                (carolann_graves@hp.com)
 28 kumpf 1.15 //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 29 mike  1.9  //
 30            //%/////////////////////////////////////////////////////////////////////////////
 31            
 32            #include <cstring>
 33 kumpf 1.17 #include <Pegasus/Common/InternalException.h>
 34 mike  1.9  #include "CIMScope.h"
 35            
 36            PEGASUS_NAMESPACE_BEGIN
 37            
 38 kumpf 1.15 const CIMScope CIMScope::NONE = 0;
 39            const CIMScope CIMScope::CLASS = 1;
 40            const CIMScope CIMScope::ASSOCIATION = 2;
 41            const CIMScope CIMScope::INDICATION = 4;
 42            const CIMScope CIMScope::PROPERTY = 8;
 43            const CIMScope CIMScope::REFERENCE = 16;
 44            const CIMScope CIMScope::METHOD = 32;
 45            const CIMScope CIMScope::PARAMETER = 64;
 46            const CIMScope CIMScope::ANY = CIMScope::CLASS + CIMScope::ASSOCIATION +
 47                                           CIMScope::INDICATION + CIMScope::PROPERTY +
 48                                           CIMScope::REFERENCE + CIMScope::METHOD +
 49                                           CIMScope::PARAMETER;
 50 mike  1.9  
 51 kumpf 1.14 CIMScope::CIMScope ()
 52 kumpf 1.15     : cimScope (CIMScope::NONE.cimScope)
 53 kumpf 1.14 {
 54            }
 55            
 56            CIMScope::CIMScope (const CIMScope & scope)
 57                : cimScope (scope.cimScope)
 58            {
 59            }
 60            
 61            CIMScope::CIMScope (const Uint32 scope)
 62                : cimScope (scope)
 63            {
 64 kumpf 1.15     PEGASUS_ASSERT (scope < 128);
 65 kumpf 1.14 }
 66            
 67            CIMScope & CIMScope::operator= (const CIMScope & scope)
 68            {
 69                this->cimScope = scope.cimScope;
 70                return *this;
 71            }
 72            
 73 kumpf 1.15 void CIMScope::addScope (const CIMScope & scope)
 74 kumpf 1.14 {
 75 kumpf 1.15     this->cimScope |= scope.cimScope;
 76 kumpf 1.14 }
 77            
 78            Boolean CIMScope::hasScope (const CIMScope & scope) const
 79            {
 80 kumpf 1.16     return ((this->cimScope & scope.cimScope) == scope.cimScope);
 81 kumpf 1.14 }
 82            
 83            Boolean CIMScope::equal (const CIMScope & scope) const
 84            {
 85 kumpf 1.16     return (this->cimScope == scope.cimScope);
 86 kumpf 1.15 }
 87            
 88            CIMScope CIMScope::operator+ (const CIMScope & scope) const
 89            {
 90                return CIMScope(this->cimScope | scope.cimScope);
 91 kumpf 1.14 }
 92            
 93            String CIMScope::toString () const
 94 mike  1.9  {
 95                String tmp;
 96            
 97 kumpf 1.14     if (this->hasScope (CIMScope::CLASS))
 98 kumpf 1.18 	tmp.append("CLASS ");
 99 mike  1.9  
100 kumpf 1.14     if (this->hasScope (CIMScope::ASSOCIATION))
101 kumpf 1.18 	tmp.append("ASSOCIATION ");
102 mike  1.9  
103 kumpf 1.14     if (this->hasScope (CIMScope::INDICATION))
104 kumpf 1.18 	tmp.append("INDICATION ");
105 mike  1.9  
106 kumpf 1.14     if (this->hasScope (CIMScope::PROPERTY))
107 kumpf 1.18 	tmp.append("PROPERTY ");
108 mike  1.9  
109 kumpf 1.14     if (this->hasScope (CIMScope::REFERENCE))
110 kumpf 1.18 	tmp.append("REFERENCE ");
111 mike  1.9  
112 kumpf 1.14     if (this->hasScope (CIMScope::METHOD))
113 kumpf 1.18 	tmp.append("METHOD ");
114 mike  1.9  
115 kumpf 1.14     if (this->hasScope (CIMScope::PARAMETER))
116 kumpf 1.18 	tmp.append("PARAMETER ");
117 mike  1.9  
118                if (tmp.size())
119            	tmp.remove(tmp.size() - 1);
120            
121                return tmp;
122            }
123            
124            PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2