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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2