hops
H5Utility.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c), 2017, Blue Brain Project - EPFL (CH)
3  *
4  * Distributed under the Boost Software License, Version 1.0.
5  * (See accompanying file LICENSE_1_0.txt or copy at
6  * http://www.boost.org/LICENSE_1_0.txt)
7  *
8  */
9 
10 #ifndef H5UTILITY_HPP
11 #define H5UTILITY_HPP
12 
13 #include <H5Epublic.h>
14 
15 namespace HighFive {
16 
20 class SilenceHDF5 {
21 public:
22  inline SilenceHDF5(bool enable=true)
23  : _client_data(nullptr)
24  {
25  H5Eget_auto2(H5E_DEFAULT, &_func, &_client_data);
26  if (enable) H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
27  }
28 
29  inline ~SilenceHDF5() {
30  H5Eset_auto2(H5E_DEFAULT, _func, _client_data);
31  }
32 
33 private:
34  H5E_auto2_t _func;
35  void* _client_data;
36 };
37 
38 } // namespace HighFive
39 
40 #endif // H5UTIL_HPP
HighFive::SilenceHDF5
Utility class to disable HDF5 stack printing inside a scope.
Definition: H5Utility.hpp:20
HighFive::SilenceHDF5::SilenceHDF5
SilenceHDF5(bool enable=true)
Definition: H5Utility.hpp:22
HighFive::SilenceHDF5::~SilenceHDF5
~SilenceHDF5()
Definition: H5Utility.hpp:29
HighFive
Definition: H5_definitions.hpp:15