h5cpp  0.3.3
A modern C++ wrapper for the HDF5 C library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
link.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2017 DESY,ESS
3 //
4 // This file is part of h5cpp.
5 //
6 // This library is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU Lesser General Public License as published
8 // by the Free Software Foundation; either version 2.1 of the License, or
9 // (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the
18 // Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
19 // Boston, MA 02110-1301 USA
20 // ===========================================================================
21 //
22 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
23 // Created on: Sep 11, 2017
24 //
25 #pragma once
26 
27 #include <h5cpp/file/file.hpp>
28 #include <h5cpp/core/path.hpp>
29 #include <h5cpp/core/windows.hpp>
31 #include <h5cpp/node/types.hpp>
32 
33 namespace hdf5 {
34 namespace node {
35 
36 class Group;
37 class Node;
38 
50 {
51  public:
55  LinkTarget();
56 
65  explicit LinkTarget(const hdf5::Path &object_path);
66 
75  explicit LinkTarget(const hdf5::Path &object_path,const boost::filesystem::path &file_path);
76 
82  boost::filesystem::path file_path() const;
83 
89  hdf5::Path object_path() const;
90 
91  private:
92  boost::filesystem::path file_;
93  hdf5::Path object_path_;
94 };
95 
106 {
107  public:
113  //1 \param link_name the name of the link below its parent
115  Link(const file::File &file,
116  const Path &parent_path,
117  const std::string &link_name);
118 
124  Link() = default;
125 
129  Link(const Link &) = default;
130 
137  Path path() const;
138 
143  LinkTarget target(const property::LinkAccessList &lapl = property::LinkAccessList()) const;
144 
145 
149  LinkType type(const property::LinkAccessList &lapl = property::LinkAccessList()) const;
150 
156  Group parent() const;
157 
158  const file::File &file() const;
159 
167  Node operator*() const;
168 
169 
173  bool exists() const;
174 
178  bool is_resolvable() const;
179 
180 
181  DLL_EXPORT friend bool operator==(const Link &lhs, const Link &rhs);
182 
183  private:
184  file::File parent_file_;
185  Path parent_path_;
186 #ifdef _MSC_VER
187 #pragma warning(push)
188 #pragma warning(disable: 4251)
189 #endif
190  std::string name_;
191 #ifdef _MSC_VER
192 #pragma warning(pop)
193 #endif
194 
195  H5L_info_t get_link_info(const property::LinkAccessList &lapl) const;
196  std::string get_link_value(const property::LinkAccessList &lapl) const;
197  LinkTarget get_soft_link_target(const property::LinkAccessList &lapl) const;
198  LinkTarget get_external_link_target(const property::LinkAccessList &lapl) const;
199 };
200 
201 DLL_EXPORT bool operator!=(const Link &lhs, const Link &rhs);
202 
203 DLL_EXPORT std::ostream &operator<<(std::ostream &stream,const Link &link);
204 
205 } // namespace node
206 } // namespace hdf5
LinkType
Definition: types.hpp:47
Definition: group.hpp:46
link target descriptor
Definition: link.hpp:49
Definition: attribute.hpp:43
DLL_EXPORT void link(const Node &target, const Group &link_base, const Path &link_path, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList())
Create a soft or external link.
DLL_EXPORT std::ostream & operator<<(std::ostream &stream, const Link &link)
DLL_EXPORT bool operator!=(const Link &lhs, const Link &rhs)
Definition: node.hpp:39
path to a node object
Definition: path.hpp:49
#define DLL_EXPORT
Definition: windows.hpp:35
Definition: file.hpp:43
DLL_EXPORT bool operator==(const Node &lhs, const Node &rhs)
link access property list
Definition: link_access.hpp:39