Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add private DataSpace (named) ctor fromId. #1030

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions include/highfive/H5DataSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@

namespace HighFive {

namespace detail {
/// @brief Create a HighFive::DataSpace from an HID, without incrementing the id.
///
/// @note This is internal API and subject to change.
/// @internal
DataSpace make_data_space(hid_t hid);
} // namespace detail

/// \brief Class representing the space (dimensions) of a DataSet
///
/// \code{.cpp}
Expand Down Expand Up @@ -254,9 +262,18 @@ class DataSpace: public Object {
protected:
DataSpace() = default;

static DataSpace fromId(hid_t hid) {
DataSpace space;
space._hid = hid;

return space;
}

friend class Attribute;
friend class File;
friend class DataSet;

friend DataSpace detail::make_data_space(hid_t hid);
};

} // namespace HighFive
Expand Down
6 changes: 6 additions & 0 deletions include/highfive/bits/H5Dataspace_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@

namespace HighFive {

namespace detail {
inline DataSpace make_data_space(hid_t hid) {
return DataSpace::fromId(hid);
}
} // namespace detail

inline DataSpace::DataSpace(const std::vector<size_t>& dims)
: DataSpace(dims.begin(), dims.end()) {}

Expand Down
Loading