(file) Return to helpers.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 _base_helpers_h
 26           #define _base_helpers_h
 27           
 28           #include "instance.h"
 29           
 30           BEGIN_EXTERNC
 31           
 32           MI_Result MI_CALL Instance_SetElementFromString(
 33               MI_Instance* self, 
 34               const MI_Char* name, 
 35               const MI_Char* str);
 36           
 37           MI_Result MI_CALL Instance_SetElementFromStringA(
 38               MI_Instance* self_, 
 39               const MI_Char* name, 
 40               const MI_Char** data,
 41               MI_Uint32 size);
 42           
 43 mike  1.1 MI_Result MI_CALL Instance_GetValue(
 44               MI_Instance* self,
 45               const MI_Char* name,
 46               void* value,
 47               MI_Type type);
 48           
 49           MI_INLINE MI_Result Instance_SetBoolean(
 50               MI_Instance* self, 
 51               const MI_Char* name, 
 52               MI_Boolean x)
 53           {
 54               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_BOOLEAN, 0);
 55           }
 56           
 57           MI_INLINE MI_Result Instance_SetUint8(
 58               MI_Instance* self, 
 59               const MI_Char* name, 
 60               MI_Uint8 x)
 61           {
 62               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_UINT8, 0);
 63           }
 64 mike  1.1 
 65           MI_INLINE MI_Result Instance_SetSint8(
 66               MI_Instance* self, 
 67               const MI_Char* name, 
 68               MI_Sint8 x)
 69           {
 70               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_SINT8, 0);
 71           }
 72           
 73           MI_INLINE MI_Result Instance_SetUint16(
 74               MI_Instance* self, 
 75               const MI_Char* name, 
 76               MI_Uint16 x)
 77           {
 78               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_UINT16, 0);
 79           }
 80           
 81           MI_INLINE MI_Result Instance_SetSint16(
 82               MI_Instance* self, 
 83               const MI_Char* name, 
 84               MI_Sint16 x)
 85 mike  1.1 {
 86               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_SINT16, 0);
 87           }
 88           
 89           MI_INLINE MI_Result Instance_SetUint32(
 90               MI_Instance* self, 
 91               const MI_Char* name, 
 92               MI_Uint32 x)
 93           {
 94               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_UINT32, 0);
 95           }
 96           
 97           MI_INLINE MI_Result Instance_SetSint32(
 98               MI_Instance* self, 
 99               const MI_Char* name, 
100               MI_Sint32 x)
101           {
102               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_SINT32, 0);
103           }
104           
105           MI_INLINE MI_Result Instance_SetUint64(
106 mike  1.1     MI_Instance* self, 
107               const MI_Char* name, 
108               MI_Uint64 x)
109           {
110               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_UINT64, 0);
111           }
112           
113           MI_INLINE MI_Result Instance_SetSint64(
114               MI_Instance* self, 
115               const MI_Char* name, 
116               MI_Sint64 x)
117           {
118               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_SINT64, 0);
119           }
120           
121           MI_INLINE MI_Result Instance_SetReal32(
122               MI_Instance* self, 
123               const MI_Char* name, 
124               MI_Real32 x)
125           {
126               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_REAL32, 0);
127 mike  1.1 }
128           
129           MI_INLINE MI_Result Instance_SetReal64(
130               MI_Instance* self, 
131               const MI_Char* name, 
132               MI_Real64 x)
133           {
134               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_REAL64, 0);
135           }
136           
137           MI_INLINE MI_Result Instance_SetChar16(
138               MI_Instance* self, 
139               const MI_Char* name, 
140               MI_Char16 x)
141           {
142               return MI_Instance_SetElement(self, name, (MI_Value*)&x, MI_CHAR16, 0);
143           }
144           
145           MI_INLINE MI_Result Instance_SetDatetime(
146               MI_Instance* self, 
147               const MI_Char* name, 
148 mike  1.1     const MI_Datetime* x)
149           {
150               return MI_Instance_SetElement(self, name, (MI_Value*)x, MI_DATETIME, 0);
151           }
152           
153           MI_INLINE MI_Result Instance_SetString(
154               MI_Instance* self, 
155               const MI_Char* name, 
156               const MI_Char* str)
157           {
158               MI_Value value;
159               value.string = (MI_Char*)str;
160               return MI_Instance_SetElement(self, name, &value, MI_STRING, 0);
161           }
162           
163           MI_INLINE MI_Result Instance_GetBoolean(
164               MI_Instance* self, 
165               const MI_Char* name, 
166               MI_Boolean* x)
167           {
168               return Instance_GetValue(self, name, x, MI_BOOLEAN);
169 mike  1.1 }
170           
171           MI_INLINE MI_Result Instance_GetUint8(
172               MI_Instance* self, 
173               const MI_Char* name, 
174               MI_Uint8* x)
175           {
176               return Instance_GetValue(self, name, x, MI_UINT8);
177           }
178           
179           MI_INLINE MI_Result Instance_GetSint8(
180               MI_Instance* self, 
181               const MI_Char* name, 
182               MI_Sint8* x)
183           {
184               return Instance_GetValue(self, name, x, MI_SINT8);
185           }
186           
187           MI_INLINE MI_Result Instance_GetUint16(
188               MI_Instance* self, 
189               const MI_Char* name, 
190 mike  1.1     MI_Uint16* x)
191           {
192               return Instance_GetValue(self, name, x, MI_UINT16);
193           }
194           
195           MI_INLINE MI_Result Instance_GetSint16(
196               MI_Instance* self, 
197               const MI_Char* name, 
198               MI_Sint16* x)
199           {
200               return Instance_GetValue(self, name, x, MI_SINT16);
201           }
202           
203           MI_INLINE MI_Result Instance_GetUint32(
204               MI_Instance* self, 
205               const MI_Char* name, 
206               MI_Uint32* x)
207           {
208               return Instance_GetValue(self, name, x, MI_UINT32);
209           }
210           
211 mike  1.1 MI_INLINE MI_Result Instance_GetSint32(
212               MI_Instance* self, 
213               const MI_Char* name, 
214               MI_Sint32* x)
215           {
216               return Instance_GetValue(self, name, x, MI_SINT32);
217           }
218           
219           MI_INLINE MI_Result Instance_GetUint64(
220               MI_Instance* self, 
221               const MI_Char* name, 
222               MI_Uint64* x)
223           {
224               return Instance_GetValue(self, name, x, MI_UINT64);
225           }
226           
227           MI_INLINE MI_Result Instance_GetSint64(
228               MI_Instance* self, 
229               const MI_Char* name, 
230               MI_Sint64* x)
231           {
232 mike  1.1     return Instance_GetValue(self, name, x, MI_SINT64);
233           }
234           
235           MI_INLINE MI_Result Instance_GetReal32(
236               MI_Instance* self, 
237               const MI_Char* name, 
238               MI_Real32* x)
239           {
240               return Instance_GetValue(self, name, x, MI_REAL32);
241           }
242           
243           MI_INLINE MI_Result Instance_GetReal64(
244               MI_Instance* self, 
245               const MI_Char* name, 
246               MI_Real64* x)
247           {
248               return Instance_GetValue(self, name, x, MI_REAL64);
249           }
250           
251           MI_INLINE MI_Result Instance_GetChar16(
252               MI_Instance* self, 
253 mike  1.1     const MI_Char* name, 
254               MI_Char16* x)
255           {
256               return Instance_GetValue(self, name, x, MI_CHAR16);
257           }
258           
259           MI_INLINE MI_Result Instance_GetDatetime(
260               MI_Instance* self, 
261               const MI_Char* name, 
262               MI_Datetime* x)
263           {
264               return Instance_GetValue(self, name, x, MI_DATETIME);
265           }
266           
267           MI_INLINE MI_Result Instance_GetString(
268               MI_Instance* self, 
269               const MI_Char* name, 
270               MI_String* x)
271           {
272               return Instance_GetValue(self, name, x, MI_STRING);
273           }
274 mike  1.1 
275           MI_INLINE MI_Result Instance_GetInstance(
276               MI_Instance* self, 
277               const MI_Char* name, 
278               MI_Instance** x)
279           {
280               return Instance_GetValue(self, name, x, MI_INSTANCE);
281           }
282           
283           MI_INLINE MI_Result Instance_GetReference(
284               MI_Instance* self, 
285               const MI_Char* name, 
286               MI_Instance** x)
287           {
288               return Instance_GetValue(self, name, x, MI_REFERENCE);
289           }
290           
291           int StrToChar16(const MI_Char* str, MI_Char16* x);
292           
293           int StrToDatetime(const MI_Char* s, MI_Datetime* x);
294           
295 mike  1.1 int StrToBoolean(const MI_Char* str, MI_Boolean* x);
296           
297           int StrToUint8(const MI_Char* str, MI_Uint8* x);
298           
299           int StrToSint8(const MI_Char* str, MI_Sint8* x);
300           
301           int StrToUint16(const MI_Char* str, MI_Uint16* x);
302           
303           int StrToSint16(const MI_Char* str, MI_Sint16* x);
304           
305           int StrToUint32(const MI_Char* str, MI_Uint32* x);
306           
307           int StrToSint32(const MI_Char* str, MI_Sint32* x);
308           
309           int StrToUint64(const MI_Char* str, MI_Uint64* x);
310           
311           int StrToSint64(const MI_Char* str, MI_Sint64* x);
312           
313           int StrToReal32(const MI_Char* str, MI_Real32* x);
314           
315           int StrToReal64(const MI_Char* str, MI_Real64* x);
316 mike  1.1 
317           void DatetimeToStr(const MI_Datetime* x, MI_Char buf[26]);
318           
319           int ParseWSManDatetime(const MI_Char* str, MI_Datetime* x);
320           
321           void FormatWSManDatetime(const MI_Datetime* x, MI_Char buffer[64]);
322           
323           END_EXTERNC
324           
325           #endif /* _base_helpers_h */

ViewCVS 0.9.2