Specialization for vector of strings.
More...
template<>
struct qmcplusplus::h5data_proxy< std::vector< std::string > >
Specialization for vector of strings.
Definition at line 195 of file hdf_stl.h.
◆ data_type
◆ h5data_proxy()
◆ read()
bool read |
( |
data_type & |
ref, |
|
|
hid_t |
grp, |
|
|
const std::string & |
aname, |
|
|
hid_t |
xfer_plist = H5P_DEFAULT |
|
) |
| |
|
inline |
Definition at line 201 of file hdf_stl.h.
203 hid_t datatype = H5Tcopy(H5T_C_S1);
204 H5Tset_size(datatype, H5T_VARIABLE);
205 hid_t dataset = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
206 std::vector<char*> char_list;
211 hid_t dataspace = H5Dget_space(dataset);
212 hid_t status = H5Sget_simple_extent_dims(dataspace, &dim_out, NULL);
214 char_list.resize(dim_out);
215 ret = H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, xfer_plist, char_list.data());
217 for (
int i = 0; i < dim_out; i++)
218 ref.push_back(char_list[i]);
220 H5Dvlen_reclaim(datatype, dataspace, xfer_plist, char_list.data());
◆ write()
bool write |
( |
const data_type & |
ref, |
|
|
hid_t |
grp, |
|
|
const std::string & |
aname, |
|
|
hid_t |
xfer_plist = H5P_DEFAULT |
|
) |
| const |
|
inline |
Definition at line 230 of file hdf_stl.h.
237 hid_t datatype = H5Tcopy(H5T_C_S1);
238 H5Tset_size(datatype, H5T_VARIABLE);
239 hsize_t dim = ref.size();
242 std::vector<const char*> char_list;
243 for (
int i = 0; i < ref.size(); i++)
244 char_list.push_back(ref[i].data());
246 hid_t h1 = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
250 hid_t dataspace = H5Screate_simple(1, &dim, NULL);
251 hid_t dataset = H5Dcreate(grp, aname.c_str(), datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
252 ret = H5Dwrite(dataset, datatype, H5S_ALL, H5S_ALL, xfer_plist, char_list.data());
257 ret = H5Dwrite(h1, datatype, H5S_ALL, H5S_ALL, xfer_plist, char_list.data());
The documentation for this struct was generated from the following file:
- /home/pk7/projects/qmc/for_cron_doxygen/qmcpack/src/io/hdf/hdf_stl.h