42 #include "config_hdf5.h"
48 #include "InternalErr.h"
58 : Str(n,d),var_path(vpath)
73 hid_t file_id = H5Fopen(dataset().c_str(),H5F_ACC_RDONLY,H5P_DEFAULT);
75 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the HDF5 file ID .");
80 dset_id = H5Dopen2(file_id,var_path.c_str(),H5P_DEFAULT);
82 dset_id = H5Dopen2(file_id,name().c_str(),H5P_DEFAULT);
86 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the datatype .");
89 hid_t dtypeid = H5Dget_type(dset_id);
93 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the datatype .");
96 size_t size = H5Tget_size(dtypeid);
102 throw InternalErr(__FILE__, __LINE__,
"cannot return the size of datatype");
106 if(H5Tis_variable_str(dtypeid) >0){
107 vector<string>finstrval;
109 read_vlen_string(dset_id,1,NULL,NULL,NULL,finstrval);
110 string strval = finstrval[0];
117 get_data(dset_id, (
void *) &chr[0]);
119 string str(chr.begin(),chr.end());