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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2