HighFive 2.10.1
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
H5DataSet_misc.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 <algorithm>
12#include <functional>
13#include <numeric>
14#include <sstream>
15#include <string>
16
17#include <H5Ppublic.h>
18
19#include "h5d_wrapper.hpp"
20#include "H5Utils.hpp"
21
22namespace HighFive {
23
24inline uint64_t DataSet::getStorageSize() const {
25 return detail::h5d_get_storage_size(_hid);
26}
27
29 return DataType(detail::h5d_get_type(_hid));
30}
31
33 DataSpace space;
34 space._hid = detail::h5d_get_space(_hid);
35 return space;
36}
37
39 return getSpace();
40}
41
42inline uint64_t DataSet::getOffset() const {
43 return static_cast<uint64_t>(detail::h5d_get_offset(_hid));
44}
45
46inline void DataSet::resize(const std::vector<size_t>& dims) {
47 const size_t numDimensions = getSpace().getDimensions().size();
48 if (dims.size() != numDimensions) {
49 HDF5ErrMapper::ToException<DataSetException>("Invalid dataspace dimensions, got " +
50 std::to_string(dims.size()) + " expected " +
51 std::to_string(numDimensions));
52 }
53
54 std::vector<hsize_t> real_dims(dims.begin(), dims.end());
55 detail::h5d_set_extent(getId(), real_dims.data());
56}
57
58} // namespace HighFive
DataSpace getMemSpace() const
getMemSpace
Definition H5DataSet_misc.hpp:38
void resize(const std::vector< size_t > &dims)
Change the size of the dataset.
Definition H5DataSet_misc.hpp:46
DataType getDataType() const
getDataType
Definition H5DataSet_misc.hpp:28
uint64_t getOffset() const
getOffset
Definition H5DataSet_misc.hpp:42
uint64_t getStorageSize() const
getStorageSize
Definition H5DataSet_misc.hpp:24
DataSpace getSpace() const
getSpace
Definition H5DataSet_misc.hpp:32
Class representing the space (dimensions) of a DataSet.
Definition H5DataSpace.hpp:39
std::vector< size_t > getDimensions() const
Returns the size of the dataset in each dimension.
Definition H5Dataspace_misc.hpp:104
HDF5 Data Type.
Definition H5DataType.hpp:61
hid_t getId() const noexcept
getId
Definition H5Object_misc.hpp:69
hid_t _hid
Definition H5Object.hpp:105
Definition H5_definitions.hpp:22
static void ToException(const std::string &prefix_msg)
Definition H5Exception_misc.hpp:43