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