(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            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34 kumpf 1.14 #include "CIMInstanceRep.h"
 35 mike  1.11 #include "CIMInstance.h"
 36            #include "DeclContext.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.34 CIMInstance::CIMInstance(const CIMObject& x)
 65 mike  1.12 {
 66                if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
 67 kumpf 1.42         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.42     _rep = new CIMInstanceRep(
 74                    CIMObjectPath(String::EMPTY, CIMNamespaceName(), className));
 75 kumpf 1.14 }
 76            
 77            CIMInstance::CIMInstance(CIMInstanceRep* rep)
 78                : _rep(rep)
 79            {
 80            }
 81            
 82            CIMInstance& CIMInstance::operator=(const CIMInstance& x)
 83            {
 84                if (x._rep != _rep)
 85                {
 86                    Dec(_rep);
 87                    Inc(_rep = x._rep);
 88                }
 89                return *this;
 90            }
 91            
 92            CIMInstance::~CIMInstance()
 93            {
 94                Dec(_rep);
 95            }
 96 kumpf 1.14 
 97 kumpf 1.28 const CIMName& CIMInstance::getClassName() const
 98 kumpf 1.14 {
 99 marek 1.44     CheckRep(_rep);
100 kumpf 1.14     return _rep->getClassName();
101            }
102            
103 kumpf 1.22 const CIMObjectPath& CIMInstance::getPath() const
104 kumpf 1.14 {
105 marek 1.44     CheckRep(_rep);
106 kumpf 1.14     return _rep->getPath();
107 kumpf 1.24 }
108            
109            void CIMInstance::setPath (const CIMObjectPath & path)
110            {
111 marek 1.44     CheckRep(_rep);
112 kumpf 1.24     _rep->setPath (path);
113 kumpf 1.14 }
114            
115            CIMInstance& CIMInstance::addQualifier(const CIMQualifier& qualifier)
116            {
117 marek 1.44     CheckRep(_rep);
118 kumpf 1.14     _rep->addQualifier(qualifier);
119                return *this;
120            }
121            
122 kumpf 1.28 Uint32 CIMInstance::findQualifier(const CIMName& name) const
123 kumpf 1.14 {
124 marek 1.44     CheckRep(_rep);
125 kumpf 1.14     return _rep->findQualifier(name);
126            }
127            
128 kumpf 1.33 CIMQualifier CIMInstance::getQualifier(Uint32 index)
129 kumpf 1.14 {
130 marek 1.44     CheckRep(_rep);
131 kumpf 1.33     return _rep->getQualifier(index);
132 kumpf 1.14 }
133            
134 kumpf 1.33 CIMConstQualifier CIMInstance::getQualifier(Uint32 index) const
135 kumpf 1.14 {
136 marek 1.44     CheckRep(_rep);
137 kumpf 1.33     return _rep->getQualifier(index);
138 kumpf 1.14 }
139            
140 kumpf 1.36 void CIMInstance::removeQualifier(Uint32 index)
141            {
142 marek 1.44     CheckRep(_rep);
143 kumpf 1.36     _rep->removeQualifier(index);
144            }
145            
146 kumpf 1.14 Uint32 CIMInstance::getQualifierCount() const
147            {
148 marek 1.44     CheckRep(_rep);
149 kumpf 1.14     return _rep->getQualifierCount();
150            }
151            
152            CIMInstance& CIMInstance::addProperty(const CIMProperty& x)
153            {
154 marek 1.44     CheckRep(_rep);
155 kumpf 1.14     _rep->addProperty(x);
156                return *this;
157            }
158            
159 kumpf 1.28 Uint32 CIMInstance::findProperty(const CIMName& name) const
160 kumpf 1.14 {
161 marek 1.44     CheckRep(_rep);
162 kumpf 1.14     return _rep->findProperty(name);
163            }
164            
165 kumpf 1.34 CIMProperty CIMInstance::getProperty(Uint32 index)
166 kumpf 1.14 {
167 marek 1.44     CheckRep(_rep);
168 kumpf 1.33     return _rep->getProperty(index);
169 kumpf 1.14 }
170            
171 kumpf 1.34 CIMConstProperty CIMInstance::getProperty(Uint32 index) const
172 kumpf 1.14 {
173 marek 1.44     CheckRep(_rep);
174 kumpf 1.33     return _rep->getProperty(index);
175 kumpf 1.14 }
176            
177 kumpf 1.34 void CIMInstance::removeProperty(Uint32 index)
178 kumpf 1.14 {
179 marek 1.44     CheckRep(_rep);
180 kumpf 1.33     _rep->removeProperty(index);
181 kumpf 1.14 }
182            
183            Uint32 CIMInstance::getPropertyCount() const
184            {
185 marek 1.44     CheckRep(_rep);
186 kumpf 1.14     return _rep->getPropertyCount();
187            }
188            
189 kumpf 1.29 Boolean CIMInstance::isUninitialized() const
190 kumpf 1.14 {
191 kumpf 1.43     return _rep == 0;
192 kumpf 1.14 }
193            
194 mike  1.11 Boolean CIMInstance::identical(const CIMConstInstance& x) const
195            {
196 marek 1.44     CheckRep(x._rep);
197                CheckRep(_rep);
198 mike  1.11     return _rep->identical(x._rep);
199            }
200            
201 kumpf 1.14 CIMInstance CIMInstance::clone() const
202            {
203                return CIMInstance((CIMInstanceRep*)(_rep->clone()));
204            }
205            
206 kumpf 1.30 CIMObjectPath CIMInstance::buildPath(const CIMConstClass& cimClass) const
207 kumpf 1.14 {
208 marek 1.44     CheckRep(_rep);
209 kumpf 1.30     return _rep->buildPath(cimClass);
210 kumpf 1.14 }
211            
212 karl  1.38 void CIMInstance::filter(Boolean includeQualifiers, Boolean includeClassOrigin,
213                                    const CIMPropertyList& propertyList)
214            {
215 marek 1.44     CheckRep(_rep);
216 karl  1.38     _rep->filter(includeQualifiers, includeClassOrigin, propertyList);
217            }
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.42         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.42         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.42     _rep = new CIMInstanceRep(
257                    CIMObjectPath(String::EMPTY, CIMNamespaceName(), className));
258 kumpf 1.14 }
259            
260            CIMConstInstance& CIMConstInstance::operator=(const CIMConstInstance& x)
261            {
262                if (x._rep != _rep)
263                {
264                    Dec(_rep);
265                    Inc(_rep = x._rep);
266                }
267                return *this;
268            }
269            
270            CIMConstInstance& CIMConstInstance::operator=(const CIMInstance& x)
271            {
272                if (x._rep != _rep)
273                {
274                    Dec(_rep);
275                    Inc(_rep = x._rep);
276                }
277                return *this;
278            }
279 kumpf 1.14 
280            CIMConstInstance::~CIMConstInstance()
281            {
282                Dec(_rep);
283            }
284            
285 kumpf 1.28 const CIMName& CIMConstInstance::getClassName() const
286 kumpf 1.14 {
287 marek 1.44     CheckRep(_rep);
288 kumpf 1.14     return _rep->getClassName();
289            }
290            
291 kumpf 1.22 const CIMObjectPath& CIMConstInstance::getPath() const
292 kumpf 1.14 {
293 marek 1.44     CheckRep(_rep);
294 kumpf 1.14     return _rep->getPath();
295            }
296            
297 kumpf 1.28 Uint32 CIMConstInstance::findQualifier(const CIMName& name) const
298 kumpf 1.14 {
299 marek 1.44     CheckRep(_rep);
300 kumpf 1.14     return _rep->findQualifier(name);
301            }
302            
303 kumpf 1.33 CIMConstQualifier CIMConstInstance::getQualifier(Uint32 index) const
304 kumpf 1.14 {
305 marek 1.44     CheckRep(_rep);
306 kumpf 1.33     return _rep->getQualifier(index);
307 kumpf 1.14 }
308            
309            Uint32 CIMConstInstance::getQualifierCount() const
310            {
311 marek 1.44     CheckRep(_rep);
312 kumpf 1.14     return _rep->getQualifierCount();
313            }
314            
315 kumpf 1.28 Uint32 CIMConstInstance::findProperty(const CIMName& name) const
316 kumpf 1.14 {
317 marek 1.44     CheckRep(_rep);
318 kumpf 1.14     return _rep->findProperty(name);
319            }
320            
321 kumpf 1.33 CIMConstProperty CIMConstInstance::getProperty(Uint32 index) const
322 kumpf 1.14 {
323 marek 1.44     CheckRep(_rep);
324 kumpf 1.33     return _rep->getProperty(index);
325 kumpf 1.14 }
326            
327            Uint32 CIMConstInstance::getPropertyCount() const
328            {
329 marek 1.44     CheckRep(_rep);
330 kumpf 1.14     return _rep->getPropertyCount();
331            }
332            
333 kumpf 1.29 Boolean CIMConstInstance::isUninitialized() const
334 kumpf 1.14 {
335 kumpf 1.43     return _rep == 0;
336 kumpf 1.14 }
337            
338            Boolean CIMConstInstance::identical(const CIMConstInstance& x) const
339            {
340 marek 1.44     CheckRep(x._rep);
341                CheckRep(_rep);
342 kumpf 1.14     return _rep->identical(x._rep);
343            }
344            
345            CIMInstance CIMConstInstance::clone() const
346            {
347                return CIMInstance((CIMInstanceRep*)(_rep->clone()));
348            }
349            
350 kumpf 1.30 CIMObjectPath CIMConstInstance::buildPath(const CIMConstClass& cimClass) const
351 kumpf 1.14 {
352 marek 1.44     CheckRep(_rep);
353 kumpf 1.30     return _rep->buildPath(cimClass);
354 kumpf 1.14 }
355            
356 mike  1.11 PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2