VTK  9.2.20221001
vtkHDF5ScopedHandle.h
Go to the documentation of this file.
1 #ifndef vtkHDF5ScopedHandle_h
2 #define vtkHDF5ScopedHandle_h
3 
4 namespace vtkHDF
5 {
6 VTK_ABI_NAMESPACE_BEGIN
7 
11 #define DefineScopedHandle(name) \
12  class ScopedH5##name##Handle \
13  { \
14  public: \
15  ScopedH5##name##Handle(const ScopedH5##name##Handle& other) { this->Handle = other.Handle; } \
16  ScopedH5##name##Handle(hid_t handle) \
17  : Handle(handle) \
18  { \
19  } \
20  virtual ~ScopedH5##name##Handle() \
21  { \
22  if (this->Handle >= 0) \
23  { \
24  H5##name##close(this->Handle); \
25  } \
26  } \
27  \
28  operator hid_t() const { return this->Handle; } \
29  \
30  private: \
31  hid_t Handle; \
32  };
33 
34 // Defines ScopedH5AHandle closed with H5Aclose
36 
37 // Defines ScopedH5DHandle closed with H5Dclose
39 
40 // Defines ScopedH5FHandle closed with H5Fclose
42 
43 // Defines ScopedH5GHandle closed with H5Gclose
45 
46 // Defines ScopedH5SHandle closed with H5Sclose
48 
49 // Defines ScopedH5THandle closed with H5Tclose
51 
52 VTK_ABI_NAMESPACE_END
53 }
54 
55 #endif
56 // VTK-HeaderTest-Exclude: vtkHDF5ScopedHandle.h
DefineScopedHandle(A)