36template <
typename Derivate>
45 return DataSet(detail::h5d_create2(
static_cast<Derivate*
>(
this)->getId(),
51 accessProps.
getId()));
54template <
typename Derivate>
62 dataset_name, space, create_and_check_datatype<T>(), createProps, accessProps, parents);
65template <
typename Derivate>
73 createDataSet(dataset_name,
83template <
typename Derivate>
84template <std::
size_t N>
90 DataSet ds = createDataSet<char[N]>(
91 dataset_name,
DataSpace(data.
size()), createProps, accessProps, parents);
96template <
typename Derivate>
99 return DataSet(detail::h5d_open2(
static_cast<const Derivate*
>(
this)->getId(),
100 dataset_name.c_str(),
101 accessProps.
getId()));
104template <
typename Derivate>
108 return detail::make_group(detail::h5g_create2(
static_cast<Derivate*
>(
this)->getId(),
115template <
typename Derivate>
121 return detail::make_group(detail::h5g_create2(
static_cast<Derivate*
>(
this)->getId(),
128template <
typename Derivate>
130 return detail::make_group(detail::h5g_open2(
static_cast<const Derivate*
>(
this)->getId(),
135template <
typename Derivate>
138 return DataType(detail::h5t_open2(
static_cast<const Derivate*
>(
this)->getId(),
140 accessProps.
getId()));
143template <
typename Derivate>
146 detail::h5g_get_num_objs(
static_cast<const Derivate*
>(
this)->getId(), &res);
147 return static_cast<size_t>(res);
150template <
typename Derivate>
152 return details::get_name([&](
char* buffer,
size_t length) {
153 return detail::h5l_get_name_by_idx(
static_cast<const Derivate*
>(
this)->getId(),
164template <
typename Derivate>
166 const std::string& dst_path,
167 bool parents)
const {
170 herr_t err = detail::h5l_move(
static_cast<const Derivate*
>(
this)->getId(),
172 static_cast<const Derivate*
>(
this)->getId(),
180template <
typename Derivate>
182 std::vector<std::string> names;
183 details::HighFiveIterateData iterateData(names);
185 size_t num_objs = getNumberObjects();
186 names.reserve(num_objs);
188 detail::h5l_iterate(
static_cast<const Derivate*
>(
this)->getId(),
189 static_cast<H5_index_t
>(idx_type),
192 &details::internal_high_five_iterate<H5L_info_t>,
193 static_cast<void*
>(&iterateData));
197template <
typename Derivate>
200 const auto val = detail::nothrow::h5l_exists(
static_cast<const Derivate*
>(
this)->getId(),
214 return (node_name ==
"/") ? true : (val > 0);
217template <
typename Derivate>
221 if (group_path.find(
'/') != std::string::npos) {
224 return (group_path ==
"/") ? true : _exist(group_path,
false);
226 return _exist(group_path);
230template <
typename Derivate>
232 detail::h5l_delete(
static_cast<const Derivate*
>(
this)->getId(), node_name.c_str(), H5P_DEFAULT);
238static inline LinkType _convert_link_type(
const H5L_type_t& ltype)
noexcept {
244 case H5L_TYPE_EXTERNAL:
253template <
typename Derivate>
256 detail::h5l_get_info(
static_cast<const Derivate*
>(
this)->getId(),
261 if (linkinfo.type == H5L_TYPE_ERROR) {
263 "\" is H5L_TYPE_ERROR");
265 return _convert_link_type(linkinfo.type);
268template <
typename Derivate>
270 return _open(node_name).getType();
274template <
typename Derivate>
276 const std::string& obj_path,
279 const bool parents) {
283 detail::h5l_create_soft(obj_path.c_str(),
284 static_cast<const Derivate*
>(
this)->getId(),
286 linkCreateProps.
getId(),
287 linkAccessProps.
getId());
291template <
typename Derivate>
293 const std::string& h5_file,
294 const std::string& obj_path,
297 const bool parents) {
301 detail::h5l_create_external(h5_file.c_str(),
303 static_cast<const Derivate*
>(
this)->getId(),
305 linkCreateProps.
getId(),
306 linkAccessProps.
getId());
309template <
typename Derivate>
310template <
typename T,
typename>
315 const bool parents) {
316 static_assert(!std::is_same<T, Attribute>::value,
317 "hdf5 doesn't support hard links to Attributes");
321 detail::h5l_create_hard(target_obj.getId(),
323 static_cast<const Derivate*
>(
this)->getId(),
325 linkCreateProps.
getId(),
326 linkAccessProps.
getId());
330template <
typename Derivate>
332 const auto id = detail::h5o_open(
static_cast<const Derivate*
>(
this)->getId(),
335 return detail::make_object(
id);
Class representing a dataset.
Definition H5DataSet.hpp:30
Class representing the space (dimensions) of a DataSet.
Definition H5DataSpace.hpp:39
static DataSpace From(const T &value)
Automatically deduce the DataSpace from a container/value.
Definition H5Dataspace_misc.hpp:128
HDF5 Data Type.
Definition H5DataType.hpp:61
Represents an hdf5 group.
Definition H5Group.hpp:46
NodeTraits: Base class for Group and File.
Definition H5Node_traits.hpp:28
Group getGroup(const std::string &group_name) const
open an existing group with the name group_name
Definition H5Node_traits_misc.hpp:129
std::vector< std::string > listObjectNames(IndexType idx_type=IndexType::NAME) const
list all leaf objects name of the node / group
Definition H5Node_traits_misc.hpp:181
void unlink(const std::string &node_name) const
unlink the given dataset or group
Definition H5Node_traits_misc.hpp:231
void createExternalLink(const std::string &link_name, const std::string &h5_file, const std::string &obj_path, LinkCreateProps linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps(), const bool parents=true)
Definition H5Node_traits_misc.hpp:292
DataType getDataType(const std::string &type_name, const DataTypeAccessProps &accessProps=DataTypeAccessProps::Default()) const
open a commited datatype with the name type_name
Definition H5Node_traits_misc.hpp:136
DataSet getDataSet(const std::string &dataset_name, const DataSetAccessProps &accessProps=DataSetAccessProps::Default()) const
get an existing dataset in the current file
Definition H5Node_traits_misc.hpp:97
void createSoftLink(const std::string &linkName, const T &obj)
A shorthand to create softlink to any object which provides getPath The link will be created with def...
Definition H5Node_traits.hpp:181
void createHardLink(const std::string &link_name, const T &target_obj, LinkCreateProps linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps(), const bool parents=true)
Creates hardlinks.
Definition H5Node_traits_misc.hpp:311
Group createGroup(const std::string &group_name, bool parents=true)
create a new group, and eventually intermediate groups
Definition H5Node_traits_misc.hpp:105
DataSet createDataSet(const std::string &dataset_name, const DataSpace &space, const DataType &type, const DataSetCreateProps &createProps=DataSetCreateProps::Default(), const DataSetAccessProps &accessProps=DataSetAccessProps::Default(), bool parents=true)
createDataSet Create a new dataset in the current file of datatype type and of size space
Definition H5Node_traits_misc.hpp:37
bool rename(const std::string &src_path, const std::string &dest_path, bool parents=true) const
moves an object and its content within an HDF5 file.
Definition H5Node_traits_misc.hpp:165
bool exist(const std::string &node_name) const
check a dataset or group exists in the current node / group
Definition H5Node_traits_misc.hpp:218
ObjectType getObjectType(const std::string &node_name) const
A shorthand to get the kind of object pointed to (group, dataset, type...)
Definition H5Node_traits_misc.hpp:269
size_t getNumberObjects() const
return the number of leaf objects of the node / group
Definition H5Node_traits_misc.hpp:144
std::string getObjectName(size_t index) const
return the name of the object with the given index
Definition H5Node_traits_misc.hpp:151
LinkType getLinkType(const std::string &node_name) const
Returns the kind of link of the given name (soft, hard...)
Definition H5Node_traits_misc.hpp:254
Definition H5Object.hpp:54
hid_t getId() const noexcept
getId
Definition H5Object_misc.hpp:69
HDF5 property Lists.
Definition H5PropertyList.hpp:160
void add(const P &property)
Definition H5PropertyList_misc.hpp:72
Utility class to disable HDF5 stack printing inside a scope.
Definition H5Utility.hpp:24
void write(const T &buffer, const DataTransferProps &xfer_props=DataTransferProps())
Definition H5Slice_traits_misc.hpp:256
A structure representing a set of fixed-length strings.
Definition H5DataType.hpp:356
std::size_t size() const noexcept
Definition H5DataType.hpp:400
Definition H5_definitions.hpp:22
DataType create_and_check_datatype()
Create a DataType instance representing type T and perform a sanity check on its size.
Definition H5DataType_misc.hpp:486
LinkType
The possible types of group entries (link concept)
Definition H5Node_traits.hpp:237
ObjectType
Enum of the types of objects (H5O api)
Definition H5Object.hpp:24
IndexType
Definition H5Node_traits.hpp:19
static void ToException(const std::string &prefix_msg)
Definition H5Exception_misc.hpp:43