EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
epicsTypes.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * SPDX-License-Identifier: EPICS
7 * EPICS BASE is distributed subject to a Software License Agreement found
8 * in file LICENSE that is included with this distribution.
9 \*************************************************************************/
10 
18 #ifndef INC_epicsTypes_H
19 #define INC_epicsTypes_H
20 
21 #include "libComAPI.h"
22 #include "compilerDependencies.h"
23 
24 #ifndef stringOf
25 # if defined (__STDC__ ) || defined (__cplusplus)
26 # define stringOf(TOKEN) #TOKEN
27 # else
28 # define stringOf(TOKEN) "TOKEN"
29 # endif
30 #endif
31 
32 typedef enum {
33  epicsFalse = 0,
34  epicsTrue = 1
35 } epicsBoolean EPICS_DEPRECATED;
36 
44 typedef char epicsInt8;
45 typedef unsigned char epicsUInt8;
46 typedef short epicsInt16;
47 typedef unsigned short epicsUInt16;
48 typedef int epicsInt32;
49 typedef unsigned int epicsUInt32;
50 typedef long long epicsInt64;
51 typedef unsigned long long epicsUInt64;
52 
53 typedef epicsUInt16 epicsEnum16;
54 typedef float epicsFloat32;
55 typedef double epicsFloat64;
56 typedef epicsInt32 epicsStatus;
59 #define MAX_STRING_SIZE 40
60 
64 typedef struct {
65  unsigned length;
66  char *pString;
67 } epicsString;
68 
75 typedef char epicsOldString[MAX_STRING_SIZE];
76 
86 typedef union epics_any {
87  epicsInt8 int8;
88  epicsUInt8 uInt8;
89  epicsInt16 int16;
90  epicsUInt16 uInt16;
91  epicsEnum16 enum16;
92  epicsInt32 int32;
93  epicsUInt32 uInt32;
94  epicsInt64 int64;
95  epicsUInt64 uInt64;
96  epicsFloat32 float32;
97  epicsFloat64 float64;
98  epicsString string;
99 } epicsAny;
100 
108 typedef enum {
109  epicsInt8T,
110  epicsUInt8T,
111  epicsInt16T,
112  epicsUInt16T,
113  epicsEnum16T,
114  epicsInt32T,
115  epicsUInt32T,
116  epicsFloat32T,
117  epicsFloat64T,
118  epicsStringT,
119  epicsOldStringT
120 } epicsType;
121 #define firstEpicsType epicsInt8T
122 #define lastEpicsType epicsOldStringT
123 #define validEpicsType(x) ((x>=firstEpicsType) && (x<=lastEpicsType))
124 #define invalidEpicsType(x) ((x<firstEpicsType) || (x>lastEpicsType))
125 
126 
132 #ifdef epicsTypesGLOBAL
133 const char *epicsTypeNames [lastEpicsType+1] = {
134  "epicsInt8",
135  "epicsUInt8",
136  "epicsInt16",
137  "epicsUInt16",
138  "epicsEnum16",
139  "epicsInt32",
140  "epicsUInt32",
141  "epicsFloat32",
142  "epicsFloat64",
143  "epicsString",
144  "epicsOldString",
145 };
146 #else /* epicsTypesGLOBAL */
147 LIBCOM_API extern const char *epicsTypeNames [lastEpicsType+1];
148 #endif /* epicsTypesGLOBAL */
149 
155 #ifdef epicsTypesGLOBAL
156 const char *epicsTypeCodeNames [lastEpicsType+1] = {
157  "epicsInt8T",
158  "epicsUInt8T",
159  "epicsInt16T",
160  "epicsUInt16T",
161  "epicsEnum16T",
162  "epicsInt32T",
163  "epicsUInt32T",
164  "epicsFloat32T",
165  "epicsFloat64T",
166  "epicsStringT",
167  "epicsOldStringT",
168 };
169 #else /* epicsTypesGLOBAL */
170 LIBCOM_API extern const char *epicsTypeCodeNames [lastEpicsType+1];
171 #endif /* epicsTypesGLOBAL */
172 
178 #ifdef epicsTypesGLOBAL
179 const unsigned epicsTypeSizes [lastEpicsType+1] = {
180  sizeof (epicsInt8),
181  sizeof (epicsUInt8),
182  sizeof (epicsInt16),
183  sizeof (epicsUInt16),
184  sizeof (epicsEnum16),
185  sizeof (epicsInt32),
186  sizeof (epicsUInt32),
187  sizeof (epicsFloat32),
188  sizeof (epicsFloat64),
189  sizeof (epicsString),
190  sizeof (epicsOldString),
191 };
192 #else /* epicsTypesGLOBAL */
193 LIBCOM_API extern const unsigned epicsTypeSizes [lastEpicsType+1];
194 #endif /* epicsTypesGLOBAL */
195 
196 typedef enum {
197  epicsIntC,
198  epicsUIntC,
199  epicsEnumC,
200  epicsFloatC,
201  epicsStringC,
202  epicsOldStringC
203 } epicsTypeClass;
204 
210 #ifdef epicsTypesGLOBAL
211 const epicsTypeClass epicsTypeClasses [lastEpicsType+1] = {
212  epicsIntC,
213  epicsUIntC,
214  epicsIntC,
215  epicsUIntC,
216  epicsEnumC,
217  epicsIntC,
218  epicsUIntC,
219  epicsFloatC,
220  epicsFloatC,
221  epicsStringC,
222  epicsOldStringC
223 };
224 #else /* epicsTypesGLOBAL */
225 LIBCOM_API extern const epicsTypeClass epicsTypeClasses [lastEpicsType+1];
226 #endif /* epicsTypesGLOBAL */
227 
233 #ifdef epicsTypesGLOBAL
234 const char *epicsTypeAnyFieldName [lastEpicsType+1] = {
235  "int8",
236  "uInt8",
237  "int16",
238  "uInt16",
239  "enum16",
240  "int32",
241  "uInt32",
242  "float32",
243  "float64",
244  "string",
245  "", /* Old Style Strings will not be in epicsAny type */
246 };
247 #else /* epicsTypesGLOBAL */
248 LIBCOM_API extern const char *epicsTypeAnyFieldName [lastEpicsType+1];
249 #endif /* epicsTypesGLOBAL */
250 
251 #endif /* INC_epicsTypes_H */
252 
Compiler specific declarations.
LIBCOM_API const char * epicsTypeNames[lastEpicsType+1]
An array providing the names for each type The enumeration epicsType is an index to this array of typ...
LIBCOM_API const char * epicsTypeAnyFieldName[lastEpicsType+1]
An array providing the field name for each type The enumeration epicsType is an index to this array o...
LIBCOM_API const epicsTypeClass epicsTypeClasses[lastEpicsType+1]
An array providing the class of each type The enumeration epicsType is an index to this array of type...
LIBCOM_API const char * epicsTypeCodeNames[lastEpicsType+1]
An array providing the names for each type code The enumeration epicsType is an index to this array o...
LIBCOM_API const unsigned epicsTypeSizes[lastEpicsType+1]
An array providing the sizes for each type The enumeration epicsType is an index to this array of typ...
Union of all types.
Definition: epicsTypes.h:86
epicsType
Corresponding Type Codes (this enum must start at zero)
Definition: epicsTypes.h:108
!! Don&#39;t use this - it may vanish in the future !!
Definition: epicsTypes.h:64
char epicsOldString[MAX_STRING_SIZE]
!! Don&#39;t use this - it may vanish in the future !!
Definition: epicsTypes.h:75