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
|
39 mike 1.13 PEGASUS_USING_STD;
40
|
41 mike 1.11 PEGASUS_NAMESPACE_BEGIN
42
43 #define PEGASUS_ARRAY_T CIMInstance
44 # include "ArrayImpl.h"
45 #undef PEGASUS_ARRAY_T
46
|
47 mike 1.12 ////////////////////////////////////////////////////////////////////////////////
48 //
49 // CIMInstance
50 //
51 ////////////////////////////////////////////////////////////////////////////////
52
|
53 kumpf 1.14 CIMInstance::CIMInstance()
54 : _rep(0)
55 {
56 }
57
58 CIMInstance::CIMInstance(const CIMInstance& x)
59 {
60 Inc(_rep = x._rep);
61 }
62
|
63 kumpf 1.34 CIMInstance::CIMInstance(const CIMObject& x)
|
64 mike 1.12 {
65 if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
|
66 kumpf 1.42 throw DynamicCastFailedException();
|
67 kumpf 1.15 Inc(_rep);
|
68 mike 1.12 }
69
|
70 kumpf 1.28 CIMInstance::CIMInstance(const CIMName& className)
|
71 kumpf 1.14 {
|
72 kumpf 1.42 _rep = new CIMInstanceRep(
73 CIMObjectPath(String::EMPTY, CIMNamespaceName(), 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 kumpf 1.28 const CIMName& CIMInstance::getClassName() const
|
97 kumpf 1.14 {
|
98 marek 1.44 CheckRep(_rep);
|
99 kumpf 1.14 return _rep->getClassName();
100 }
101
|
102 kumpf 1.22 const CIMObjectPath& CIMInstance::getPath() const
|
103 kumpf 1.14 {
|
104 marek 1.44 CheckRep(_rep);
|
105 kumpf 1.14 return _rep->getPath();
|
106 kumpf 1.24 }
107
108 void CIMInstance::setPath (const CIMObjectPath & path)
109 {
|
110 marek 1.44 CheckRep(_rep);
|
111 kumpf 1.24 _rep->setPath (path);
|
112 kumpf 1.14 }
113
114 CIMInstance& CIMInstance::addQualifier(const CIMQualifier& qualifier)
115 {
|
116 marek 1.44 CheckRep(_rep);
|
117 kumpf 1.14 _rep->addQualifier(qualifier);
118 return *this;
119 }
120
|
121 kumpf 1.28 Uint32 CIMInstance::findQualifier(const CIMName& name) const
|
122 kumpf 1.14 {
|
123 marek 1.44 CheckRep(_rep);
|
124 kumpf 1.14 return _rep->findQualifier(name);
125 }
126
|
127 kumpf 1.33 CIMQualifier CIMInstance::getQualifier(Uint32 index)
|
128 kumpf 1.14 {
|
129 marek 1.44 CheckRep(_rep);
|
130 kumpf 1.33 return _rep->getQualifier(index);
|
131 kumpf 1.14 }
132
|
133 kumpf 1.33 CIMConstQualifier CIMInstance::getQualifier(Uint32 index) const
|
134 kumpf 1.14 {
|
135 marek 1.44 CheckRep(_rep);
|
136 kumpf 1.33 return _rep->getQualifier(index);
|
137 kumpf 1.14 }
138
|
139 kumpf 1.36 void CIMInstance::removeQualifier(Uint32 index)
140 {
|
141 marek 1.44 CheckRep(_rep);
|
142 kumpf 1.36 _rep->removeQualifier(index);
143 }
144
|
145 kumpf 1.14 Uint32 CIMInstance::getQualifierCount() const
146 {
|
147 marek 1.44 CheckRep(_rep);
|
148 kumpf 1.14 return _rep->getQualifierCount();
149 }
150
151 CIMInstance& CIMInstance::addProperty(const CIMProperty& x)
152 {
|
153 marek 1.44 CheckRep(_rep);
|
154 kumpf 1.14 _rep->addProperty(x);
155 return *this;
156 }
157
|
158 kumpf 1.28 Uint32 CIMInstance::findProperty(const CIMName& name) const
|
159 kumpf 1.14 {
|
160 marek 1.44 CheckRep(_rep);
|
161 kumpf 1.14 return _rep->findProperty(name);
162 }
163
|
164 kumpf 1.34 CIMProperty CIMInstance::getProperty(Uint32 index)
|
165 kumpf 1.14 {
|
166 marek 1.44 CheckRep(_rep);
|
167 kumpf 1.33 return _rep->getProperty(index);
|
168 kumpf 1.14 }
169
|
170 kumpf 1.34 CIMConstProperty CIMInstance::getProperty(Uint32 index) const
|
171 kumpf 1.14 {
|
172 marek 1.44 CheckRep(_rep);
|
173 kumpf 1.33 return _rep->getProperty(index);
|
174 kumpf 1.14 }
175
|
176 kumpf 1.34 void CIMInstance::removeProperty(Uint32 index)
|
177 kumpf 1.14 {
|
178 marek 1.44 CheckRep(_rep);
|
179 kumpf 1.33 _rep->removeProperty(index);
|
180 kumpf 1.14 }
181
182 Uint32 CIMInstance::getPropertyCount() const
183 {
|
184 marek 1.44 CheckRep(_rep);
|
185 kumpf 1.14 return _rep->getPropertyCount();
186 }
187
|
188 kumpf 1.29 Boolean CIMInstance::isUninitialized() const
|
189 kumpf 1.14 {
|
190 kumpf 1.43 return _rep == 0;
|
191 kumpf 1.14 }
192
|
193 mike 1.11 Boolean CIMInstance::identical(const CIMConstInstance& x) const
194 {
|
195 marek 1.44 CheckRep(x._rep);
196 CheckRep(_rep);
|
197 mike 1.11 return _rep->identical(x._rep);
198 }
199
|
200 kumpf 1.14 CIMInstance CIMInstance::clone() const
201 {
202 return CIMInstance((CIMInstanceRep*)(_rep->clone()));
203 }
204
|
205 kumpf 1.30 CIMObjectPath CIMInstance::buildPath(const CIMConstClass& cimClass) const
|
206 kumpf 1.14 {
|
207 marek 1.44 CheckRep(_rep);
|
208 kumpf 1.30 return _rep->buildPath(cimClass);
|
209 kumpf 1.14 }
210
|
211 karl 1.38 void CIMInstance::filter(Boolean includeQualifiers, Boolean includeClassOrigin,
212 const CIMPropertyList& propertyList)
213 {
|
214 marek 1.44 CheckRep(_rep);
|
215 karl 1.38 _rep->filter(includeQualifiers, includeClassOrigin, propertyList);
216 }
217
|
218 mike 1.12 ////////////////////////////////////////////////////////////////////////////////
219 //
220 // CIMConstInstance
221 //
222 ////////////////////////////////////////////////////////////////////////////////
223
|
224 kumpf 1.14 CIMConstInstance::CIMConstInstance()
225 : _rep(0)
226 {
227 }
228
229 CIMConstInstance::CIMConstInstance(const CIMConstInstance& x)
230 {
231 Inc(_rep = x._rep);
232 }
233
234 CIMConstInstance::CIMConstInstance(const CIMInstance& x)
235 {
236 Inc(_rep = x._rep);
237 }
238
|
239 kumpf 1.34 CIMConstInstance::CIMConstInstance(const CIMObject& x)
|
240 mike 1.12 {
241 if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
|
242 kumpf 1.42 throw DynamicCastFailedException();
|
243 kumpf 1.15 Inc(_rep);
|
244 mike 1.12 }
245
246 CIMConstInstance::CIMConstInstance(const CIMConstObject& x)
247 {
248 if (!(_rep = dynamic_cast<CIMInstanceRep*>(x._rep)))
|
249 kumpf 1.42 throw DynamicCastFailedException();
|
250 kumpf 1.15 Inc(_rep);
|
251 kumpf 1.14 }
252
|
253 kumpf 1.28 CIMConstInstance::CIMConstInstance(const CIMName& className)
|
254 kumpf 1.14 {
|
255 kumpf 1.42 _rep = new CIMInstanceRep(
256 CIMObjectPath(String::EMPTY, CIMNamespaceName(), className));
|
257 kumpf 1.14 }
258
259 CIMConstInstance& CIMConstInstance::operator=(const CIMConstInstance& x)
260 {
261 if (x._rep != _rep)
262 {
263 Dec(_rep);
264 Inc(_rep = x._rep);
265 }
266 return *this;
267 }
268
269 CIMConstInstance& CIMConstInstance::operator=(const CIMInstance& x)
270 {
271 if (x._rep != _rep)
272 {
273 Dec(_rep);
274 Inc(_rep = x._rep);
275 }
276 return *this;
277 }
278 kumpf 1.14
279 CIMConstInstance::~CIMConstInstance()
280 {
281 Dec(_rep);
282 }
283
|
284 kumpf 1.28 const CIMName& CIMConstInstance::getClassName() const
|
285 kumpf 1.14 {
|
286 marek 1.44 CheckRep(_rep);
|
287 kumpf 1.14 return _rep->getClassName();
288 }
289
|
290 kumpf 1.22 const CIMObjectPath& CIMConstInstance::getPath() const
|
291 kumpf 1.14 {
|
292 marek 1.44 CheckRep(_rep);
|
293 kumpf 1.14 return _rep->getPath();
294 }
295
|
296 kumpf 1.28 Uint32 CIMConstInstance::findQualifier(const CIMName& name) const
|
297 kumpf 1.14 {
|
298 marek 1.44 CheckRep(_rep);
|
299 kumpf 1.14 return _rep->findQualifier(name);
300 }
301
|
302 kumpf 1.33 CIMConstQualifier CIMConstInstance::getQualifier(Uint32 index) const
|
303 kumpf 1.14 {
|
304 marek 1.44 CheckRep(_rep);
|
305 kumpf 1.33 return _rep->getQualifier(index);
|
306 kumpf 1.14 }
307
308 Uint32 CIMConstInstance::getQualifierCount() const
309 {
|
310 marek 1.44 CheckRep(_rep);
|
311 kumpf 1.14 return _rep->getQualifierCount();
312 }
313
|
314 kumpf 1.28 Uint32 CIMConstInstance::findProperty(const CIMName& name) const
|
315 kumpf 1.14 {
|
316 marek 1.44 CheckRep(_rep);
|
317 kumpf 1.14 return _rep->findProperty(name);
318 }
319
|
320 kumpf 1.33 CIMConstProperty CIMConstInstance::getProperty(Uint32 index) const
|
321 kumpf 1.14 {
|
322 marek 1.44 CheckRep(_rep);
|
323 kumpf 1.33 return _rep->getProperty(index);
|
324 kumpf 1.14 }
325
326 Uint32 CIMConstInstance::getPropertyCount() const
327 {
|
328 marek 1.44 CheckRep(_rep);
|
329 kumpf 1.14 return _rep->getPropertyCount();
330 }
331
|
332 kumpf 1.29 Boolean CIMConstInstance::isUninitialized() const
|
333 kumpf 1.14 {
|
334 kumpf 1.43 return _rep == 0;
|
335 kumpf 1.14 }
336
337 Boolean CIMConstInstance::identical(const CIMConstInstance& x) const
338 {
|
339 marek 1.44 CheckRep(x._rep);
340 CheckRep(_rep);
|
341 kumpf 1.14 return _rep->identical(x._rep);
342 }
343
344 CIMInstance CIMConstInstance::clone() const
345 {
346 return CIMInstance((CIMInstanceRep*)(_rep->clone()));
347 }
348
|
349 kumpf 1.30 CIMObjectPath CIMConstInstance::buildPath(const CIMConstClass& cimClass) const
|
350 kumpf 1.14 {
|
351 marek 1.44 CheckRep(_rep);
|
352 kumpf 1.30 return _rep->buildPath(cimClass);
|
353 kumpf 1.14 }
354
|
355 mike 1.11 PEGASUS_NAMESPACE_END
|