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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2