1 martin 1.43 //%LICENSE////////////////////////////////////////////////////////////////
2 //
3 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 martin 1.43 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 mike 1.14 //
|
28 martin 1.43 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.14 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_PropertyRep_h
33 #define Pegasus_PropertyRep_h
34
35 #include <Pegasus/Common/Config.h>
|
36 marek 1.37 #include <Pegasus/Common/Constants.h>
|
37 kumpf 1.25 #include <Pegasus/Common/InternalException.h>
|
38 mike 1.14 #include <Pegasus/Common/String.h>
|
39 kumpf 1.23 #include <Pegasus/Common/CIMName.h>
|
40 mike 1.14 #include <Pegasus/Common/CIMValue.h>
41 #include <Pegasus/Common/CIMQualifier.h>
42 #include <Pegasus/Common/CIMQualifierList.h>
|
43 kumpf 1.22 #include <Pegasus/Common/Linkage.h>
|
44 marek 1.37 #include <Pegasus/Common/OrderedSet.h>
|
45 mike 1.14
46 PEGASUS_NAMESPACE_BEGIN
47
48 class CIMClassRep;
49 class CIMProperty;
50 class CIMConstProperty;
51 class DeclContext;
52
|
53 thilo.boehm 1.41 class CIMPropertyRep
|
54 mike 1.14 {
55 public:
56
57 CIMPropertyRep(
|
58 kumpf 1.35 const CIMName& name,
59 const CIMValue& value,
60 Uint32 arraySize,
61 const CIMName& referenceClassName,
62 const CIMName& classOrigin,
63 Boolean propagated);
|
64 mike 1.14
|
65 kumpf 1.23 const CIMName& getName() const
|
66 mike 1.14 {
|
67 kumpf 1.35 return _name;
|
68 mike 1.14 }
69
|
70 kumpf 1.40 Uint32 getNameTag() const
|
71 marek 1.37 {
72 return _nameTag;
73 }
74
75 void increaseOwnerCount()
76 {
77 _ownerCount++;
78 return;
79 }
80
81 void decreaseOwnerCount()
82 {
|
83 thilo.boehm 1.41 _ownerCount--;
|
84 marek 1.37 return;
85 }
86
|
87 kumpf 1.23 void setName(const CIMName& name);
|
88 mike 1.14
89 const CIMValue& getValue() const
90 {
|
91 kumpf 1.35 return _value;
|
92 mike 1.14 }
93
94 void setValue(const CIMValue& value);
95
96 Uint32 getArraySize() const
97 {
|
98 kumpf 1.35 return _arraySize;
|
99 mike 1.14 }
100
|
101 kumpf 1.23 const CIMName& getReferenceClassName() const
|
102 mike 1.14 {
|
103 kumpf 1.35 return _referenceClassName;
|
104 mike 1.14 }
105
|
106 kumpf 1.23 const CIMName& getClassOrigin() const
|
107 mike 1.14 {
|
108 kumpf 1.35 return _classOrigin;
|
109 mike 1.14 }
110
|
111 marek 1.39 void setClassOrigin(const CIMName& classOrigin)
112 {
113 _classOrigin = classOrigin;
114 }
|
115 mike 1.14
116 Boolean getPropagated() const
117 {
|
118 kumpf 1.35 return _propagated;
|
119 mike 1.14 }
120
121 void setPropagated(Boolean propagated)
122 {
|
123 kumpf 1.35 _propagated = propagated;
|
124 mike 1.14 }
125
126 void addQualifier(const CIMQualifier& qualifier)
127 {
|
128 kumpf 1.35 _qualifiers.add(qualifier);
|
129 mike 1.14 }
130
|
131 kumpf 1.23 Uint32 findQualifier(const CIMName& name) const
|
132 mike 1.14 {
|
133 kumpf 1.35 return _qualifiers.find(name);
|
134 mike 1.14 }
135
|
136 kumpf 1.26 CIMQualifier getQualifier(Uint32 index)
|
137 mike 1.14 {
|
138 kumpf 1.35 return _qualifiers.getQualifier(index);
|
139 mike 1.14 }
140
|
141 kumpf 1.26 CIMConstQualifier getQualifier(Uint32 index) const
|
142 mike 1.14 {
|
143 kumpf 1.35 return _qualifiers.getQualifier(index);
|
144 mike 1.14 }
145
|
146 kumpf 1.26 void removeQualifier(Uint32 index)
|
147 mike 1.14 {
|
148 kumpf 1.35 _qualifiers.removeQualifier(index);
|
149 mike 1.14 }
150
151 Uint32 getQualifierCount() const
152 {
|
153 kumpf 1.35 return _qualifiers.getCount();
|
154 mike 1.14 }
155
156 void resolve(
|
157 kumpf 1.35 DeclContext* declContext,
158 const CIMNamespaceName& nameSpace,
159 Boolean isInstancePart,
160 const CIMConstProperty& property,
161 Boolean propagateQualifiers);
|
162 mike 1.14
163 void resolve(
|
164 kumpf 1.35 DeclContext* declContext,
165 const CIMNamespaceName& nameSpace,
166 Boolean isInstancePart,
167 Boolean propagateQualifiers);
|
168 mike 1.14
169 Boolean identical(const CIMPropertyRep* x) const;
170
|
171 kumpf 1.24 CIMPropertyRep* clone() const
|
172 mike 1.14 {
|
173 kumpf 1.35 return new CIMPropertyRep(*this, true);
|
174 mike 1.14 }
175
|
176 thilo.boehm 1.41 void Inc()
177 {
178 _refCounter++;
179 }
180
181 void Dec()
182 {
183 if (_refCounter.decAndTestIfZero())
184 delete this;
185 }
186
|
187 mike 1.14 private:
188
189 // Cloning constructor:
190
|
191 mike 1.16 CIMPropertyRep(const CIMPropertyRep& x, Boolean propagateQualifiers);
|
192 mike 1.14
|
193 kumpf 1.36 CIMPropertyRep(); // Unimplemented
194 CIMPropertyRep(const CIMPropertyRep& x); // Unimplemented
195 CIMPropertyRep& operator=(const CIMPropertyRep& x); // Unimplemented
|
196 mike 1.14
|
197 kumpf 1.23 CIMName _name;
|
198 mike 1.14 CIMValue _value;
199 Uint32 _arraySize;
|
200 kumpf 1.23 CIMName _referenceClassName;
201 CIMName _classOrigin;
|
202 mike 1.14 Boolean _propagated;
203 CIMQualifierList _qualifiers;
|
204 marek 1.37 Uint32 _nameTag;
205
|
206 thilo.boehm 1.41 // reference counter as member to avoid
207 // virtual function resolution overhead
208 AtomicInt _refCounter;
209
|
210 marek 1.37 // Number of containers in which this property is a member. Adding a
211 // property to a container increments this count. Removing a property
212 // from a container decrements this count. When this count is non-zero,
213 // any attempt to change the _name member results in an exception (see
214 // setName()).
215 Uint32 _ownerCount;
|
216 mike 1.14
217 friend class CIMClassRep;
|
218 marek 1.37 friend class CIMObjectRep;
219 friend class CIMProperty;
220 friend class CIMPropertyInternal;
|
221 mike 1.42 friend class CIMBuffer;
|
222 mike 1.14 };
223
224 PEGASUS_NAMESPACE_END
225
226 #endif /* Pegasus_PropertyRep_h */
|