h5cpp  0.6
A modern C++ wrapper for the HDF5 C library
object_id.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2017 DESY,ESS
3 //
4 // This file is part of h5pp.
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 // Authors: Martin Shetty <martin.shetty@esss.se>
23 // Sebastian Koenig <skoenig@ncsu.edu>
24 //
25 #pragma once
26 
27 #include <h5cpp/core/hdf5_capi.hpp>
28 #include <string>
29 #include <sstream>
31 #include <h5cpp/core/windows.hpp>
33 
34 namespace hdf5
35 {
36 
49 
51 {
52  public:
59  ObjectId() {}
60 
70  ObjectId(const ObjectHandle &handle);
71 
75  bool operator== (const ObjectId& other) const;
76 
80  bool operator!= (const ObjectId& other) const;
81 
86  bool operator< (const ObjectId& other) const;
87 
88 #ifndef _DOXYGEN_ /* workaround for the #613 breathe bug */
92  DLL_EXPORT friend std::ostream & operator<<(std::ostream &os, const ObjectId& p);
93 #endif /* DOXYGEN */
94 
103  unsigned long file_number() const noexcept;
104 
113  haddr_t object_address() const noexcept;
114 
123  fs::path file_name() const noexcept;
124 
129  static std::string get_file_name(const ObjectHandle &handle);
130 
131 #if H5_VERSION_GE(1,11,0)
132 #define H5O_info_t_ H5O_info1_t
133 #else
134 #define H5O_info_t_ H5O_info_t
135 #endif
136 
144  static H5O_info_t_ get_info(const ObjectHandle &handle);
145 
146 
147  private:
148  unsigned long file_num_ {0};
149  haddr_t obj_addr_ {0};
150 #ifdef _MSC_VER
151 #pragma warning(push)
152 #pragma warning(disable: 4251)
153 #endif
154  fs::path file_name_;
155 #ifdef _MSC_VER
156 #pragma warning(pop)
157 #endif
158 };
159 
160 #ifdef _DOXYGEN_ /* workaround for the #613 breathe bug */
164  DLL_EXPORT friend std::ostream & operator<<(std::ostream &os, const ObjectId& p);
165 #endif /* DOXYGEN */
166 
167 }
Wrapper for hid_t object identifiers.
Definition: object_handle.hpp:67
Unique ID of an HDF5 object.
Definition: object_id.hpp:51
static H5O_info_t_ get_info(const ObjectHandle &handle)
get object info
ObjectId()
default constructor
Definition: object_id.hpp:59
unsigned long file_number() const noexcept
Get the HDF5 file number.
ObjectId(const ObjectHandle &handle)
constructor
top-level namespace of the entire library
Definition: attribute.hpp:45
bool operator<(const Version &lhs, const Version &rhs)
checks if the left version is strictly small than the right
bool operator!=(const ObjectHandle &lhs, const ObjectHandle &rhs)
not equal to operator
bool operator==(const ObjectHandle &lhs, const ObjectHandle &rhs)
equality operator
std::ostream & operator<<(std::ostream &stream, const IterationOrder &order)
ouput stream for iteration order enumeration
#define H5O_info_t_
Definition: object_id.hpp:134
#define DLL_EXPORT
Definition: windows.hpp:29