PVData C++ 8.0.7
Loading...
Searching...
No Matches
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)
27typedef int intptr_t;
28typedef 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>
35typedef epicsUInt8 uint8_t;
36typedef epicsInt8 int8_t;
37typedef epicsUInt16 uint16_t;
38typedef epicsInt16 int16_t;
39typedef epicsUInt32 uint32_t;
40typedef epicsInt32 int32_t;
41typedef epicsUInt64 uint64_t;
42typedef epicsInt64 int64_t;
43#else
44#include <stdint.h>
45#endif
46
47#include <pv/sharedPtr.h>
48
50namespace epics {
52namespace pvData {
53
54namespace 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
69typedef detail::pick_type<int8_t, signed char,
70 detail::pick_type<uint8_t, char, unsigned char>::type
71 >::type boolean;
75typedef int8_t int8;
79typedef int16_t int16;
83typedef int32_t int32;
87typedef int64_t int64;
91typedef uint8_t uint8;
95typedef uint16_t uint16;
99typedef uint32_t uint32;
103typedef uint64_t uint64;
104
105// float and double are types
106
111typedef std::tr1::shared_ptr<StringArray> StringArrayPtr;
112inline std::string * get(StringArray &value)
113{
114 return &value[0];
115}
116inline std::string const * get(StringArray const &value)
117{
118 return static_cast<std::string const *>(&value[0]);
119}
120inline std::string * get(StringArrayPtr &value)
121{
122 return get(*value.get());
123}
124inline std::string const * get(StringArrayPtr const &value)
125{
126 return get(*value.get());
127}
128inline StringArray & getVector(StringArrayPtr &value)
129{
130 return *value.get();
131}
132inline StringArray const & getVector(StringArrayPtr const &value)
133{
134 return *value.get();
135}
136typedef std::vector<std::string>::iterator StringArray_iterator;
137typedef 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 */
constexpr const _Tp && get(const pair< _Tp, _Up > &&__p) noexcept
uint32_t uint32
Definition pvType.h:99
int32_t int32
Definition pvType.h:83
std::vector< std::string > StringArray
Definition pvType.h:110
int16_t int16
Definition pvType.h:79
uint64_t uint64
Definition pvType.h:103
detail::pick_type< int8_t, signedchar, detail::pick_type< uint8_t, char, unsignedchar >::type >::type boolean
Definition pvType.h:71
int8_t int8
Definition pvType.h:75
int64_t int64
Definition pvType.h:87
uint16_t uint16
Definition pvType.h:95
uint8_t uint8
Definition pvType.h:91
epics
Definition convert.h:21