h5cpp  0.6.0
A modern C++ wrapper for the HDF5 C library
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:
56 
65  explicit LinkTarget(const hdf5::Path &object_path);
66 
75  explicit LinkTarget(const hdf5::Path &object_path,const fs::path &file_path);
76 
82  fs::path file_path() const;
83 
90 
91  private:
92 #ifdef _MSC_VER
93 #pragma warning(push)
94 #pragma warning(disable: 4251)
95 #endif
96  fs::path file_;
97 #ifdef _MSC_VER
98 #pragma warning(pop)
99 #endif
100  hdf5::Path object_path_;
101 };
102 
114 {
115  public:
123  Link(const file::File &file,
124  const Path &parent_path,
125  const std::string &link_name);
126 
132  Link() = default;
133 
140  Path path() const;
141 
147 
148 
153 
159  Group parent() const;
160 
161  const file::File &file() const;
162 
170  Node operator*() const;
171 
172 
176  bool exists() const;
177 
181  bool is_resolvable() const;
182 
183 
197  DLL_EXPORT friend bool operator==(const Link &lhs, const Link &rhs);
198 
199  private:
200  file::File parent_file_;
201  Path parent_path_;
202 #ifdef _MSC_VER
203 #pragma warning(push)
204 #pragma warning(disable: 4251)
205 #endif
206  std::string name_;
207 #ifdef _MSC_VER
208 #pragma warning(pop)
209 #endif
210 
211  H5L_info_t get_link_info(const property::LinkAccessList &lapl) const;
212  std::string get_link_value(const property::LinkAccessList &lapl) const;
213  LinkTarget get_soft_link_target(const property::LinkAccessList &lapl) const;
214  LinkTarget get_external_link_target(const property::LinkAccessList &lapl) const;
215 };
216 
217 DLL_EXPORT bool operator!=(const Link &lhs, const Link &rhs);
218 
219 DLL_EXPORT std::ostream &operator<<(std::ostream &stream,const Link &link);
220 
221 } // namespace node
222 } // namespace hdf5
path to a node object
Definition: path.hpp:54
Definition: file.hpp:52
Definition: group.hpp:51
link target descriptor
Definition: link.hpp:50
LinkTarget(const hdf5::Path &object_path)
constructor
fs::path file_path() const
get file path
LinkTarget(const hdf5::Path &object_path, const fs::path &file_path)
constructor
hdf5::Path object_path() const
get object path
LinkTarget()
default constructor
Definition: node.hpp:40
link access property list
Definition: link_access.hpp:43
std::ostream & operator<<(std::ostream &stream, const Link &link)
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.
LinkType
link type enumeration
Definition: types.hpp:72
bool operator!=(const Link &lhs, const Link &rhs)
top-level namespace of the entire library
Definition: attribute.hpp:45
#define DLL_EXPORT
Definition: windows.hpp:29