(file) Return to PropertyAccessor.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 karl  1.1 //%2006////////////////////////////////////////////////////////////////////////
  2           //
  3           // 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           // IBM Corp.; EMC Corporation, The Open Group.
  7           // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8           // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9           // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10           // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11           // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12           // EMC Corporation; Symantec Corporation; The Open Group.
 13           //
 14           // Permission is hereby granted, free of charge, to any person obtaining a copy
 15           // 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           // 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           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 karl  1.1 // 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           // 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           // 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           #include "PropertyAccessor.h"
 35           
 36           PEGASUS_NAMESPACE_BEGIN
 37           
 38           /* template for local getter for value in named property of an instance.
 39              param inst CIMInstance target.
 40              @param name String name of property
 41              @param x Value from Template
 42              @return returns True if Property value exits. Else
 43 karl  1.1    returns false if property value is null
 44           */
 45           template<class T>
 46           bool _Get(
 47 kumpf 1.2     const CIMInstance& inst,
 48               const String& name,
 49 karl  1.1     T& x)
 50           {
 51               bool isNull;
 52               Uint32 pos = inst.findProperty(name);
 53               const CIMValue& value = inst.getProperty(pos).getValue();
 54           
 55               if ((isNull = value.isNull()))
 56 kumpf 1.2         x = T();
 57 karl  1.1     else
 58 kumpf 1.2         value.get(x);
 59 karl  1.1     return !isNull;
 60           }
 61           
 62           /* template for local setter for value in named property of an instance.
 63              param inst CIMInstance target.
 64              @param name String name of property
 65              @param x value to be set. Template representing the value type
 66              @return returns True if Property value exits. Else
 67              returns false if property value is null
 68           */
 69           template<class T>
 70           void _Set(
 71 kumpf 1.2     CIMInstance& inst,
 72               const String& name,
 73 karl  1.1     const T& x,
 74               bool null)
 75           {
 76               Uint32 pos = inst.findProperty(name);
 77               CIMValue value;
 78           
 79               value.set(x);
 80               if (null)
 81                   value.setNullValue(GetType((T*)0), IsArray((T*)0));
 82           
 83               inst.getProperty(pos).setValue(value);
 84           }
 85           
 86           bool Get(
 87 kumpf 1.2     const CIMInstance& inst,
 88               const String& name,
 89 karl  1.1     Boolean& value)
 90           {
 91               return _Get(inst, name, value);
 92           }
 93           
 94           void Set(
 95 kumpf 1.2     CIMInstance& inst,
 96               const String& name,
 97               const Boolean& value,
 98 karl  1.1     bool null)
 99           {
100               _Set(inst, name, value, null);
101           }
102           
103           bool Get(
104 kumpf 1.2     const CIMInstance& inst,
105               const String& name,
106 karl  1.1     Array<Boolean>& value)
107           {
108               return _Get(inst, name, value);;
109           }
110           
111           void Set(
112               CIMInstance& inst,
113 kumpf 1.2     const String& name,
114               const Array<Boolean>& value,
115 karl  1.1     bool null)
116           {
117               _Set(inst, name, value, null);
118           }
119           bool Get(
120 kumpf 1.2     const CIMInstance& inst,
121               const String& name,
122 karl  1.1     Uint8& value)
123           {
124               return _Get(inst, name, value);;
125           }
126           
127           void Set(
128               CIMInstance& inst,
129 kumpf 1.2     const String& name,
130               const Uint8& value,
131 karl  1.1     bool null)
132           {
133               _Set(inst, name, value, null);
134           }
135           
136           bool Get(
137 kumpf 1.2     const CIMInstance& inst,
138               const String& name,
139 karl  1.1     Array<Uint8>& value)
140           {
141               return _Get(inst, name, value);
142           }
143           
144           void Set(
145               CIMInstance& inst,
146 kumpf 1.2     const String& name,
147               const Array<Uint8>& value,
148 karl  1.1     bool null)
149           {
150               _Set(inst, name, value, null);
151           }
152           bool Get(
153 kumpf 1.2     const CIMInstance& inst,
154               const String& name,
155 karl  1.1     Sint8& value)
156           {
157               return _Get(inst, name, value);;
158           }
159           
160           void Set(
161               CIMInstance& inst,
162 kumpf 1.2     const String& name,
163               const Sint8& value,
164 karl  1.1     bool null)
165           {
166               _Set(inst, name, value, null);
167           }
168           
169           bool Get(
170 kumpf 1.2     const CIMInstance& inst,
171               const String& name,
172 karl  1.1     Array<Sint8>& value)
173           {
174               return _Get(inst, name, value);;
175           }
176           
177           void Set(
178               CIMInstance& inst,
179 kumpf 1.2     const String& name,
180               const Array<Sint8>& value,
181 karl  1.1     bool null)
182           {
183               _Set(inst, name, value, null);
184           }
185           bool Get(
186 kumpf 1.2     const CIMInstance& inst,
187               const String& name,
188 karl  1.1     Uint16& value)
189           {
190               return _Get(inst, name, value);;
191           }
192           
193           void Set(
194               CIMInstance& inst,
195 kumpf 1.2     const String& name,
196               const Uint16& value,
197 karl  1.1     bool null)
198           {
199               _Set(inst, name, value, null);
200           }
201           
202           bool Get(
203 kumpf 1.2     const CIMInstance& inst,
204               const String& name,
205 karl  1.1     Array<Uint16>& value)
206           {
207               return _Get(inst, name, value);;
208           }
209           
210           void Set(
211               CIMInstance& inst,
212 kumpf 1.2     const String& name,
213               const Array<Uint16>& value,
214 karl  1.1     bool null)
215           {
216               _Set(inst, name, value, null);
217           }
218 kumpf 1.2 
219 karl  1.1 bool Get(
220 kumpf 1.2     const CIMInstance& inst,
221               const String& name,
222 karl  1.1     Sint16& value)
223           {
224               return _Get(inst, name, value);;
225           }
226           
227           void Set(
228               CIMInstance& inst,
229 kumpf 1.2     const String& name,
230               const Sint16& value,
231 karl  1.1     bool null)
232           {
233               _Set(inst, name, value, null);
234           }
235           
236           bool Get(
237 kumpf 1.2     const CIMInstance& inst,
238               const String& name,
239 karl  1.1     Array<Sint16>& value)
240           {
241               return _Get(inst, name, value);;
242           }
243           
244           void Set(
245               CIMInstance& inst,
246 kumpf 1.2     const String& name,
247               const Array<Sint16>& value,
248 karl  1.1     bool null)
249           {
250               _Set(inst, name, value, null);
251           }
252           bool Get(
253 kumpf 1.2     const CIMInstance& inst,
254               const String& name,
255 karl  1.1     Uint32& value)
256           {
257               return _Get(inst, name, value);;
258           }
259           
260           void Set(
261               CIMInstance& inst,
262 kumpf 1.2     const String& name,
263               const Uint32& value,
264 karl  1.1     bool null)
265           {
266               _Set(inst, name, value, null);
267           }
268           
269           bool Get(
270 kumpf 1.2     const CIMInstance& inst,
271               const String& name,
272 karl  1.1     Array<Uint32>& value)
273           {
274               return _Get(inst, name, value);;
275           }
276           
277           void Set(
278               CIMInstance& inst,
279 kumpf 1.2     const String& name,
280               const Array<Uint32>& value,
281 karl  1.1     bool null)
282           {
283               _Set(inst, name, value, null);
284           }
285           bool Get(
286 kumpf 1.2     const CIMInstance& inst,
287               const String& name,
288 karl  1.1     Sint32& value)
289           {
290               return _Get(inst, name, value);;
291           }
292           
293           void Set(
294               CIMInstance& inst,
295 kumpf 1.2     const String& name,
296               const Sint32& value,
297 karl  1.1     bool null)
298           {
299               _Set(inst, name, value, null);
300           }
301           
302           bool Get(
303 kumpf 1.2     const CIMInstance& inst,
304               const String& name,
305 karl  1.1     Array<Sint32>& value)
306           {
307               return _Get(inst, name, value);;
308           }
309           
310           void Set(
311               CIMInstance& inst,
312 kumpf 1.2     const String& name,
313               const Array<Sint32>& value,
314 karl  1.1     bool null)
315           {
316               _Set(inst, name, value, null);
317           }
318           bool Get(
319 kumpf 1.2     const CIMInstance& inst,
320               const String& name,
321 karl  1.1     Uint64& value)
322           {
323               return _Get(inst, name, value);;
324           }
325           
326           void Set(
327               CIMInstance& inst,
328 kumpf 1.2     const String& name,
329               const Uint64& value,
330 karl  1.1     bool null)
331           {
332               _Set(inst, name, value, null);
333           }
334           
335           bool Get(
336 kumpf 1.2     const CIMInstance& inst,
337               const String& name,
338 karl  1.1     Array<Uint64>& value)
339           {
340               return _Get(inst, name, value);;
341           }
342           
343           void Set(
344               CIMInstance& inst,
345 kumpf 1.2     const String& name,
346               const Array<Uint64>& value,
347 karl  1.1     bool null)
348           {
349               _Set(inst, name, value, null);
350           }
351           bool Get(
352 kumpf 1.2     const CIMInstance& inst,
353               const String& name,
354 karl  1.1     Sint64& value)
355           {
356               return _Get(inst, name, value);;
357           }
358           
359           void Set(
360               CIMInstance& inst,
361 kumpf 1.2     const String& name,
362               const Sint64& value,
363 karl  1.1     bool null)
364           {
365               _Set(inst, name, value, null);
366           }
367           
368           bool Get(
369 kumpf 1.2     const CIMInstance& inst,
370               const String& name,
371 karl  1.1     Array<Sint64>& value)
372           {
373               return _Get(inst, name, value);;
374           }
375           
376           void Set(
377               CIMInstance& inst,
378 kumpf 1.2     const String& name,
379               const Array<Sint64>& value,
380 karl  1.1     bool null)
381           {
382               _Set(inst, name, value, null);
383           }
384           bool Get(
385 kumpf 1.2     const CIMInstance& inst,
386               const String& name,
387 karl  1.1     Real32& value)
388           {
389               return _Get(inst, name, value);;
390           }
391           
392           void Set(
393               CIMInstance& inst,
394 kumpf 1.2     const String& name,
395               const Real32& value,
396 karl  1.1     bool null)
397           {
398               _Set(inst, name, value, null);
399           }
400           
401           bool Get(
402 kumpf 1.2     const CIMInstance& inst,
403               const String& name,
404 karl  1.1     Array<Real32>& value)
405           {
406               return _Get(inst, name, value);;
407           }
408           
409           void Set(
410               CIMInstance& inst,
411 kumpf 1.2     const String& name,
412               const Array<Real32>& value,
413 karl  1.1     bool null)
414           {
415               _Set(inst, name, value, null);
416           }
417           bool Get(
418 kumpf 1.2     const CIMInstance& inst,
419               const String& name,
420 karl  1.1     Real64& value)
421           {
422               return _Get(inst, name, value);;
423           }
424           
425           void Set(
426               CIMInstance& inst,
427 kumpf 1.2     const String& name,
428               const Real64& value,
429 karl  1.1     bool null)
430           {
431               _Set(inst, name, value, null);
432           }
433           
434           bool Get(
435 kumpf 1.2     const CIMInstance& inst,
436               const String& name,
437 karl  1.1     Array<Real64>& value)
438           {
439               return _Get(inst, name, value);;
440           }
441           
442           void Set(
443               CIMInstance& inst,
444 kumpf 1.2     const String& name,
445               const Array<Real64>& value,
446 karl  1.1     bool null)
447           {
448               _Set(inst, name, value, null);
449           }
450           bool Get(
451 kumpf 1.2     const CIMInstance& inst,
452               const String& name,
453 karl  1.1     Char16& value)
454           {
455               return _Get(inst, name, value);;
456           }
457           
458           void Set(
459               CIMInstance& inst,
460 kumpf 1.2     const String& name,
461               const Char16& value,
462 karl  1.1     bool null)
463           {
464               _Set(inst, name, value, null);
465           }
466           
467           bool Get(
468 kumpf 1.2     const CIMInstance& inst,
469               const String& name,
470 karl  1.1     Array<Char16>& value)
471           {
472               return _Get(inst, name, value);;
473           }
474           
475           void Set(
476               CIMInstance& inst,
477 kumpf 1.2     const String& name,
478               const Array<Char16>& value,
479 karl  1.1     bool null)
480           {
481               _Set(inst, name, value, null);
482           }
483           bool Get(
484 kumpf 1.2     const CIMInstance& inst,
485               const String& name,
486 karl  1.1     String& value)
487           {
488               return _Get(inst, name, value);;
489           }
490           
491           void Set(
492               CIMInstance& inst,
493 kumpf 1.2     const String& name,
494               const String& value,
495 karl  1.1     bool null)
496           {
497               _Set(inst, name, value, null);
498           }
499           
500           bool Get(
501 kumpf 1.2     const CIMInstance& inst,
502               const String& name,
503 karl  1.1     Array<String>& value)
504           {
505               return _Get(inst, name, value);
506           }
507           
508           void Set(
509               CIMInstance& inst,
510 kumpf 1.2     const String& name,
511               const Array<String>& value,
512 karl  1.1     bool null)
513           {
514               _Set(inst, name, value, null);
515           }
516           bool Get(
517 kumpf 1.2     const CIMInstance& inst,
518               const String& name,
519 karl  1.1     CIMDateTime& value)
520           {
521               return _Get(inst, name, value);
522           }
523           
524           void Set(
525               CIMInstance& inst,
526 kumpf 1.2     const String& name,
527               const CIMDateTime& value,
528 karl  1.1     bool null)
529           {
530               _Set(inst, name, value, null);
531           }
532           
533           bool Get(
534 kumpf 1.2     const CIMInstance& inst,
535               const String& name,
536 karl  1.1     Array<CIMDateTime>& value)
537           {
538               return _Get(inst, name, value);
539           }
540           
541           void Set(
542               CIMInstance& inst,
543 kumpf 1.2     const String& name,
544               const Array<CIMDateTime>& value,
545 karl  1.1     bool null)
546           {
547               _Set(inst, name, value, null);
548           }
549           PEGASUS_NAMESPACE_END
550           

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2