VTK
9.3.0
Main Page
Related Pages
Topics
Namespaces
Classes
Files
File List
File Members
IO
HDF
vtkHDF5ScopedHandle.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2
// SPDX-License-Identifier: BSD-3-Clause
3
#ifndef vtkHDF5ScopedHandle_h
4
#define vtkHDF5ScopedHandle_h
5
6
namespace
vtkHDF
7
{
8
VTK_ABI_NAMESPACE_BEGIN
9
13
#define DefineScopedHandle(name) \
14
class ScopedH5##name##Handle \
15
{ \
16
public: \
17
ScopedH5##name##Handle(const ScopedH5##name##Handle& other) { this->Handle = other.Handle; } \
18
ScopedH5##name##Handle(hid_t handle) \
19
: Handle(handle) \
20
{ \
21
} \
22
virtual ~ScopedH5##name##Handle() \
23
{ \
24
if (this->Handle >= 0) \
25
{ \
26
H5##name##close(this->Handle); \
27
} \
28
} \
29
\
30
operator hid_t() const { return this->Handle; } \
31
\
32
private: \
33
hid_t Handle; \
34
};
35
36
// Defines ScopedH5AHandle closed with H5Aclose
37
DefineScopedHandle
(A);
38
39
// Defines ScopedH5DHandle closed with H5Dclose
40
DefineScopedHandle
(D);
41
42
// Defines ScopedH5FHandle closed with H5Fclose
43
DefineScopedHandle
(F);
44
45
// Defines ScopedH5GHandle closed with H5Gclose
46
DefineScopedHandle
(G);
47
48
// Defines ScopedH5SHandle closed with H5Sclose
49
DefineScopedHandle
(S);
50
51
// Defines ScopedH5THandle closed with H5Tclose
52
DefineScopedHandle
(T);
53
54
VTK_ABI_NAMESPACE_END
55
}
56
57
#endif
58
// VTK-HeaderTest-Exclude: vtkHDF5ScopedHandle.h
vtkHDF
Definition
vtkHDF5ScopedHandle.h:7
DefineScopedHandle
#define DefineScopedHandle(name)
RAII class for automatically closing H5 handles.
Definition
vtkHDF5ScopedHandle.h:13
Generated on Sat Feb 15 2025 13:13:19 for VTK by
1.9.8