Add more support for strings
This commit is contained in:
parent
2c48088476
commit
1bd685e9c5
@ -263,6 +263,35 @@ namespace CosmoTool {
|
||||
}
|
||||
};
|
||||
|
||||
struct CosmoString {
|
||||
char const * s;
|
||||
operator char const *() { return s; }
|
||||
char const *operator=(char const *s0) {
|
||||
s = s0;
|
||||
return s0;
|
||||
}
|
||||
};
|
||||
|
||||
class hdf5_CosmoStringType {
|
||||
public:
|
||||
H5::StrType type;
|
||||
|
||||
hdf5_CosmoStringType() : type(H5::PredType::C_S1, H5T_VARIABLE) {
|
||||
}
|
||||
|
||||
static const hdf5_CosmoStringType *ctype()
|
||||
{
|
||||
static hdf5_CosmoStringType singleton;
|
||||
return &singleton;
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct get_hdf5_data_type<CosmoString> {
|
||||
static H5::DataType type() {
|
||||
return hdf5_CosmoStringType::ctype()->type;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ArrayType>
|
||||
void hdf5_write_array(H5_CommonFileGroup& fg, const std::string& data_set_name, const ArrayType& data )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user