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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2