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

  1 karl  1.29 //%2003////////////////////////////////////////////////////////////////////////
  2 mike  1.5  //
  3 karl  1.29 // 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.5  //
  8            // Permission is hereby granted, free of charge, to any person obtaining a copy
  9 chip  1.7  // 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.5  // 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 kumpf 1.21 // 
 15 chip  1.7  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 16 mike  1.5  // 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 chip  1.7  // 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.5  // 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.11 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 29 kumpf 1.18 //              Carol Ann Krug Graves, Hewlett-Packard Company
 30            //                  (carolann_graves@hp.com)
 31 mike  1.5  //
 32            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34 kumpf 1.10 #include "CIMClassRep.h"
 35            #include "CIMInstanceRep.h"
 36            #include "CIMObjectRep.h"
 37 mike  1.5  #include "CIMObject.h"
 38 mike  1.6  #include "CIMClass.h"
 39            #include "CIMInstance.h"
 40 mike  1.5  #include "XmlWriter.h"
 41            
 42            PEGASUS_NAMESPACE_BEGIN
 43            
 44 kumpf 1.19 #define PEGASUS_ARRAY_T CIMObject
 45            # include "ArrayImpl.h"
 46            #undef PEGASUS_ARRAY_T
 47            
 48 mike  1.5  ////////////////////////////////////////////////////////////////////////////////
 49            //
 50            // CIMObject
 51            //
 52            ////////////////////////////////////////////////////////////////////////////////
 53            
 54 kumpf 1.10 CIMObject::CIMObject()
 55                : _rep(0)
 56            {
 57            }
 58            
 59            CIMObject::CIMObject(const CIMObject& x)
 60            {
 61                Inc(_rep = x._rep);
 62            }
 63            
 64 mike  1.6  CIMObject::CIMObject(const CIMClass& x)
 65 mike  1.5  {
 66 mike  1.6      Inc(_rep = x._rep);
 67            }
 68 mike  1.5  
 69 mike  1.6  CIMObject::CIMObject(const CIMInstance& x)
 70            {
 71                Inc(_rep = x._rep);
 72 mike  1.5  }
 73            
 74 kumpf 1.10 CIMObject::CIMObject(CIMObjectRep* rep)
 75                : _rep(rep)
 76            {
 77            }
 78            
 79            CIMObject& CIMObject::operator=(const CIMObject& x)
 80            {
 81                if (x._rep != _rep)
 82                {
 83                    Dec(_rep);
 84            	Inc(_rep = x._rep);
 85                }
 86                return *this;
 87            }
 88            
 89            CIMObject::~CIMObject()
 90            {
 91                Dec(_rep);
 92            }
 93            
 94 kumpf 1.23 const CIMName& CIMObject::getClassName() const
 95 kumpf 1.10 {
 96                _checkRep();
 97                return _rep->getClassName();
 98            }
 99            
100 kumpf 1.16 const CIMObjectPath& CIMObject::getPath() const
101 kumpf 1.10 {
102                _checkRep();
103                return _rep->getPath();
104 kumpf 1.18 }
105            
106            void CIMObject::setPath (const CIMObjectPath & path)
107            {
108                _checkRep ();
109                _rep->setPath (path);
110 kumpf 1.10 }
111            
112            CIMObject& CIMObject::addQualifier(const CIMQualifier& qualifier)
113            {
114                _checkRep();
115                _rep->addQualifier(qualifier);
116                return *this;
117            }
118            
119 kumpf 1.23 Uint32 CIMObject::findQualifier(const CIMName& name) const
120 kumpf 1.10 {
121                _checkRep();
122                return _rep->findQualifier(name);
123            }
124            
125 kumpf 1.28 CIMQualifier CIMObject::getQualifier(Uint32 index)
126 kumpf 1.10 {
127                _checkRep();
128 kumpf 1.28     return _rep->getQualifier(index);
129 kumpf 1.10 }
130            
131 kumpf 1.28 CIMConstQualifier CIMObject::getQualifier(Uint32 index) const
132 kumpf 1.10 {
133                _checkRep();
134 kumpf 1.28     return _rep->getQualifier(index);
135 kumpf 1.10 }
136            
137 kumpf 1.28 void CIMObject::removeQualifier(Uint32 index)
138 kumpf 1.10 {
139                _checkRep();
140 kumpf 1.28     _rep->removeQualifier(index);
141 kumpf 1.10 }
142            
143            Uint32 CIMObject::getQualifierCount() const
144            {
145                _checkRep();
146                return _rep->getQualifierCount();
147            }
148            
149            CIMObject& CIMObject::addProperty(const CIMProperty& x)
150            {
151                _checkRep();
152                _rep->addProperty(x);
153                return *this;
154            }
155            
156 kumpf 1.23 Uint32 CIMObject::findProperty(const CIMName& name) const
157 kumpf 1.10 {
158                _checkRep();
159                return _rep->findProperty(name);
160            }
161            
162 kumpf 1.28 CIMProperty CIMObject::getProperty(Uint32 index)
163 kumpf 1.10 {
164                _checkRep();
165 kumpf 1.28     return _rep->getProperty(index);
166 kumpf 1.10 }
167            
168 kumpf 1.28 CIMConstProperty CIMObject::getProperty(Uint32 index) const
169 kumpf 1.10 {
170                _checkRep();
171 kumpf 1.28     return _rep->getProperty(index);
172 kumpf 1.10 }
173            
174 kumpf 1.28 void CIMObject::removeProperty(Uint32 index)
175 kumpf 1.10 {
176                _checkRep();
177 kumpf 1.28     _rep->removeProperty(index);
178 kumpf 1.10 }
179            
180            Uint32 CIMObject::getPropertyCount() const
181            {
182                _checkRep();
183                return _rep->getPropertyCount();
184            }
185            
186 kumpf 1.24 Boolean CIMObject::isUninitialized() const
187 kumpf 1.10 {
188 kumpf 1.13     return (_rep == 0)? true : false;
189 kumpf 1.10 }
190            
191 kumpf 1.25 Boolean CIMObject::isClass () const
192            {
193                try
194                {
195                    const CIMClass c (*this);
196                    return true;
197                }
198 kumpf 1.30     catch (DynamicCastFailedException&)
199 kumpf 1.25     {
200                    return false;
201                }
202            }
203            
204            Boolean CIMObject::isInstance () const
205            {
206                try
207                {
208                    const CIMInstance i (*this);
209                    return true;
210                }
211 kumpf 1.30     catch (DynamicCastFailedException&)
212 kumpf 1.25     {
213                    return false;
214                }
215            }
216            
217 mike  1.6  Boolean CIMObject::identical(const CIMConstObject& x) const
218 mike  1.5  {
219 mike  1.6      x._checkRep();
220                _checkRep();
221                return _rep->identical(x._rep);
222            }
223 mike  1.5  
224 kumpf 1.10 CIMObject CIMObject::clone() const
225            {
226                _checkRep();
227                return CIMObject(_rep->clone());
228            }
229            
230            void CIMObject::_checkRep() const
231            {
232                if (!_rep)
233 kumpf 1.27         throw UninitializedObjectException();
234 kumpf 1.10 }
235            
236 mike  1.6  ////////////////////////////////////////////////////////////////////////////////
237            //
238            // CIMConstObject
239            //
240            ////////////////////////////////////////////////////////////////////////////////
241            
242 kumpf 1.10 CIMConstObject::CIMConstObject()
243                : _rep(0)
244            {
245            }
246            
247            CIMConstObject::CIMConstObject(const CIMConstObject& x)
248            {
249                Inc(_rep = x._rep);
250            }
251            
252            CIMConstObject::CIMConstObject(const CIMObject& x)
253            {
254                Inc(_rep = x._rep);
255            }
256            
257 mike  1.6  CIMConstObject::CIMConstObject(const CIMClass& x)
258            {
259                Inc(_rep = x._rep);
260 mike  1.5  }
261            
262 chip  1.7  CIMConstObject::CIMConstObject(const CIMConstClass& x)
263            {
264                Inc(_rep = x._rep);
265            }
266            
267 mike  1.6  CIMConstObject::CIMConstObject(const CIMInstance& x)
268 mike  1.5  {
269 mike  1.6      Inc(_rep = x._rep);
270            }
271 mike  1.5  
272 chip  1.7  CIMConstObject::CIMConstObject(const CIMConstInstance& x)
273            {
274                Inc(_rep = x._rep);
275            }
276            
277 kumpf 1.10 CIMConstObject& CIMConstObject::operator=(const CIMConstObject& x)
278            {
279                if (x._rep != _rep)
280                {
281                    Dec(_rep);
282                    Inc(_rep = x._rep);
283 mike  1.5      }
284 mike  1.6      return *this;
285 mike  1.5  }
286            
287 kumpf 1.10 CIMConstObject::~CIMConstObject()
288            {
289                Dec(_rep);
290            }
291            
292 kumpf 1.23 const CIMName& CIMConstObject::getClassName() const
293 kumpf 1.10 {
294                _checkRep();
295                return _rep->getClassName();
296            }
297            
298 kumpf 1.16 const CIMObjectPath& CIMConstObject::getPath() const
299 kumpf 1.10 {
300                _checkRep();
301                return _rep->getPath();
302            }
303            
304 kumpf 1.23 Uint32 CIMConstObject::findQualifier(const CIMName& name) const
305 kumpf 1.10 {
306                _checkRep();
307                return _rep->findQualifier(name);
308            }
309            
310 kumpf 1.28 CIMConstQualifier CIMConstObject::getQualifier(Uint32 index) const
311 kumpf 1.10 {
312                _checkRep();
313 kumpf 1.28     return _rep->getQualifier(index);
314 kumpf 1.10 }
315            
316            Uint32 CIMConstObject::getQualifierCount() const
317            {
318                _checkRep();
319                return _rep->getQualifierCount();
320            }
321            
322 kumpf 1.23 Uint32 CIMConstObject::findProperty(const CIMName& name) const
323 kumpf 1.10 {
324                _checkRep();
325                return _rep->findProperty(name);
326            }
327            
328 kumpf 1.28 CIMConstProperty CIMConstObject::getProperty(Uint32 index) const
329 kumpf 1.10 {
330                _checkRep();
331 kumpf 1.28     return _rep->getProperty(index);
332 kumpf 1.10 }
333            
334            Uint32 CIMConstObject::getPropertyCount() const
335            {
336                _checkRep();
337                return _rep->getPropertyCount();
338            }
339            
340 kumpf 1.24 Boolean CIMConstObject::isUninitialized() const
341 kumpf 1.10 {
342 kumpf 1.13     return (_rep == 0)? true : false;
343 kumpf 1.10 }
344            
345 kumpf 1.27 Boolean CIMConstObject::isClass() const
346            {
347                try
348                {
349                    const CIMConstClass c(*this);
350                    return true;
351                }
352 kumpf 1.30     catch (DynamicCastFailedException&)
353 kumpf 1.27     {
354                    return false;
355                }
356            }
357            
358            Boolean CIMConstObject::isInstance() const
359            {
360                try
361                {
362                    const CIMConstInstance i(*this);
363                    return true;
364                }
365 kumpf 1.30     catch (DynamicCastFailedException&)
366 kumpf 1.27     {
367                    return false;
368                }
369            }
370            
371 kumpf 1.10 Boolean CIMConstObject::identical(const CIMConstObject& x) const
372            {
373                x._checkRep();
374                _checkRep();
375                return _rep->identical(x._rep);
376            }
377            
378            CIMObject CIMConstObject::clone() const
379            {
380                return CIMObject(_rep->clone());
381            }
382            
383            void CIMConstObject::_checkRep() const
384            {
385                if (!_rep)
386 kumpf 1.27         throw UninitializedObjectException();
387 kumpf 1.10 }
388            
389 mike  1.5  PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2