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

  1 mike  1.5 //%/////////////////////////////////////////////////////////////////////////////
  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 chip  1.7 // 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 mike  1.5 // 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 chip  1.7 //
 12           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 13 mike  1.5 // 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 chip  1.7 // 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 mike  1.5 // 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           //
 23           // Author: Mike Brasher (mbrasher@bmc.com)
 24           //
 25 kumpf 1.11 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 26 mike  1.5  //
 27            //%/////////////////////////////////////////////////////////////////////////////
 28            
 29 kumpf 1.10 #include "CIMClassRep.h"
 30            #include "CIMInstanceRep.h"
 31            #include "CIMObjectRep.h"
 32 mike  1.5  #include "CIMObject.h"
 33 mike  1.6  #include "CIMClass.h"
 34            #include "CIMInstance.h"
 35 mike  1.5  #include "XmlWriter.h"
 36            
 37            PEGASUS_NAMESPACE_BEGIN
 38            
 39            ////////////////////////////////////////////////////////////////////////////////
 40            //
 41            // CIMObject
 42            //
 43            ////////////////////////////////////////////////////////////////////////////////
 44            
 45 kumpf 1.10 CIMObject::CIMObject()
 46                : _rep(0)
 47            {
 48            }
 49            
 50            CIMObject::CIMObject(const CIMObject& x)
 51            {
 52                Inc(_rep = x._rep);
 53            }
 54            
 55 mike  1.6  CIMObject::CIMObject(const CIMClass& x)
 56 mike  1.5  {
 57 mike  1.6      Inc(_rep = x._rep);
 58            }
 59 mike  1.5  
 60 mike  1.6  CIMObject::CIMObject(const CIMInstance& x)
 61            {
 62                Inc(_rep = x._rep);
 63 mike  1.5  }
 64            
 65 kumpf 1.10 CIMObject::CIMObject(CIMObjectRep* rep)
 66                : _rep(rep)
 67            {
 68            }
 69            
 70            CIMObject& CIMObject::operator=(const CIMObject& x)
 71            {
 72                if (x._rep != _rep)
 73                {
 74                    Dec(_rep);
 75            	Inc(_rep = x._rep);
 76                }
 77                return *this;
 78            }
 79            
 80 mike  1.6  CIMObject& CIMObject::operator=(const CIMClass& x)
 81 mike  1.5  {
 82 mike  1.6      if (x._rep != _rep)
 83                {
 84 kumpf 1.9          Dec(_rep);
 85 mike  1.6  	Inc(_rep = x._rep);
 86                }
 87                return *this;
 88            }
 89 mike  1.5  
 90 mike  1.6  CIMObject& CIMObject::operator=(const CIMInstance& x)
 91            {
 92                if (x._rep != _rep)
 93                {
 94 kumpf 1.9          Dec(_rep);
 95 mike  1.6  	Inc(_rep = x._rep);
 96                }
 97                return *this;
 98 mike  1.5  }
 99            
100 kumpf 1.10 CIMObject::~CIMObject()
101            {
102                Dec(_rep);
103            }
104            
105            const String& CIMObject::getClassName() const
106            {
107                _checkRep();
108                return _rep->getClassName();
109            }
110            
111            const Boolean CIMObject::equalClassName(const String& classname) const
112            {
113                _checkRep();
114                return _rep->equalClassName(classname);
115            }
116            
117 kumpf 1.16 const CIMObjectPath& CIMObject::getPath() const
118 kumpf 1.10 {
119                _checkRep();
120                return _rep->getPath();
121            }
122            
123            CIMObject& CIMObject::addQualifier(const CIMQualifier& qualifier)
124            {
125                _checkRep();
126                _rep->addQualifier(qualifier);
127                return *this;
128            }
129            
130            Uint32 CIMObject::findQualifier(const String& name) const
131            {
132                _checkRep();
133                return _rep->findQualifier(name);
134            }
135            
136            Boolean CIMObject::existsQualifier(const String& name) const
137            {
138                _checkRep();
139 kumpf 1.10     return _rep->existsQualifier(name);
140            }
141            
142            CIMQualifier CIMObject::getQualifier(Uint32 pos)
143            {
144                _checkRep();
145                return _rep->getQualifier(pos);
146            }
147            
148            CIMConstQualifier CIMObject::getQualifier(Uint32 pos) const
149            {
150                _checkRep();
151                return _rep->getQualifier(pos);
152            }
153            
154            void CIMObject::removeQualifier(Uint32 pos)
155            {
156                _checkRep();
157                _rep->removeQualifier(pos);
158            }
159            
160 kumpf 1.10 Uint32 CIMObject::getQualifierCount() const
161            {
162                _checkRep();
163                return _rep->getQualifierCount();
164            }
165            
166            CIMObject& CIMObject::addProperty(const CIMProperty& x)
167            {
168                _checkRep();
169                _rep->addProperty(x);
170                return *this;
171            }
172            
173            Uint32 CIMObject::findProperty(const String& name) const
174            {
175                _checkRep();
176                return _rep->findProperty(name);
177            }
178            
179            Boolean CIMObject::existsProperty(const String& name) const
180            {
181 kumpf 1.10     _checkRep();
182                return _rep->existsProperty(name);
183            }
184            
185            CIMProperty CIMObject::getProperty(Uint32 pos)
186            {
187                _checkRep();
188                return _rep->getProperty(pos);
189            }
190            
191            CIMConstProperty CIMObject::getProperty(Uint32 pos) const
192            {
193                _checkRep();
194                return _rep->getProperty(pos);
195            }
196            
197            void CIMObject::removeProperty(Uint32 pos)
198            {
199                _checkRep();
200                _rep->removeProperty(pos);
201            }
202 kumpf 1.10 
203            Uint32 CIMObject::getPropertyCount() const
204            {
205                _checkRep();
206                return _rep->getPropertyCount();
207            }
208            
209 kumpf 1.13 Boolean CIMObject::isNull() const
210 kumpf 1.10 {
211 kumpf 1.13     return (_rep == 0)? true : false;
212 kumpf 1.10 }
213            
214 mike  1.6  Boolean CIMObject::identical(const CIMConstObject& x) const
215 mike  1.5  {
216 mike  1.6      x._checkRep();
217                _checkRep();
218                return _rep->identical(x._rep);
219            }
220 mike  1.5  
221 kumpf 1.10 CIMObject CIMObject::clone() const
222            {
223                _checkRep();
224                return CIMObject(_rep->clone());
225            }
226            
227            void CIMObject::_checkRep() const
228            {
229                if (!_rep)
230 kumpf 1.12         ThrowUninitializedHandle();
231 kumpf 1.10 }
232            
233 mike  1.6  ////////////////////////////////////////////////////////////////////////////////
234            //
235            // CIMConstObject
236            //
237            ////////////////////////////////////////////////////////////////////////////////
238            
239 kumpf 1.10 CIMConstObject::CIMConstObject()
240                : _rep(0)
241            {
242            }
243            
244            CIMConstObject::CIMConstObject(const CIMConstObject& x)
245            {
246                Inc(_rep = x._rep);
247            }
248            
249            CIMConstObject::CIMConstObject(const CIMObject& x)
250            {
251                Inc(_rep = x._rep);
252            }
253            
254 mike  1.6  CIMConstObject::CIMConstObject(const CIMClass& x)
255            {
256                Inc(_rep = x._rep);
257 mike  1.5  }
258            
259 chip  1.7  CIMConstObject::CIMConstObject(const CIMConstClass& x)
260            {
261                Inc(_rep = x._rep);
262            }
263            
264 mike  1.6  CIMConstObject::CIMConstObject(const CIMInstance& x)
265 mike  1.5  {
266 mike  1.6      Inc(_rep = x._rep);
267            }
268 mike  1.5  
269 chip  1.7  CIMConstObject::CIMConstObject(const CIMConstInstance& x)
270            {
271                Inc(_rep = x._rep);
272            }
273            
274 kumpf 1.10 CIMConstObject& CIMConstObject::operator=(const CIMConstObject& x)
275            {
276                if (x._rep != _rep)
277                {
278                    Dec(_rep);
279                    Inc(_rep = x._rep);
280                }
281                return *this;
282            }
283            
284            CIMConstObject& CIMConstObject::operator=(const CIMObject& x)
285            {
286                if (x._rep != _rep)
287                {
288                    Dec(_rep);
289                    Inc(_rep = x._rep);
290                }
291                return *this;
292            }
293            
294 mike  1.6  CIMConstObject& CIMConstObject::operator=(const CIMClass& x)
295            {
296                if (x._rep != _rep)
297                {
298 kumpf 1.9          Dec(_rep);
299 mike  1.6  	Inc(_rep = x._rep);
300                }
301                return *this;
302 mike  1.5  }
303            
304 mike  1.6  CIMConstObject& CIMConstObject::operator=(const CIMInstance& x)
305 mike  1.5  {
306 mike  1.6      if (x._rep != _rep)
307                {
308 kumpf 1.9          Dec(_rep);
309 mike  1.6  	Inc(_rep = x._rep);
310                }
311                return *this;
312            }
313 mike  1.5  
314 mike  1.6  CIMConstObject& CIMConstObject::operator=(const CIMConstClass& x)
315            {
316                if (x._rep != _rep)
317 mike  1.5      {
318 kumpf 1.9          Dec(_rep);
319 mike  1.6  	Inc(_rep = x._rep);
320 mike  1.5      }
321 mike  1.6      return *this;
322            }
323            
324            CIMConstObject& CIMConstObject::operator=(const CIMConstInstance& x)
325            {
326                if (x._rep != _rep)
327 mike  1.5      {
328 kumpf 1.9          Dec(_rep);
329 mike  1.6  	Inc(_rep = x._rep);
330 mike  1.5      }
331 mike  1.6      return *this;
332 mike  1.5  }
333            
334 kumpf 1.10 CIMConstObject::~CIMConstObject()
335            {
336                Dec(_rep);
337            }
338            
339            const String& CIMConstObject::getClassName() const
340            {
341                _checkRep();
342                return _rep->getClassName();
343            }
344            
345 kumpf 1.16 const CIMObjectPath& CIMConstObject::getPath() const
346 kumpf 1.10 {
347                _checkRep();
348                return _rep->getPath();
349            }
350            
351            Uint32 CIMConstObject::findQualifier(const String& name) const
352            {
353                _checkRep();
354                return _rep->findQualifier(name);
355            }
356            
357            CIMConstQualifier CIMConstObject::getQualifier(Uint32 pos) const
358            {
359                _checkRep();
360                return _rep->getQualifier(pos);
361            }
362            
363            Uint32 CIMConstObject::getQualifierCount() const
364            {
365                _checkRep();
366                return _rep->getQualifierCount();
367 kumpf 1.10 }
368            
369            Uint32 CIMConstObject::findProperty(const String& name) const
370            {
371                _checkRep();
372                return _rep->findProperty(name);
373            }
374            
375            CIMConstProperty CIMConstObject::getProperty(Uint32 pos) const
376            {
377                _checkRep();
378                return _rep->getProperty(pos);
379            }
380            
381            Uint32 CIMConstObject::getPropertyCount() const
382            {
383                _checkRep();
384                return _rep->getPropertyCount();
385            }
386            
387 kumpf 1.13 Boolean CIMConstObject::isNull() const
388 kumpf 1.10 {
389 kumpf 1.13     return (_rep == 0)? true : false;
390 kumpf 1.10 }
391            
392            Boolean CIMConstObject::identical(const CIMConstObject& x) const
393            {
394                x._checkRep();
395                _checkRep();
396                return _rep->identical(x._rep);
397            }
398            
399            CIMObject CIMConstObject::clone() const
400            {
401                return CIMObject(_rep->clone());
402            }
403            
404            void CIMConstObject::_checkRep() const
405            {
406                if (!_rep)
407 kumpf 1.12         ThrowUninitializedHandle();
408 kumpf 1.10 }
409            
410 mike  1.5  ////////////////////////////////////////////////////////////////////////////////
411            //
412            // CIMObjectWithPath
413            //
414            ////////////////////////////////////////////////////////////////////////////////
415            
416            CIMObjectWithPath::CIMObjectWithPath()
417            {
418            }
419            
420            CIMObjectWithPath::CIMObjectWithPath(
421 kumpf 1.16     const CIMObjectPath& reference,
422 chip  1.7      const CIMObject& object)
423 mike  1.5      : _reference(reference), _object(object)
424            {
425            }
426            
427            CIMObjectWithPath::CIMObjectWithPath(const CIMObjectWithPath& x)
428                : _reference(x._reference), _object(x._object)
429            {
430            }
431            
432            CIMObjectWithPath::~CIMObjectWithPath()
433            {
434            }
435            
436            CIMObjectWithPath& CIMObjectWithPath::operator=(const CIMObjectWithPath& x)
437            {
438                if (this != &x)
439                {
440            	_reference = x._reference;
441            	_object = x._object;
442                }
443                return *this;
444 mike  1.5  }
445            
446            void CIMObjectWithPath::set(
447 kumpf 1.16     const CIMObjectPath& reference,
448 mike  1.5      const CIMObject& object)
449            {
450                _reference = reference;
451                _object = object;
452 kumpf 1.10 }
453            
454 kumpf 1.16 const CIMObjectPath& CIMObjectWithPath::getReference() const
455 kumpf 1.10 {
456                return _reference;
457            }
458            
459            const CIMObject& CIMObjectWithPath::getObject() const
460            {
461                return _object;
462            }
463            
464 kumpf 1.16 CIMObjectPath& CIMObjectWithPath::getReference()
465 kumpf 1.10 {
466                return _reference;
467            }
468            
469            CIMObject& CIMObjectWithPath::getObject()
470            {
471                return _object;
472 mike  1.5  }
473            
474            PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2