diff --git a/src/hdf5_array.hpp b/src/hdf5_array.hpp index 711c0bc..11762bb 100644 --- a/src/hdf5_array.hpp +++ b/src/hdf5_array.hpp @@ -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 { + static H5::DataType type() { + return hdf5_CosmoStringType::ctype()->type; + } + }; + template void hdf5_write_array(H5_CommonFileGroup& fg, const std::string& data_set_name, const ArrayType& data ) {