This is Unofficial EPICS BASE Doxygen Site
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 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
9 
10 /*
11  * Author: Jeff Hill
12  * Date: 5-95
13  */
14 
15 #ifndef INC_epicsTypes_H
16 #define INC_epicsTypes_H
17 
18 #include "libComAPI.h"
19 #include "compilerDependencies.h"
20 
21 #ifndef stringOf
22 # if defined (__STDC__ ) || defined (__cplusplus)
23 # define stringOf(TOKEN) #TOKEN
24 # else
25 # define stringOf(TOKEN) "TOKEN"
26 # endif
27 #endif
28 
29 typedef enum {
33 
34 /*
35  * Architecture Independent Data Types
36  * These are sufficient for all our current archs
37  */
38 typedef char epicsInt8;
39 typedef unsigned char epicsUInt8;
40 typedef short epicsInt16;
41 typedef unsigned short epicsUInt16;
42 typedef int epicsInt32;
43 typedef unsigned int epicsUInt32;
44 typedef long long epicsInt64;
45 typedef unsigned long long epicsUInt64;
46 
48 typedef float epicsFloat32;
49 typedef double epicsFloat64;
51 
52 
53 typedef struct {
54  unsigned length;
55  char *pString;
56 } epicsString;
57 
58 /*
59  * !! Dont use this - it may vanish in the future !!
60  *
61  * Provided only for backwards compatibility with
62  * db_access.h
63  *
64  */
65 #define MAX_STRING_SIZE 40
67 
68 /*
69  * union of all types
70  *
71  * Strings included here as pointers only so that we support
72  * large string types.
73  *
74  * Arrays included here as pointers because large arrays will
75  * not fit in this union.
76  */
77 typedef union epics_any {
90 } epicsAny;
91 
92 /*
93  * Corresponding Type Codes
94  * (this enum must start at zero)
95  *
96  * !! Update epicsTypeToDBR_XXXX[] and DBR_XXXXToEpicsType
97  * in db_access.h if you edit this enum !!
98  */
99 typedef enum {
111 } epicsType;
112 #define firstEpicsType epicsInt8T
113 #define lastEpicsType epicsOldStringT
114 #define validEpicsType(x) ((x>=firstEpicsType) && (x<=lastEpicsType))
115 #define invalidEpicsType(x) ((x<firstEpicsType) || (x>lastEpicsType))
116 
117 
118 /*
119  * The enumeration "epicsType" is an index to this array
120  * of type name strings.
121  */
122 #ifdef epicsTypesGLOBAL
123 const char *epicsTypeNames [lastEpicsType+1] = {
124  "epicsInt8",
125  "epicsUInt8",
126  "epicsInt16",
127  "epicsUInt16",
128  "epicsEnum16",
129  "epicsInt32",
130  "epicsUInt32",
131  "epicsFloat32",
132  "epicsFloat64",
133  "epicsString",
134  "epicsOldString",
135 };
136 #else /* epicsTypesGLOBAL */
137 LIBCOM_API extern const char *epicsTypeNames [lastEpicsType+1];
138 #endif /* epicsTypesGLOBAL */
139 
140 /*
141  * The enumeration "epicsType" is an index to this array
142  * of type code name strings.
143  */
144 #ifdef epicsTypesGLOBAL
145 const char *epicsTypeCodeNames [lastEpicsType+1] = {
146  "epicsInt8T",
147  "epicsUInt8T",
148  "epicsInt16T",
149  "epicsUInt16T",
150  "epicsEnum16T",
151  "epicsInt32T",
152  "epicsUInt32T",
153  "epicsFloat32T",
154  "epicsFloat64T",
155  "epicsStringT",
156  "epicsOldStringT",
157 };
158 #else /* epicsTypesGLOBAL */
159 LIBCOM_API extern const char *epicsTypeCodeNames [lastEpicsType+1];
160 #endif /* epicsTypesGLOBAL */
161 
162 #ifdef epicsTypesGLOBAL
163 const unsigned epicsTypeSizes [lastEpicsType+1] = {
164  sizeof (epicsInt8),
165  sizeof (epicsUInt8),
166  sizeof (epicsInt16),
167  sizeof (epicsUInt16),
168  sizeof (epicsEnum16),
169  sizeof (epicsInt32),
170  sizeof (epicsUInt32),
171  sizeof (epicsFloat32),
172  sizeof (epicsFloat64),
173  sizeof (epicsString),
174  sizeof (epicsOldString),
175 };
176 #else /* epicsTypesGLOBAL */
177 LIBCOM_API extern const unsigned epicsTypeSizes [lastEpicsType+1];
178 #endif /* epicsTypesGLOBAL */
179 
180 /*
181  * The enumeration "epicsType" is an index to this array
182  * of type class identifiers.
183  */
184 typedef enum {
192 
193 #ifdef epicsTypesGLOBAL
195  epicsIntC,
196  epicsUIntC,
197  epicsIntC,
198  epicsUIntC,
199  epicsEnumC,
200  epicsIntC,
201  epicsUIntC,
202  epicsFloatC,
203  epicsFloatC,
204  epicsStringC,
206 };
207 #else /* epicsTypesGLOBAL */
208 LIBCOM_API extern const epicsTypeClass epicsTypeClasses [lastEpicsType+1];
209 #endif /* epicsTypesGLOBAL */
210 
211 
212 #ifdef epicsTypesGLOBAL
213 const char *epicsTypeAnyFieldName [lastEpicsType+1] = {
214  "int8",
215  "uInt8",
216  "int16",
217  "uInt16",
218  "enum16",
219  "int32",
220  "uInt32",
221  "float32",
222  "float64",
223  "string",
224  "", /* Old Style Strings will not be in epicsAny type */
225 };
226 #else /* epicsTypesGLOBAL */
227 LIBCOM_API extern const char *epicsTypeAnyFieldName [lastEpicsType+1];
228 #endif /* epicsTypesGLOBAL */
229 
230 #endif /* INC_epicsTypes_H */
231 
LIBCOM_API const unsigned epicsTypeSizes[lastEpicsType+1]
unsigned length
Definition: epicsTypes.h:54
epicsUInt8 uInt8
Definition: epicsTypes.h:79
char epicsOldString[MAX_STRING_SIZE]
Definition: epicsTypes.h:66
double epicsFloat64
Definition: epicsTypes.h:49
epicsUInt32 uInt32
Definition: epicsTypes.h:84
epicsInt64 int64
Definition: epicsTypes.h:85
unsigned short epicsUInt16
Definition: epicsTypes.h:41
epicsFloat64 float64
Definition: epicsTypes.h:88
epicsInt32 int32
Definition: epicsTypes.h:83
unsigned char epicsUInt8
Definition: epicsTypes.h:39
unsigned int epicsUInt32
Definition: epicsTypes.h:43
char * pString
Definition: epicsTypes.h:55
unsigned long long epicsUInt64
Definition: epicsTypes.h:45
LIBCOM_API const char * epicsTypeAnyFieldName[lastEpicsType+1]
epicsInt16 int16
Definition: epicsTypes.h:80
float epicsFloat32
Definition: epicsTypes.h:48
epicsEnum16 enum16
Definition: epicsTypes.h:82
epicsString string
Definition: epicsTypes.h:89
char epicsInt8
Definition: epicsTypes.h:38
epicsUInt16 epicsEnum16
Definition: epicsTypes.h:47
epicsUInt16 uInt16
Definition: epicsTypes.h:81
epicsType
Definition: epicsTypes.h:99
#define MAX_STRING_SIZE
Definition: epicsTypes.h:65
union epics_any epicsAny
epicsInt8 int8
Definition: epicsTypes.h:78
epicsUInt64 uInt64
Definition: epicsTypes.h:86
LIBCOM_API const char * epicsTypeCodeNames[lastEpicsType+1]
LIBCOM_API const char * epicsTypeNames[lastEpicsType+1]
epicsTypeClass
Definition: epicsTypes.h:184
struct rset rset EPICS_DEPRECATED
Definition: recSup.h:88
short epicsInt16
Definition: epicsTypes.h:40
Compiler specific declarations.
epicsFloat32 float32
Definition: epicsTypes.h:87
epicsBoolean
Definition: epicsTypes.h:29
epicsInt32 epicsStatus
Definition: epicsTypes.h:50
LIBCOM_API const epicsTypeClass epicsTypeClasses[lastEpicsType+1]
#define lastEpicsType
Definition: epicsTypes.h:113
int epicsInt32
Definition: epicsTypes.h:42
long long epicsInt64
Definition: epicsTypes.h:44