HighFive 2.10.1
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
H5DataSpace.hpp
Go to the documentation of this file.
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#pragma once
10
11#include <vector>
12#include <array>
13#include <cstdint>
14#include <type_traits>
15#include <initializer_list>
16
17#include "H5Object.hpp"
19
20namespace HighFive {
21
22namespace detail {
27DataSpace make_data_space(hid_t hid);
28} // namespace detail
29
39class DataSpace: public Object {
40 public:
42
49 static const size_t UNLIMITED = SIZE_MAX;
50
59 // simple dataspace are handle directly from their dimensions
60 };
61
70 explicit DataSpace(const std::vector<size_t>& dims);
71
80 template <size_t N>
81 explicit DataSpace(const std::array<size_t, N>& dims);
82
91 DataSpace(const std::initializer_list<size_t>& dims);
92
102 template <typename... Args>
103 explicit DataSpace(size_t dim1, Args... dims);
104
116 // Attention: Explicitly disable DataSpace(int_like, int_like) from trying
117 // to use this constructor
118 template <typename IT,
119 typename = typename std::enable_if<!std::is_integral<IT>::value, IT>::type>
120 DataSpace(const IT begin, const IT end);
121
134 explicit DataSpace(const std::vector<size_t>& dims, const std::vector<size_t>& maxdims);
135
154 explicit DataSpace(DataspaceType space_type);
155
163 static DataSpace Scalar();
164
172 static DataSpace Null();
173
182 DataSpace clone() const;
183
190 size_t getNumberDimensions() const;
191
205 std::vector<size_t> getDimensions() const;
206
214 size_t getElementCount() const;
215
228 std::vector<size_t> getMaxDimensions() const;
229
243 template <typename T>
244 static DataSpace From(const T& value);
245
255 template <std::size_t N, std::size_t Width>
256 static DataSpace FromCharArrayStrings(const char (&string_array)[N][Width]);
257
258 protected:
259 DataSpace() = default;
260
261 static DataSpace fromId(hid_t hid) {
262 DataSpace space;
263 space._hid = hid;
264
265 return space;
266 }
267
268 friend class Attribute;
269 friend class File;
270 friend class DataSet;
271
272 friend DataSpace detail::make_data_space(hid_t hid);
273};
274
275} // namespace HighFive
276
277// We include bits right away since DataSpace is user-constructible
Class representing an Attribute of a DataSet or Group.
Definition H5Attribute.hpp:46
Class representing a dataset.
Definition H5DataSet.hpp:30
Class representing the space (dimensions) of a DataSet.
Definition H5DataSpace.hpp:39
static DataSpace FromCharArrayStrings(const char(&string_array)[N][Width])
Create a DataSpace from a value of type string array.
Definition H5Dataspace_misc.hpp:134
static const ObjectType type
Definition H5DataSpace.hpp:41
static DataSpace fromId(hid_t hid)
Definition H5DataSpace.hpp:261
static DataSpace From(const T &value)
Automatically deduce the DataSpace from a container/value.
Definition H5Dataspace_misc.hpp:128
size_t getNumberDimensions() const
Returns the number of dimensions of a DataSpace.
Definition H5Dataspace_misc.hpp:100
std::vector< size_t > getMaxDimensions() const
Returns the maximum size of the dataset in each dimension.
Definition H5Dataspace_misc.hpp:116
DataspaceType
An enum to create scalar and null DataSpace with DataSpace::DataSpace(DataspaceType dtype).
Definition H5DataSpace.hpp:56
@ dataspace_scalar
Value to create scalar DataSpace.
Definition H5DataSpace.hpp:57
@ dataspace_null
Value to create null DataSpace.
Definition H5DataSpace.hpp:58
static DataSpace Scalar()
Create a scalar DataSpace.
Definition H5Dataspace_misc.hpp:51
size_t getElementCount() const
Return the number of elements in this DataSpace.
Definition H5Dataspace_misc.hpp:112
std::vector< size_t > getDimensions() const
Returns the size of the dataset in each dimension.
Definition H5Dataspace_misc.hpp:104
DataSpace clone() const
Create a copy of the DataSpace which will have different id.
Definition H5Dataspace_misc.hpp:94
static DataSpace Null()
Create a null DataSpace.
Definition H5Dataspace_misc.hpp:55
static const size_t UNLIMITED
Magic value to specify that a DataSpace can grow without limit.
Definition H5DataSpace.hpp:49
File class.
Definition H5File.hpp:24
Definition H5Object.hpp:54
hid_t _hid
Definition H5Object.hpp:105
Definition H5_definitions.hpp:22
ObjectType
Enum of the types of objects (H5O api)
Definition H5Object.hpp:24