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 mday 1.35.2.1 CIMInstance::CIMInstance(const CIMObject& x) throw(DynamicCastFailed)
|
65 mike 1.12 {
66 if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
|
67 mday 1.35.2.1 throw DynamicCastFailed();
|
68 kumpf 1.15 Inc(_rep);
|
69 mike 1.12 }
70
|
71 mday 1.35.2.1 CIMInstance::CIMInstance(const String& className)
|
72 kumpf 1.14 {
|
73 mday 1.35.2.1 _rep = new CIMInstanceRep(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 mday 1.35.2.1 const String& 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 mday 1.35.2.1 Uint32 CIMInstance::findQualifier(const String& name) const
|
122 kumpf 1.14 {
123 _checkRep();
124 return _rep->findQualifier(name);
125 }
126
|
127 mday 1.35.2.1 CIMQualifier CIMInstance::getQualifier(Uint32 pos)
|
128 kumpf 1.14 {
129 _checkRep();
|
130 mday 1.35.2.1 return _rep->getQualifier(pos);
|
131 kumpf 1.14 }
132
|
133 mday 1.35.2.1 CIMConstQualifier CIMInstance::getQualifier(Uint32 pos) const
|
134 kumpf 1.14 {
135 _checkRep();
|
136 mday 1.35.2.1 return _rep->getQualifier(pos);
|
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 mday 1.35.2.1 Uint32 CIMInstance::findProperty(const String& name) const
|
153 kumpf 1.14 {
154 _checkRep();
155 return _rep->findProperty(name);
156 }
157
|
158 mday 1.35.2.1 CIMProperty CIMInstance::getProperty(Uint32 pos) throw(OutOfBounds)
|
159 kumpf 1.14 {
160 _checkRep();
|
161 mday 1.35.2.1 return _rep->getProperty(pos);
|
162 kumpf 1.14 }
163
|
164 mday 1.35.2.1 CIMConstProperty CIMInstance::getProperty(Uint32 pos) const throw(OutOfBounds)
|
165 kumpf 1.14 {
166 _checkRep();
|
167 mday 1.35.2.1 return _rep->getProperty(pos);
|
168 kumpf 1.14 }
169
|
170 mday 1.35.2.1 void CIMInstance::removeProperty(Uint32 pos) throw(OutOfBounds)
|
171 kumpf 1.14 {
172 _checkRep();
|
173 mday 1.35.2.1 _rep->removeProperty(pos);
|
174 kumpf 1.14 }
175
176 Uint32 CIMInstance::getPropertyCount() const
177 {
178 _checkRep();
179 return _rep->getPropertyCount();
180 }
181
|
182 mday 1.35.2.1 Boolean CIMInstance::isNull() 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 mday 1.35.2.1 CIMObjectPath CIMInstance::getInstanceName(const CIMConstClass& cimClass) const
|
200 kumpf 1.14 {
201 _checkRep();
|
202 mday 1.35.2.1 return _rep->getInstanceName(cimClass);
203 }
204
205 String CIMInstance::toString() const
206 {
207 _checkRep();
208 return _rep->toString();
|
209 kumpf 1.14 }
210
211 void CIMInstance::_checkRep() const
212 {
213 if (!_rep)
|
214 mday 1.35.2.1 ThrowUninitializedHandle();
|
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 mday 1.35.2.1 CIMConstInstance::CIMConstInstance(const CIMObject& x) throw(DynamicCastFailed)
|
239 mike 1.12 {
240 if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
|
241 mday 1.35.2.1 throw DynamicCastFailed();
|
242 kumpf 1.15 Inc(_rep);
|
243 mike 1.12 }
244
245 CIMConstInstance::CIMConstInstance(const CIMConstObject& x)
|
246 mday 1.35.2.1 throw(DynamicCastFailed)
|
247 mike 1.12 {
248 if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
|
249 mday 1.35.2.1 throw DynamicCastFailed();
|
250 kumpf 1.15 Inc(_rep);
|
251 kumpf 1.14 }
252
|
253 mday 1.35.2.1 CIMConstInstance::CIMConstInstance(const String& className)
|
254 kumpf 1.14 {
|
255 mday 1.35.2.1 _rep = new CIMInstanceRep(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 mday 1.35.2.1 const String& 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 mday 1.35.2.1 Uint32 CIMConstInstance::findQualifier(const String& name) const
|
296 kumpf 1.14 {
297 _checkRep();
298 return _rep->findQualifier(name);
299 }
300
|
301 mday 1.35.2.1 CIMConstQualifier CIMConstInstance::getQualifier(Uint32 pos) const
|
302 kumpf 1.14 {
303 _checkRep();
|
304 mday 1.35.2.1 return _rep->getQualifier(pos);
|
305 kumpf 1.14 }
306
307 Uint32 CIMConstInstance::getQualifierCount() const
308 {
309 _checkRep();
310 return _rep->getQualifierCount();
311 }
312
|
313 mday 1.35.2.1 Uint32 CIMConstInstance::findProperty(const String& name) const
|
314 kumpf 1.14 {
315 _checkRep();
316 return _rep->findProperty(name);
317 }
318
|
319 mday 1.35.2.1 CIMConstProperty CIMConstInstance::getProperty(Uint32 pos) const
|
320 kumpf 1.14 {
321 _checkRep();
|
322 mday 1.35.2.1 return _rep->getProperty(pos);
|
323 kumpf 1.14 }
324
325 Uint32 CIMConstInstance::getPropertyCount() const
326 {
327 _checkRep();
328 return _rep->getPropertyCount();
329 }
330
|
331 mday 1.35.2.1 Boolean CIMConstInstance::isNull() 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 mday 1.35.2.1 CIMObjectPath CIMConstInstance::getInstanceName(const CIMConstClass& cimClass) const
349 {
350 _checkRep();
351 return _rep->getInstanceName(cimClass);
352 }
353
354 String CIMConstInstance::toString() const
|
355 kumpf 1.14 {
356 _checkRep();
|
357 mday 1.35.2.1 return _rep->toString();
|
358 kumpf 1.14 }
359
360 void CIMConstInstance::_checkRep() const
361 {
362 if (!_rep)
|
363 mday 1.35.2.1 ThrowUninitializedHandle();
364 }
365
366
367 Boolean operator==(const CIMInstance& x, const CIMInstance& y)
368 {
369 return x.identical(y);
|
370 mike 1.11 }
371
372 PEGASUS_NAMESPACE_END
|