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

  1 karl  1.37 //%2006////////////////////////////////////////////////////////////////////////
  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 karl  1.37 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 mike  1.9  //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15 kumpf 1.22 // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18 mike  1.9  // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20            // 
 21 kumpf 1.22 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 mike  1.9  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24 kumpf 1.22 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27 mike  1.9  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30            //==============================================================================
 31            //
 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.38         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 karl  1.34 CIMInstance CIMClass::buildInstance(Boolean includeQualifiers,
282 karl  1.33     Boolean includeClassOrigin,
283                const CIMPropertyList& propertyList) const
284            {
285                _checkRep();
286 kumpf 1.38     return _rep->buildInstance(includeQualifiers,
287 karl  1.33         includeClassOrigin,
288                    propertyList);
289            }
290            
291 mike  1.10 ////////////////////////////////////////////////////////////////////////////////
292            //
293            // CIMConstClass
294            //
295            ////////////////////////////////////////////////////////////////////////////////
296            
297 kumpf 1.11 CIMConstClass::CIMConstClass()
298                : _rep(0)
299            {
300            }
301            
302            CIMConstClass::CIMConstClass(const CIMConstClass& x)
303            {
304                Inc(_rep = x._rep);
305            }
306            
307            CIMConstClass::CIMConstClass(const CIMClass& x)
308            {
309                Inc(_rep = x._rep);
310            }
311            
312 kumpf 1.31 CIMConstClass::CIMConstClass(const CIMObject& x)
313 mike  1.10 {
314                if (!(_rep = dynamic_cast<CIMClassRep*>(x._rep)))
315 kumpf 1.38         throw DynamicCastFailedException();
316 kumpf 1.12     Inc(_rep);
317 mike  1.10 }
318            
319 kumpf 1.31 CIMConstClass::CIMConstClass(const CIMConstObject& x)
320 mike  1.10 {
321                if (!(_rep = dynamic_cast<CIMClassRep*>(x._rep)))
322 kumpf 1.38         throw DynamicCastFailedException();
323 kumpf 1.12     Inc(_rep);
324 kumpf 1.11 }
325            
326            CIMConstClass::CIMConstClass(
327 kumpf 1.25     const CIMName& className,
328                const CIMName& superClassName)
329 kumpf 1.11 {
330 kumpf 1.25     _rep = new CIMClassRep(className, superClassName);
331 kumpf 1.11 }
332            
333            CIMConstClass& CIMConstClass::operator=(const CIMConstClass& x)
334            {
335                if (x._rep != _rep)
336                {
337                    Dec(_rep);
338                    Inc(_rep = x._rep);
339                }
340                return *this;
341            }
342            
343            CIMConstClass& CIMConstClass::operator=(const CIMClass& x)
344            {
345                if (x._rep != _rep)
346                {
347                    Dec(_rep);
348                    Inc(_rep = x._rep);
349                }
350                return *this;
351            }
352 kumpf 1.11 
353            CIMConstClass::~CIMConstClass()
354            {
355                Dec(_rep);
356            }
357            
358            Boolean CIMConstClass::isAssociation() const
359            {
360                _checkRep();
361                return _rep->isAssociation();
362            }
363            
364            Boolean CIMConstClass::isAbstract() const
365            {
366                _checkRep();
367                return _rep->isAbstract();
368            }
369            
370 kumpf 1.25 const CIMName& CIMConstClass::getClassName() const
371 kumpf 1.11 {
372                _checkRep();
373                return _rep->getClassName();
374            }
375            
376 kumpf 1.18 const CIMObjectPath& CIMConstClass::getPath() const
377 kumpf 1.11 {
378                _checkRep();
379                return _rep->getPath();
380            }
381            
382 kumpf 1.25 const CIMName& CIMConstClass::getSuperClassName() const
383 kumpf 1.11 {
384                _checkRep();
385                return _rep->getSuperClassName();
386            }
387            
388 kumpf 1.25 Uint32 CIMConstClass::findQualifier(const CIMName& name) const
389 kumpf 1.11 {
390                _checkRep();
391                return _rep->findQualifier(name);
392            }
393            
394 kumpf 1.30 CIMConstQualifier CIMConstClass::getQualifier(Uint32 index) const
395 kumpf 1.11 {
396                _checkRep();
397 kumpf 1.30     return _rep->getQualifier(index);
398 kumpf 1.11 }
399            
400            Uint32 CIMConstClass::getQualifierCount() const
401            {
402                _checkRep();
403                return _rep->getQualifierCount();
404            }
405            
406 kumpf 1.25 Uint32 CIMConstClass::findProperty(const CIMName& name) const
407 kumpf 1.11 {
408                _checkRep();
409                return _rep->findProperty(name);
410            }
411            
412 kumpf 1.30 CIMConstProperty CIMConstClass::getProperty(Uint32 index) const
413 kumpf 1.11 {
414                _checkRep();
415 kumpf 1.30     return _rep->getProperty(index);
416 kumpf 1.11 }
417            
418            Uint32 CIMConstClass::getPropertyCount() const
419            {
420                _checkRep();
421                return _rep->getPropertyCount();
422            }
423            
424 kumpf 1.25 Uint32 CIMConstClass::findMethod(const CIMName& name) const
425 kumpf 1.11 {
426                _checkRep();
427                return _rep->findMethod(name);
428            }
429            
430 kumpf 1.30 CIMConstMethod CIMConstClass::getMethod(Uint32 index) const
431 kumpf 1.11 {
432                _checkRep();
433 kumpf 1.30     return _rep->getMethod(index);
434 kumpf 1.11 }
435            
436            Uint32 CIMConstClass::getMethodCount() const
437            {
438                _checkRep();
439                return _rep->getMethodCount();
440            }
441            
442 kumpf 1.26 Boolean CIMConstClass::isUninitialized() 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 kumpf 1.25 void CIMConstClass::getKeyNames(Array<CIMName>& keyNames) const
460 kumpf 1.11 {
461                _checkRep();
462                _rep->getKeyNames(keyNames);
463            }
464            
465            Boolean CIMConstClass::hasKeys() const
466            {
467                _checkRep();
468                return _rep->hasKeys();
469            }
470            
471            void CIMConstClass::_checkRep() const
472            {
473                if (!_rep)
474 kumpf 1.29         throw UninitializedObjectException();
475 mike  1.9  }
476            
477            PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2