h5gt 0.2.0
C++ wrapper for HDF5 library (based on HighFive project)
Loading...
Searching...
No Matches
H5DataSet.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 H5DATASET_HPP
10#define H5DATASET_HPP
11
12#include <vector>
13
14#include "H5DataSpace.hpp"
15#include "H5DataType.hpp"
16#include "bits/H5_definitions.hpp"
17#include "bits/H5Annotate_traits.hpp"
18#include "bits/H5Slice_traits.hpp"
19#include "bits/H5_definitions.hpp"
20
21namespace h5gt {
22
26class DataSet : public Object,
27 public SliceTraits<DataSet>,
28 public AnnotateTraits<DataSet> {
29public:
30
31 const static ObjectType type = ObjectType::Dataset;
32
37 uint64_t getStorageSize() const;
38
43 uint64_t getOffset() const;
44
49 DataType getDataType() const;
50
51 LinkInfo getLinkInfo() const;
52
57 DataSpace getSpace() const;
58
64 DataSpace getMemSpace() const;
65
66 File getFile() const;
67
72 std::string unpackSoftLink() const;
73
74 void unlink() const;
75
83 bool rename(const std::string& dest_path,
84 const LinkCreateProps& linkCreateProps = LinkCreateProps(),
85 const LinkAccessProps& linkAccessProps = LinkAccessProps()) const;
86
87 Group getParent(const GroupAccessProps& groupAccessProps = GroupAccessProps()) const;
88
89 DataSetCreateProps getCreateProps() const;
90 DataSetAccessProps getAccessProps() const;
91
97 void resize(const std::vector<size_t>& dims);
98
99
104 inline std::vector<size_t> getDimensions() const {
105 return getSpace().getDimensions();
106 }
107
113 inline size_t getElementCount() const {
114 return getSpace().getElementCount();
115 }
116
120 bool operator==(const DataSet& other) const;
121 bool operator!=(const DataSet& other) const;
122
123 static DataSet FromId(const hid_t& id, const bool& increaseRefCount = false){
124 Object obj = Object(id, ObjectType::Dataset, increaseRefCount);
125 return DataSet(obj);
126 };
127
128protected:
129 DataSet(const Object& obj) : Object(obj){};
130 using Object::Object;
131
132 inline DataSet(Object&& o) noexcept : Object(std::move(o)) {}
133
134 friend class Reference;
135 friend class Selection;
136 template <typename Derivate> friend class NodeTraits;
137
138};
139
140} // namespace h5gt
141
142#endif // H5DATASET_HPP
Definition H5Annotate_traits.hpp:19
Definition H5PropertyList.hpp:255
Definition H5PropertyList.hpp:171
Class representing a dataset.
Definition H5DataSet.hpp:28
std::string unpackSoftLink() const
unpackSoftLink retrieve target path to this dataset
Definition H5DataSet_misc.hpp:63
size_t getElementCount() const
Get the total number of elements in the current dataset. E.g. 2x2x2 matrix has size 8....
Definition H5DataSet.hpp:113
uint64_t getOffset() const
getOffset
Definition H5DataSet_misc.hpp:119
void resize(const std::vector< size_t > &dims)
Change the size of the dataset.
Definition H5DataSet_misc.hpp:128
DataType getDataType() const
getDataType
Definition H5DataSet_misc.hpp:33
DataSpace getSpace() const
getSpace
Definition H5DataSet_misc.hpp:41
bool operator==(const DataSet &other) const
operator == Check if objects reside in the same file and equal to each other
Definition H5DataSet_misc.hpp:145
bool rename(const std::string &dest_path, const LinkCreateProps &linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps()) const
rename move link within container
Definition H5DataSet_misc.hpp:71
std::vector< size_t > getDimensions() const
Get the dimensions of the whole DataSet. This is a shorthand for getSpace().getDimensions()
Definition H5DataSet.hpp:104
DataSpace getMemSpace() const
getMemSpace
Definition H5DataSet_misc.hpp:50
uint64_t getStorageSize() const
getStorageSize
Definition H5DataSet_misc.hpp:29
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:48
File class.
Definition H5File.hpp:25
Definition H5PropertyList.hpp:162
Represents an hdf5 group.
Definition H5Group.hpp:23
Definition H5Object.hpp:55
Definition H5Slice_traits.hpp:54