1#ifndef NGEN_BMI_PRIMITIVE_TYPE_HPP
2#define NGEN_BMI_PRIMITIVE_TYPE_HPP
28 :
std::runtime_error(
"No C++ type corresponds to the BMI type name '" +
std::string(
type_name) +
"'")
104 template <
typename T>
107 if constexpr (std::is_same_v<T, long double>) {
109 }
else if constexpr (std::is_same_v<T, double>) {
111 }
else if constexpr (std::is_same_v<T, float>) {
114 static_assert(std::is_integral_v<T> && !std::is_same_v<T, bool>,
"No primitive_type for this type");
115 static_assert(
sizeof(T) == 1 ||
sizeof(T) == 2 ||
sizeof(T) == 4 ||
sizeof(T) == 8,
116 "No primitive_type of this integer's width");
117 constexpr bool is_signed = std::is_signed_v<T>;
171 template <
typename F>
191 return f.template operator()<
long double>();
213 if (type ==
"double" || type ==
"double precision")
215 if (type ==
"long double")
217 if (type ==
"float" || type ==
"real")
220 if (type ==
"int8" || type ==
"int8_t")
222 if (type ==
"uint8" || type ==
"uint8_t")
224 if (type ==
"int16" || type ==
"int16_t")
226 if (type ==
"uint16" || type ==
"uint16_t")
228 if (type ==
"int32" || type ==
"int32_t")
230 if (type ==
"uint32" || type ==
"uint32_t")
232 if (type ==
"int64" || type ==
"int64_t")
234 if (type ==
"uint64" || type ==
"uint64_t")
237 if (type ==
"short" || type ==
"short int" || type ==
"signed short" || type ==
"signed short int")
239 if (type ==
"unsigned short" || type ==
"unsigned short int")
241 if (type ==
"int" || type ==
"signed" || type ==
"signed int" || type ==
"integer")
243 if (type ==
"unsigned" || type ==
"unsigned int")
245 if (type ==
"long" || type ==
"long int" || type ==
"signed long" || type ==
"signed long int")
247 if (type ==
"unsigned long" || type ==
"unsigned long int")
249 if (type ==
"long long" || type ==
"long long int" || type ==
"signed long long" || type ==
"signed long long int")
251 if (type ==
"unsigned long long" || type ==
"unsigned long long int")
Definition deserialization.hpp:40
constexpr const char * to_string(primitive_type type)
The enumerator's name, e.g.
Definition bmi_primitive_type.hpp:65
auto with_primitive_type(primitive_type type, F &&f)
Call f with the C++ type that type denotes.
Definition bmi_primitive_type.hpp:172
primitive_type
The type of one item of a BMI variable, independent of how any language spells it.
Definition bmi_primitive_type.hpp:50
constexpr primitive_type primitive_type_of()
The primitive_type of the C++ arithmetic type.
Definition bmi_primitive_type.hpp:105
constexpr bool long_double_is_float128
Whether long double is IEEE binary128, the one format with a 113-bit significand.
Definition bmi_primitive_type.hpp:62
primitive_type parse_bmi_type(std::string_view type)
The primitive_type a BMI type name denotes.
Definition bmi_primitive_type.hpp:211
constexpr size_t size_of(primitive_type type)
The size in bytes of one item of type.
Definition bmi_primitive_type.hpp:85
Definition AbstractCLibBmiAdapter.hpp:6
Thrown when a BMI type name has no C++ type behind it.
Definition bmi_primitive_type.hpp:26
std::string type_name
Definition bmi_primitive_type.hpp:31
unknown_bmi_type(std::string_view type_name)
Definition bmi_primitive_type.hpp:27
Thrown when a primitive_type has no C++ type on this platform.
Definition bmi_primitive_type.hpp:126
unsupported_primitive_type(primitive_type type)
Definition bmi_primitive_type.hpp:127
primitive_type type
Definition bmi_primitive_type.hpp:132