h5gt 0.2.0
C++ wrapper for HDF5 library (based on HighFive project)
Loading...
Searching...
No Matches
H5Group.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 H5GT_H5GROUP_HPP
10#define H5GT_H5GROUP_HPP
11
12#include "H5Object.hpp"
13#include "bits/H5_definitions.hpp"
14#include "bits/H5Annotate_traits.hpp"
15#include "bits/H5Node_traits.hpp"
16
17namespace h5gt {
18
21class Group : public Object,
22 public NodeTraits<Group>,
23 public AnnotateTraits<Group> {
24public:
25
26 // this makes available to use both
27 // Object::getObjectType and NodeTraits<T>::getObjectType
31 using NodeTraits<Group>::unlink;
33
34 const static ObjectType type = ObjectType::Group;
35
36 LinkInfo getLinkInfo() const {
38 }
39
46 std::string unpackSoftLink() const{
47 return Object::_unpackSoftLink(getPath());
48 }
49
50 void unlink() const{
51 return Object::_unlink(getPath());
52 }
53
61 bool rename(const std::string& dest_path,
62 const LinkCreateProps& linkCreateProps = LinkCreateProps(),
63 const LinkAccessProps& linkAccessProps = LinkAccessProps()) const{
64 return NodeTraits<Group>::rename(getPath(), dest_path, linkCreateProps, linkAccessProps);
65 }
66
67 Group getParent(const GroupAccessProps& groupAccessProps = GroupAccessProps()) const {
68 std::string path = getPath();
69 if (path == "/")
70 HDF5ErrMapper::ToException<GroupException>(
71 std::string(path + " has no parent"));
72
73 std::string objName;
74 std::string parentPath = details::splitPathToParentAndObj(path, objName);
75 if (parentPath.empty())
76 HDF5ErrMapper::ToException<GroupException>(
77 std::string(objName + " has no parent"));
78
79 return getGroup(parentPath, groupAccessProps);
80 }
81
85 bool operator==(const Group& other) const {
86 return Object::operator==(other);
87 }
88
89 bool operator!=(const Group& other) const {
90 return !(*this == other);
91 }
92
93 static Group FromId(const hid_t& id, const bool& increaseRefCount = false){
94 Object obj = Object(id, ObjectType::Group, increaseRefCount);
95 return Group(obj);
96 };
97
98protected:
99 Group(const Object& obj) : Object(obj){};
100 using Object::Object;
101
102 inline Group(Object&& o) noexcept : Object(std::move(o)) {};
103
104 friend class File;
105 friend class Reference;
106 template <typename Derivate> friend class ::h5gt::NodeTraits;
107};
108
109} // namespace h5gt
110
111#endif // H5GT_H5GROUP_HPP
Definition H5Annotate_traits.hpp:19
Definition H5PropertyList.hpp:162
Represents an hdf5 group.
Definition H5Group.hpp:23
ObjectType getObjectType() const
Gets the fundamental type of the object (dataset, group, etc)
Definition H5Object_misc.hpp:195
std::string unpackSoftLink() const
unpackSoftLink retrieve the path where Soft link points to
Definition H5Group.hpp:46
bool rename(const std::string &dest_path, const LinkCreateProps &linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps()) const
rename move link within container
Definition H5Group.hpp:61
bool operator==(const Group &other) const
operator == Check if objects reside in the same file and equal to each other
Definition H5Group.hpp:85
NodeTraits: Base class for Group and File.
Definition H5Node_traits.hpp:23
bool rename(const std::string &src_path, const std::string &dest_path, const LinkCreateProps &linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps()) const
moves an object and its content within an HDF5 file.
Definition H5Node_traits_misc.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
Definition H5Object.hpp:55
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
ObjectType getObjectType() const
Gets the fundamental type of the object (dataset, group, etc)
Definition H5Object_misc.hpp:195
std::string getPath() const
return the path to the current group, dataset, datatype or attribute's holder
Definition H5Object_misc.hpp:185
bool operator==(const Object &other) const
When coparing objects h5gt::File must be open.
Definition H5Object_misc.hpp:105