HighFive  2.3.1
HighFive - Header-only C++ HDF5 interface
H5DataSet.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 #ifndef H5DATASET_HPP
10 #define H5DATASET_HPP
11 
12 #include <vector>
13 
14 #include "H5DataSpace.hpp"
15 #include "H5DataType.hpp"
16 #include "H5Object.hpp"
17 #include "bits/H5_definitions.hpp"
19 #include "bits/H5Slice_traits.hpp"
20 #include "bits/H5Path_traits.hpp"
21 #include "bits/H5_definitions.hpp"
22 
23 namespace HighFive {
24 
28 class DataSet : public Object,
29  public SliceTraits<DataSet>,
30  public AnnotateTraits<DataSet>,
31  public PathTraits<DataSet> {
32  public:
33 
35 
40  uint64_t getStorageSize() const;
41 
46  uint64_t getOffset() const;
47 
52  DataType getDataType() const;
53 
58  DataSpace getSpace() const;
59 
65  DataSpace getMemSpace() const;
66 
67 
73  void resize(const std::vector<size_t>& dims);
74 
75 
80  inline std::vector<size_t> getDimensions() const {
81  return getSpace().getDimensions();
82  }
83 
89  inline size_t getElementCount() const {
90  return getSpace().getElementCount();
91  }
92 
93  H5_DEPRECATED("Default constructor creates unsafe uninitialized objects")
94  DataSet() = default;
95 
96  protected:
97  using Object::Object; // bring DataSet(hid_t)
98 
99  DataSet(Object&& o) noexcept : Object(std::move(o)) {}
100 
101  friend class Reference;
102  template <typename Derivate> friend class NodeTraits;
103 
104 };
105 
106 } // namespace HighFive
107 
108 #endif // H5DATASET_HPP
#define H5_DEPRECATED
Definition: H5_definitions.hpp:9
Definition: H5Annotate_traits.hpp:19
Class representing a dataset.
Definition: H5DataSet.hpp:31
DataSpace getMemSpace() const
getMemSpace
Definition: H5DataSet_misc.hpp:46
void resize(const std::vector< size_t > &dims)
Change the size of the dataset.
Definition: H5DataSet_misc.hpp:59
DataType getDataType() const
getDataType
Definition: H5DataSet_misc.hpp:33
uint64_t getOffset() const
getOffset
Definition: H5DataSet_misc.hpp:50
uint64_t getStorageSize() const
getStorageSize
Definition: H5DataSet_misc.hpp:29
DataSpace getSpace() const
getSpace
Definition: H5DataSet_misc.hpp:37
static const ObjectType type
Definition: H5DataSet.hpp:34
size_t getElementCount() const
Get the total number of elements in the current dataset. E.g. 2x2x2 matrix has size 8....
Definition: H5DataSet.hpp:89
std::vector< size_t > getDimensions() const
Get the dimensions of the whole DataSet. This is a shorthand for getSpace().getDimensions()
Definition: H5DataSet.hpp:80
Class representing the space (dimensions) of a dataset.
Definition: H5DataSpace.hpp:37
size_t getElementCount() const
getElementCount
Definition: H5Dataspace_misc.hpp:114
std::vector< size_t > getDimensions() const
getDimensions
Definition: H5Dataspace_misc.hpp:103
HDF5 Data Type.
Definition: H5DataType.hpp:42
NodeTraits: Base class for Group and File.
Definition: H5Node_traits.hpp:23
Definition: H5Object.hpp:36
Definition: H5Path_traits.hpp:16
An HDF5 (object) reference type.
Definition: H5Reference.hpp:31
Definition: H5Slice_traits.hpp:54
Definition: H5_definitions.hpp:15
ObjectType
Enum of the types of objects (H5O api)
Definition: H5Object.hpp:25