11 #ifndef odc_core_codec_IntegerMissing_H
12 #define odc_core_codec_IntegerMissing_H
21 template <
typename ByteOrder,
23 typename InternalValueType,
41 unsigned char*
encode(
unsigned char* p,
const double&
d)
override {
42 static_assert(
sizeof(ValueType) ==
sizeof(
d),
"unsafe casting check");
44 const ValueType&
val(
reinterpret_cast<const ValueType&
>(
d));
47 s = DerivedCodec::missingMarker;
50 ASSERT(s != DerivedCodec::missingMarker);
53 ::memcpy(p, &s,
sizeof(s));
58 static_assert(
sizeof(ValueType) ==
sizeof(out),
"unsafe casting check");
60 ValueType* val_out =
reinterpret_cast<ValueType*
>(out);
63 (*val_out) = (s == DerivedCodec::missingMarker ? this->
missingValue_ : (s + this->
min_));
67 this->
ds().advance(
sizeof(InternalValueType));
74 template <
typename ByteOrder,
typename ValueType>
76 constexpr
static const char*
codec_name() {
return "int8_missing"; }
83 template<
typename ByteOrder,
typename ValueType>
85 constexpr
static const char*
codec_name() {
return "int16_missing"; }
93 template <
typename ByteOrder,
typename ValueType>
96 static_assert(
sizeof(ValueType) ==
sizeof(
double),
"unsafe casting check");
98 constexpr
static const char*
codec_name() {
return "constant_or_missing"; }
106 s << this->
name_ <<
", value=";
111 s << std::fixed << this->
min_;
122 template <
typename ByteOrder>
127 constexpr
static const char*
codec_name() {
return "real_constant_or_missing"; }
static double integerMDI()
static std::string codec_name_str()
void decode(double *out) override
unsigned char * encode(unsigned char *p, const double &d) override
BaseCodecMissing(api::ColumnType type, const std::string &name=codec_name_str(), double minmaxmissing=odc::MDI::integerMDI())
constexpr static const char * codec_name()
CodecRealConstantOrMissing(api::ColumnType type)
~CodecRealConstantOrMissing() override
const std::string & name() const
DataStream< ByteOrder > & ds()
constexpr static const char * codec_name()
constexpr static uint8_t missingMarker
void print(std::ostream &s) const
constexpr static uint16_t missingMarker
constexpr static const char * codec_name()
constexpr static uint8_t missingMarker
constexpr static const char * codec_name()