h5cpp  0.6.0
A modern C++ wrapper for the HDF5 C library
array.hpp
Go to the documentation of this file.
1 #pragma once
2 
6 #include <array>
7 
8 namespace hdf5 {
9 namespace datatype {
10 
11 template<typename T, size_t N>
12 class TypeTrait<std::array<T, N>> {
13  public:
14  using Type = std::array<T, N>;
15  using TypeClass = typename TypeTrait<T>::TypeClass;
16  static TypeClass create(const Type & = Type()) {
17  return TypeTrait<typename std::remove_const<T>::type>::create();
18  }
19  const static TypeClass & get(const Type & = Type()) {
20  const static TypeClass & cref_ = TypeTrait<typename std::remove_const<T>::type>::create();
21  return cref_;
22  }
23 };
24 } // end of namespace datatype
25 
26 namespace dataspace {
27 
28 template<typename T, size_t N>
29 class TypeTrait<std::array<T, N>> {
30  public:
32 
33  static DataspaceType create(const std::array<T, N> &) {
35  }
36 
37  const static DataspaceType & get(const std::array<T, N> &, DataspacePool &) {
38  const static DataspaceType & cref_ = Simple(hdf5::Dimensions{N}, hdf5::Dimensions{N});
39  return cref_;
40  }
41 
42  static void *ptr(std::array<T, N> &value) {
43  return reinterpret_cast<void *>(value.data());
44  }
45 
46  static const void *cptr(const std::array<T, N> &value) {
47  return reinterpret_cast<const void *>(value.data());
48  }
49 };
50 
51 } // end of namespace dataspace
52 } // end of namespace hdf5
data space object pool
Definition: pool.hpp:42
simple multidimensional dataspace
Definition: simple.hpp:43
static void * ptr(std::array< T, N > &value)
Definition: array.hpp:42
static const void * cptr(const std::array< T, N > &value)
Definition: array.hpp:46
static DataspaceType create(const std::array< T, N > &)
Definition: array.hpp:33
static const DataspaceType & get(const std::array< T, N > &, DataspacePool &)
Definition: array.hpp:37
type trait for dataspace construction
Definition: type_trait.hpp:54
Datatype TypeClass
subtype of Datatype which will be used
Definition: type_trait.hpp:58
static TypeClass create(const T &=T())
create the new type instance
static const TypeClass & get(const T &=T())
reference to const static type instance
Type
Definition: type.hpp:43
top-level namespace of the entire library
Definition: attribute.hpp:45
std::vector< hsize_t > Dimensions
Definition: types.hpp:32