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 //%/////////////////////////////////////////////////////////////////////////////
33
|
34 kumpf 1.10 #include "CIMClassRep.h"
35 #include "CIMInstanceRep.h"
36 #include "CIMObjectRep.h"
|
37 mike 1.5 #include "CIMObject.h"
|
38 mike 1.6 #include "CIMClass.h"
39 #include "CIMInstance.h"
|
40 mike 1.5 #include "XmlWriter.h"
41
42 PEGASUS_NAMESPACE_BEGIN
43
|
44 kumpf 1.19 #define PEGASUS_ARRAY_T CIMObject
45 # include "ArrayImpl.h"
46 #undef PEGASUS_ARRAY_T
47
|
48 mike 1.5 ////////////////////////////////////////////////////////////////////////////////
49 //
50 // CIMObject
51 //
52 ////////////////////////////////////////////////////////////////////////////////
53
|
54 kumpf 1.10 CIMObject::CIMObject()
55 : _rep(0)
56 {
57 }
58
59 CIMObject::CIMObject(const CIMObject& x)
60 {
|
61 thilo.boehm 1.45 _rep = x._rep;
62 if (_rep)
63 _rep->Inc();
|
64 kumpf 1.10 }
65
|
66 mike 1.6 CIMObject::CIMObject(const CIMClass& x)
|
67 mike 1.5 {
|
68 thilo.boehm 1.45 _rep = x._rep;
69 if (_rep)
70 _rep->Inc();
|
71 mike 1.6 }
|
72 mike 1.5
|
73 mike 1.6 CIMObject::CIMObject(const CIMInstance& x)
74 {
|
75 thilo.boehm 1.45 _rep = x._rep;
76 if (_rep)
77 _rep->Inc();
|
78 mike 1.5 }
79
|
80 kumpf 1.10 CIMObject::CIMObject(CIMObjectRep* rep)
81 : _rep(rep)
82 {
83 }
84
85 CIMObject& CIMObject::operator=(const CIMObject& x)
86 {
87 if (x._rep != _rep)
88 {
|
89 thilo.boehm 1.45 if (_rep)
90 _rep->Dec();
91 _rep = x._rep;
92 if (_rep)
93 _rep->Inc();
|
94 kumpf 1.10 }
95 return *this;
96 }
97
98 CIMObject::~CIMObject()
99 {
|
100 thilo.boehm 1.45 if (_rep)
101 _rep->Dec();
|
102 kumpf 1.10 }
103
|
104 kumpf 1.23 const CIMName& CIMObject::getClassName() const
|
105 kumpf 1.10 {
|
106 marek 1.41 CheckRep(_rep);
|
107 kumpf 1.10 return _rep->getClassName();
108 }
109
|
110 kumpf 1.16 const CIMObjectPath& CIMObject::getPath() const
|
111 kumpf 1.10 {
|
112 marek 1.41 CheckRep(_rep);
|
113 kumpf 1.10 return _rep->getPath();
|
114 kumpf 1.18 }
115
|
116 kumpf 1.39 void CIMObject::setPath(const CIMObjectPath & path)
|
117 kumpf 1.18 {
|
118 marek 1.41 CheckRep(_rep);
|
119 kumpf 1.39 _rep->setPath(path);
|
120 kumpf 1.10 }
121
122 CIMObject& CIMObject::addQualifier(const CIMQualifier& qualifier)
123 {
|
124 marek 1.41 CheckRep(_rep);
|
125 kumpf 1.10 _rep->addQualifier(qualifier);
126 return *this;
127 }
128
|
129 kumpf 1.23 Uint32 CIMObject::findQualifier(const CIMName& name) const
|
130 kumpf 1.10 {
|
131 marek 1.41 CheckRep(_rep);
|
132 kumpf 1.10 return _rep->findQualifier(name);
133 }
134
|
135 kumpf 1.28 CIMQualifier CIMObject::getQualifier(Uint32 index)
|
136 kumpf 1.10 {
|
137 marek 1.41 CheckRep(_rep);
|
138 kumpf 1.28 return _rep->getQualifier(index);
|
139 kumpf 1.10 }
140
|
141 kumpf 1.28 CIMConstQualifier CIMObject::getQualifier(Uint32 index) const
|
142 kumpf 1.10 {
|
143 marek 1.41 CheckRep(_rep);
|
144 kumpf 1.28 return _rep->getQualifier(index);
|
145 kumpf 1.10 }
146
|
147 kumpf 1.28 void CIMObject::removeQualifier(Uint32 index)
|
148 kumpf 1.10 {
|
149 marek 1.41 CheckRep(_rep);
|
150 kumpf 1.28 _rep->removeQualifier(index);
|
151 kumpf 1.10 }
152
153 Uint32 CIMObject::getQualifierCount() const
154 {
|
155 marek 1.41 CheckRep(_rep);
|
156 kumpf 1.10 return _rep->getQualifierCount();
157 }
158
159 CIMObject& CIMObject::addProperty(const CIMProperty& x)
160 {
|
161 marek 1.41 CheckRep(_rep);
|
162 kumpf 1.10 _rep->addProperty(x);
163 return *this;
164 }
165
|
166 kumpf 1.23 Uint32 CIMObject::findProperty(const CIMName& name) const
|
167 kumpf 1.10 {
|
168 marek 1.41 CheckRep(_rep);
|
169 kumpf 1.10 return _rep->findProperty(name);
170 }
171
|
172 kumpf 1.28 CIMProperty CIMObject::getProperty(Uint32 index)
|
173 kumpf 1.10 {
|
174 marek 1.41 CheckRep(_rep);
|
175 kumpf 1.28 return _rep->getProperty(index);
|
176 kumpf 1.10 }
177
|
178 kumpf 1.28 CIMConstProperty CIMObject::getProperty(Uint32 index) const
|
179 kumpf 1.10 {
|
180 marek 1.41 CheckRep(_rep);
|
181 kumpf 1.28 return _rep->getProperty(index);
|
182 kumpf 1.10 }
183
|
184 kumpf 1.28 void CIMObject::removeProperty(Uint32 index)
|
185 kumpf 1.10 {
|
186 marek 1.41 CheckRep(_rep);
|
187 kumpf 1.28 _rep->removeProperty(index);
|
188 kumpf 1.10 }
189
190 Uint32 CIMObject::getPropertyCount() const
191 {
|
192 marek 1.41 CheckRep(_rep);
|
193 kumpf 1.10 return _rep->getPropertyCount();
194 }
195
|
196 kumpf 1.24 Boolean CIMObject::isUninitialized() const
|
197 kumpf 1.10 {
|
198 kumpf 1.39 return _rep == 0;
|
199 kumpf 1.10 }
200
|
201 kumpf 1.39 String CIMObject::toString() const
|
202 dave.sudlik 1.32 {
|
203 kumpf 1.43 CheckRep(_rep);
|
204 mike 1.36 Buffer out;
|
205 kumpf 1.39
|
206 kumpf 1.43 XmlWriter::appendObjectElement(out, *this);
|
207 dave.sudlik 1.32
208 return out.getData();
209 }
210
|
211 kumpf 1.39 Boolean CIMObject::isClass() const
|
212 kumpf 1.25 {
|
213 marek 1.44 return Boolean(dynamic_cast<CIMClassRep*>(this->_rep));
|
214 kumpf 1.25 }
215
|
216 kumpf 1.39 Boolean CIMObject::isInstance() const
|
217 kumpf 1.25 {
|
218 marek 1.44 return Boolean(dynamic_cast<CIMInstanceRep*>(this->_rep));
|
219 kumpf 1.25 }
220
|
221 mike 1.6 Boolean CIMObject::identical(const CIMConstObject& x) const
|
222 mike 1.5 {
|
223 marek 1.41 CheckRep(x._rep);
224 CheckRep(_rep);
|
225 mike 1.6 return _rep->identical(x._rep);
226 }
|
227 mike 1.5
|
228 kumpf 1.10 CIMObject CIMObject::clone() const
229 {
|
230 marek 1.41 CheckRep(_rep);
|
231 kumpf 1.10 return CIMObject(_rep->clone());
232 }
233
234
|
235 mike 1.6 ////////////////////////////////////////////////////////////////////////////////
236 //
237 // CIMConstObject
238 //
239 ////////////////////////////////////////////////////////////////////////////////
240
|
241 kumpf 1.10 CIMConstObject::CIMConstObject()
242 : _rep(0)
243 {
244 }
245
246 CIMConstObject::CIMConstObject(const CIMConstObject& x)
247 {
|
248 thilo.boehm 1.45 _rep = x._rep;
249 if (_rep)
250 _rep->Inc();
|
251 kumpf 1.10 }
252
253 CIMConstObject::CIMConstObject(const CIMObject& x)
254 {
|
255 thilo.boehm 1.45 _rep = x._rep;
256 if (_rep)
257 _rep->Inc();
|
258 kumpf 1.10 }
259
|
260 mike 1.6 CIMConstObject::CIMConstObject(const CIMClass& x)
261 {
|
262 thilo.boehm 1.45 _rep = x._rep;
263 if (_rep)
264 _rep->Inc();
|
265 mike 1.5 }
266
|
267 chip 1.7 CIMConstObject::CIMConstObject(const CIMConstClass& x)
268 {
|
269 thilo.boehm 1.45 _rep = x._rep;
270 if (_rep)
271 _rep->Inc();
|
272 chip 1.7 }
273
|
274 mike 1.6 CIMConstObject::CIMConstObject(const CIMInstance& x)
|
275 mike 1.5 {
|
276 thilo.boehm 1.45 _rep = x._rep;
277 if (_rep)
278 _rep->Inc();
|
279 mike 1.6 }
|
280 mike 1.5
|
281 chip 1.7 CIMConstObject::CIMConstObject(const CIMConstInstance& x)
282 {
|
283 thilo.boehm 1.45 _rep = x._rep;
284 if (_rep)
285 _rep->Inc();
|
286 chip 1.7 }
287
|
288 kumpf 1.10 CIMConstObject& CIMConstObject::operator=(const CIMConstObject& x)
289 {
290 if (x._rep != _rep)
291 {
|
292 thilo.boehm 1.45 if (_rep)
293 _rep->Dec();
294 _rep = x._rep;
295 if (_rep)
296 _rep->Inc();
|
297 mike 1.5 }
|
298 mike 1.6 return *this;
|
299 mike 1.5 }
300
|
301 kumpf 1.10 CIMConstObject::~CIMConstObject()
302 {
|
303 thilo.boehm 1.45 if (_rep)
304 _rep->Dec();
|
305 kumpf 1.10 }
306
|
307 kumpf 1.23 const CIMName& CIMConstObject::getClassName() const
|
308 kumpf 1.10 {
|
309 marek 1.41 CheckRep(_rep);
|
310 kumpf 1.10 return _rep->getClassName();
311 }
312
|
313 kumpf 1.16 const CIMObjectPath& CIMConstObject::getPath() const
|
314 kumpf 1.10 {
|
315 marek 1.41 CheckRep(_rep);
|
316 kumpf 1.10 return _rep->getPath();
317 }
318
|
319 kumpf 1.23 Uint32 CIMConstObject::findQualifier(const CIMName& name) const
|
320 kumpf 1.10 {
|
321 marek 1.41 CheckRep(_rep);
|
322 kumpf 1.10 return _rep->findQualifier(name);
323 }
324
|
325 kumpf 1.28 CIMConstQualifier CIMConstObject::getQualifier(Uint32 index) const
|
326 kumpf 1.10 {
|
327 marek 1.41 CheckRep(_rep);
|
328 kumpf 1.28 return _rep->getQualifier(index);
|
329 kumpf 1.10 }
330
331 Uint32 CIMConstObject::getQualifierCount() const
332 {
|
333 marek 1.41 CheckRep(_rep);
|
334 kumpf 1.10 return _rep->getQualifierCount();
335 }
336
|
337 kumpf 1.23 Uint32 CIMConstObject::findProperty(const CIMName& name) const
|
338 kumpf 1.10 {
|
339 marek 1.41 CheckRep(_rep);
|
340 kumpf 1.10 return _rep->findProperty(name);
341 }
342
|
343 kumpf 1.28 CIMConstProperty CIMConstObject::getProperty(Uint32 index) const
|
344 kumpf 1.10 {
|
345 marek 1.41 CheckRep(_rep);
|
346 kumpf 1.28 return _rep->getProperty(index);
|
347 kumpf 1.10 }
348
349 Uint32 CIMConstObject::getPropertyCount() const
350 {
|
351 marek 1.41 CheckRep(_rep);
|
352 kumpf 1.10 return _rep->getPropertyCount();
353 }
354
|
355 kumpf 1.24 Boolean CIMConstObject::isUninitialized() const
|
356 kumpf 1.10 {
|
357 kumpf 1.39 return _rep == 0;
|
358 kumpf 1.10 }
359
|
360 kumpf 1.39 String CIMConstObject::toString() const
|
361 dave.sudlik 1.32 {
|
362 kumpf 1.43 CheckRep(_rep);
|
363 mike 1.36 Buffer out;
|
364 kumpf 1.39
|
365 kumpf 1.43 XmlWriter::appendObjectElement(out, *this);
|
366 dave.sudlik 1.32
367 return out.getData();
368 }
369
|
370 kumpf 1.27 Boolean CIMConstObject::isClass() const
371 {
|
372 marek 1.44 return Boolean(dynamic_cast<CIMClassRep*>(this->_rep));
|
373 kumpf 1.27 }
374
375 Boolean CIMConstObject::isInstance() const
376 {
|
377 marek 1.44 return Boolean(dynamic_cast<CIMInstanceRep*>(this->_rep));
|
378 kumpf 1.27 }
379
|
380 kumpf 1.10 Boolean CIMConstObject::identical(const CIMConstObject& x) const
381 {
|
382 marek 1.41 CheckRep(x._rep);
383 CheckRep(_rep);
|
384 kumpf 1.10 return _rep->identical(x._rep);
385 }
386
387 CIMObject CIMConstObject::clone() const
388 {
389 return CIMObject(_rep->clone());
390 }
391
|
392 mike 1.5 PEGASUS_NAMESPACE_END
|