47 using T = std::underlying_type<DataTypeClass>::type;
48 return static_cast<DataTypeClass>(
static_cast<T
>(lhs) |
static_cast<T
>(rhs));
52 using T = std::underlying_type<DataTypeClass>::type;
53 return static_cast<DataTypeClass>(
static_cast<T
>(lhs) &
static_cast<T
>(rhs));
84 std::string
string()
const;
109 bool empty()
const noexcept;
116 return details::get_plist<DataTypeCreateProps>(*
this, H5Tget_create_plist);
126 template <
typename Derivate>
132 Ascii = H5T_CSET_ASCII,
133 Utf8 = H5T_CSET_UTF8,
149 using DataType::DataType;
197 return detail::h5t_get_sign(
getId()) != H5T_SGN_NONE;
201 using DataType::DataType;
228 :
name(std::move(t_name))
240 inline CompoundType(
const std::vector<member_def>& t_members,
size_t size = 0)
241 : members(t_members) {
244 inline CompoundType(std::vector<member_def>&& t_members,
size_t size = 0)
245 : members(std::move(t_members)) {
248 inline CompoundType(
const std::initializer_list<member_def>& t_members,
size_t size = 0)
249 : members(t_members) {
259 std::ostringstream ss;
260 ss <<
"hid " <<
_hid <<
" does not refer to a compound data type";
263 size_t n_members =
static_cast<size_t>(detail::h5t_get_nmembers(
_hid));
264 members.reserve(n_members);
265 for (
unsigned i = 0; i < n_members; i++) {
266 char* name = detail::h5t_get_member_name(
_hid, i);
267 size_t offset = detail::h5t_get_member_offset(
_hid, i);
268 hid_t member_hid = detail::h5t_get_member_type(
_hid, i);
270 members.emplace_back(std::string(name), member_type, offset);
272 detail::h5_free_memory(name);
279 inline void commit(
const Object&
object,
const std::string& name)
const;
282 inline const std::vector<member_def>&
getMembers() const noexcept {
288 std::vector<member_def> members;
293 void create(
size_t size = 0);
325 ,
value(std::move(t_value)) {}
333 : members(t_members) {
334 static_assert(std::is_enum<T>::value,
"EnumType<T>::create takes only enum");
335 if (members.empty()) {
336 HDF5ErrMapper::ToException<DataTypeException>(
337 "Could not create an enum without members");
342 EnumType(std::initializer_list<member_def> t_members)
348 void commit(
const Object&
object,
const std::string& name)
const;
351 std::vector<member_def> members;
383#define HIGHFIVE_REGISTER_TYPE(type, function) \
385 inline HighFive::DataType HighFive::create_datatype<type>() { \
create an HDF5 DataType from a C++ type
Definition H5DataType.hpp:211
AtomicType()
Definition H5DataType_misc.hpp:240
T basic_type
Definition H5DataType.hpp:215
Class representing an Attribute of a DataSet or Group.
Definition H5Attribute.hpp:47
Create a compound HDF5 datatype.
Definition H5DataType.hpp:222
void commit(const Object &object, const std::string &name) const
Commit datatype into the given Object.
Definition H5DataType_misc.hpp:345
const std::vector< member_def > & getMembers() const noexcept
Get read access to the CompoundType members.
Definition H5DataType.hpp:282
CompoundType(const std::initializer_list< member_def > &t_members, size_t size=0)
Definition H5DataType.hpp:248
CompoundType(const std::vector< member_def > &t_members, size_t size=0)
Initializes a compound type from a vector of member definitions.
Definition H5DataType.hpp:240
CompoundType(DataType &&type)
Initializes a compound type from a DataType.
Definition H5DataType.hpp:256
CompoundType(std::vector< member_def > &&t_members, size_t size=0)
Definition H5DataType.hpp:244
Class representing a dataset.
Definition H5DataSet.hpp:30
Exception specific to HighFive DataType interface.
Definition H5Exception.hpp:97
HDF5 Data Type.
Definition H5DataType.hpp:62
bool operator==(const DataType &other) const
Definition H5DataType_misc.hpp:44
bool isFixedLenStr() const
Returns whether the type is a fixed-length string.
Definition H5DataType_misc.hpp:56
DataTypeCreateProps getCreatePropertyList() const
Get the list of properties for creation of this DataType.
Definition H5DataType.hpp:115
size_t getSize() const
Returns the length (in bytes) of this type elements.
Definition H5DataType_misc.hpp:40
IntegerType asIntegerType() const
Returns this datatype as a IntegerType.
Definition H5DataType_misc.hpp:76
bool isVariableStr() const
Returns whether the type is a variable-length string.
Definition H5DataType_misc.hpp:52
bool empty() const noexcept
Check the DataType was default constructed.
Definition H5DataType_misc.hpp:32
std::string string() const
Returns a friendly description of the type (e.g. Float32)
Definition H5DataType_misc.hpp:88
DataTypeClass getClass() const
Return the fundamental type.
Definition H5DataType_misc.hpp:36
bool isReference() const
Returns whether the type is a Reference.
Definition H5DataType_misc.hpp:60
StringType asStringType() const
Returns this datatype as a StringType.
Definition H5DataType_misc.hpp:64
bool operator!=(const DataType &other) const
Definition H5DataType_misc.hpp:48
Create a enum HDF5 datatype.
Definition H5DataType.hpp:318
EnumType(std::initializer_list< member_def > t_members)
Definition H5DataType.hpp:342
EnumType(const EnumType &other)=default
void commit(const Object &object, const std::string &name) const
Commit datatype into the given Object.
Definition H5DataType_misc.hpp:362
EnumType(const std::vector< member_def > &t_members)
Definition H5DataType.hpp:332
File class.
Definition H5File.hpp:25
Definition H5DataType.hpp:153
An Integer datatype (i.e. H5T_INTEGER).
Definition H5DataType.hpp:194
bool isSigned()
Definition H5DataType.hpp:196
NodeTraits: Base class for Group and File.
Definition H5Node_traits.hpp:28
Definition H5Object.hpp:36
hid_t getId() const noexcept
getId
Definition H5Object_misc.hpp:75
Object()
Definition H5Object_misc.hpp:20
hid_t _hid
Definition H5Object.hpp:98
HDF5 property Lists.
Definition H5PropertyList.hpp:138
An HDF5 (object) reference type.
Definition H5Reference.hpp:33
Definition H5DataType.hpp:136
StringPadding getPadding() const
For fixed length stings return the padding.
Definition H5DataType_misc.hpp:92
CharacterSet getCharacterSet() const
For stings return the character set.
Definition H5DataType_misc.hpp:96
Definition H5DataType.hpp:180
Definition assert_compatible_spaces.hpp:15
DataType create_and_check_datatype()
Create a DataType instance representing type T and perform a sanity check on its size.
Definition H5DataType_misc.hpp:450
DataType create_datatype()
Create a DataType instance representing type T.
Definition H5DataType_misc.hpp:443
CharacterSet
Definition H5DataType.hpp:131
DataTypeClass operator|(DataTypeClass lhs, DataTypeClass rhs)
Definition H5DataType.hpp:46
DataTypeClass operator&(DataTypeClass lhs, DataTypeClass rhs)
Definition H5DataType.hpp:51
DataTypeClass
Enum of Fundamental data classes.
Definition H5DataType.hpp:31
StringPadding
Definition string_padding.hpp:7
Use for defining a sub-type of compound type.
Definition H5DataType.hpp:226
size_t offset
Definition H5DataType.hpp:233
member_def(std::string t_name, DataType t_base_type, size_t t_offset=0)
Definition H5DataType.hpp:227
DataType base_type
Definition H5DataType.hpp:232
std::string name
Definition H5DataType.hpp:231
Use for defining a member of enum type.
Definition H5DataType.hpp:322
T value
Definition H5DataType.hpp:327
std::string name
Definition H5DataType.hpp:326
member_def(const std::string &t_name, T t_value)
Definition H5DataType.hpp:323