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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2