HDTree  0.5.2
HDTree C++ API
Atomic.h
Go to the documentation of this file.
1 
3 #pragma once
4 
8 #ifdef TRUE
9 #define NEED_TO_REDEFINE_TRUE
10 #undef TRUE
11 #undef FALSE
12 #endif
13 
14 #include <highfive/H5DataType.hpp>
15 #include <type_traits>
16 
17 namespace hdtree {
18 
26 template <typename AtomicType>
27 using is_atomic =
28  std::integral_constant<bool,
29  std::is_arithmetic<AtomicType>::value ||
30  std::is_same<AtomicType, std::string>::value>;
31 
33 template <typename AtomicType>
34 inline constexpr bool is_atomic_v = is_atomic<AtomicType>::value;
35 
42 enum class Bool : bool { TRUE = true, FALSE = false };
43 
47 HighFive::EnumType<Bool> create_enum_bool();
48 
49 } // namespace hdtree
50 
68 template <>
69 HighFive::DataType HighFive::create_datatype<hdtree::Bool>();
Geant4 does a GLOBAL definition of the keyword TRUE.
Definition: Atomic.cxx:3
HighFive::EnumType< Bool > create_enum_bool()
HighFive method for creating the enum data type.
Definition: Atomic.cxx:5
constexpr bool is_atomic_v
shorthand for easier use
Definition: Atomic.h:34
std::integral_constant< bool, std::is_arithmetic< AtomicType >::value||std::is_same< AtomicType, std::string >::value > is_atomic
HighFive supports many C++ "atomic" types that are used regularly.
Definition: Atomic.h:30
Bool
Boolean enum aligned with h5py.
Definition: Atomic.h:42