1 mike 1.9 //%/////////////////////////////////////////////////////////////////////////////
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.9 //
23 // Author: Mike Brasher (mbrasher@bmc.com)
24 //
25 // Modified By:
26 //
27 //%/////////////////////////////////////////////////////////////////////////////
28
|
29 kumpf 1.11 #include "CIMClassRep.h"
|
30 mike 1.9 #include "CIMClass.h"
31
32 PEGASUS_NAMESPACE_BEGIN
33
34 #define PEGASUS_ARRAY_T CIMClass
35 # include "ArrayImpl.h"
36 #undef PEGASUS_ARRAY_T
37
|
38 mike 1.10 ////////////////////////////////////////////////////////////////////////////////
39 //
40 // CIMClass
41 //
42 ////////////////////////////////////////////////////////////////////////////////
43
|
44 kumpf 1.11 CIMClass::CIMClass()
45 : _rep(0)
46 {
47 }
48
49 CIMClass::CIMClass(const CIMClass& x)
50 {
51 Inc(_rep = x._rep);
52 }
53
|
54 mike 1.10 CIMClass::CIMClass(const CIMObject& x)
55 {
|
56 kumpf 1.11 // ATTN-RK-P1-20020502: Need to Inc(_rep)?
|
57 mike 1.10 if (!(_rep = dynamic_cast<CIMClassRep*>(x._rep)))
58 throw DynamicCastFailed();
59 }
60
61 CIMClass::CIMClass(const CIMObject& x, NoThrow&)
62 {
|
63 kumpf 1.11 // ATTN-RK-P1-20020502: Need to Inc(_rep)?
|
64 mike 1.10 _rep = dynamic_cast<CIMClassRep*>(x._rep);
65 }
66
|
67 kumpf 1.11 CIMClass::CIMClass(
68 const CIMReference& reference,
69 const String& superClassName)
70 {
71 _rep = new CIMClassRep(reference, superClassName);
72 }
73
74 CIMClass::CIMClass(CIMClassRep* rep)
75 : _rep(rep)
76 {
77 }
78
79 CIMClass& CIMClass::operator=(const CIMClass& x)
80 {
81 if (x._rep != _rep)
82 {
83 Dec(_rep);
84 Inc(_rep = x._rep);
85 }
86 return *this;
87 }
88 kumpf 1.11
89 CIMClass::~CIMClass()
90 {
91 Dec(_rep);
92 }
93
94 Boolean CIMClass::isAssociation() const
95 {
96 _checkRep();
97 return _rep->isAssociation();
98 }
99
100 Boolean CIMClass::isAbstract() const
101 {
102 _checkRep();
103 return _rep->isAbstract();
104 }
105
106 const String& CIMClass::getClassName() const
107 {
108 _checkRep();
109 kumpf 1.11 return _rep->getClassName();
110 }
111
112 const Boolean CIMClass::equalClassName(const String& classname) const
113 {
114 _checkRep();
115 return _rep->equalClassName(classname);
116 }
117
118 const CIMReference& CIMClass::getPath() const
119 {
120 _checkRep();
121 return _rep->getPath();
122 }
123
124 const String& CIMClass::getSuperClassName() const
125 {
126 _checkRep();
127 return _rep->getSuperClassName();
128 }
129
130 kumpf 1.11 void CIMClass::setSuperClassName(const String& superClassName)
131 {
132 _checkRep();
133 _rep->setSuperClassName(superClassName);
134 }
135
136 CIMClass& CIMClass::addQualifier(const CIMQualifier& qualifier)
137 {
138 _checkRep();
139 _rep->addQualifier(qualifier);
140 return *this;
141 }
142
143 Uint32 CIMClass::findQualifier(const String& name) const
144 {
145 _checkRep();
146 return _rep->findQualifier(name);
147 }
148
149 Boolean CIMClass::existsQualifier(const String& name) const
150 {
151 kumpf 1.11 _checkRep();
152 return _rep->existsQualifier(name);
153 }
154
155 Boolean CIMClass::isTrueQualifier(const String& name) const
156 {
157 _checkRep();
158 return _rep->isTrueQualifier(name);
159 }
160
161 CIMQualifier CIMClass::getQualifier(Uint32 pos)
162 {
163 _checkRep();
164 return _rep->getQualifier(pos);
165 }
166
167 CIMConstQualifier CIMClass::getQualifier(Uint32 pos) const
168 {
169 _checkRep();
170 return _rep->getQualifier(pos);
171 }
172 kumpf 1.11
173 void CIMClass::removeQualifier(Uint32 pos)
174 {
175 _checkRep();
176 _rep->removeQualifier(pos);
177 }
178
179 Uint32 CIMClass::getQualifierCount() const
180 {
181 _checkRep();
182 return _rep->getQualifierCount();
183 }
184
185 CIMClass& CIMClass::addProperty(const CIMProperty& x)
186 {
187 _checkRep();
188 _rep->addProperty(x);
189 return *this;
190 }
191
192 Uint32 CIMClass::findProperty(const String& name) const
193 kumpf 1.11 {
194 _checkRep();
195 return _rep->findProperty(name);
196 }
197
198 Boolean CIMClass::existsProperty(const String& name) const
199 {
200 _checkRep();
201 return _rep->existsProperty(name);
202 }
203
204 CIMProperty CIMClass::getProperty(Uint32 pos)
205 {
206 _checkRep();
207 return _rep->getProperty(pos);
208 }
209
210 CIMConstProperty CIMClass::getProperty(Uint32 pos) const
211 {
212 _checkRep();
213 return _rep->getProperty(pos);
214 kumpf 1.11 }
215
216 void CIMClass::removeProperty(Uint32 pos)
217 {
218 _checkRep();
219 _rep->removeProperty(pos);
220 }
221
222 Uint32 CIMClass::getPropertyCount() const
223 {
224 _checkRep();
225 return _rep->getPropertyCount();
226 }
227
228 CIMClass& CIMClass::addMethod(const CIMMethod& x)
229 {
230 _checkRep();
231 _rep->addMethod(x);
232 return *this;
233 }
234
235 kumpf 1.11 Uint32 CIMClass::findMethod(const String& name) const
236 {
237 _checkRep();
238 return _rep->findMethod(name);
239 }
240
241 Boolean CIMClass::existsMethod(const String& name) const
242 {
243 _checkRep();
244 return _rep->existsMethod(name);
245 }
246
247 CIMMethod CIMClass::getMethod(Uint32 pos)
248 {
249 _checkRep();
250 return _rep->getMethod(pos);
251 }
252
253 CIMConstMethod CIMClass::getMethod(Uint32 pos) const
254 {
255 _checkRep();
256 kumpf 1.11 return _rep->getMethod(pos);
257 }
258
259 void CIMClass::removeMethod(Uint32 pos)
260 {
261 _checkRep();
262 _rep->removeMethod(pos);
263 }
264
265 Uint32 CIMClass::getMethodCount() const
266 {
267 _checkRep();
268 return _rep->getMethodCount();
269 }
270
271 void CIMClass::resolve(
272 DeclContext* declContext,
273 const String& nameSpace)
274 {
275 _checkRep();
276 _rep->resolve(declContext, nameSpace);
277 kumpf 1.11 }
278
279 CIMClass::operator int() const
280 {
281 return (_rep != 0);
282 }
283
284 void CIMClass::toXml(Array<Sint8>& out) const
285 {
286 _checkRep();
287 _rep->toXml(out);
288 }
289
290 void CIMClass::print(PEGASUS_STD(ostream)& o) const
291 {
292 _checkRep();
293 _rep->print(o);
294 }
295
296 void CIMClass::toMof(Array<Sint8>& out) const
297 {
298 kumpf 1.11 _checkRep();
299 _rep->toMof(out);
300 }
301
302 void CIMClass::printMof(PEGASUS_STD(ostream)& o) const
303 {
304 _checkRep();
305 _rep->printMof(o);
306 }
307
|
308 mike 1.9 Boolean CIMClass::identical(const CIMConstClass& x) const
309 {
310 x._checkRep();
311 _checkRep();
312 return _rep->identical(x._rep);
|
313 mike 1.10 }
314
|
315 kumpf 1.11 CIMClass CIMClass::clone() const
316 {
317 return CIMClass((CIMClassRep*)(_rep->clone()));
318 }
319
320 void CIMClass::getKeyNames(Array<String>& keyNames) const
321 {
322 _checkRep();
323 _rep->getKeyNames(keyNames);
324 }
325
326 Boolean CIMClass::hasKeys() const
327 {
328 _checkRep();
329 return _rep->hasKeys();
330 }
331
332 void CIMClass::_checkRep() const
333 {
334 if (!_rep)
335 ThrowUnitializedHandle();
336 kumpf 1.11 }
337
|
338 mike 1.10 ////////////////////////////////////////////////////////////////////////////////
339 //
340 // CIMConstClass
341 //
342 ////////////////////////////////////////////////////////////////////////////////
343
|
344 kumpf 1.11 CIMConstClass::CIMConstClass()
345 : _rep(0)
346 {
347 }
348
349 CIMConstClass::CIMConstClass(const CIMConstClass& x)
350 {
351 Inc(_rep = x._rep);
352 }
353
354 CIMConstClass::CIMConstClass(const CIMClass& x)
355 {
356 Inc(_rep = x._rep);
357 }
358
|
359 mike 1.10 CIMConstClass::CIMConstClass(const CIMObject& x)
360 {
|
361 kumpf 1.11 // ATTN-RK-P1-20020502: Need to Inc(_rep)?
|
362 mike 1.10 if (!(_rep = dynamic_cast<CIMClassRep*>(x._rep)))
363 throw DynamicCastFailed();
364 }
365
366 CIMConstClass::CIMConstClass(const CIMConstObject& x)
367 {
|
368 kumpf 1.11 // ATTN-RK-P1-20020502: Need to Inc(_rep)?
|
369 mike 1.10 if (!(_rep = dynamic_cast<CIMClassRep*>(x._rep)))
370 throw DynamicCastFailed();
371 }
372
373 CIMConstClass::CIMConstClass(const CIMObject& x, NoThrow&)
374 {
|
375 kumpf 1.11 // ATTN-RK-P1-20020502: Need to Inc(_rep)?
|
376 mike 1.10 _rep = dynamic_cast<CIMClassRep*>(x._rep);
377 }
378
379 CIMConstClass::CIMConstClass(const CIMConstObject& x, NoThrow&)
380 {
|
381 kumpf 1.11 // ATTN-RK-P1-20020502: Need to Inc(_rep)?
|
382 mike 1.10 _rep = dynamic_cast<CIMClassRep*>(x._rep);
|
383 kumpf 1.11 }
384
385 CIMConstClass::CIMConstClass(
386 const CIMReference& reference,
387 const String& superClassName)
388 {
389 // ATTN-RK-P1-20020502: Need to Inc(_rep)?
390 _rep = new CIMClassRep(reference, superClassName);
391 }
392
393 CIMConstClass& CIMConstClass::operator=(const CIMConstClass& x)
394 {
395 if (x._rep != _rep)
396 {
397 Dec(_rep);
398 Inc(_rep = x._rep);
399 }
400 return *this;
401 }
402
403 CIMConstClass& CIMConstClass::operator=(const CIMClass& x)
404 kumpf 1.11 {
405 if (x._rep != _rep)
406 {
407 Dec(_rep);
408 Inc(_rep = x._rep);
409 }
410 return *this;
411 }
412
413 CIMConstClass::~CIMConstClass()
414 {
415 Dec(_rep);
416 }
417
418 Boolean CIMConstClass::isAssociation() const
419 {
420 _checkRep();
421 return _rep->isAssociation();
422 }
423
424 Boolean CIMConstClass::isAbstract() const
425 kumpf 1.11 {
426 _checkRep();
427 return _rep->isAbstract();
428 }
429
430 const String& CIMConstClass::getClassName() const
431 {
432 _checkRep();
433 return _rep->getClassName();
434 }
435
436 const Boolean CIMConstClass::equalClassName(const String& classname) const
437 {
438 _checkRep();
439 return _rep->equalClassName(classname);
440 }
441
442 const CIMReference& CIMConstClass::getPath() const
443 {
444 _checkRep();
445 return _rep->getPath();
446 kumpf 1.11 }
447
448 const String& CIMConstClass::getSuperClassName() const
449 {
450 _checkRep();
451 return _rep->getSuperClassName();
452 }
453
454 Uint32 CIMConstClass::findQualifier(const String& name) const
455 {
456 _checkRep();
457 return _rep->findQualifier(name);
458 }
459
460 CIMConstQualifier CIMConstClass::getQualifier(Uint32 pos) const
461 {
462 _checkRep();
463 return _rep->getQualifier(pos);
464 }
465
466 Boolean CIMConstClass::isTrueQualifier(const String& name) const
467 kumpf 1.11 {
468 _checkRep();
469 return _rep->isTrueQualifier(name);
470 }
471
472 Uint32 CIMConstClass::getQualifierCount() const
473 {
474 _checkRep();
475 return _rep->getQualifierCount();
476 }
477
478 Uint32 CIMConstClass::findProperty(const String& name) const
479 {
480 _checkRep();
481 return _rep->findProperty(name);
482 }
483
484 CIMConstProperty CIMConstClass::getProperty(Uint32 pos) const
485 {
486 _checkRep();
487 return _rep->getProperty(pos);
488 kumpf 1.11 }
489
490 Uint32 CIMConstClass::getPropertyCount() const
491 {
492 _checkRep();
493 return _rep->getPropertyCount();
494 }
495
496 Uint32 CIMConstClass::findMethod(const String& name) const
497 {
498 _checkRep();
499 return _rep->findMethod(name);
500 }
501
502 CIMConstMethod CIMConstClass::getMethod(Uint32 pos) const
503 {
504 _checkRep();
505 return _rep->getMethod(pos);
506 }
507
508 Uint32 CIMConstClass::getMethodCount() const
509 kumpf 1.11 {
510 _checkRep();
511 return _rep->getMethodCount();
512 }
513
514 CIMConstClass::operator int() const
515 {
516 return (_rep != 0);
517 }
518
519 void CIMConstClass::toXml(Array<Sint8>& out) const
520 {
521 _checkRep();
522 _rep->toXml(out);
523 }
524
525 void CIMConstClass::print(PEGASUS_STD(ostream)& o) const
526 {
527 _checkRep();
528 _rep->print(o);
529 }
530 kumpf 1.11
531 Boolean CIMConstClass::identical(const CIMConstClass& x) const
532 {
533 x._checkRep();
534 _checkRep();
535 return _rep->identical(x._rep);
536 }
537
538 CIMClass CIMConstClass::clone() const
539 {
540 return CIMClass((CIMClassRep*)(_rep->clone()));
541 }
542
543 void CIMConstClass::getKeyNames(Array<String>& keyNames) const
544 {
545 _checkRep();
546 _rep->getKeyNames(keyNames);
547 }
548
549 Boolean CIMConstClass::hasKeys() const
550 {
551 kumpf 1.11 _checkRep();
552 return _rep->hasKeys();
553 }
554
555 void CIMConstClass::_checkRep() const
556 {
557 if (!_rep)
558 ThrowUnitializedHandle();
|
559 mike 1.9 }
560
561 PEGASUS_NAMESPACE_END
|