36typedef std::pair<H5E_auto2_t, void*> HDF5_error_handler_t;
38inline HDF5_error_handler_t
39HDF5_turn_off_error_handling()
41 HDF5_error_handler_t h;
42 H5::Exception::getAutoPrint(h.first, &h.second);
43 H5::Exception::dontPrint();
48HDF5_set_error_handler(HDF5_error_handler_t& h)
50 H5::Exception::setAutoPrint(h.first, h.second);
54HDF5_dataset_exists(
const H5::H5File& file,
const std::string& dataset_name)
56 auto h = HDF5_turn_off_error_handling();
57 const auto ret = H5Lexists(file.getId(), dataset_name.c_str(), H5P_DEFAULT);
58 HDF5_set_error_handler(h);
63HDF5_group_exists(
const H5::H5File& file,
const std::string& group_name)
66 return HDF5_dataset_exists(file, group_name);
70get_HDF5_group(
const H5::H5File& file,
const std::string& group_name)
72 if (!HDF5_group_exists(file, group_name))
77 return file.openGroup(group_name);
81is_valid(
const H5::H5Object& obj)
83 return obj.getId() != H5I_INVALID_HID;