1 karl 1.37 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.5 //
|
3 karl 1.31 // 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.29 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.31 // 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.34 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.37 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.5 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 chip 1.7 // 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.5 // 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 kumpf 1.21 //
|
21 chip 1.7 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mike 1.5 // 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 chip 1.7 // 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.5 // 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.11 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
35 kumpf 1.18 // Carol Ann Krug Graves, Hewlett-Packard Company
36 // (carolann_graves@hp.com)
|
37 dave.sudlik 1.32 // Dave Sudlik, IBM (dsudlik@us.ibm.com)
|
38 david.dillard 1.33 // David Dillard, VERITAS Software Corp.
39 // (david.dillard@veritas.com)
|
40 mike 1.5 //
41 //%/////////////////////////////////////////////////////////////////////////////
42
|
43 kumpf 1.10 #include "CIMClassRep.h"
44 #include "CIMInstanceRep.h"
45 #include "CIMObjectRep.h"
|
46 mike 1.5 #include "CIMObject.h"
|
47 mike 1.6 #include "CIMClass.h"
48 #include "CIMInstance.h"
|
49 mike 1.5 #include "XmlWriter.h"
50
51 PEGASUS_NAMESPACE_BEGIN
52
|
53 kumpf 1.19 #define PEGASUS_ARRAY_T CIMObject
54 # include "ArrayImpl.h"
55 #undef PEGASUS_ARRAY_T
56
|
57 mike 1.5 ////////////////////////////////////////////////////////////////////////////////
58 //
59 // CIMObject
60 //
61 ////////////////////////////////////////////////////////////////////////////////
62
|
63 kumpf 1.10 CIMObject::CIMObject()
64 : _rep(0)
65 {
66 }
67
68 CIMObject::CIMObject(const CIMObject& x)
69 {
70 Inc(_rep = x._rep);
71 }
72
|
73 mike 1.6 CIMObject::CIMObject(const CIMClass& x)
|
74 mike 1.5 {
|
75 mike 1.6 Inc(_rep = x._rep);
76 }
|
77 mike 1.5
|
78 mike 1.6 CIMObject::CIMObject(const CIMInstance& x)
79 {
80 Inc(_rep = x._rep);
|
81 mike 1.5 }
82
|
83 kumpf 1.10 CIMObject::CIMObject(CIMObjectRep* rep)
84 : _rep(rep)
85 {
86 }
87
88 CIMObject& CIMObject::operator=(const CIMObject& x)
89 {
90 if (x._rep != _rep)
91 {
92 Dec(_rep);
93 Inc(_rep = x._rep);
94 }
95 return *this;
96 }
97
98 CIMObject::~CIMObject()
99 {
100 Dec(_rep);
101 }
102
|
103 kumpf 1.23 const CIMName& CIMObject::getClassName() const
|
104 kumpf 1.10 {
105 _checkRep();
106 return _rep->getClassName();
107 }
108
|
109 kumpf 1.16 const CIMObjectPath& CIMObject::getPath() const
|
110 kumpf 1.10 {
111 _checkRep();
112 return _rep->getPath();
|
113 kumpf 1.18 }
114
115 void CIMObject::setPath (const CIMObjectPath & path)
116 {
117 _checkRep ();
118 _rep->setPath (path);
|
119 kumpf 1.10 }
120
121 CIMObject& CIMObject::addQualifier(const CIMQualifier& qualifier)
122 {
123 _checkRep();
124 _rep->addQualifier(qualifier);
125 return *this;
126 }
127
|
128 kumpf 1.23 Uint32 CIMObject::findQualifier(const CIMName& name) const
|
129 kumpf 1.10 {
130 _checkRep();
131 return _rep->findQualifier(name);
132 }
133
|
134 kumpf 1.28 CIMQualifier CIMObject::getQualifier(Uint32 index)
|
135 kumpf 1.10 {
136 _checkRep();
|
137 kumpf 1.28 return _rep->getQualifier(index);
|
138 kumpf 1.10 }
139
|
140 kumpf 1.28 CIMConstQualifier CIMObject::getQualifier(Uint32 index) const
|
141 kumpf 1.10 {
142 _checkRep();
|
143 kumpf 1.28 return _rep->getQualifier(index);
|
144 kumpf 1.10 }
145
|
146 kumpf 1.28 void CIMObject::removeQualifier(Uint32 index)
|
147 kumpf 1.10 {
148 _checkRep();
|
149 kumpf 1.28 _rep->removeQualifier(index);
|
150 kumpf 1.10 }
151
152 Uint32 CIMObject::getQualifierCount() const
153 {
154 _checkRep();
155 return _rep->getQualifierCount();
156 }
157
158 CIMObject& CIMObject::addProperty(const CIMProperty& x)
159 {
160 _checkRep();
161 _rep->addProperty(x);
162 return *this;
163 }
164
|
165 kumpf 1.23 Uint32 CIMObject::findProperty(const CIMName& name) const
|
166 kumpf 1.10 {
167 _checkRep();
168 return _rep->findProperty(name);
169 }
170
|
171 kumpf 1.28 CIMProperty CIMObject::getProperty(Uint32 index)
|
172 kumpf 1.10 {
173 _checkRep();
|
174 kumpf 1.28 return _rep->getProperty(index);
|
175 kumpf 1.10 }
176
|
177 kumpf 1.28 CIMConstProperty CIMObject::getProperty(Uint32 index) const
|
178 kumpf 1.10 {
179 _checkRep();
|
180 kumpf 1.28 return _rep->getProperty(index);
|
181 kumpf 1.10 }
182
|
183 kumpf 1.28 void CIMObject::removeProperty(Uint32 index)
|
184 kumpf 1.10 {
185 _checkRep();
|
186 kumpf 1.28 _rep->removeProperty(index);
|
187 kumpf 1.10 }
188
189 Uint32 CIMObject::getPropertyCount() const
190 {
191 _checkRep();
192 return _rep->getPropertyCount();
193 }
194
|
195 kumpf 1.24 Boolean CIMObject::isUninitialized() const
|
196 kumpf 1.10 {
|
197 kumpf 1.13 return (_rep == 0)? true : false;
|
198 kumpf 1.10 }
199
|
200 dave.sudlik 1.32 String CIMObject::toString () const
201 {
|
202 mike 1.36 Buffer out;
|
203 dave.sudlik 1.32
204 _checkRep();
205 _rep->toXml(out);
|
206 david.dillard 1.35 out.append('\0');
|
207 dave.sudlik 1.32
208 return out.getData();
209 }
210
|
211 kumpf 1.25 Boolean CIMObject::isClass () const
212 {
213 try
214 {
215 const CIMClass c (*this);
216 return true;
217 }
|
218 kumpf 1.30 catch (DynamicCastFailedException&)
|
219 kumpf 1.25 {
220 return false;
221 }
222 }
223
224 Boolean CIMObject::isInstance () const
225 {
226 try
227 {
228 const CIMInstance i (*this);
229 return true;
230 }
|
231 kumpf 1.30 catch (DynamicCastFailedException&)
|
232 kumpf 1.25 {
233 return false;
234 }
235 }
236
|
237 mike 1.6 Boolean CIMObject::identical(const CIMConstObject& x) const
|
238 mike 1.5 {
|
239 mike 1.6 x._checkRep();
240 _checkRep();
241 return _rep->identical(x._rep);
242 }
|
243 mike 1.5
|
244 kumpf 1.10 CIMObject CIMObject::clone() const
245 {
246 _checkRep();
247 return CIMObject(_rep->clone());
248 }
249
250 void CIMObject::_checkRep() const
251 {
252 if (!_rep)
|
253 kumpf 1.27 throw UninitializedObjectException();
|
254 kumpf 1.10 }
255
|
256 mike 1.6 ////////////////////////////////////////////////////////////////////////////////
257 //
258 // CIMConstObject
259 //
260 ////////////////////////////////////////////////////////////////////////////////
261
|
262 kumpf 1.10 CIMConstObject::CIMConstObject()
263 : _rep(0)
264 {
265 }
266
267 CIMConstObject::CIMConstObject(const CIMConstObject& x)
268 {
269 Inc(_rep = x._rep);
270 }
271
272 CIMConstObject::CIMConstObject(const CIMObject& x)
273 {
274 Inc(_rep = x._rep);
275 }
276
|
277 mike 1.6 CIMConstObject::CIMConstObject(const CIMClass& x)
278 {
279 Inc(_rep = x._rep);
|
280 mike 1.5 }
281
|
282 chip 1.7 CIMConstObject::CIMConstObject(const CIMConstClass& x)
283 {
284 Inc(_rep = x._rep);
285 }
286
|
287 mike 1.6 CIMConstObject::CIMConstObject(const CIMInstance& x)
|
288 mike 1.5 {
|
289 mike 1.6 Inc(_rep = x._rep);
290 }
|
291 mike 1.5
|
292 chip 1.7 CIMConstObject::CIMConstObject(const CIMConstInstance& x)
293 {
294 Inc(_rep = x._rep);
295 }
296
|
297 kumpf 1.10 CIMConstObject& CIMConstObject::operator=(const CIMConstObject& x)
298 {
299 if (x._rep != _rep)
300 {
301 Dec(_rep);
302 Inc(_rep = x._rep);
|
303 mike 1.5 }
|
304 mike 1.6 return *this;
|
305 mike 1.5 }
306
|
307 kumpf 1.10 CIMConstObject::~CIMConstObject()
308 {
309 Dec(_rep);
310 }
311
|
312 kumpf 1.23 const CIMName& CIMConstObject::getClassName() const
|
313 kumpf 1.10 {
314 _checkRep();
315 return _rep->getClassName();
316 }
317
|
318 kumpf 1.16 const CIMObjectPath& CIMConstObject::getPath() const
|
319 kumpf 1.10 {
320 _checkRep();
321 return _rep->getPath();
322 }
323
|
324 kumpf 1.23 Uint32 CIMConstObject::findQualifier(const CIMName& name) const
|
325 kumpf 1.10 {
326 _checkRep();
327 return _rep->findQualifier(name);
328 }
329
|
330 kumpf 1.28 CIMConstQualifier CIMConstObject::getQualifier(Uint32 index) const
|
331 kumpf 1.10 {
332 _checkRep();
|
333 kumpf 1.28 return _rep->getQualifier(index);
|
334 kumpf 1.10 }
335
336 Uint32 CIMConstObject::getQualifierCount() const
337 {
338 _checkRep();
339 return _rep->getQualifierCount();
340 }
341
|
342 kumpf 1.23 Uint32 CIMConstObject::findProperty(const CIMName& name) const
|
343 kumpf 1.10 {
344 _checkRep();
345 return _rep->findProperty(name);
346 }
347
|
348 kumpf 1.28 CIMConstProperty CIMConstObject::getProperty(Uint32 index) const
|
349 kumpf 1.10 {
350 _checkRep();
|
351 kumpf 1.28 return _rep->getProperty(index);
|
352 kumpf 1.10 }
353
354 Uint32 CIMConstObject::getPropertyCount() const
355 {
356 _checkRep();
357 return _rep->getPropertyCount();
358 }
359
|
360 kumpf 1.24 Boolean CIMConstObject::isUninitialized() const
|
361 kumpf 1.10 {
|
362 kumpf 1.13 return (_rep == 0)? true : false;
|
363 kumpf 1.10 }
364
|
365 dave.sudlik 1.32 String CIMConstObject::toString () const
366 {
|
367 mike 1.36 Buffer out;
|
368 dave.sudlik 1.32
369 _checkRep();
370 _rep->toXml(out);
|
371 david.dillard 1.35 out.append('\0');
|
372 dave.sudlik 1.32
373 return out.getData();
374 }
375
|
376 kumpf 1.27 Boolean CIMConstObject::isClass() const
377 {
378 try
379 {
380 const CIMConstClass c(*this);
381 return true;
382 }
|
383 kumpf 1.30 catch (DynamicCastFailedException&)
|
384 kumpf 1.27 {
385 return false;
386 }
387 }
388
389 Boolean CIMConstObject::isInstance() const
390 {
391 try
392 {
393 const CIMConstInstance i(*this);
394 return true;
395 }
|
396 kumpf 1.30 catch (DynamicCastFailedException&)
|
397 kumpf 1.27 {
398 return false;
399 }
400 }
401
|
402 kumpf 1.10 Boolean CIMConstObject::identical(const CIMConstObject& x) const
403 {
404 x._checkRep();
405 _checkRep();
406 return _rep->identical(x._rep);
407 }
408
409 CIMObject CIMConstObject::clone() const
410 {
411 return CIMObject(_rep->clone());
412 }
413
414 void CIMConstObject::_checkRep() const
415 {
416 if (!_rep)
|
417 kumpf 1.27 throw UninitializedObjectException();
|
418 kumpf 1.10 }
419
|
420 mike 1.5 PEGASUS_NAMESPACE_END
|