Код: Выделить всё
#include "H5Cpp.h"
#include
struct myData {
int int1;
double d1, d2, d3, d4, d5, d6;
int int2;
};
int main(){
H5::H5File file;
// set file_path to the file and record_path to the dataset
file.openFile(file_path.c_str(), H5F_ACC_RDONLY);
H5::DataSet dataset = file.openDataSet(record_path.c_str());
H5::DataSpace dataspace = dataset.getSpace();
hsize_t dims[2];
dataspace.getSimpleExtentDims(dims, NULL);
std::vector data(dims[0]); // this set is not an array directly *dims[1]);
dataset.read(data.data(), dataset.getDataType());
/* ... work with the vector data as need be ... */
return 0;
}
Код: Выделить всё
H5T_class_t type_class = datatype.getClass();
if (type_class == H5T_COMPOUND) {
H5::CompType compType = dataset.getCompType();
int numMembers = compType.getNmembers();
for (int i = 0; i < numMembers; ++i) {
std::string name = compType.getMemberName(i);
H5::DataType mType = compType.getMemberDataType(i);
H5T_class_t mClass = mType.getClass();
}
}
Каков правильный способ динамического построения контейнера для чтения общего набора данных H5T_COMPOUND?
Подробнее здесь: https://stackoverflow.com/questions/791 ... nd-dataset
Мобильная версия