h5cpp  0.5.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
type_trait.hpp
hdf5::dataspace::Type
Type
Definition: type.hpp:43
hdf5::dataspace::TypeTrait< std::array< T, N > >::cptr
static const void * cptr(const std::array< T, N > &value)
Definition: array.hpp:46
hdf5::dataspace::TypeTrait
type trait for dataspace construction
Definition: type_trait.hpp:54
hdf5::datatype::TypeTrait::create
static TypeClass create(const T &=T())
create the new type instance
hdf5::dataspace::Simple
simple multidimensional dataspace
Definition: simple.hpp:43
hdf5::dataspace::TypeTrait< std::array< T, N > >::create
static DataspaceType create(const std::array< T, N > &)
Definition: array.hpp:33
hdf5::datatype::TypeTrait::TypeClass
Datatype TypeClass
subtype of Datatype which will be used
Definition: type_trait.hpp:58
hdf5::datatype::TypeTrait::get
const static TypeClass & get(const T &=T())
reference to const static type instance
hdf5::Dimensions
std::vector< hsize_t > Dimensions
Definition: types.hpp:32
hdf5::dataspace::TypeTrait< std::array< T, N > >::ptr
static void * ptr(std::array< T, N > &value)
Definition: array.hpp:42
hdf5::dataspace::TypeTrait< std::array< T, N > >::get
const static DataspaceType & get(const std::array< T, N > &, DataspacePool &)
Definition: array.hpp:37
type_trait.hpp
simple.hpp
hdf5::dataspace::DataspacePool
data space object pool
Definition: pool.hpp:41
hdf5
top-level namespace of the entire library
Definition: attribute.hpp:45