h5gt 0.2.0
C++ wrapper for HDF5 library (based on HighFive project)
Loading...
Searching...
No Matches
H5DataSpace.hpp
1/*
2 * Copyright (c), 2017, Adrien Devresse <adrien.devresse@epfl.ch>
3 *
4 * Distributed under the Boost Software License, Version 1.0.
5 * (See accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
7 *
8 */
9#ifndef H5DATASPACE_HPP
10#define H5DATASPACE_HPP
11
12#include <vector>
13#include <array>
14#include <cstdint>
15#include <type_traits>
16#include <initializer_list>
17
18#ifdef H5GT_USE_BOOST
19// starting Boost 1.64, serialization header must come before ublas
20#include <boost/serialization/vector.hpp>
21#include <boost/multi_array.hpp>
22#include <boost/numeric/ublas/matrix.hpp>
23#endif
24
25#ifdef H5GT_USE_EIGEN
26#include <Eigen/Eigen>
27#endif
28
29#include "H5PropertyList.hpp"
30#include "bits/H5_definitions.hpp"
31
32namespace h5gt {
33
37class DataSpace : public Object {
38public:
39
40 const static ObjectType type = ObjectType::DataSpace;
41
42 static const size_t UNLIMITED = SIZE_MAX;
43
46 datascape_scalar,
47 datascape_null
48 // simple dataspace are handle directly from their dimensions
49 };
50
56 explicit DataSpace(const std::vector<size_t>& dims);
57
58 // create a dataspace of N-dimensions
59 template <size_t N>
60 explicit DataSpace(const std::array<size_t, N>& dims);
61
65 DataSpace(const std::initializer_list<size_t>& items);
66
69 template<typename... Args>
70 explicit DataSpace(size_t dim1, Args... dims);
71
75 template <typename IT, typename = typename std::enable_if<!std::is_integral<IT>::value,IT>::type>
76 DataSpace(const IT begin,
77 const IT end);
78
82 explicit DataSpace(const std::vector<size_t>& dims,
83 const std::vector<size_t>& maxdims);
84
88 explicit DataSpace(DataspaceType dtype);
89
92 DataSpace clone() const;
93
98 size_t getNumberDimensions() const;
99
103 std::vector<size_t> getDimensions() const;
104
107 size_t getElementCount() const;
108
111 size_t getElementCountSelected() const;
112
116 std::vector<size_t> getMaxDimensions() const;
117
119 template <typename T>
120 static DataSpace From(const T& value);
121
122 template <std::size_t N, std::size_t Width>
123 static DataSpace FromCharArrayStrings(const char(&)[N][Width]);
124
125 static DataSpace FromId(const hid_t& id, const bool& increaseRefCount = false){
126 Object obj = Object(id, ObjectType::DataSpace, increaseRefCount);
127 return DataSpace(obj);
128 };
129
130protected:
131 DataSpace(const Object& obj) : Object(obj){};
132 DataSpace() = default;
133
134 friend class Attribute;
135 friend class File;
136 friend class DataSet;
137 friend class Selection;
138};
139
140} // namespace h5gt
141
142// We include bits right away since DataSpace is user-constructible
143#include "bits/H5Dataspace_misc.hpp"
144
145#endif // H5DATASPACE_HPP
Class representing the space (dimensions) of a dataset.
Definition H5DataSpace.hpp:37
size_t getElementCount() const
getElementCount
Definition H5Dataspace_misc.hpp:114
DataSpace clone() const
Definition H5Dataspace_misc.hpp:86
size_t getElementCountSelected() const
getElementCountSelected
Definition H5Dataspace_misc.hpp:120
static DataSpace From(const T &value)
Create a dataspace matching a type accepted by details::inspector.
Definition H5Dataspace_misc.hpp:137
DataSpace(const std::vector< size_t > &dims)
Definition H5Dataspace_misc.hpp:23
DataspaceType
dataspace type
Definition H5DataSpace.hpp:45
size_t getNumberDimensions() const
getNumberDimensions
Definition H5Dataspace_misc.hpp:94
std::vector< size_t > getMaxDimensions() const
getMaxDimensions
Definition H5Dataspace_misc.hpp:124
std::vector< size_t > getDimensions() const
getDimensions
Definition H5Dataspace_misc.hpp:103
Definition H5Object.hpp:55