QMCPACK
hdf_error_suppression.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
8 // Luke Shulenburger, lshulen@sandia.gov, Sandia National Laboratories
9 //
10 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 
14 #ifndef QMCPLUSPLUS_HDF5_ERROR_SUPPRESSION_H
15 #define QMCPLUSPLUS_HDF5_ERROR_SUPPRESSION_H
16 
17 #include "hdf5.h"
18 
19 namespace qmcplusplus
20 {
21 /// class suppressing warnings from the HDF5 library
23 {
24 public:
25  /// constructor
27  {
28  H5Eget_auto2(H5E_DEFAULT, &err_func, &client_data);
29  H5Eset_auto2(H5E_DEFAULT, nullptr, nullptr);
30  enabled = true;
31  }
32  /// We don't want more than one instance at a time.
35  /// destructor reset HDF5 error handling
37  {
38  H5Eset_auto2(H5E_DEFAULT, err_func, client_data);
39  enabled = false;
40  }
41 
42  /// status of hdf_error_suppression. An instance of this class changes enabled to true.
43  static inline bool enabled{false};
44 
45 private:
46  ///error type
47  H5E_auto2_t err_func;
48  ///error handling
49  void* client_data{nullptr};
50 };
51 
52 } // namespace qmcplusplus
53 #endif //QMCPLUSPLUS_HDF5_ERROR_SUPPRESSION_H
54 
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
~hdf_error_suppression()
destructor reset HDF5 error handling
class suppressing warnings from the HDF5 library
hdf_error_suppression & operator=(const hdf_error_suppression &)=delete
static bool enabled
status of hdf_error_suppression. An instance of this class changes enabled to true.