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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2