Skip to content

Commit

Permalink
Get the name of unknown types from the h5t class
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAce committed Feb 23, 2021
1 parent 9e5d3d0 commit 0eafe21
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions h5pp/include/h5pp/details/h5ppHdf5.h
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,19 @@ namespace h5pp::hdf5 {
} else {
h5pp::logger::log->debug("No C++ type match for non-committed HDF5 type");
}

return getCppType<std::nullopt_t>();
std::string name = "UNKNOWN TYPE";
if(H5Tget_class(type) == H5T_class_t::H5T_INTEGER) name ="H5T_INTEGER";
else if(H5Tget_class(type) == H5T_class_t::H5T_FLOAT) name ="H5T_FLOAT";
else if(H5Tget_class(type) == H5T_class_t::H5T_TIME) name ="H5T_TIME";
else if(H5Tget_class(type) == H5T_class_t::H5T_STRING) name ="H5T_STRING";
else if(H5Tget_class(type) == H5T_class_t::H5T_BITFIELD) name ="H5T_BITFIELD";
else if(H5Tget_class(type) == H5T_class_t::H5T_OPAQUE) name ="H5T_OPAQUE";
else if(H5Tget_class(type) == H5T_class_t::H5T_COMPOUND) name ="H5T_COMPOUND";
else if(H5Tget_class(type) == H5T_class_t::H5T_REFERENCE) name ="H5T_REFERENCE";
else if(H5Tget_class(type) == H5T_class_t::H5T_ENUM) name ="H5T_ENUM";
else if(H5Tget_class(type) == H5T_class_t::H5T_VLEN) name ="H5T_VLEN";
else if(H5Tget_class(type) == H5T_class_t::H5T_ARRAY) name ="H5T_ARRAY";
return {typeid(nullptr), name, getBytesPerElem(type)};
}

[[nodiscard]] inline TypeInfo getTypeInfo(std::optional<std::string> objectPath,
Expand Down

0 comments on commit 0eafe21

Please sign in to comment.