PVData C++  8.0.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
pvType.h
1 /* pvType.h */
2 /*
3  * Copyright information and license terms for this software can be
4  * found in the file LICENSE that is included with the distribution
5  */
10 /* Definitions for the primitive types for pvData.
11  * It also defines the arrays of the primitive types
12  */
13 
14 #ifndef PVTYPE_H
15 #define PVTYPE_H
16 
17 #if defined(_WIN32) && !defined(_MINGW)
18 #pragma warning( push )
19 #pragma warning(disable: 4251)
20 #endif
21 
22 #include <string>
23 #include <vector>
24 
25 #if defined(vxWorks) && \
26  (_WRS_VXWORKS_MAJOR+0 <= 6) && (_WRS_VXWORKS_MINOR+0 < 9)
27 typedef int intptr_t;
28 typedef unsigned int uintptr_t;
29 #ifndef INT64_MAX
30 #define INT64_MAX (0x7fffffffffffffffLL)
31 #define UINT64_MAX (0xffffffffffffffffULL)
32 #endif
33 #elif _MSC_VER==1500
34 #include <epicsTypes.h>
35 typedef epicsUInt8 uint8_t;
36 typedef epicsInt8 int8_t;
37 typedef epicsUInt16 uint16_t;
38 typedef epicsInt16 int16_t;
39 typedef epicsUInt32 uint32_t;
40 typedef epicsInt32 int32_t;
41 typedef epicsUInt64 uint64_t;
42 typedef epicsInt64 int64_t;
43 #else
44 #include <stdint.h>
45 #endif
46 
47 #include <pv/sharedPtr.h>
48 
50 namespace epics {
52 namespace pvData {
53 
54 namespace detail {
55  // Pick either type If or type Else to not be Cond
56  template<typename Cond, typename If, typename Else>
57  struct pick_type { typedef If type; };
58  template<typename Cond, typename Else>
59  struct pick_type<Cond,Cond,Else> { typedef Else type; };
60 }
61 
69 typedef detail::pick_type<int8_t, signed char,
70  detail::pick_type<uint8_t, char, unsigned char>::type
71  >::type boolean;
75 typedef int8_t int8;
79 typedef int16_t int16;
83 typedef int32_t int32;
87 typedef int64_t int64;
91 typedef uint8_t uint8;
95 typedef uint16_t uint16;
99 typedef uint32_t uint32;
103 typedef uint64_t uint64;
104 
105 // float and double are types
106 
111 typedef std::tr1::shared_ptr<StringArray> StringArrayPtr;
112 inline std::string * get(StringArray &value)
113 {
114  return &value[0];
115 }
116 inline std::string const * get(StringArray const &value)
117 {
118  return static_cast<std::string const *>(&value[0]);
119 }
120 inline std::string * get(StringArrayPtr &value)
121 {
122  return get(*value.get());
123 }
124 inline std::string const * get(StringArrayPtr const &value)
125 {
126  return get(*value.get());
127 }
128 inline StringArray & getVector(StringArrayPtr &value)
129 {
130  return *value.get();
131 }
132 inline StringArray const & getVector(StringArrayPtr const &value)
133 {
134  return *value.get();
135 }
136 typedef std::vector<std::string>::iterator StringArray_iterator;
137 typedef std::vector<std::string>::const_iterator StringArray_const_iterator;
138 
139 }}
140 
141 #if defined(_WIN32) && !defined(_MINGW)
142 #pragma warning( pop )
143 #endif
144 
145 #endif /* PVTYPE_H */
uint32_t uint32
Definition: pvType.h:99
std::vector< std::string > StringArray
Definition: pvType.h:110
uint8_t uint8
Definition: pvType.h:91
int16_t int16
Definition: pvType.h:79
detail::pick_type< int8_t, signed char, detail::pick_type< uint8_t, char, unsigned char >::type >::type boolean
Definition: pvType.h:71
int64_t int64
Definition: pvType.h:87
int32_t int32
Definition: pvType.h:83
uint16_t uint16
Definition: pvType.h:95
int8_t int8
Definition: pvType.h:75
uint64_t uint64
Definition: pvType.h:103