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