1 martin 1.42 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.43 //
|
3 martin 1.42 // 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 martin 1.43 //
|
10 martin 1.42 // 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 martin 1.43 //
|
17 martin 1.42 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.43 //
|
20 martin 1.42 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.43 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.42 // 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 martin 1.43 //
|
28 martin 1.42 //////////////////////////////////////////////////////////////////////////
|
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 thilo.boehm 1.41 _rep = x._rep;
55 if (_rep)
56 _rep->Inc();
|
57 kumpf 1.11 }
58
|
59 kumpf 1.31 CIMClass::CIMClass(const CIMObject& x)
|
60 mike 1.10 {
61 if (!(_rep = dynamic_cast<CIMClassRep*>(x._rep)))
|
62 kumpf 1.38 throw DynamicCastFailedException();
|
63 thilo.boehm 1.41 _rep->Inc();
|
64 mike 1.10 }
65
|
66 kumpf 1.11 CIMClass::CIMClass(
|
67 kumpf 1.25 const CIMName& className,
68 const CIMName& superClassName)
|
69 kumpf 1.11 {
|
70 kumpf 1.25 _rep = new CIMClassRep(className, superClassName);
|
71 kumpf 1.11 }
72
73 CIMClass::CIMClass(CIMClassRep* rep)
74 : _rep(rep)
75 {
76 }
77
78 CIMClass& CIMClass::operator=(const CIMClass& x)
79 {
80 if (x._rep != _rep)
81 {
|
82 thilo.boehm 1.41 if (_rep)
83 _rep->Dec();
84 _rep = x._rep;
85 if (_rep)
86 _rep->Inc();
|
87 kumpf 1.11 }
88 return *this;
89 }
90
91 CIMClass::~CIMClass()
92 {
|
93 thilo.boehm 1.41 if (_rep)
94 _rep->Dec();
|
95 kumpf 1.11 }
96
97 Boolean CIMClass::isAssociation() const
98 {
|
99 marek 1.39 CheckRep(_rep);
|
100 kumpf 1.11 return _rep->isAssociation();
101 }
102
103 Boolean CIMClass::isAbstract() const
104 {
|
105 marek 1.39 CheckRep(_rep);
|
106 kumpf 1.11 return _rep->isAbstract();
107 }
108
|
109 kumpf 1.25 const CIMName& CIMClass::getClassName() const
|
110 kumpf 1.11 {
|
111 marek 1.39 CheckRep(_rep);
|
112 kumpf 1.11 return _rep->getClassName();
113 }
114
|
115 kumpf 1.18 const CIMObjectPath& CIMClass::getPath() const
|
116 kumpf 1.11 {
|
117 marek 1.39 CheckRep(_rep);
|
118 kumpf 1.11 return _rep->getPath();
|
119 kumpf 1.21 }
120
121 void CIMClass::setPath (const CIMObjectPath & path)
122 {
|
123 marek 1.39 CheckRep(_rep);
|
124 kumpf 1.21 _rep->setPath (path);
|
125 kumpf 1.11 }
126
|
127 kumpf 1.25 const CIMName& CIMClass::getSuperClassName() const
|
128 kumpf 1.11 {
|
129 marek 1.39 CheckRep(_rep);
|
130 kumpf 1.11 return _rep->getSuperClassName();
131 }
132
|
133 kumpf 1.25 void CIMClass::setSuperClassName(const CIMName& superClassName)
|
134 kumpf 1.11 {
|
135 marek 1.39 CheckRep(_rep);
|
136 kumpf 1.11 _rep->setSuperClassName(superClassName);
137 }
138
139 CIMClass& CIMClass::addQualifier(const CIMQualifier& qualifier)
140 {
|
141 marek 1.39 CheckRep(_rep);
|
142 kumpf 1.11 _rep->addQualifier(qualifier);
143 return *this;
144 }
145
|
146 kumpf 1.25 Uint32 CIMClass::findQualifier(const CIMName& name) const
|
147 kumpf 1.11 {
|
148 marek 1.39 CheckRep(_rep);
|
149 kumpf 1.11 return _rep->findQualifier(name);
150 }
151
|
152 kumpf 1.30 CIMQualifier CIMClass::getQualifier(Uint32 index)
|
153 kumpf 1.11 {
|
154 marek 1.39 CheckRep(_rep);
|
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 marek 1.39 CheckRep(_rep);
|
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 marek 1.39 CheckRep(_rep);
|
167 kumpf 1.30 _rep->removeQualifier(index);
|
168 kumpf 1.11 }
169
170 Uint32 CIMClass::getQualifierCount() const
171 {
|
172 marek 1.39 CheckRep(_rep);
|
173 kumpf 1.11 return _rep->getQualifierCount();
174 }
175
176 CIMClass& CIMClass::addProperty(const CIMProperty& x)
177 {
|
178 marek 1.39 CheckRep(_rep);
|
179 kumpf 1.11 _rep->addProperty(x);
180 return *this;
181 }
182
|
183 kumpf 1.25 Uint32 CIMClass::findProperty(const CIMName& name) const
|
184 kumpf 1.11 {
|
185 marek 1.39 CheckRep(_rep);
|
186 kumpf 1.11 return _rep->findProperty(name);
187 }
188
|
189 kumpf 1.30 CIMProperty CIMClass::getProperty(Uint32 index)
|
190 kumpf 1.11 {
|
191 marek 1.39 CheckRep(_rep);
|
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 marek 1.39 CheckRep(_rep);
|
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 marek 1.39 CheckRep(_rep);
|
204 kumpf 1.30 _rep->removeProperty(index);
|
205 kumpf 1.11 }
206
207 Uint32 CIMClass::getPropertyCount() const
208 {
|
209 marek 1.39 CheckRep(_rep);
|
210 kumpf 1.11 return _rep->getPropertyCount();
211 }
212
213 CIMClass& CIMClass::addMethod(const CIMMethod& x)
214 {
|
215 marek 1.39 CheckRep(_rep);
|
216 kumpf 1.11 _rep->addMethod(x);
217 return *this;
218 }
219
|
220 kumpf 1.25 Uint32 CIMClass::findMethod(const CIMName& name) const
|
221 kumpf 1.11 {
|
222 marek 1.39 CheckRep(_rep);
|
223 kumpf 1.11 return _rep->findMethod(name);
224 }
225
|
226 kumpf 1.30 CIMMethod CIMClass::getMethod(Uint32 index)
|
227 kumpf 1.11 {
|
228 marek 1.39 CheckRep(_rep);
|
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 marek 1.39 CheckRep(_rep);
|
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 marek 1.39 CheckRep(_rep);
|
241 kumpf 1.30 _rep->removeMethod(index);
|
242 kumpf 1.11 }
243
244 Uint32 CIMClass::getMethodCount() const
245 {
|
246 marek 1.39 CheckRep(_rep);
|
247 kumpf 1.11 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 marek 1.39 CheckRep(x._rep);
258 CheckRep(_rep);
|
259 mike 1.9 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 marek 1.39 CheckRep(_rep);
|
270 kumpf 1.11 _rep->getKeyNames(keyNames);
271 }
272
273 Boolean CIMClass::hasKeys() const
274 {
|
275 marek 1.39 CheckRep(_rep);
|
276 kumpf 1.11 return _rep->hasKeys();
277 }
278
|
279 karl 1.34 CIMInstance CIMClass::buildInstance(Boolean includeQualifiers,
|
280 karl 1.33 Boolean includeClassOrigin,
281 const CIMPropertyList& propertyList) const
282 {
|
283 marek 1.39 CheckRep(_rep);
|
284 kumpf 1.38 return _rep->buildInstance(includeQualifiers,
|
285 karl 1.33 includeClassOrigin,
286 propertyList);
287 }
288
|
289 mike 1.10 ////////////////////////////////////////////////////////////////////////////////
290 //
291 // CIMConstClass
292 //
293 ////////////////////////////////////////////////////////////////////////////////
294
|
295 kumpf 1.11 CIMConstClass::CIMConstClass()
296 : _rep(0)
297 {
298 }
299
300 CIMConstClass::CIMConstClass(const CIMConstClass& x)
301 {
|
302 thilo.boehm 1.41 _rep = x._rep;
303 if (_rep)
304 _rep->Inc();
|
305 kumpf 1.11 }
306
307 CIMConstClass::CIMConstClass(const CIMClass& x)
308 {
|
309 thilo.boehm 1.41 _rep = x._rep;
310 if (_rep)
311 _rep->Inc();
|
312 kumpf 1.11 }
313
|
314 kumpf 1.31 CIMConstClass::CIMConstClass(const CIMObject& x)
|
315 mike 1.10 {
316 if (!(_rep = dynamic_cast<CIMClassRep*>(x._rep)))
|
317 kumpf 1.38 throw DynamicCastFailedException();
|
318 thilo.boehm 1.41 _rep->Inc();
|
319 mike 1.10 }
320
|
321 kumpf 1.31 CIMConstClass::CIMConstClass(const CIMConstObject& x)
|
322 mike 1.10 {
323 if (!(_rep = dynamic_cast<CIMClassRep*>(x._rep)))
|
324 kumpf 1.38 throw DynamicCastFailedException();
|
325 thilo.boehm 1.41 _rep->Inc();
|
326 kumpf 1.11 }
327
328 CIMConstClass::CIMConstClass(
|
329 kumpf 1.25 const CIMName& className,
330 const CIMName& superClassName)
|
331 kumpf 1.11 {
|
332 kumpf 1.25 _rep = new CIMClassRep(className, superClassName);
|
333 kumpf 1.11 }
334
335 CIMConstClass& CIMConstClass::operator=(const CIMConstClass& x)
336 {
337 if (x._rep != _rep)
338 {
|
339 thilo.boehm 1.41 if (_rep)
340 _rep->Dec();
341 _rep = x._rep;
342 if (_rep)
343 _rep->Inc();
|
344 kumpf 1.11 }
345 return *this;
346 }
347
348 CIMConstClass& CIMConstClass::operator=(const CIMClass& x)
349 {
350 if (x._rep != _rep)
351 {
|
352 thilo.boehm 1.41 if (_rep)
353 _rep->Dec();
354 _rep = x._rep;
355 if (_rep)
356 _rep->Inc();
|
357 kumpf 1.11 }
358 return *this;
359 }
360
361 CIMConstClass::~CIMConstClass()
362 {
|
363 thilo.boehm 1.41 if (_rep)
364 _rep->Dec();
|
365 kumpf 1.11 }
366
367 Boolean CIMConstClass::isAssociation() const
368 {
|
369 marek 1.39 CheckRep(_rep);
|
370 kumpf 1.11 return _rep->isAssociation();
371 }
372
373 Boolean CIMConstClass::isAbstract() const
374 {
|
375 marek 1.39 CheckRep(_rep);
|
376 kumpf 1.11 return _rep->isAbstract();
377 }
378
|
379 kumpf 1.25 const CIMName& CIMConstClass::getClassName() const
|
380 kumpf 1.11 {
|
381 marek 1.39 CheckRep(_rep);
|
382 kumpf 1.11 return _rep->getClassName();
383 }
384
|
385 kumpf 1.18 const CIMObjectPath& CIMConstClass::getPath() const
|
386 kumpf 1.11 {
|
387 marek 1.39 CheckRep(_rep);
|
388 kumpf 1.11 return _rep->getPath();
389 }
390
|
391 kumpf 1.25 const CIMName& CIMConstClass::getSuperClassName() const
|
392 kumpf 1.11 {
|
393 marek 1.39 CheckRep(_rep);
|
394 kumpf 1.11 return _rep->getSuperClassName();
395 }
396
|
397 kumpf 1.25 Uint32 CIMConstClass::findQualifier(const CIMName& name) const
|
398 kumpf 1.11 {
|
399 marek 1.39 CheckRep(_rep);
|
400 kumpf 1.11 return _rep->findQualifier(name);
401 }
402
|
403 kumpf 1.30 CIMConstQualifier CIMConstClass::getQualifier(Uint32 index) const
|
404 kumpf 1.11 {
|
405 marek 1.39 CheckRep(_rep);
|
406 kumpf 1.30 return _rep->getQualifier(index);
|
407 kumpf 1.11 }
408
409 Uint32 CIMConstClass::getQualifierCount() const
410 {
|
411 marek 1.39 CheckRep(_rep);
|
412 kumpf 1.11 return _rep->getQualifierCount();
413 }
414
|
415 kumpf 1.25 Uint32 CIMConstClass::findProperty(const CIMName& name) const
|
416 kumpf 1.11 {
|
417 marek 1.39 CheckRep(_rep);
|
418 kumpf 1.11 return _rep->findProperty(name);
419 }
420
|
421 kumpf 1.30 CIMConstProperty CIMConstClass::getProperty(Uint32 index) const
|
422 kumpf 1.11 {
|
423 marek 1.39 CheckRep(_rep);
|
424 kumpf 1.30 return _rep->getProperty(index);
|
425 kumpf 1.11 }
426
427 Uint32 CIMConstClass::getPropertyCount() const
428 {
|
429 marek 1.39 CheckRep(_rep);
|
430 kumpf 1.11 return _rep->getPropertyCount();
431 }
432
|
433 kumpf 1.25 Uint32 CIMConstClass::findMethod(const CIMName& name) const
|
434 kumpf 1.11 {
|
435 marek 1.39 CheckRep(_rep);
|
436 kumpf 1.11 return _rep->findMethod(name);
437 }
438
|
439 kumpf 1.30 CIMConstMethod CIMConstClass::getMethod(Uint32 index) const
|
440 kumpf 1.11 {
|
441 marek 1.39 CheckRep(_rep);
|
442 kumpf 1.30 return _rep->getMethod(index);
|
443 kumpf 1.11 }
444
445 Uint32 CIMConstClass::getMethodCount() const
446 {
|
447 marek 1.39 CheckRep(_rep);
|
448 kumpf 1.11 return _rep->getMethodCount();
449 }
450
|
451 kumpf 1.26 Boolean CIMConstClass::isUninitialized() const
|
452 kumpf 1.11 {
|
453 kumpf 1.15 return (_rep == 0)? true : false;
|
454 kumpf 1.11 }
455
456 Boolean CIMConstClass::identical(const CIMConstClass& x) const
457 {
|
458 marek 1.39 CheckRep(x._rep);
459 CheckRep(_rep);
|
460 kumpf 1.11 return _rep->identical(x._rep);
461 }
462
463 CIMClass CIMConstClass::clone() const
464 {
465 return CIMClass((CIMClassRep*)(_rep->clone()));
466 }
467
|
468 kumpf 1.25 void CIMConstClass::getKeyNames(Array<CIMName>& keyNames) const
|
469 kumpf 1.11 {
|
470 marek 1.39 CheckRep(_rep);
|
471 kumpf 1.11 _rep->getKeyNames(keyNames);
472 }
473
474 Boolean CIMConstClass::hasKeys() const
475 {
|
476 marek 1.39 CheckRep(_rep);
|
477 kumpf 1.11 return _rep->hasKeys();
478 }
479
|
480 mike 1.9 PEGASUS_NAMESPACE_END
|