TRIQS/h5 1.3.0
C++ interface to HDF5
Loading...
Searching...
No Matches
utils.hpp
Go to the documentation of this file.
1// Copyright (c) 2024 Simons Foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0.txt
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Authors: Thomas Hahn, Olivier Parcollet, Nils Wentzell
16
22#ifndef LIBH5_UTILS_HPP
23#define LIBH5_UTILS_HPP
24
25#include <cstdint>
26#include <stdexcept>
27#include <sstream>
28#include <vector>
29
30namespace h5 {
31
45 using hid_t = int64_t;
46
52#ifdef H5_VER_GE_113
53 using hsize_t = uint64_t;
54#else
55 using hsize_t = unsigned long long;
56#endif
57
59 using v_t = std::vector<hsize_t>;
60
68 template <typename... Ts>
69 [[nodiscard]] std::runtime_error make_runtime_error(Ts const &...ts) {
70 std::stringstream ss;
71 (ss << ... << ts);
72 return std::runtime_error{ss.str()};
73 }
74
77} // namespace h5
78
79#endif // LIBH5_UTILS_HPP
std::vector< hsize_t > v_t
Vector of h5::hsize_t used throughout the h5 library.
Definition utils.hpp:59
unsigned long long hsize_t
Size type used in HDF5.
Definition utils.hpp:55
std::runtime_error make_runtime_error(Ts const &...ts)
Create a std::runtime_error with an error message constructed from the given arguments.
Definition utils.hpp:69
int64_t hid_t
ID type used in HDF5.
Definition utils.hpp:45