(file) Return to PropertyAccessor.h 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           #ifndef Pegasus_PropertyAccessor_h
 35           #define Pegasus_PropertyAccessor_h
 36           
 37           #include <Pegasus/Common/CIMInstance.h>
 38           
 39           PEGASUS_NAMESPACE_BEGIN
 40 kumpf 1.2 /*
 41               PropertyAccessor is a set of support functions for property value access
 42               within instances.  These functions provide the capability to get and set
 43               the value of all of the native property types within Pegasus using only
 44               the reference to the instance and the property name as identifiers.  They
 45               provide, in effect, an associative link to property values as an
 46               alternate to the index based reference defined in the CIMInstance
 47               object.  Further, they allow directly getting and setting the value in
 48               place of the multistep approach in the objects where the the CIMValue
 49               must first be retrieved before the value can be accessed.  This reduces
 50               the access to a single line of code.
 51           
 52               These functions assume that the property exists in the instance.
 53           
 54               Examples:
 55                   Set(_inst, "ErrorSourceFormat", Uint16(value), null);
 56                   bool nullStat = Get(_inst, "ErrorSourceFormat", t);
 57               These functions are to be used only internally within OpenPegasus
 58 karl  1.1 */
 59           
 60           /** Get the named property value from the target instance.
 61               @param inst CIMInstance from which the property value is to be retrieved.
 62               @param name String Name of the property which is to be accessed.
 63               @param value Boolean The value of the property is returned in this
 64               variable if the NULL attribute is NOT set for the CIMValue for this
 65               property.
 66               @return bool returns true if the CIMValue for the property is NOT Null.
 67 kumpf 1.2     @exception Returns CIM_ERR_NO_SUCH_PROPERTY if the named property is not
 68               in the instance.
 69           */
 70 karl  1.1 bool Get(
 71 kumpf 1.2     const CIMInstance& inst,
 72               const String& name,
 73 karl  1.1     Boolean& value);
 74           
 75           /** Get the named property value from the target instance.
 76               @param inst CIMInstance from which the property value is to be retrieved.
 77               @param name String Name of the property which is to be accessed.
 78               @param value Boolean The value of the property is returned in this
 79               variable if the NULL attribute is NOT set for the CIMValue for this
 80               property.
 81               @param null bool If this is set true, the value parameter is ignored and the
 82               property is set to NULL.
 83               @return bool returns true if the CIMValue for the property is NOT Null.
 84 kumpf 1.2     @exception Returns CIM_ERR_NO_SUCH_PROPERTY if the named property is not
 85               in the instance.
 86           */
 87 karl  1.1 void Set(
 88               CIMInstance& inst,
 89 kumpf 1.2     const String& name,
 90               const Boolean& value,
 91 karl  1.1     bool null);
 92           
 93           bool Get(
 94 kumpf 1.2     const CIMInstance& inst,
 95               const String& name,
 96 karl  1.1     Array<Boolean>& value);
 97           
 98           void Set(
 99               CIMInstance& inst,
100 kumpf 1.2     const String& name,
101               const Array<Boolean>& value,
102 karl  1.1     bool null);
103           
104           bool Get(
105 kumpf 1.2     const CIMInstance& inst,
106               const String& name,
107 karl  1.1     Uint8& value);
108           
109           void Set(
110               CIMInstance& inst,
111 kumpf 1.2     const String& name,
112               const Uint8& value,
113 karl  1.1     bool null);
114           
115           bool Get(
116 kumpf 1.2     const CIMInstance& inst,
117               const String& name,
118 karl  1.1     Array<Uint8>& value);
119           
120           void Set(
121               CIMInstance& inst,
122 kumpf 1.2     const String& name,
123               const Array<Uint8>& value,
124 karl  1.1     bool null);
125           
126           bool Get(
127 kumpf 1.2     const CIMInstance& inst,
128               const String& name,
129 karl  1.1     Sint8& value);
130           
131           void Set(
132               CIMInstance& inst,
133 kumpf 1.2     const String& name,
134               const Sint8& value,
135 karl  1.1     bool null);
136           
137           bool Get(
138 kumpf 1.2     const CIMInstance& inst,
139               const String& name,
140 karl  1.1     Array<Sint8>& value);
141           
142           void Set(
143               CIMInstance& inst,
144 kumpf 1.2     const String& name,
145               const Array<Sint8>& value,
146 karl  1.1     bool null);
147           
148           bool Get(
149 kumpf 1.2     const CIMInstance& inst,
150               const String& name,
151 karl  1.1     Uint16& value);
152           
153           void Set(
154               CIMInstance& inst,
155 kumpf 1.2     const String& name,
156               const Uint16& value,
157 karl  1.1     bool null);
158           
159           bool Get(
160 kumpf 1.2     const CIMInstance& inst,
161               const String& name,
162 karl  1.1     Array<Uint16>& value);
163           
164           void Set(
165               CIMInstance& inst,
166 kumpf 1.2     const String& name,
167               const Array<Uint16>& value,
168 karl  1.1     bool null);
169           
170           bool Get(
171 kumpf 1.2     const CIMInstance& inst,
172               const String& name,
173 karl  1.1     Sint16& value);
174           
175           void Set(
176               CIMInstance& inst,
177 kumpf 1.2     const String& name,
178               const Sint16& value,
179 karl  1.1     bool null);
180           
181           bool Get(
182 kumpf 1.2     const CIMInstance& inst,
183               const String& name,
184 karl  1.1     Array<Sint16>& value);
185           
186           void Set(
187               CIMInstance& inst,
188 kumpf 1.2     const String& name,
189               const Array<Sint16>& value,
190 karl  1.1     bool null);
191           
192           bool Get(
193 kumpf 1.2     const CIMInstance& inst,
194               const String& name,
195 karl  1.1     Uint32& value);
196           
197           void Set(
198               CIMInstance& inst,
199 kumpf 1.2     const String& name,
200               const Uint32& value,
201 karl  1.1     bool null);
202           
203           bool Get(
204 kumpf 1.2     const CIMInstance& inst,
205               const String& name,
206 karl  1.1     Array<Uint32>& value);
207           
208           void Set(
209               CIMInstance& inst,
210 kumpf 1.2     const String& name,
211               const Array<Uint32>& value,
212 karl  1.1     bool null);
213           
214           bool Get(
215 kumpf 1.2     const CIMInstance& inst,
216               const String& name,
217 karl  1.1     Sint32& value);
218           
219           void Set(
220               CIMInstance& inst,
221 kumpf 1.2     const String& name,
222               const Sint32& value,
223 karl  1.1     bool null);
224           
225           bool Get(
226 kumpf 1.2     const CIMInstance& inst,
227               const String& name,
228 karl  1.1     Array<Sint32>& value);
229           
230           void Set(
231               CIMInstance& inst,
232 kumpf 1.2     const String& name,
233               const Array<Sint32>& value,
234 karl  1.1     bool null);
235           
236           bool Get(
237 kumpf 1.2     const CIMInstance& inst,
238               const String& name,
239 karl  1.1     Uint64& value);
240           
241           void Set(
242               CIMInstance& inst,
243 kumpf 1.2     const String& name,
244               const Uint64& value,
245 karl  1.1     bool null);
246           
247           bool Get(
248 kumpf 1.2     const CIMInstance& inst,
249               const String& name,
250 karl  1.1     Array<Uint64>& value);
251           
252           void Set(
253               CIMInstance& inst,
254 kumpf 1.2     const String& name,
255               const Array<Uint64>& value,
256 karl  1.1     bool null);
257           
258           bool Get(
259 kumpf 1.2     const CIMInstance& inst,
260               const String& name,
261 karl  1.1     Sint64& value);
262           
263           void Set(
264               CIMInstance& inst,
265 kumpf 1.2     const String& name,
266               const Sint64& value,
267 karl  1.1     bool null);
268           
269           bool Get(
270 kumpf 1.2     const CIMInstance& inst,
271               const String& name,
272 karl  1.1     Array<Sint64>& value);
273           
274           void Set(
275               CIMInstance& inst,
276 kumpf 1.2     const String& name,
277               const Array<Sint64>& value,
278 karl  1.1     bool null);
279           
280           bool Get(
281 kumpf 1.2     const CIMInstance& inst,
282               const String& name,
283 karl  1.1     Real32& value);
284           
285           void Set(
286               CIMInstance& inst,
287 kumpf 1.2     const String& name,
288               const Real32& value,
289 karl  1.1     bool null);
290           
291           bool Get(
292 kumpf 1.2     const CIMInstance& inst,
293               const String& name,
294 karl  1.1     Array<Real32>& value);
295           
296           void Set(
297               CIMInstance& inst,
298 kumpf 1.2     const String& name,
299               const Array<Real32>& value,
300 karl  1.1     bool null);
301           
302           bool Get(
303 kumpf 1.2     const CIMInstance& inst,
304               const String& name,
305 karl  1.1     Real64& value);
306           
307           void Set(
308               CIMInstance& inst,
309 kumpf 1.2     const String& name,
310               const Real64& value,
311 karl  1.1     bool null);
312           
313           bool Get(
314 kumpf 1.2     const CIMInstance& inst,
315               const String& name,
316 karl  1.1     Array<Real64>& value);
317           
318           void Set(
319               CIMInstance& inst,
320 kumpf 1.2     const String& name,
321               const Array<Real64>& value,
322 karl  1.1     bool null);
323           
324           bool Get(
325 kumpf 1.2     const CIMInstance& inst,
326               const String& name,
327 karl  1.1     Char16& value);
328           
329           void Set(
330               CIMInstance& inst,
331 kumpf 1.2     const String& name,
332               const Char16& value,
333 karl  1.1     bool null);
334           
335           bool Get(
336 kumpf 1.2     const CIMInstance& inst,
337               const String& name,
338 karl  1.1     Array<Char16>& value);
339           
340           void Set(
341               CIMInstance& inst,
342 kumpf 1.2     const String& name,
343               const Array<Char16>& value,
344 karl  1.1     bool null);
345           
346           bool Get(
347 kumpf 1.2     const CIMInstance& inst,
348               const String& name,
349 karl  1.1     String& value);
350           
351           void Set(
352               CIMInstance& inst,
353 kumpf 1.2     const String& name,
354               const String& value,
355 karl  1.1     bool null);
356           
357           bool Get(
358 kumpf 1.2     const CIMInstance& inst,
359               const String& name,
360 karl  1.1     Array<String>& value);
361           
362           void Set(
363               CIMInstance& inst,
364 kumpf 1.2     const String& name,
365               const Array<String>& value,
366 karl  1.1     bool null);
367           
368           bool Get(
369 kumpf 1.2     const CIMInstance& inst,
370               const String& name,
371 karl  1.1     CIMDateTime& value);
372           
373           void Set(
374               CIMInstance& inst,
375 kumpf 1.2     const String& name,
376               const CIMDateTime& value,
377 karl  1.1     bool null);
378           
379           bool Get(
380 kumpf 1.2     const CIMInstance& inst,
381               const String& name,
382 karl  1.1     Array<CIMDateTime>& value);
383           
384           void Set(
385               CIMInstance& inst,
386 kumpf 1.2     const String& name,
387               const Array<CIMDateTime>& value,
388 karl  1.1     bool null);
389           
390           inline CIMType GetType(Boolean*) { return CIMTYPE_BOOLEAN; }
391           inline CIMType GetType(Uint8*) { return CIMTYPE_UINT8; }
392           inline CIMType GetType(Sint8*) { return CIMTYPE_SINT8; }
393           inline CIMType GetType(Uint16*) { return CIMTYPE_UINT16; }
394           inline CIMType GetType(Sint16*) { return CIMTYPE_SINT16; }
395           inline CIMType GetType(Uint32*) { return CIMTYPE_UINT32; }
396           inline CIMType GetType(Sint32*) { return CIMTYPE_SINT32; }
397           inline CIMType GetType(Uint64*) { return CIMTYPE_UINT64; }
398           inline CIMType GetType(Sint64*) { return CIMTYPE_SINT64; }
399           inline CIMType GetType(Real32*) { return CIMTYPE_REAL32; }
400           inline CIMType GetType(Real64*) { return CIMTYPE_REAL64; }
401           inline CIMType GetType(Char16*) { return CIMTYPE_CHAR16; }
402           inline CIMType GetType(String*) { return CIMTYPE_STRING; }
403           inline CIMType GetType(CIMDateTime*) { return CIMTYPE_DATETIME; }
404           inline CIMType GetType(CIMObjectPath*) { return CIMTYPE_REFERENCE; }
405           inline CIMType GetType(CIMObject*) { return CIMTYPE_OBJECT; }
406           inline CIMType GetType(Array<Boolean>*) { return CIMTYPE_BOOLEAN; }
407           inline CIMType GetType(Array<Uint8>*) { return CIMTYPE_UINT8; }
408           inline CIMType GetType(Array<Sint8>*) { return CIMTYPE_SINT8; }
409 karl  1.1 inline CIMType GetType(Array<Uint16>*) { return CIMTYPE_UINT16; }
410           inline CIMType GetType(Array<Sint16>*) { return CIMTYPE_SINT16; }
411           inline CIMType GetType(Array<Uint32>*) { return CIMTYPE_UINT32; }
412           inline CIMType GetType(Array<Sint32>*) { return CIMTYPE_SINT32; }
413           inline CIMType GetType(Array<Uint64>*) { return CIMTYPE_UINT64; }
414           inline CIMType GetType(Array<Sint64>*) { return CIMTYPE_SINT64; }
415           inline CIMType GetType(Array<Real32>*) { return CIMTYPE_REAL32; }
416           inline CIMType GetType(Array<Real64>*) { return CIMTYPE_REAL64; }
417           inline CIMType GetType(Array<Char16>*) { return CIMTYPE_CHAR16; }
418           inline CIMType GetType(Array<String>*) { return CIMTYPE_STRING; }
419           inline CIMType GetType(Array<CIMDateTime>*) { return CIMTYPE_DATETIME; }
420           inline CIMType GetType(Array<CIMObjectPath>*) { return CIMTYPE_REFERENCE; }
421           inline CIMType GetType(Array<CIMObject>*) { return CIMTYPE_OBJECT; }
422           
423           inline bool IsArray(Boolean*) { return false; }
424           inline bool IsArray(Uint8*) { return false; }
425           inline bool IsArray(Sint8*) { return false; }
426           inline bool IsArray(Uint16*) { return false; }
427           inline bool IsArray(Sint16*) { return false; }
428           inline bool IsArray(Uint32*) { return false; }
429           inline bool IsArray(Sint32*) { return false; }
430 karl  1.1 inline bool IsArray(Uint64*) { return false; }
431           inline bool IsArray(Sint64*) { return false; }
432           inline bool IsArray(Real32*) { return false; }
433           inline bool IsArray(Real64*) { return false; }
434           inline bool IsArray(Char16*) { return false; }
435           inline bool IsArray(String*) { return false; }
436           inline bool IsArray(CIMDateTime*) { return false; }
437           inline bool IsArray(CIMObjectPath*) { return false; }
438           inline bool IsArray(CIMObject*) { return false; }
439           inline bool IsArray(Array<Boolean>*) { return true; }
440           inline bool IsArray(Array<Uint8>*) { return true; }
441           inline bool IsArray(Array<Sint8>*) { return true; }
442           inline bool IsArray(Array<Uint16>*) { return true; }
443           inline bool IsArray(Array<Sint16>*) { return true; }
444           inline bool IsArray(Array<Uint32>*) { return true; }
445           inline bool IsArray(Array<Sint32>*) { return true; }
446           inline bool IsArray(Array<Uint64>*) { return true; }
447           inline bool IsArray(Array<Sint64>*) { return true; }
448           inline bool IsArray(Array<Real32>*) { return true; }
449           inline bool IsArray(Array<Real64>*) { return true; }
450           inline bool IsArray(Array<Char16>*) { return true; }
451 karl  1.1 inline bool IsArray(Array<String>*) { return true; }
452           inline bool IsArray(Array<CIMDateTime>*) { return true; }
453           inline bool IsArray(Array<CIMObjectPath>*) { return true; }
454           inline bool IsArray(Array<CIMObject>*) { return true; }
455           
456           PEGASUS_NAMESPACE_END
457           
458           #endif /* Pegasus_PropertyAccessor_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2