1 mike 1.9 //%/////////////////////////////////////////////////////////////////////////////
2 //
|
3 kumpf 1.22 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
|
5 mike 1.9 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 kumpf 1.22 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10 mike 1.9 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
|
13 kumpf 1.22 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
14 mike 1.9 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
16 kumpf 1.22 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
19 mike 1.9 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 //==============================================================================
23 //
24 // Author: Mike Brasher (mbrasher@bmc.com)
25 //
|
26 kumpf 1.12 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
27 kumpf 1.21 // Carol Ann Krug Graves, Hewlett-Packard Company
28 // (carolann_graves@hp.com)
|
29 mike 1.9 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
|
32 kumpf 1.11 #include "CIMClassRep.h"
|
33 mike 1.9 #include "CIMClass.h"
34
35 PEGASUS_NAMESPACE_BEGIN
36
37 #define PEGASUS_ARRAY_T CIMClass
38 # include "ArrayImpl.h"
39 #undef PEGASUS_ARRAY_T
40
|
41 mike 1.10 ////////////////////////////////////////////////////////////////////////////////
42 //
43 // CIMClass
44 //
45 ////////////////////////////////////////////////////////////////////////////////
46
|
47 kumpf 1.11 CIMClass::CIMClass()
48 : _rep(0)
49 {
50 }
51
52 CIMClass::CIMClass(const CIMClass& x)
53 {
54 Inc(_rep = x._rep);
55 }
56
|
57 kumpf 1.13 CIMClass::CIMClass(const CIMObject& x) throw(DynamicCastFailed)
|
58 mike 1.10 {
59 if (!(_rep = dynamic_cast<CIMClassRep*>(x._rep)))
60 throw DynamicCastFailed();
|
61 kumpf 1.12 Inc(_rep);
|
62 mike 1.10 }
63
|
64 kumpf 1.11 CIMClass::CIMClass(
|
65 kumpf 1.18 const CIMObjectPath& reference,
|
66 kumpf 1.11 const String& superClassName)
67 {
68 _rep = new CIMClassRep(reference, superClassName);
69 }
70
71 CIMClass::CIMClass(CIMClassRep* rep)
72 : _rep(rep)
73 {
74 }
75
76 CIMClass& CIMClass::operator=(const CIMClass& x)
77 {
78 if (x._rep != _rep)
79 {
80 Dec(_rep);
81 Inc(_rep = x._rep);
82 }
83 return *this;
84 }
85
86 CIMClass::~CIMClass()
87 kumpf 1.11 {
88 Dec(_rep);
89 }
90
91 Boolean CIMClass::isAssociation() const
92 {
93 _checkRep();
94 return _rep->isAssociation();
95 }
96
97 Boolean CIMClass::isAbstract() const
98 {
99 _checkRep();
100 return _rep->isAbstract();
101 }
102
103 const String& CIMClass::getClassName() const
104 {
105 _checkRep();
106 return _rep->getClassName();
107 }
108 kumpf 1.11
|
109 kumpf 1.18 const CIMObjectPath& CIMClass::getPath() const
|
110 kumpf 1.11 {
111 _checkRep();
112 return _rep->getPath();
|
113 kumpf 1.21 }
114
115 void CIMClass::setPath (const CIMObjectPath & path)
116 {
117 _checkRep ();
118 _rep->setPath (path);
|
119 kumpf 1.11 }
120
121 const String& CIMClass::getSuperClassName() const
122 {
123 _checkRep();
124 return _rep->getSuperClassName();
125 }
126
127 void CIMClass::setSuperClassName(const String& superClassName)
128 {
129 _checkRep();
130 _rep->setSuperClassName(superClassName);
131 }
132
133 CIMClass& CIMClass::addQualifier(const CIMQualifier& qualifier)
134 {
135 _checkRep();
136 _rep->addQualifier(qualifier);
137 return *this;
138 }
139
140 kumpf 1.11 Uint32 CIMClass::findQualifier(const String& name) const
141 {
142 _checkRep();
143 return _rep->findQualifier(name);
144 }
145
146 Boolean CIMClass::isTrueQualifier(const String& name) const
147 {
148 _checkRep();
149 return _rep->isTrueQualifier(name);
150 }
151
152 CIMQualifier CIMClass::getQualifier(Uint32 pos)
153 {
154 _checkRep();
155 return _rep->getQualifier(pos);
156 }
157
158 CIMConstQualifier CIMClass::getQualifier(Uint32 pos) const
159 {
160 _checkRep();
161 kumpf 1.11 return _rep->getQualifier(pos);
162 }
163
164 void CIMClass::removeQualifier(Uint32 pos)
165 {
166 _checkRep();
167 _rep->removeQualifier(pos);
168 }
169
170 Uint32 CIMClass::getQualifierCount() const
171 {
172 _checkRep();
173 return _rep->getQualifierCount();
174 }
175
176 CIMClass& CIMClass::addProperty(const CIMProperty& x)
177 {
178 _checkRep();
179 _rep->addProperty(x);
180 return *this;
181 }
182 kumpf 1.11
183 Uint32 CIMClass::findProperty(const String& name) const
184 {
185 _checkRep();
186 return _rep->findProperty(name);
187 }
188
189 CIMProperty CIMClass::getProperty(Uint32 pos)
190 {
191 _checkRep();
192 return _rep->getProperty(pos);
193 }
194
195 CIMConstProperty CIMClass::getProperty(Uint32 pos) const
196 {
197 _checkRep();
198 return _rep->getProperty(pos);
199 }
200
201 void CIMClass::removeProperty(Uint32 pos)
202 {
203 kumpf 1.11 _checkRep();
204 _rep->removeProperty(pos);
205 }
206
207 Uint32 CIMClass::getPropertyCount() const
208 {
209 _checkRep();
210 return _rep->getPropertyCount();
211 }
212
213 CIMClass& CIMClass::addMethod(const CIMMethod& x)
214 {
215 _checkRep();
216 _rep->addMethod(x);
217 return *this;
218 }
219
220 Uint32 CIMClass::findMethod(const String& name) const
221 {
222 _checkRep();
223 return _rep->findMethod(name);
224 kumpf 1.11 }
225
226 CIMMethod CIMClass::getMethod(Uint32 pos)
227 {
228 _checkRep();
229 return _rep->getMethod(pos);
230 }
231
232 CIMConstMethod CIMClass::getMethod(Uint32 pos) const
233 {
234 _checkRep();
235 return _rep->getMethod(pos);
236 }
237
238 void CIMClass::removeMethod(Uint32 pos)
239 {
240 _checkRep();
241 _rep->removeMethod(pos);
242 }
243
244 Uint32 CIMClass::getMethodCount() const
245 kumpf 1.11 {
246 _checkRep();
247 return _rep->getMethodCount();
248 }
249
|
250 kumpf 1.15 Boolean CIMClass::isNull() const
|
251 kumpf 1.11 {
|
252 kumpf 1.15 return (_rep == 0)? true : false;
|
253 kumpf 1.11 }
254
|
255 mike 1.9 Boolean CIMClass::identical(const CIMConstClass& x) const
256 {
257 x._checkRep();
258 _checkRep();
259 return _rep->identical(x._rep);
|
260 mike 1.10 }
261
|
262 kumpf 1.11 CIMClass CIMClass::clone() const
263 {
264 return CIMClass((CIMClassRep*)(_rep->clone()));
265 }
266
267 void CIMClass::getKeyNames(Array<String>& keyNames) const
268 {
269 _checkRep();
270 _rep->getKeyNames(keyNames);
271 }
272
273 Boolean CIMClass::hasKeys() const
274 {
275 _checkRep();
276 return _rep->hasKeys();
277 }
278
279 void CIMClass::_checkRep() const
280 {
281 if (!_rep)
|
282 kumpf 1.14 ThrowUninitializedHandle();
|
283 kumpf 1.11 }
284
|
285 mike 1.10 ////////////////////////////////////////////////////////////////////////////////
286 //
287 // CIMConstClass
288 //
289 ////////////////////////////////////////////////////////////////////////////////
290
|
291 kumpf 1.11 CIMConstClass::CIMConstClass()
292 : _rep(0)
293 {
294 }
295
296 CIMConstClass::CIMConstClass(const CIMConstClass& x)
297 {
298 Inc(_rep = x._rep);
299 }
300
301 CIMConstClass::CIMConstClass(const CIMClass& x)
302 {
303 Inc(_rep = x._rep);
304 }
305
|
306 kumpf 1.13 CIMConstClass::CIMConstClass(const CIMObject& x) throw(DynamicCastFailed)
|
307 mike 1.10 {
308 if (!(_rep = dynamic_cast<CIMClassRep*>(x._rep)))
309 throw DynamicCastFailed();
|
310 kumpf 1.12 Inc(_rep);
|
311 mike 1.10 }
312
|
313 kumpf 1.13 CIMConstClass::CIMConstClass(const CIMConstObject& x) throw(DynamicCastFailed)
|
314 mike 1.10 {
315 if (!(_rep = dynamic_cast<CIMClassRep*>(x._rep)))
316 throw DynamicCastFailed();
|
317 kumpf 1.12 Inc(_rep);
|
318 kumpf 1.11 }
319
320 CIMConstClass::CIMConstClass(
|
321 kumpf 1.18 const CIMObjectPath& reference,
|
322 kumpf 1.11 const String& superClassName)
323 {
324 _rep = new CIMClassRep(reference, superClassName);
325 }
326
327 CIMConstClass& CIMConstClass::operator=(const CIMConstClass& x)
328 {
329 if (x._rep != _rep)
330 {
331 Dec(_rep);
332 Inc(_rep = x._rep);
333 }
334 return *this;
335 }
336
337 CIMConstClass& CIMConstClass::operator=(const CIMClass& x)
338 {
339 if (x._rep != _rep)
340 {
341 Dec(_rep);
342 Inc(_rep = x._rep);
343 kumpf 1.11 }
344 return *this;
345 }
346
347 CIMConstClass::~CIMConstClass()
348 {
349 Dec(_rep);
350 }
351
352 Boolean CIMConstClass::isAssociation() const
353 {
354 _checkRep();
355 return _rep->isAssociation();
356 }
357
358 Boolean CIMConstClass::isAbstract() const
359 {
360 _checkRep();
361 return _rep->isAbstract();
362 }
363
364 kumpf 1.11 const String& CIMConstClass::getClassName() const
365 {
366 _checkRep();
367 return _rep->getClassName();
368 }
369
|
370 kumpf 1.18 const CIMObjectPath& CIMConstClass::getPath() const
|
371 kumpf 1.11 {
372 _checkRep();
373 return _rep->getPath();
374 }
375
376 const String& CIMConstClass::getSuperClassName() const
377 {
378 _checkRep();
379 return _rep->getSuperClassName();
380 }
381
382 Uint32 CIMConstClass::findQualifier(const String& name) const
383 {
384 _checkRep();
385 return _rep->findQualifier(name);
386 }
387
388 CIMConstQualifier CIMConstClass::getQualifier(Uint32 pos) const
389 {
390 _checkRep();
391 return _rep->getQualifier(pos);
392 kumpf 1.11 }
393
394 Boolean CIMConstClass::isTrueQualifier(const String& name) const
395 {
396 _checkRep();
397 return _rep->isTrueQualifier(name);
398 }
399
400 Uint32 CIMConstClass::getQualifierCount() const
401 {
402 _checkRep();
403 return _rep->getQualifierCount();
404 }
405
406 Uint32 CIMConstClass::findProperty(const String& name) const
407 {
408 _checkRep();
409 return _rep->findProperty(name);
410 }
411
412 CIMConstProperty CIMConstClass::getProperty(Uint32 pos) const
413 kumpf 1.11 {
414 _checkRep();
415 return _rep->getProperty(pos);
416 }
417
418 Uint32 CIMConstClass::getPropertyCount() const
419 {
420 _checkRep();
421 return _rep->getPropertyCount();
422 }
423
424 Uint32 CIMConstClass::findMethod(const String& name) const
425 {
426 _checkRep();
427 return _rep->findMethod(name);
428 }
429
430 CIMConstMethod CIMConstClass::getMethod(Uint32 pos) const
431 {
432 _checkRep();
433 return _rep->getMethod(pos);
434 kumpf 1.11 }
435
436 Uint32 CIMConstClass::getMethodCount() const
437 {
438 _checkRep();
439 return _rep->getMethodCount();
440 }
441
|
442 kumpf 1.15 Boolean CIMConstClass::isNull() const
|
443 kumpf 1.11 {
|
444 kumpf 1.15 return (_rep == 0)? true : false;
|
445 kumpf 1.11 }
446
447 Boolean CIMConstClass::identical(const CIMConstClass& x) const
448 {
449 x._checkRep();
450 _checkRep();
451 return _rep->identical(x._rep);
452 }
453
454 CIMClass CIMConstClass::clone() const
455 {
456 return CIMClass((CIMClassRep*)(_rep->clone()));
457 }
458
459 void CIMConstClass::getKeyNames(Array<String>& keyNames) const
460 {
461 _checkRep();
462 _rep->getKeyNames(keyNames);
463 }
464
465 Boolean CIMConstClass::hasKeys() const
466 kumpf 1.11 {
467 _checkRep();
468 return _rep->hasKeys();
469 }
470
471 void CIMConstClass::_checkRep() const
472 {
473 if (!_rep)
|
474 kumpf 1.14 ThrowUninitializedHandle();
|
475 mike 1.9 }
476
477 PEGASUS_NAMESPACE_END
|