提交 6e293334 编写于 作者: M Marius Muja

HDF5 compatibility fix

上级 9c6f5ba0
......@@ -75,7 +75,12 @@ void save_to_file(const flann::Matrix<T>& dataset, const std::string& filename,
hid_t space_id = H5Screate_simple(2, dimsf, NULL);
hid_t memspace_id = H5Screate_simple(2, dimsf, NULL);
hid_t dataset_id = H5Dcreate2(file_id, name.c_str(), get_hdf5_type<T>(), space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
hid_t dataset_id;
#if H5_VERS_MINOR >= 8
dataset_id = H5Dcreate2(file_id, name.c_str(), get_hdf5_type<T>(), space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
#else
dataset_id = = H5Dcreate(file_id, name.c_str(), get_hdf5_type<T>(), space_id, H5P_DEFAULT);
#endif
CHECK_ERROR(dataset_id,"Error creating dataset in file.");
status = H5Dwrite(dataset_id, get_hdf5_type<T>(), memspace_id, space_id, H5P_DEFAULT, dataset.data );
......@@ -96,7 +101,12 @@ void load_from_file(flann::Matrix<T>& dataset, const std::string& filename, cons
hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
CHECK_ERROR(file_id,"Error opening hdf5 file.");
hid_t dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT);
hid_t dataset_id;
#if H5_VERS_MINOR >= 8
dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT);
#else
dataset_id = H5Dopen(file_id, name.c_str());
#endif
CHECK_ERROR(dataset_id,"Error opening dataset in file.");
hid_t space_id = H5Dget_space(dataset_id);
......@@ -142,7 +152,12 @@ void load_from_file(flann::Matrix<T>& dataset, const std::string& filename, cons
hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, plist_id);
CHECK_ERROR(file_id,"Error opening hdf5 file.");
H5Pclose(plist_id);
hid_t dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT);
hid_t dataset_id;
#if H5_VERS_MINOR >= 8
dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT);
#else
dataset_id = H5Dopen(file_id, name.c_str());
#endif
CHECK_ERROR(dataset_id,"Error opening dataset in file.");
hid_t space_id = H5Dget_space(dataset_id);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册