(file) Return to CIMClass.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2