1 mike 1.12 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to
7 // deal in the Software without restriction, including without limitation the
8 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 // sell copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
13 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
14 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
18 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
19 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 //
21 //==============================================================================
22 mike 1.12 //
23 // Author: Mike Brasher (mbrasher@bmc.com)
24 //
25 // Modified By:
26 //
27 //%/////////////////////////////////////////////////////////////////////////////
28
29 #ifndef Pegasus_Parameter_h
30 #define Pegasus_Parameter_h
31
32 #include <Pegasus/Common/Config.h>
33 #include <Pegasus/Common/CIMParameterRep.h>
34
35 PEGASUS_NAMESPACE_BEGIN
36
37 ////////////////////////////////////////////////////////////////////////////////
38 //
39 // CIMParameter
40 //
41 ////////////////////////////////////////////////////////////////////////////////
42
43 mike 1.12 class CIMConstParameter;
44
45 class PEGASUS_COMMON_LINKAGE CIMParameter
46 {
47 public:
48
49 CIMParameter() : _rep(0)
50 {
51
52 }
53
54 CIMParameter(const CIMParameter& x)
55 {
56 Inc(_rep = x._rep);
57 }
58
59 CIMParameter& operator=(const CIMParameter& x)
60 {
61 if (x._rep != _rep)
62 {
63 Dec(_rep);
64 mike 1.12 Inc(_rep = x._rep);
65 }
66 return *this;
67 }
68
69 // Throws IllegalName if name argument not legal CIM identifier.
70
71 CIMParameter(
72 const String& name,
73 CIMType type,
74 Boolean isArray = false,
75 Uint32 arraySize = 0,
76 const String& referenceClassName = String::EMPTY)
77 {
78 _rep = new CIMParameterRep(
79 name, type, isArray, arraySize, referenceClassName);
80 }
81
82 ~CIMParameter()
83 {
84 Dec(_rep);
85 mike 1.12 }
86
87 const String& getName() const
88 {
89 _checkRep();
90 return _rep->getName();
91 }
92
93 // Throws IllegalName if name argument not legal CIM identifier.
94
95 void setName(const String& name)
96 {
97 _checkRep();
98 _rep->setName(name);
99 }
100
101 Boolean isArray() const
102 {
103 _checkRep();
104 return _rep->isArray();
105 }
106 mike 1.12
|
192 mike 1.12 void print(PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const
193 {
194 _checkRep();
195 _rep->print(o);
196 }
197
198 Boolean identical(const CIMConstParameter& x) const;
199
200 CIMParameter clone() const
201 {
202 return CIMParameter(_rep->clone());
203 }
204
205 private:
206
207 CIMParameter(CIMParameterRep* rep) : _rep(rep)
208 {
209 }
210
211 void _checkRep() const
212 {
213 mike 1.12 if (!_rep)
214 ThrowUnitializedHandle();
215 }
216
217 CIMParameterRep* _rep;
218 friend class CIMConstParameter;
219 };
220
221 ////////////////////////////////////////////////////////////////////////////////
222 //
223 // CIMConstParameter
224 //
225 ////////////////////////////////////////////////////////////////////////////////
226
227 class PEGASUS_COMMON_LINKAGE CIMConstParameter
228 {
229 public:
230
231 CIMConstParameter() : _rep(0)
232 {
233
234 mike 1.12 }
235
236 CIMConstParameter(const CIMConstParameter& x)
237 {
238 Inc(_rep = x._rep);
239 }
240
241 CIMConstParameter(const CIMParameter& x)
242 {
243 Inc(_rep = x._rep);
244 }
245
246 CIMConstParameter& operator=(const CIMConstParameter& x)
247 {
248 if (x._rep != _rep)
249 {
250 Dec(_rep);
251 Inc(_rep = x._rep);
252 }
253 return *this;
254 }
255 mike 1.12
256 CIMConstParameter& operator=(const CIMParameter& x)
257 {
258 if (x._rep != _rep)
259 {
260 Dec(_rep);
261 Inc(_rep = x._rep);
262 }
263 return *this;
264 }
265
266 // Throws IllegalName if name argument not legal CIM identifier.
267
268 CIMConstParameter(
269 const String& name,
270 CIMType type,
271 Boolean isArray = false,
272 Uint32 arraySize = 0,
273 const String& referenceClassName = String::EMPTY)
274 {
275 _rep = new CIMParameterRep(
276 mike 1.12 name, type, isArray, arraySize, referenceClassName);
277 }
278
279 ~CIMConstParameter()
280 {
281 Dec(_rep);
282 }
283
284 const String& getName() const
285 {
286 _checkRep();
287 return _rep->getName();
288 }
289
290 Boolean isArray() const
291 {
292 _checkRep();
293 return _rep->isArray();
294 }
295
|