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.15 //
|
28 martin 1.43 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.15 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_MethodRep_h
33 #define Pegasus_MethodRep_h
34
35 #include <Pegasus/Common/Config.h>
|
36 kumpf 1.24 #include <Pegasus/Common/Linkage.h>
|
37 marek 1.37 #include <Pegasus/Common/Constants.h>
|
38 kumpf 1.26 #include <Pegasus/Common/InternalException.h>
|
39 mike 1.15 #include <Pegasus/Common/String.h>
|
40 kumpf 1.24 #include <Pegasus/Common/CIMName.h>
|
41 mike 1.15 #include <Pegasus/Common/CIMQualifier.h>
42 #include <Pegasus/Common/CIMQualifierList.h>
43 #include <Pegasus/Common/CIMParameter.h>
|
44 marek 1.37 #include <Pegasus/Common/CIMParameterRep.h>
|
45 mike 1.15 #include <Pegasus/Common/Pair.h>
|
46 marek 1.37 #include <Pegasus/Common/OrderedSet.h>
|
47 mike 1.15
48 PEGASUS_NAMESPACE_BEGIN
49
50 class CIMConstMethod;
51 class DeclContext;
52
|
53 thilo.boehm 1.41 class CIMMethodRep
|
54 mike 1.15 {
55 public:
56
57 CIMMethodRep(
|
58 kumpf 1.35 const CIMName& name,
59 CIMType type,
60 const CIMName& classOrigin,
61 Boolean propagated);
|
62 mike 1.15
|
63 thilo.boehm 1.41 const CIMName& getName() const
|
64 mike 1.15 {
|
65 kumpf 1.35 return _name;
|
66 mike 1.15 }
67
|
68 kumpf 1.40 Uint32 getNameTag() const
|
69 marek 1.37 {
70 return _nameTag;
71 }
72
73 void increaseOwnerCount()
74 {
75 _ownerCount++;
76 return;
77 }
78
79 void decreaseOwnerCount()
80 {
|
81 thilo.boehm 1.41 _ownerCount--;
|
82 marek 1.37 return;
83 }
84
|
85 kumpf 1.24 void setName(const CIMName& name);
|
86 mike 1.15
87 CIMType getType() const
88 {
|
89 kumpf 1.35 return _type;
|
90 mike 1.15 }
91
|
92 marek 1.39 void setType(CIMType type)
93 {
94 _type = type;
95 }
|
96 mike 1.15
|
97 kumpf 1.24 const CIMName& getClassOrigin() const
|
98 mike 1.15 {
|
99 kumpf 1.35 return _classOrigin;
|
100 mike 1.15 }
101
|
102 marek 1.39 void setClassOrigin(const CIMName& classOrigin)
103 {
104 _classOrigin = classOrigin;
105 }
|
106 mike 1.15
107 Boolean getPropagated() const
108 {
|
109 kumpf 1.35 return _propagated;
|
110 mike 1.15 }
111
112 void setPropagated(Boolean propagated)
113 {
|
114 kumpf 1.35 _propagated = propagated;
|
115 mike 1.15 }
116
117 void addQualifier(const CIMQualifier& qualifier)
118 {
|
119 kumpf 1.35 _qualifiers.add(qualifier);
|
120 mike 1.15 }
|
121 kumpf 1.18
|
122 kumpf 1.24 Uint32 findQualifier(const CIMName& name) const
|
123 mike 1.15 {
|
124 kumpf 1.35 return _qualifiers.find(name);
|
125 mike 1.15 }
126
|
127 kumpf 1.27 CIMQualifier getQualifier(Uint32 index)
|
128 mike 1.15 {
|
129 kumpf 1.35 return _qualifiers.getQualifier(index);
|
130 mike 1.15 }
131
132
|
133 kumpf 1.27 CIMConstQualifier getQualifier(Uint32 index) const
|
134 mike 1.15 {
|
135 kumpf 1.35 return _qualifiers.getQualifier(index);
|
136 mike 1.15 }
|
137 kumpf 1.18
|
138 kumpf 1.27 void removeQualifier(Uint32 index)
|
139 mike 1.15 {
|
140 kumpf 1.35 _qualifiers.removeQualifier(index);
|
141 mike 1.15 }
142
143
144 Uint32 getQualifierCount() const
145 {
|
146 kumpf 1.35 return _qualifiers.getCount();
|
147 mike 1.15 }
148
149 void addParameter(const CIMParameter& x);
150
|
151 marek 1.39 Uint32 findParameter(const CIMName& name) const
152 {
153 return _parameters.find(name, generateCIMNameTag(name));
154 }
|
155 mike 1.15
|
156 marek 1.39 CIMParameter getParameter(Uint32 index)
157 {
158 return _parameters[index];
159 }
|
160 mike 1.15
|
161 kumpf 1.27 CIMConstParameter getParameter(Uint32 index) const
|
162 mike 1.15 {
|
163 kumpf 1.35 return ((CIMMethodRep*)this)->getParameter(index);
|
164 mike 1.15 }
165
|
166 marek 1.39 void removeParameter (Uint32 index)
167 {
168 _parameters.remove (index);
169 }
|
170 kumpf 1.25
|
171 marek 1.39 Uint32 getParameterCount() const
172 {
173 return _parameters.size();
174 }
|
175 mike 1.15
176 void resolve(
|
177 kumpf 1.35 DeclContext* declContext,
178 const CIMNamespaceName& nameSpace,
179 const CIMConstMethod& method);
|
180 mike 1.15
181 void resolve(
|
182 kumpf 1.35 DeclContext* declContext,
183 const CIMNamespaceName& nameSpace);
|
184 mike 1.15
185 Boolean identical(const CIMMethodRep* x) const;
186
187 CIMMethodRep* clone() const
188 {
|
189 kumpf 1.35 return new CIMMethodRep(*this);
|
190 mike 1.15 }
191
|
192 thilo.boehm 1.41 void Inc()
193 {
194 _refCounter++;
195 }
196
197 void Dec()
198 {
199 if (_refCounter.decAndTestIfZero())
200 delete this;
201 }
202
|
203 mike 1.15 private:
204
205 CIMMethodRep(const CIMMethodRep& x);
206
|
207 kumpf 1.36 CIMMethodRep(); // Unimplemented
208 CIMMethodRep& operator=(const CIMMethodRep& x); // Unimplemented
|
209 mike 1.15
|
210 kumpf 1.24 CIMName _name;
|
211 mike 1.15 CIMType _type;
|
212 kumpf 1.24 CIMName _classOrigin;
|
213 mike 1.15 Boolean _propagated;
214 CIMQualifierList _qualifiers;
|
215 marek 1.37 Uint32 _nameTag;
216 Uint32 _ownerCount;
217
|
218 thilo.boehm 1.41 // reference counter as member to avoid
219 // virtual function resolution overhead
220 AtomicInt _refCounter;
221
|
222 marek 1.37 typedef OrderedSet<CIMParameter,
223 CIMParameterRep,
224 PEGASUS_PARAMETER_ORDEREDSET_HASHSIZE> ParameterSet;
225 ParameterSet _parameters;
|
226 mike 1.15
227 friend class CIMClassRep;
|
228 mike 1.42 friend class CIMBuffer;
|
229 mike 1.15 };
230
231 PEGASUS_NAMESPACE_END
232
233 #endif /* Pegasus_MethodRep_h */
|