12 #ifndef ECL_CONVERTERS_CONVERTERS_FROM_BYTE_ARRAY_HPP_ 13 #define ECL_CONVERTERS_CONVERTERS_FROM_BYTE_ARRAY_HPP_ 55 template<
typename Integral,
typename ByteArray>
56 class ECL_PUBLIC FromByteArray :
public ConverterBase
76 Integral operator()(
const ByteArray &byte_array)
86 StandardException(LOC,
ConversionError,
"The byte array is too long for the integral type specified."));
93 for (
unsigned int i = 0; i < byte_array.size(); ++i)
95 unsigned_value |=
static_cast<unsigned char>(byte_array[i]) << 8 * i;
99 Integral value =
static_cast<Integral
>(unsigned_value);
104 return unsigned_value;
110 virtual ~FromByteArray() {}
122 template<
typename Integral>
124 public converters::FromByteArray<Integral, std::vector<char> >
130 template<
typename Integral>
131 class ECL_PUBLIC Converter<Integral, std::vector<unsigned char> > :
public converters::FromByteArray<Integral,
132 std::vector<unsigned char> >
138 template<
typename Integral>
139 class ECL_PUBLIC Converter<Integral, std::vector<signed char> > :
public converters::FromByteArray<Integral,
140 std::vector<signed char> >
#define ecl_compile_time_assert(logical_expression)
Primary templates for the family of converter classes.
std::vector< unsigned char > ByteArray
Primary template and general fallback for converter classes.
#define ecl_compile_time_concept_check(Model)
#define ecl_debug_throw(exception)