11 #ifndef odc_core_Column_H
12 #define odc_core_Column_H
18 #include "eckit/sql/SQLTypedefs.h"
19 #include "eckit/os/BackTrace.h"
21 namespace eckit {
class DataHandle; }
44 bool equals(
const Column& other,
bool compareDataSizes=
true)
const;
61 template <
typename ByteOrder>
void resetCodec();
88 virtual void print(std::ostream& s)
const;
91 const std::string __repr__()
98 const std::string __str__() {
return name_; }
102 { p.
print(s);
return s; }
119 template <
typename ByteOrder>
129 static_assert(std::is_same<std::remove_reference<decltype(names)>::type::value_type, std::string>::value,
"Format sanity check");
130 static_assert(std::is_same<std::remove_reference<decltype(sizes)>::type::value_type, int32_t>::value,
"Format sanity check");
137 ASSERT(names.size() == sizes.size());
143 template <
typename ByteOrder>
153 static_assert(std::is_same<std::remove_reference<decltype(names)>::type::value_type, std::string>::value,
"Format sanity check");
154 static_assert(std::is_same<std::remove_reference<decltype(sizes)>::type::value_type, int32_t>::value,
"Format sanity check");
155 ASSERT(names.size() == sizes.size());
167 template <
typename ByteOrder>
172 std::string codecName;
175 case INTEGER: codecName =
"int32";
break;
178 codecName =
"int32";
break;
179 case REAL: codecName =
"long_real";
break;
180 case DOUBLE: codecName =
"long_real";
break;
181 case STRING: codecName =
"chars";
break;
183 ASSERT(!
"Type not supported");
193 template <
typename ByteOrder>
static void count(void *counter, const double *data, size_t n)
static double bitfieldMDI()
We always use 0 as MDI of Bitfield columns.
static CodecFactory & instance()
std::unique_ptr< Codec > load(DataStream< ByteOrder > &ds, api::ColumnType type) const
void bitfieldDef(const eckit::sql::BitfieldDef &b)
std::unique_ptr< Codec > coder_
double missingValue() const
void hasMissing(bool h)
Delegations to Codec:
bool equals(const Column &other, bool compareDataSizes=true) const
size_t dataSizeDoubles() const
void load(DataStream< ByteOrder > &ds)
virtual void print(std::ostream &s) const
void missingValue(double v)
const eckit::sql::BitfieldDef & bitfieldDef() const
static const char * columnTypeName(api::ColumnType type)
api::ColumnType type() const
void name(const std::string name)
bool hasInitialisedCoder() const
void type(api::ColumnType t)
void coder(std::unique_ptr< Codec > c)
bool operator!=(const Column &other) const
void dataSizeDoubles(size_t count)
Column & operator=(const Column &)
bool operator==(const Column &) const
return true if names and types are the same; do not compare codecs.
const std::string & name() const
eckit::sql::BitfieldDef bitfieldDef_
bitfieldDef_ is not empty if type_ == BITFIELD.
int32_t type_
Note: type_ should be ColumnType, but it is saved on file so must be of a fixed size type.
friend std::ostream & operator<<(std::ostream &s, const Column &p)
void save(DataStream< ByteOrder > &ds)
int32_t hasMissing() const
void write(const T &elem)