HighFive 2.10.1
HighFive - Header-only C++ HDF5 interface
|
#include <H5DataType.hpp>
Public Member Functions | |
FixedLengthStringType (size_t size, StringPadding padding, CharacterSet character_set=CharacterSet::Ascii) | |
Create a fixed length string datatype. | |
![]() | |
CharacterSet | getCharacterSet () const |
For stings return the character set. | |
StringPadding | getPadding () const |
For fixed length stings return the padding. | |
![]() | |
bool | operator== (const DataType &other) const |
bool | operator!= (const DataType &other) const |
DataTypeClass | getClass () const |
Return the fundamental type. | |
size_t | getSize () const |
Returns the length (in bytes) of this type elements. | |
std::string | string () const |
Returns a friendly description of the type (e.g. Float32) | |
bool | isVariableStr () const |
Returns whether the type is a variable-length string. | |
bool | isFixedLenStr () const |
Returns whether the type is a fixed-length string. | |
StringType | asStringType () const |
Returns this datatype as a StringType . | |
bool | empty () const noexcept |
Check the DataType was default constructed. | |
bool | isReference () const |
Returns whether the type is a Reference. | |
DataTypeCreateProps | getCreatePropertyList () const |
Get the list of properties for creation of this DataType. | |
![]() | |
Object (Object &&other) noexcept | |
~Object () | |
bool | isValid () const noexcept |
isValid | |
hid_t | getId () const noexcept |
getId | |
ObjectInfo | getInfo () const |
Retrieve several infos about the current object (address, dates, etc) | |
ObjectType | getType () const |
Gets the fundamental type of the object (dataset, group, etc) | |
bool | operator== (const Object &other) const noexcept |
Additional Inherited Members | |
![]() | |
Object (Object &&other) noexcept | |
Object () | |
Object (const Object &other) | |
Object (hid_t) | |
![]() | |
Object () | |
Object (const Object &other) | |
Object (hid_t) | |
Object & | operator= (const Object &other) |
![]() | |
hid_t | _hid |
|
inline |
Create a fixed length string datatype.
The string will be size
bytes long, regardless whether it's ASCII or UTF8. In particular, a string with n
UFT8 characters in general requires 4*n
bytes.
The string padding is subtle, essentially it's just a hint. While commonly, a null-terminated string is guaranteed to have one ‘’\0' which marks the semantic end of the string, this is not enforced by HDF5. In fact, there are HDF5 files that contain strings that claim to be null-terminated but aren't. The length of the buffer must be at least
sizebytes regardless of the padding. HDF5 will read or write
sizebytes, irrespective of when (if at all) the
\0` occurs.
Note that when writing, passing StringPadding::NullTerminated
is a guarantee to the reader that it contains a \0
. Therefore, make sure that the string really is null-terminated. Otherwise prefer a null-padded string. This mearly states that the buffer is filled up with 0 or more \0
.