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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2