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 _micxx_types_h
26 #define _micxx_types_h
27
28 #include <MI.h>
29 #include "linkage.h"
30 #include "array.h"
31 #include "string.h"
32 #include "datetime.h"
33
34 MI_BEGIN_NAMESPACE
35
36 // character type.
37 typedef MI_Char Char;
38
39 // simple types
40 typedef MI_Boolean Boolean;
41 typedef MI_Uint8 Uint8;
42 typedef MI_Sint8 Sint8;
43 mike 1.1 typedef MI_Uint16 Uint16;
44 typedef MI_Sint16 Sint16;
45 typedef MI_Uint32 Uint32;
46 typedef MI_Sint32 Sint32;
47 typedef MI_Uint64 Uint64;
48 typedef MI_Sint64 Sint64;
49 typedef MI_Real32 Real32;
50 typedef MI_Real64 Real64;
51 typedef MI_Char16 Char16;
52
53 typedef MI_Type Type;
54
55 // Convert from MI_Boolean to bool.
56 inline bool __bool(MI_Boolean x)
57 {
58 return x ? true : false;
59 }
60
61 MICXX_LINKAGE extern const ArrayTraits* __traits[16];
62
63 template<>
64 mike 1.1 inline const ArrayTraits* GetArrayTraits<Uint8>()
65 {
66 return __traits[MI_UINT8];
67 };
68
69 template<>
70 inline const ArrayTraits* GetArrayTraits<Sint8>()
71 {
72 return __traits[MI_SINT8];
73 };
74
75 template<>
76 inline const ArrayTraits* GetArrayTraits<Uint16>()
77 {
78 return __traits[MI_UINT16];
79 };
80
81 template<>
82 inline const ArrayTraits* GetArrayTraits<Sint16>()
83 {
84 return __traits[MI_SINT16];
85 mike 1.1 };
86
87 template<>
88 inline const ArrayTraits* GetArrayTraits<Uint32>()
89 {
90 return __traits[MI_UINT32];
91 };
92
93 template<>
94 inline const ArrayTraits* GetArrayTraits<Sint32>()
95 {
96 return __traits[MI_SINT32];
97 };
98
99 template<>
100 inline const ArrayTraits* GetArrayTraits<Uint64>()
101 {
102 return __traits[MI_UINT64];
103 };
104
105 template<>
106 mike 1.1 inline const ArrayTraits* GetArrayTraits<Sint64>()
107 {
108 return __traits[MI_SINT64];
109 };
110
111 template<>
112 inline const ArrayTraits* GetArrayTraits<Real32>()
113 {
114 return __traits[MI_REAL32];
115 };
116
117 template<>
118 inline const ArrayTraits* GetArrayTraits<Real64>()
119 {
120 return __traits[MI_REAL64];
121 };
122
123 template<>
124 inline const ArrayTraits* GetArrayTraits<Datetime>()
125 {
126 return __traits[MI_DATETIME];
127 mike 1.1 };
128
129 template<>
130 inline const ArrayTraits* GetArrayTraits<String>()
131 {
132 return __traits[MI_STRING];
133 };
134
135 // Array types
136 typedef Array<Boolean> BooleanA;
137 typedef Array<Uint8> Uint8A;
138 typedef Array<Sint8> Sint8A;
139 typedef Array<Uint16> Uint16A;
140 typedef Array<Sint16> Sint16A;
141 typedef Array<Uint32> Uint32A;
142 typedef Array<Sint32> Sint32A;
143 typedef Array<Uint64> Uint64A;
144 typedef Array<Sint64> Sint64A;
145 typedef Array<Real32> Real32A;
146 typedef Array<Real64> Real64A;
147 typedef Array<Datetime> DatetimeA;
148 mike 1.1 typedef Array<String> StringA;
149 typedef Array<Char16> Char16A;
150
151 typedef MI_Result Result;
152
153 MI_END_NAMESPACE
154
155 #endif /* _micxx_types_h */
|