9#ifndef H5DATASET_MISC_HPP
10#define H5DATASET_MISC_HPP
19#include <boost/multi_array.hpp>
30 return H5Dget_storage_size(_hid);
37inline LinkInfo DataSet::getLinkInfo()
const {
43 if ((space._hid = H5Dget_space(_hid)) < 0) {
44 HDF5ErrMapper::ToException<DataSetException>(
45 "Unable to get DataSpace out of DataSet");
54inline File DataSet::getFile()
const {
55 hid_t fileId = H5Iget_file_id(_hid);
56 if (!H5Iis_valid(fileId)){
57 HDF5ErrMapper::ToException<DataSetException>(
58 std::string(
"File ID is invalid. Probably the object doesn't belong to any file"));
60 return File::FromId(fileId,
false);
64 return Object::_unpackSoftLink(
getPath());
67inline void DataSet::unlink()
const{
68 return Object::_unlink(
getPath());
75 getId(
false), dst_path.c_str(),
76 linkCreateProps.getId(
false), linkAccessProps.getId(
false));
78 HDF5ErrMapper::ToException<DataSetException>(
79 std::string(
"Unable to move link to \"") + dst_path +
"\":");
88 HDF5ErrMapper::ToException<DataSetException>(
89 std::string(path +
" has no parent"));
92 std::string parentPath = details::splitPathToParentAndObj(path, objName);
93 if (parentPath.empty())
94 HDF5ErrMapper::ToException<DataSetException>(
95 std::string(objName +
" has no parent"));
97 File file = getFile();
98 return file.
getGroup(parentPath, groupAccessProps);
101inline DataSetCreateProps DataSet::getCreateProps()
const{
102 hid_t prop_id = H5Dget_create_plist(_hid);
104 HDF5ErrMapper::ToException<DataSetException>(
105 "Cannot get creation property list for a DataSet");
107 return DataSetCreateProps::FromId(prop_id,
false);
110inline DataSetAccessProps DataSet::getAccessProps()
const{
111 hid_t prop_id = H5Dget_access_plist(_hid);
113 HDF5ErrMapper::ToException<DataSetException>(
114 "Cannot get access property list for a DataSet");
116 return DataSetAccessProps::FromId(prop_id,
false);
120 uint64_t addr = H5Dget_offset(_hid);
121 if (addr == HADDR_UNDEF) {
122 HDF5ErrMapper::ToException<DataSetException>(
123 "Cannot get offset of DataSet.");
131 if (dims.size() != numDimensions) {
132 HDF5ErrMapper::ToException<DataSetException>(
133 "Invalid dataspace dimensions, got " + std::to_string(dims.size()) +
134 " expected " + std::to_string(numDimensions));
137 std::vector<hsize_t> real_dims(dims.begin(), dims.end());
139 if (H5Dset_extent(
getId(
false), real_dims.data()) < 0) {
140 HDF5ErrMapper::ToException<DataSetException>(
141 "Could not resize dataset.");
149inline bool DataSet::operator!=(
const DataSet& other)
const {
150 return !(*
this == other);
Class representing a dataset.
Definition H5DataSet.hpp:28
std::string unpackSoftLink() const
unpackSoftLink retrieve target path to this dataset
Definition H5DataSet_misc.hpp:63
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
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
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 H5PropertyList.hpp:138
Definition H5PropertyList.hpp:129
Definition H5Object.hpp:200
Group getGroup(const std::string &group_name, const GroupAccessProps &groupAccessProps=GroupAccessProps()) const
open an existing group with the name group_name
Definition H5Node_traits_misc.hpp:142
LinkInfo _getLinkInfo(const std::string &objPath) const
getLinkInfo retrieve link info from an object with 'objPath'. This object must reside in the same con...
Definition H5Object_misc.hpp:216
std::string getPath() const
return the path to the current group, dataset, datatype or attribute's holder
Definition H5Object_misc.hpp:185
hid_t getId(const bool &increaseRefCount=false) const noexcept
getId
Definition H5Object_misc.hpp:172
bool operator==(const Object &other) const
When coparing objects h5gt::File must be open.
Definition H5Object_misc.hpp:105