12 #include <epicsConvert.h>
15 #include <pv/pvType.h>
16 #include <pv/pvIntrospect.h>
17 #include <pv/templateMeta.h>
20 namespace epics {
namespace pvData {
25 epicsShareExtern
void parseToPOD(
const char*,
boolean *out);
26 epicsShareExtern
void parseToPOD(
const char*,
int8 *out);
27 epicsShareExtern
void parseToPOD(
const char*,
uint8 *out);
28 epicsShareExtern
void parseToPOD(
const char*, int16_t *out);
29 epicsShareExtern
void parseToPOD(
const char*, uint16_t *out);
30 epicsShareExtern
void parseToPOD(
const char*, int32_t *out);
31 epicsShareExtern
void parseToPOD(
const char*, uint32_t *out);
32 epicsShareExtern
void parseToPOD(
const char*, int64_t *out);
33 epicsShareExtern
void parseToPOD(
const char*, uint64_t *out);
34 epicsShareExtern
void parseToPOD(
const char*,
float *out);
35 epicsShareExtern
void parseToPOD(
const char*,
double *out);
37 static inline void parseToPOD(
const std::string& str,
boolean *out) {
return parseToPOD(str.
c_str(), out); }
38 static inline void parseToPOD(
const std::string& str,
int8 *out) {
return parseToPOD(str.
c_str(), out); }
39 static inline void parseToPOD(
const std::string& str,
uint8 *out) {
return parseToPOD(str.
c_str(), out); }
40 static inline void parseToPOD(
const std::string& str, int16_t *out) {
return parseToPOD(str.
c_str(), out); }
41 static inline void parseToPOD(
const std::string& str, uint16_t *out) {
return parseToPOD(str.
c_str(), out); }
42 static inline void parseToPOD(
const std::string& str, int32_t *out) {
return parseToPOD(str.
c_str(), out); }
43 static inline void parseToPOD(
const std::string& str, uint32_t *out) {
return parseToPOD(str.
c_str(), out); }
44 static inline void parseToPOD(
const std::string& str, int64_t *out) {
return parseToPOD(str.
c_str(), out); }
45 static inline void parseToPOD(
const std::string& str, uint64_t *out) {
return parseToPOD(str.
c_str(), out); }
46 static inline void parseToPOD(
const std::string& str,
float *out) {
return parseToPOD(str.
c_str(), out); }
47 static inline void parseToPOD(
const std::string& str,
double *out) {
return parseToPOD(str.
c_str(), out); }
52 template<
typename ARG>
61 static FORCE_INLINE return_t op(
const T& i) {
return i; }
67 typedef signed int return_t;
68 static FORCE_INLINE return_t op(
int8 i) {
return i; }
72 typedef unsigned int return_t;
73 static FORCE_INLINE return_t op(
uint8 i) {
return i; }
78 typedef const char* return_t;
79 static FORCE_INLINE return_t op(
boolean i) {
return i ?
"true" :
"false"; }
84 template<
typename TO,
typename FROM,
class Enable =
void>
86 static FORCE_INLINE TO op(FROM from) {
87 return static_cast<TO
>(from);
94 static FORCE_INLINE
float op(
double from) {
95 return epicsConvertDoubleToFloat(from);
101 template<
typename FROM>
105 strm << print_convolute<FROM>::op(from);
114 template<
typename TO>
116 static FORCE_INLINE TO op(
const std::string& from) {
118 parseToPOD(from, &ret);
125 template<
typename TO>
131 static FORCE_INLINE TO op(
const char* from) {
133 parseToPOD(from, &ret);
194 template<
typename TO,
typename FROM>
195 static FORCE_INLINE TO castUnsafe(
const FROM& from)
208 typename detail::print_convolute<T>::return_t
209 print_cast(
const T& v) {
return detail::print_convolute<T>::op(v); }
250 #endif // PVTYPECAST_H
basic_ostream< _CharT, _Traits > & operator<<(basic_ostream< _CharT, _Traits > &__os, const basic_string< _CharT, _Traits, _Alloc > &__str)
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::bernoulli_distribution &__x)
__string_type str() const
basic_string< char > string
constexpr iterator_traits< _InputIterator >::difference_type count(_InputIterator __first, _InputIterator __last, const _Tp &__value)
detail::pick_type< int8_t, signed char, detail::pick_type< uint8_t, char, unsigned char >::type >::type boolean
escape & style(style_t s)
Change escaping style.
const _CharT * c_str() const noexcept