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_types_h
26 #define _omi_types_h
27
28 #include "config.h"
29 #include <common.h>
30
31 BEGIN_EXTERNC
32
33 extern const char* __typeNames[32];
34 extern MI_Uint8 __typeSizes[32];
35
36 INLINE const char* Type_NameOf(MI_Type type)
37 {
38 MI_Uint32 i = (MI_Uint32)type;
39 DEBUG_ASSERT(i < 32);
40 return __typeNames[i];
41 }
42
43 mike 1.1 INLINE size_t Type_SizeOf(MI_Type type)
44 {
45 MI_Uint32 i = (MI_Uint32)type;
46 DEBUG_ASSERT(i < 32);
47 return (size_t)__typeSizes[i];
48 }
49
50 INLINE MI_Type Type_ScalarOf(MI_Type type)
51 {
52 return (MI_Type)((MI_Uint32)type & ~MI_ARRAY_BIT);
53 }
54
55 END_EXTERNC
56
57 #endif /* _omi_types_h */
|