Added string support

This commit is contained in:
Guilhem Lavaux 2016-12-11 16:26:17 +01:00
parent 4f29b0b7f4
commit 03a187f063

View File

@ -202,6 +202,29 @@ namespace CosmoTool {
} }
}; };
class hdf5_StringType
{
public:
H5::StrType type;
hdf5_StringType()
: type(0, H5T_VARIABLE)
{
}
static const hdf5_StringType *ctype()
{
static hdf5_StringType singleton;
return &singleton;
}
};
template<> struct get_hdf5_data_type<std::string> {
static H5::DataType type() {
return hdf5_StringType::ctype()->type;
}
};
class hdf5_BoolType class hdf5_BoolType
{ {
public: public:
@ -326,7 +349,7 @@ namespace CosmoTool {
H5::DataSpace dataspace = dataset.getSpace(); H5::DataSpace dataspace = dataset.getSpace();
std::vector<hsize_t> dimensions(data.num_dimensions()); std::vector<hsize_t> dimensions(data.num_dimensions());
if (dataspace.getSimpleExtentNdims() != data.num_dimensions()) if ((size_t)dataspace.getSimpleExtentNdims() != (size_t)data.num_dimensions())
{ {
throw InvalidDimensions(); throw InvalidDimensions();
} }