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 "Indentor.h"
38 #include "CIMName.h"
39 #include "XmlWriter.h"
40
|
41 mike 1.13 PEGASUS_USING_STD;
42
|
43 mike 1.11 PEGASUS_NAMESPACE_BEGIN
44
45 #define PEGASUS_ARRAY_T CIMInstance
46 # include "ArrayImpl.h"
47 #undef PEGASUS_ARRAY_T
48
|
49 mike 1.12 ////////////////////////////////////////////////////////////////////////////////
50 //
51 // CIMInstance
52 //
53 ////////////////////////////////////////////////////////////////////////////////
54
|
55 kumpf 1.14 CIMInstance::CIMInstance()
56 : _rep(0)
57 {
58 }
59
60 CIMInstance::CIMInstance(const CIMInstance& x)
61 {
62 Inc(_rep = x._rep);
63 }
64
|
65 kumpf 1.34 CIMInstance::CIMInstance(const CIMObject& x)
|
66 mike 1.12 {
67 if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
|
68 kumpf 1.42 throw DynamicCastFailedException();
|
69 kumpf 1.15 Inc(_rep);
|
70 mike 1.12 }
71
|
72 kumpf 1.28 CIMInstance::CIMInstance(const CIMName& className)
|
73 kumpf 1.14 {
|
74 kumpf 1.42 _rep = new CIMInstanceRep(
75 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 karl 1.38
220 void CIMInstance::filter(Boolean includeQualifiers, Boolean includeClassOrigin,
221 const CIMPropertyList& propertyList)
222 {
223 _checkRep();
224 _rep->filter(includeQualifiers, includeClassOrigin, propertyList);
225 }
226
|
227 mike 1.12 ////////////////////////////////////////////////////////////////////////////////
228 //
229 // CIMConstInstance
230 //
231 ////////////////////////////////////////////////////////////////////////////////
232
|
233 kumpf 1.14 CIMConstInstance::CIMConstInstance()
234 : _rep(0)
235 {
236 }
237
238 CIMConstInstance::CIMConstInstance(const CIMConstInstance& x)
239 {
240 Inc(_rep = x._rep);
241 }
242
243 CIMConstInstance::CIMConstInstance(const CIMInstance& x)
244 {
245 Inc(_rep = x._rep);
246 }
247
|
248 kumpf 1.34 CIMConstInstance::CIMConstInstance(const CIMObject& x)
|
249 mike 1.12 {
250 if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
|
251 kumpf 1.42 throw DynamicCastFailedException();
|
252 kumpf 1.15 Inc(_rep);
|
253 mike 1.12 }
254
255 CIMConstInstance::CIMConstInstance(const CIMConstObject& x)
256 {
257 if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
|
258 kumpf 1.42 throw DynamicCastFailedException();
|
259 kumpf 1.15 Inc(_rep);
|
260 kumpf 1.14 }
261
|
262 kumpf 1.28 CIMConstInstance::CIMConstInstance(const CIMName& className)
|
263 kumpf 1.14 {
|
264 kumpf 1.42 _rep = new CIMInstanceRep(
265 CIMObjectPath(String::EMPTY, CIMNamespaceName(), className));
|
266 kumpf 1.14 }
267
268 CIMConstInstance& CIMConstInstance::operator=(const CIMConstInstance& x)
269 {
270 if (x._rep != _rep)
271 {
272 Dec(_rep);
273 Inc(_rep = x._rep);
274 }
275 return *this;
276 }
277
278 CIMConstInstance& CIMConstInstance::operator=(const CIMInstance& x)
279 {
280 if (x._rep != _rep)
281 {
282 Dec(_rep);
283 Inc(_rep = x._rep);
284 }
285 return *this;
286 }
287 kumpf 1.14
288 CIMConstInstance::~CIMConstInstance()
289 {
290 Dec(_rep);
291 }
292
|
293 kumpf 1.28 const CIMName& CIMConstInstance::getClassName() const
|
294 kumpf 1.14 {
295 _checkRep();
296 return _rep->getClassName();
297 }
298
|
299 kumpf 1.22 const CIMObjectPath& CIMConstInstance::getPath() const
|
300 kumpf 1.14 {
301 _checkRep();
302 return _rep->getPath();
303 }
304
|
305 kumpf 1.28 Uint32 CIMConstInstance::findQualifier(const CIMName& name) const
|
306 kumpf 1.14 {
307 _checkRep();
308 return _rep->findQualifier(name);
309 }
310
|
311 kumpf 1.33 CIMConstQualifier CIMConstInstance::getQualifier(Uint32 index) const
|
312 kumpf 1.14 {
313 _checkRep();
|
314 kumpf 1.33 return _rep->getQualifier(index);
|
315 kumpf 1.14 }
316
317 Uint32 CIMConstInstance::getQualifierCount() const
318 {
319 _checkRep();
320 return _rep->getQualifierCount();
321 }
322
|
323 kumpf 1.28 Uint32 CIMConstInstance::findProperty(const CIMName& name) const
|
324 kumpf 1.14 {
325 _checkRep();
326 return _rep->findProperty(name);
327 }
328
|
329 kumpf 1.33 CIMConstProperty CIMConstInstance::getProperty(Uint32 index) const
|
330 kumpf 1.14 {
331 _checkRep();
|
332 kumpf 1.33 return _rep->getProperty(index);
|
333 kumpf 1.14 }
334
335 Uint32 CIMConstInstance::getPropertyCount() const
336 {
337 _checkRep();
338 return _rep->getPropertyCount();
339 }
340
|
341 kumpf 1.29 Boolean CIMConstInstance::isUninitialized() const
|
342 kumpf 1.14 {
|
343 kumpf 1.18 return (_rep == 0)? true : false;
|
344 kumpf 1.14 }
345
346 Boolean CIMConstInstance::identical(const CIMConstInstance& x) const
347 {
348 x._checkRep();
349 _checkRep();
350 return _rep->identical(x._rep);
351 }
352
353 CIMInstance CIMConstInstance::clone() const
354 {
355 return CIMInstance((CIMInstanceRep*)(_rep->clone()));
356 }
357
|
358 kumpf 1.30 CIMObjectPath CIMConstInstance::buildPath(const CIMConstClass& cimClass) const
|
359 kumpf 1.14 {
360 _checkRep();
|
361 kumpf 1.30 return _rep->buildPath(cimClass);
|
362 kumpf 1.14 }
363
364 void CIMConstInstance::_checkRep() const
365 {
366 if (!_rep)
|
367 kumpf 1.32 throw UninitializedObjectException();
|
368 mike 1.11 }
369
370 PEGASUS_NAMESPACE_END
|