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

Move h5t_* to separate file. #860

Merged
merged 1 commit into from
Nov 24, 2023
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
59 changes: 1 addition & 58 deletions include/highfive/bits/H5DataType_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,67 +23,10 @@
#endif

#include "H5Inspector_misc.hpp"
#include "h5t_wrapper.hpp"

namespace HighFive {

namespace detail {

inline hid_t h5t_copy(hid_t original) {
auto copy = H5Tcopy(original);
if (copy == H5I_INVALID_HID) {
HDF5ErrMapper::ToException<DataTypeException>("Error copying datatype.");
}

return copy;
}

inline hsize_t h5t_get_size(hid_t hid) {
hsize_t size = H5Tget_size(hid);
if (size == 0) {
HDF5ErrMapper::ToException<DataTypeException>("Error getting size of datatype.");
}

return size;
}

inline H5T_cset_t h5t_get_cset(hid_t hid) {
auto cset = H5Tget_cset(hid);
if (cset == H5T_CSET_ERROR) {
HDF5ErrMapper::ToException<DataTypeException>("Error getting cset of datatype.");
}

return cset;
}

inline H5T_str_t h5t_get_strpad(hid_t hid) {
auto strpad = H5Tget_strpad(hid);
if (strpad == H5T_STR_ERROR) {
HDF5ErrMapper::ToException<DataTypeException>("Error getting strpad of datatype.");
}

return strpad;
}

inline void h5t_set_size(hid_t hid, hsize_t size) {
if (H5Tset_size(hid, size) < 0) {
HDF5ErrMapper::ToException<DataTypeException>("Error setting size of datatype.");
}
}

inline void h5t_set_cset(hid_t hid, H5T_cset_t cset) {
if (H5Tset_cset(hid, cset) < 0) {
HDF5ErrMapper::ToException<DataTypeException>("Error setting cset of datatype.");
}
}

inline void h5t_set_strpad(hid_t hid, H5T_str_t strpad) {
if (H5Tset_strpad(hid, strpad) < 0) {
HDF5ErrMapper::ToException<DataTypeException>("Error setting strpad of datatype.");
}
}
} // namespace detail


namespace { // unnamed
inline DataTypeClass convert_type_class(const H5T_class_t& tclass);
inline std::string type_class_string(DataTypeClass);
Expand Down
63 changes: 63 additions & 0 deletions include/highfive/bits/h5t_wrapper.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#pragma once

#include <H5Tpublic.h>

namespace HighFive {
namespace detail {

inline hid_t h5t_copy(hid_t original) {
auto copy = H5Tcopy(original);
if (copy == H5I_INVALID_HID) {
HDF5ErrMapper::ToException<DataTypeException>("Error copying datatype.");

Check warning on line 11 in include/highfive/bits/h5t_wrapper.hpp

View check run for this annotation

Codecov / codecov/patch

include/highfive/bits/h5t_wrapper.hpp#L11

Added line #L11 was not covered by tests
}

return copy;
}

inline hsize_t h5t_get_size(hid_t hid) {
hsize_t size = H5Tget_size(hid);
if (size == 0) {
HDF5ErrMapper::ToException<DataTypeException>("Error getting size of datatype.");

Check warning on line 20 in include/highfive/bits/h5t_wrapper.hpp

View check run for this annotation

Codecov / codecov/patch

include/highfive/bits/h5t_wrapper.hpp#L20

Added line #L20 was not covered by tests
}

return size;
}

inline H5T_cset_t h5t_get_cset(hid_t hid) {
auto cset = H5Tget_cset(hid);
if (cset == H5T_CSET_ERROR) {
HDF5ErrMapper::ToException<DataTypeException>("Error getting cset of datatype.");

Check warning on line 29 in include/highfive/bits/h5t_wrapper.hpp

View check run for this annotation

Codecov / codecov/patch

include/highfive/bits/h5t_wrapper.hpp#L29

Added line #L29 was not covered by tests
}

return cset;
}

inline H5T_str_t h5t_get_strpad(hid_t hid) {
auto strpad = H5Tget_strpad(hid);
if (strpad == H5T_STR_ERROR) {
HDF5ErrMapper::ToException<DataTypeException>("Error getting strpad of datatype.");

Check warning on line 38 in include/highfive/bits/h5t_wrapper.hpp

View check run for this annotation

Codecov / codecov/patch

include/highfive/bits/h5t_wrapper.hpp#L38

Added line #L38 was not covered by tests
}

return strpad;
}

inline void h5t_set_size(hid_t hid, hsize_t size) {
if (H5Tset_size(hid, size) < 0) {
HDF5ErrMapper::ToException<DataTypeException>("Error setting size of datatype.");

Check warning on line 46 in include/highfive/bits/h5t_wrapper.hpp

View check run for this annotation

Codecov / codecov/patch

include/highfive/bits/h5t_wrapper.hpp#L46

Added line #L46 was not covered by tests
}
}

inline void h5t_set_cset(hid_t hid, H5T_cset_t cset) {
if (H5Tset_cset(hid, cset) < 0) {
HDF5ErrMapper::ToException<DataTypeException>("Error setting cset of datatype.");

Check warning on line 52 in include/highfive/bits/h5t_wrapper.hpp

View check run for this annotation

Codecov / codecov/patch

include/highfive/bits/h5t_wrapper.hpp#L52

Added line #L52 was not covered by tests
}
}

inline void h5t_set_strpad(hid_t hid, H5T_str_t strpad) {
if (H5Tset_strpad(hid, strpad) < 0) {
HDF5ErrMapper::ToException<DataTypeException>("Error setting strpad of datatype.");

Check warning on line 58 in include/highfive/bits/h5t_wrapper.hpp

View check run for this annotation

Codecov / codecov/patch

include/highfive/bits/h5t_wrapper.hpp#L58

Added line #L58 was not covered by tests
}
}

} // namespace detail
} // namespace HighFive