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