(file) Return to field.h CVS log (file) (dir) Up to [OMI] / omi / base

  1 mike  1.1 /*
  2           **==============================================================================
  3           **
  4           ** Open Management Infrastructure (OMI)
  5           **
  6           ** Copyright (c) Microsoft Corporation
  7           ** 
  8           ** Licensed under the Apache License, Version 2.0 (the "License"); you may not 
  9           ** use this file except in compliance with the License. You may obtain a copy 
 10           ** of the License at 
 11           **
 12           **     http://www.apache.org/licenses/LICENSE-2.0 
 13           **
 14           ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15           ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
 16           ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
 17           ** MERCHANTABLITY OR NON-INFRINGEMENT. 
 18           **
 19           ** See the Apache 2 License for the specific language governing permissions 
 20           ** and limitations under the License.
 21           **
 22 mike  1.1 **==============================================================================
 23           */
 24           
 25           #ifndef _omi_field_h
 26           #define _omi_field_h
 27           
 28           #include "config.h"
 29           #include <string.h>
 30           #include <common.h>
 31           #include "batch.h"
 32           #include "types.h"
 33           
 34           BEGIN_EXTERNC
 35           
 36           typedef union _Field
 37           {
 38               MI_BooleanField boolean;
 39               MI_Uint8Field uint8;
 40               MI_Sint8Field sint8;
 41               MI_Uint16Field uint16;
 42               MI_Sint16Field sint16;
 43 mike  1.1     MI_Uint32Field uint32;
 44               MI_Sint32Field sint32;
 45               MI_Uint64Field uint64;
 46               MI_Sint64Field sint64;
 47               MI_Real32Field real32;
 48               MI_Real64Field real64;
 49               MI_Char16Field char16;
 50               MI_DatetimeField datetime;
 51               MI_StringField string;
 52               MI_ReferenceField reference;
 53               MI_InstanceField instance;
 54               MI_BooleanAField booleana;
 55               MI_Uint8AField uint8a;
 56               MI_Sint8AField sint8a;
 57               MI_Uint16AField uint16a;
 58               MI_Sint16AField sint16a;
 59               MI_Uint32AField uint32a;
 60               MI_Sint32AField sint32a;
 61               MI_Uint64AField uint64a;
 62               MI_Sint64AField sint64a;
 63               MI_Real32AField real32a;
 64 mike  1.1     MI_Real64AField real64a;
 65               MI_Char16AField char16a;
 66               MI_DatetimeAField datetimea;
 67               MI_StringAField stringa;
 68               MI_ReferenceAField referencea;
 69               MI_InstanceAField instancea;
 70               MI_ArrayField array;
 71           }
 72           Field;
 73           
 74           MI_Result Field_Construct(
 75               Field* self,
 76               MI_Type type,
 77               const MI_Value* value,
 78               MI_Uint32 flags,
 79               Batch* batch);
 80           
 81           void Field_Destruct(
 82               Field* self,
 83               MI_Type type,
 84               Batch* batch);
 85 mike  1.1 
 86           void Field_Clear(
 87               Field* self,
 88               MI_Type type,
 89               Batch* batch);
 90           
 91           MI_Result Field_Set(
 92               Field* self,
 93               MI_Type type,
 94               const MI_Value* value,
 95               MI_Uint32 flags,
 96               Batch* batch);
 97           
 98           MI_Result Field_Copy(
 99               Field* self,
100               MI_Type type,
101               const Field* field,
102               Batch* batch);
103           
104           void Field_Extract(
105               const Field* field,
106 mike  1.1     MI_Type type,
107               MI_Value* valueOut,
108               MI_Boolean* existsOut,
109               MI_Uint8* flagsOut);
110           
111           void Field_Print(
112               const Field* self,
113               FILE* os, 
114               MI_Type type, 
115               MI_Uint32 level);
116           
117           MI_INLINE MI_Boolean Field_GetExists(
118               const Field* field, 
119               MI_Type type)
120           {
121               return *((MI_Boolean*)((char*)field + Type_SizeOf(type)));
122           }
123           
124           MI_INLINE MI_Uint8 Field_GetFlags(
125               const Field* field, 
126               MI_Type type)
127 mike  1.1 {
128               return *((MI_Uint8*)
129                   ((char*)field + Type_SizeOf(type) + sizeof(MI_Uint8)));
130           }
131           
132           /* Return true if fields are equivalent (only applies to key types) */
133           MI_Boolean Field_MatchKey(
134               const Field* field1,
135               const Field* field2, 
136               MI_Type type);
137           
138           END_EXTERNC
139           
140           #endif /* _omi_field_h */

ViewCVS 0.9.2