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));
83 std::string
string()
const;
103 bool empty()
const noexcept;
110 return details::get_plist<DataTypeCreateProps>(*
this, H5Tget_create_plist);
120 template <
typename Derivate>
126 Ascii = H5T_CSET_ASCII,
127 Utf8 = H5T_CSET_UTF8,
143 using DataType::DataType;
206 :
name(std::move(t_name))
220 inline CompoundType(
const std::vector<member_def>& t_members,
size_t size = 0)
221 : members(t_members) {
224 inline CompoundType(std::vector<member_def>&& t_members,
size_t size = 0)
225 : members(std::move(t_members)) {
228 inline CompoundType(
const std::initializer_list<member_def>& t_members,
size_t size = 0)
229 : members(t_members) {
239 std::ostringstream ss;
240 ss <<
"hid " <<
_hid <<
" does not refer to a compound data type";
243 size_t n_members =
static_cast<size_t>(detail::h5t_get_nmembers(
_hid));
244 members.reserve(n_members);
245 for (
unsigned i = 0; i < n_members; i++) {
246 char* name = detail::h5t_get_member_name(
_hid, i);
247 size_t offset = detail::h5t_get_member_offset(
_hid, i);
248 hid_t member_hid = detail::h5t_get_member_type(
_hid, i);
250 members.emplace_back(std::string(name), member_type, offset);
252 detail::h5_free_memory(name);
259 inline void commit(
const Object&
object,
const std::string& name)
const;
262 inline const std::vector<member_def>&
getMembers() const noexcept {
268 std::vector<member_def> members;
273 void create(
size_t size = 0);
305 ,
value(std::move(t_value)) {}
313 : members(t_members) {
314 static_assert(std::is_enum<T>::value,
"EnumType<T>::create takes only enum");
315 if (members.empty()) {
317 "Could not create an enum without members");
322 EnumType(std::initializer_list<member_def> t_members)
328 void commit(
const Object&
object,
const std::string& name)
const;
331 std::vector<member_def> members;
347namespace deprecated {
357template <std::
size_t N>
385 void push_back(
const std::array<char, N>&);
390 std::string
getString(std::size_t index)
const;
393 inline const char*
operator[](std::size_t i)
const noexcept {
394 return datavec[i].data();
396 inline const char*
at(std::size_t i)
const {
397 return datavec.at(i).data();
399 inline bool empty() const noexcept {
400 return datavec.empty();
402 inline std::size_t
size() const noexcept {
403 return datavec.size();
409 return datavec.front().data();
411 inline const char*
back()
const {
412 return datavec.back().data();
415 return datavec[0].data();
417 inline const char*
data() const noexcept {
418 return datavec[0].data();
422 using vector_t =
typename std::vector<std::array<char, N>>;
433 return datavec.begin();
436 return datavec.end();
439 return datavec.begin();
442 return datavec.cbegin();
445 return datavec.end();
448 return datavec.cend();
451 return datavec.rbegin();
454 return datavec.rend();
457 return datavec.rbegin();
460 return datavec.rend();
470 deprecated::FixedLenStringArray<N>;
490#define HIGHFIVE_REGISTER_TYPE(type, function) \
492 inline HighFive::DataType HighFive::create_datatype<type>() { \
#define H5_DEPRECATED_USING(msg)
Definition H5_definitions.hpp:16
create an HDF5 DataType from a C++ type
Definition H5DataType.hpp:189
AtomicType()
Definition H5DataType_misc.hpp:235
T basic_type
Definition H5DataType.hpp:193
Class representing an Attribute of a DataSet or Group.
Definition H5Attribute.hpp:46
Create a compound HDF5 datatype.
Definition H5DataType.hpp:200
void commit(const Object &object, const std::string &name) const
Commit datatype into the given Object.
Definition H5DataType_misc.hpp:381
const std::vector< member_def > & getMembers() const noexcept
Get read access to the CompoundType members.
Definition H5DataType.hpp:262
CompoundType(const CompoundType &other)=default
CompoundType(const std::initializer_list< member_def > &t_members, size_t size=0)
Definition H5DataType.hpp:228
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:220
CompoundType(DataType &&type)
Initializes a compound type from a DataType.
Definition H5DataType.hpp:236
CompoundType(std::vector< member_def > &&t_members, size_t size=0)
Definition H5DataType.hpp:224
Class representing a dataset.
Definition H5DataSet.hpp:30
Exception specific to HighFive DataType interface.
Definition H5Exception.hpp:94
HDF5 Data Type.
Definition H5DataType.hpp:61
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:109
size_t getSize() const
Returns the length (in bytes) of this type elements.
Definition H5DataType_misc.hpp:40
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:76
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:298
EnumType(std::initializer_list< member_def > t_members)
Definition H5DataType.hpp:322
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:398
EnumType(const std::vector< member_def > &t_members)
Definition H5DataType.hpp:312
File class.
Definition H5File.hpp:24
Definition H5DataType.hpp:147
FixedLengthStringType(size_t size, StringPadding padding, CharacterSet character_set=CharacterSet::Ascii)
Create a fixed length string datatype.
Definition H5DataType_misc.hpp:88
NodeTraits: Base class for Group and File.
Definition H5Node_traits.hpp:28
Definition H5Object.hpp:54
Object()
Definition H5Object_misc.hpp:25
hid_t _hid
Definition H5Object.hpp:105
HDF5 property Lists.
Definition H5PropertyList.hpp:160
An HDF5 (object) reference type.
Definition H5Reference.hpp:33
Definition H5DataType.hpp:130
StringPadding getPadding() const
For fixed length stings return the padding.
Definition H5DataType_misc.hpp:80
CharacterSet getCharacterSet() const
For stings return the character set.
Definition H5DataType_misc.hpp:84
Definition H5DataType.hpp:174
VariableLengthStringType(CharacterSet character_set=CharacterSet::Ascii)
Create a variable length string HDF5 datatype.
Definition H5DataType_misc.hpp:103
A structure representing a set of fixed-length strings.
Definition H5DataType.hpp:358
typename vector_t::const_iterator const_iterator
Definition H5DataType.hpp:427
const_iterator end() const noexcept
Definition H5DataType.hpp:444
const_iterator cend() const noexcept
Definition H5DataType.hpp:447
void resize(std::size_t n)
Definition H5DataType.hpp:405
bool empty() const noexcept
Definition H5DataType.hpp:399
const char * front() const
Definition H5DataType.hpp:408
const_iterator cbegin() const noexcept
Definition H5DataType.hpp:441
void push_back(const std::string &)
Append an std::string to the buffer structure.
Definition H5DataType_misc.hpp:268
const char * back() const
Definition H5DataType.hpp:411
typename vector_t::reverse_iterator reverse_iterator
Definition H5DataType.hpp:428
const char * at(std::size_t i) const
Definition H5DataType.hpp:396
const char * operator[](std::size_t i) const noexcept
Definition H5DataType.hpp:393
std::string getString(std::size_t index) const
Retrieve a string from the structure as std::string.
Definition H5DataType_misc.hpp:282
reverse_iterator rend() noexcept
Definition H5DataType.hpp:453
typename vector_t::const_reverse_iterator const_reverse_iterator
Definition H5DataType.hpp:429
const_iterator begin() const noexcept
Definition H5DataType.hpp:438
FixedLenStringArray()=default
const_reverse_iterator rbegin() const noexcept
Definition H5DataType.hpp:456
iterator begin() noexcept
Definition H5DataType.hpp:432
char * data() noexcept
Definition H5DataType.hpp:414
typename vector_t::value_type value_type
Definition H5DataType.hpp:430
reverse_iterator rbegin() noexcept
Definition H5DataType.hpp:450
iterator end() noexcept
Definition H5DataType.hpp:435
const_reverse_iterator rend() const noexcept
Definition H5DataType.hpp:459
typename vector_t::iterator iterator
Definition H5DataType.hpp:426
std::size_t size() const noexcept
Definition H5DataType.hpp:402
const char * data() const noexcept
Definition H5DataType.hpp:417
Definition H5_definitions.hpp:22
DataType create_and_check_datatype()
Create a DataType instance representing type T and perform a sanity check on its size.
Definition H5DataType_misc.hpp:486
DataType create_datatype()
Create a DataType instance representing type T.
Definition H5DataType_misc.hpp:479
CharacterSet
Definition H5DataType.hpp:125
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:204
size_t offset
Definition H5DataType.hpp:211
member_def(std::string t_name, DataType t_base_type, size_t t_offset=0)
Definition H5DataType.hpp:205
DataType base_type
Definition H5DataType.hpp:210
std::string name
Definition H5DataType.hpp:209
Use for defining a member of enum type.
Definition H5DataType.hpp:302
T value
Definition H5DataType.hpp:307
std::string name
Definition H5DataType.hpp:306
member_def(const std::string &t_name, T t_value)
Definition H5DataType.hpp:303
static void ToException(const std::string &prefix_msg)
Definition H5Exception_misc.hpp:43