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

  1 thilo.boehm 1.1 //%LICENSE////////////////////////////////////////////////////////////////
  2                 //
  3                 // Licensed to The Open Group (TOG) under one or more contributor license
  4                 // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5                 // this work for additional information regarding copyright ownership.
  6                 // Each contributor licenses this file to you under the OpenPegasus Open
  7                 // Source License; you may not use this file except in compliance with the
  8                 // License.
  9                 //
 10                 // Permission is hereby granted, free of charge, to any person obtaining a
 11                 // copy of this software and associated documentation files (the "Software"),
 12                 // to deal in the Software without restriction, including without limitation
 13                 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14                 // and/or sell copies of the Software, and to permit persons to whom the
 15                 // Software is furnished to do so, subject to the following conditions:
 16                 //
 17                 // The above copyright notice and this permission notice shall be included
 18                 // in all copies or substantial portions of the Software.
 19                 //
 20                 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21                 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 thilo.boehm 1.1 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23                 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24                 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25                 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26                 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27                 //
 28                 //////////////////////////////////////////////////////////////////////////
 29                 //
 30                 //%/////////////////////////////////////////////////////////////////////////////
 31                 
 32                 #include "PropertyAccessor.h"
 33                 
 34                 PEGASUS_NAMESPACE_BEGIN
 35                 
 36                 /* template for local getter for value in named property of an instance.
 37                    param inst CIMInstance target.
 38                    @param name String name of property
 39                    @param x Value from Template
 40                    @return returns True if Property value exits. Else
 41                    returns false if property value is null
 42                 */
 43 thilo.boehm 1.1 template<class T>
 44                 bool _Get(
 45                     const CIMInstance& inst,
 46                     const String& name,
 47                     T& x)
 48                 {
 49                     bool isNull;
 50                     Uint32 pos = inst.findProperty(name);
 51                     const CIMValue& value = inst.getProperty(pos).getValue();
 52                 
 53                     if ((isNull = value.isNull()))
 54                         x = T();
 55                     else
 56                         value.get(x);
 57                     return !isNull;
 58                 }
 59                 
 60                 /* template for local setter for value in named property of an instance.
 61                    param inst CIMInstance target.
 62                    @param name String name of property
 63                    @param x value to be set. Template representing the value type
 64 thilo.boehm 1.1    @return returns True if Property value exits. Else
 65                    returns false if property value is null
 66                 */
 67                 template<class T>
 68                 void _Set(
 69                     CIMInstance& inst,
 70                     const String& name,
 71                     const T& x,
 72                     bool null)
 73                 {
 74                     Uint32 pos = inst.findProperty(name);
 75                     CIMValue value;
 76                 
 77                     value.set(x);
 78                     if (null)
 79                         value.setNullValue(GetType((T*)0), IsArray((T*)0));
 80                 
 81                     inst.getProperty(pos).setValue(value);
 82                 }
 83                 
 84                 bool Get(
 85 thilo.boehm 1.1     const CIMInstance& inst,
 86                     const String& name,
 87                     Boolean& value)
 88                 {
 89                     return _Get(inst, name, value);
 90                 }
 91                 
 92                 void Set(
 93                     CIMInstance& inst,
 94                     const String& name,
 95                     const Boolean& value,
 96                     bool null)
 97                 {
 98                     _Set(inst, name, value, null);
 99                 }
100                 
101                 bool Get(
102                     const CIMInstance& inst,
103                     const String& name,
104                     Array<Boolean>& value)
105                 {
106 thilo.boehm 1.1     return _Get(inst, name, value);;
107                 }
108                 
109                 void Set(
110                     CIMInstance& inst,
111                     const String& name,
112                     const Array<Boolean>& value,
113                     bool null)
114                 {
115                     _Set(inst, name, value, null);
116                 }
117                 bool Get(
118                     const CIMInstance& inst,
119                     const String& name,
120                     Uint8& value)
121                 {
122                     return _Get(inst, name, value);;
123                 }
124                 
125                 void Set(
126                     CIMInstance& inst,
127 thilo.boehm 1.1     const String& name,
128                     const Uint8& value,
129                     bool null)
130                 {
131                     _Set(inst, name, value, null);
132                 }
133                 
134                 bool Get(
135                     const CIMInstance& inst,
136                     const String& name,
137                     Array<Uint8>& value)
138                 {
139                     return _Get(inst, name, value);
140                 }
141                 
142                 void Set(
143                     CIMInstance& inst,
144                     const String& name,
145                     const Array<Uint8>& value,
146                     bool null)
147                 {
148 thilo.boehm 1.1     _Set(inst, name, value, null);
149                 }
150                 bool Get(
151                     const CIMInstance& inst,
152                     const String& name,
153                     Sint8& value)
154                 {
155                     return _Get(inst, name, value);;
156                 }
157                 
158                 void Set(
159                     CIMInstance& inst,
160                     const String& name,
161                     const Sint8& value,
162                     bool null)
163                 {
164                     _Set(inst, name, value, null);
165                 }
166                 
167                 bool Get(
168                     const CIMInstance& inst,
169 thilo.boehm 1.1     const String& name,
170                     Array<Sint8>& value)
171                 {
172                     return _Get(inst, name, value);;
173                 }
174                 
175                 void Set(
176                     CIMInstance& inst,
177                     const String& name,
178                     const Array<Sint8>& value,
179                     bool null)
180                 {
181                     _Set(inst, name, value, null);
182                 }
183                 bool Get(
184                     const CIMInstance& inst,
185                     const String& name,
186                     Uint16& value)
187                 {
188                     return _Get(inst, name, value);;
189                 }
190 thilo.boehm 1.1 
191                 void Set(
192                     CIMInstance& inst,
193                     const String& name,
194                     const Uint16& value,
195                     bool null)
196                 {
197                     _Set(inst, name, value, null);
198                 }
199                 
200                 bool Get(
201                     const CIMInstance& inst,
202                     const String& name,
203                     Array<Uint16>& value)
204                 {
205                     return _Get(inst, name, value);;
206                 }
207                 
208                 void Set(
209                     CIMInstance& inst,
210                     const String& name,
211 thilo.boehm 1.1     const Array<Uint16>& value,
212                     bool null)
213                 {
214                     _Set(inst, name, value, null);
215                 }
216                 
217                 bool Get(
218                     const CIMInstance& inst,
219                     const String& name,
220                     Sint16& value)
221                 {
222                     return _Get(inst, name, value);;
223                 }
224                 
225                 void Set(
226                     CIMInstance& inst,
227                     const String& name,
228                     const Sint16& value,
229                     bool null)
230                 {
231                     _Set(inst, name, value, null);
232 thilo.boehm 1.1 }
233                 
234                 bool Get(
235                     const CIMInstance& inst,
236                     const String& name,
237                     Array<Sint16>& value)
238                 {
239                     return _Get(inst, name, value);;
240                 }
241                 
242                 void Set(
243                     CIMInstance& inst,
244                     const String& name,
245                     const Array<Sint16>& value,
246                     bool null)
247                 {
248                     _Set(inst, name, value, null);
249                 }
250                 bool Get(
251                     const CIMInstance& inst,
252                     const String& name,
253 thilo.boehm 1.1     Uint32& value)
254                 {
255                     return _Get(inst, name, value);;
256                 }
257                 
258                 void Set(
259                     CIMInstance& inst,
260                     const String& name,
261                     const Uint32& value,
262                     bool null)
263                 {
264                     _Set(inst, name, value, null);
265                 }
266                 
267                 bool Get(
268                     const CIMInstance& inst,
269                     const String& name,
270                     Array<Uint32>& value)
271                 {
272                     return _Get(inst, name, value);;
273                 }
274 thilo.boehm 1.1 
275                 void Set(
276                     CIMInstance& inst,
277                     const String& name,
278                     const Array<Uint32>& value,
279                     bool null)
280                 {
281                     _Set(inst, name, value, null);
282                 }
283                 bool Get(
284                     const CIMInstance& inst,
285                     const String& name,
286                     Sint32& value)
287                 {
288                     return _Get(inst, name, value);;
289                 }
290                 
291                 void Set(
292                     CIMInstance& inst,
293                     const String& name,
294                     const Sint32& value,
295 thilo.boehm 1.1     bool null)
296                 {
297                     _Set(inst, name, value, null);
298                 }
299                 
300                 bool Get(
301                     const CIMInstance& inst,
302                     const String& name,
303                     Array<Sint32>& value)
304                 {
305                     return _Get(inst, name, value);;
306                 }
307                 
308                 void Set(
309                     CIMInstance& inst,
310                     const String& name,
311                     const Array<Sint32>& value,
312                     bool null)
313                 {
314                     _Set(inst, name, value, null);
315                 }
316 thilo.boehm 1.1 bool Get(
317                     const CIMInstance& inst,
318                     const String& name,
319                     Uint64& value)
320                 {
321                     return _Get(inst, name, value);;
322                 }
323                 
324                 void Set(
325                     CIMInstance& inst,
326                     const String& name,
327                     const Uint64& value,
328                     bool null)
329                 {
330                     _Set(inst, name, value, null);
331                 }
332                 
333                 bool Get(
334                     const CIMInstance& inst,
335                     const String& name,
336                     Array<Uint64>& value)
337 thilo.boehm 1.1 {
338                     return _Get(inst, name, value);;
339                 }
340                 
341                 void Set(
342                     CIMInstance& inst,
343                     const String& name,
344                     const Array<Uint64>& value,
345                     bool null)
346                 {
347                     _Set(inst, name, value, null);
348                 }
349                 bool Get(
350                     const CIMInstance& inst,
351                     const String& name,
352                     Sint64& value)
353                 {
354                     return _Get(inst, name, value);;
355                 }
356                 
357                 void Set(
358 thilo.boehm 1.1     CIMInstance& inst,
359                     const String& name,
360                     const Sint64& value,
361                     bool null)
362                 {
363                     _Set(inst, name, value, null);
364                 }
365                 
366                 bool Get(
367                     const CIMInstance& inst,
368                     const String& name,
369                     Array<Sint64>& value)
370                 {
371                     return _Get(inst, name, value);;
372                 }
373                 
374                 void Set(
375                     CIMInstance& inst,
376                     const String& name,
377                     const Array<Sint64>& value,
378                     bool null)
379 thilo.boehm 1.1 {
380                     _Set(inst, name, value, null);
381                 }
382                 bool Get(
383                     const CIMInstance& inst,
384                     const String& name,
385                     Real32& value)
386                 {
387                     return _Get(inst, name, value);;
388                 }
389                 
390                 void Set(
391                     CIMInstance& inst,
392                     const String& name,
393                     const Real32& value,
394                     bool null)
395                 {
396                     _Set(inst, name, value, null);
397                 }
398                 
399                 bool Get(
400 thilo.boehm 1.1     const CIMInstance& inst,
401                     const String& name,
402                     Array<Real32>& value)
403                 {
404                     return _Get(inst, name, value);;
405                 }
406                 
407                 void Set(
408                     CIMInstance& inst,
409                     const String& name,
410                     const Array<Real32>& value,
411                     bool null)
412                 {
413                     _Set(inst, name, value, null);
414                 }
415                 bool Get(
416                     const CIMInstance& inst,
417                     const String& name,
418                     Real64& value)
419                 {
420                     return _Get(inst, name, value);;
421 thilo.boehm 1.1 }
422                 
423                 void Set(
424                     CIMInstance& inst,
425                     const String& name,
426                     const Real64& value,
427                     bool null)
428                 {
429                     _Set(inst, name, value, null);
430                 }
431                 
432                 bool Get(
433                     const CIMInstance& inst,
434                     const String& name,
435                     Array<Real64>& value)
436                 {
437                     return _Get(inst, name, value);;
438                 }
439                 
440                 void Set(
441                     CIMInstance& inst,
442 thilo.boehm 1.1     const String& name,
443                     const Array<Real64>& value,
444                     bool null)
445                 {
446                     _Set(inst, name, value, null);
447                 }
448                 bool Get(
449                     const CIMInstance& inst,
450                     const String& name,
451                     Char16& value)
452                 {
453                     return _Get(inst, name, value);;
454                 }
455                 
456                 void Set(
457                     CIMInstance& inst,
458                     const String& name,
459                     const Char16& value,
460                     bool null)
461                 {
462                     _Set(inst, name, value, null);
463 thilo.boehm 1.1 }
464                 
465                 bool Get(
466                     const CIMInstance& inst,
467                     const String& name,
468                     Array<Char16>& value)
469                 {
470                     return _Get(inst, name, value);;
471                 }
472                 
473                 void Set(
474                     CIMInstance& inst,
475                     const String& name,
476                     const Array<Char16>& value,
477                     bool null)
478                 {
479                     _Set(inst, name, value, null);
480                 }
481                 bool Get(
482                     const CIMInstance& inst,
483                     const String& name,
484 thilo.boehm 1.1     String& value)
485                 {
486                     return _Get(inst, name, value);;
487                 }
488                 
489                 void Set(
490                     CIMInstance& inst,
491                     const String& name,
492                     const String& value,
493                     bool null)
494                 {
495                     _Set(inst, name, value, null);
496                 }
497                 
498                 bool Get(
499                     const CIMInstance& inst,
500                     const String& name,
501                     Array<String>& value)
502                 {
503                     return _Get(inst, name, value);
504                 }
505 thilo.boehm 1.1 
506                 void Set(
507                     CIMInstance& inst,
508                     const String& name,
509                     const Array<String>& value,
510                     bool null)
511                 {
512                     _Set(inst, name, value, null);
513                 }
514                 bool Get(
515                     const CIMInstance& inst,
516                     const String& name,
517                     CIMDateTime& value)
518                 {
519                     return _Get(inst, name, value);
520                 }
521                 
522                 void Set(
523                     CIMInstance& inst,
524                     const String& name,
525                     const CIMDateTime& value,
526 thilo.boehm 1.1     bool null)
527                 {
528                     _Set(inst, name, value, null);
529                 }
530                 
531                 bool Get(
532                     const CIMInstance& inst,
533                     const String& name,
534                     Array<CIMDateTime>& value)
535                 {
536                     return _Get(inst, name, value);
537                 }
538                 
539                 void Set(
540                     CIMInstance& inst,
541                     const String& name,
542                     const Array<CIMDateTime>& value,
543                     bool null)
544                 {
545                     _Set(inst, name, value, null);
546                 }
547 thilo.boehm 1.1 PEGASUS_NAMESPACE_END
548                 

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2