hdf5_cpp.h Source File

CPP API: hdf5_cpp.h Source File
hdf5_cpp.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2020-2026 MEmilio
3 *
4 * Authors: Daniel Abele
5 *
6 * Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 #ifndef MIO_IO_HDF5_CPP_H
21 #define MIO_IO_HDF5_CPP_H
22 
23 #include "memilio/config.h"
24 
25 #ifdef MEMILIO_HAS_HDF5
26 
28 
30 
31 #include "hdf5.h"
32 
34 
35 namespace mio
36 {
37 
41 struct H5File {
42  hid_t id;
43  ~H5File()
44  {
45  H5Fclose(id);
46  }
47 };
48 
52 struct H5Group {
53  hid_t id;
54  ~H5Group()
55  {
56  H5Gclose(id);
57  }
58 };
59 
63 struct H5DataSpace {
64  hid_t id;
65  ~H5DataSpace()
66  {
67  H5Sclose(id);
68  }
69 };
70 
74 struct H5DataSet {
75  hid_t id;
76  ~H5DataSet()
77  {
78  H5Dclose(id);
79  }
80 };
81 
91 #define MEMILIO_H5_CHECK(id, ...) \
92  do { \
93  if (id < 0) { \
94  return ::mio::failure(__VA_ARGS__); \
95  } \
96  } while (0)
97 
98 } // namespace mio
99 
100 #endif // MEMILIO_HAS_HDF5
101 
102 #endif // MIO_IO_HDF5_CPP_H
#define MSVC_WARNING_POP()
Definition: compiler_diagnostics.h:44
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
MSVC_WARNING_DISABLE_PUSH(4127) GCC_CLANG_DIAGNOSTIC(ignored "-Wexpansion-to-defined") namespace mio
Definition: random_number_generator.h:31