ddn.data.hdf5.attribute

HDF5 Attribute Wrapper

This module provides a D wrapper for HDF5 attribute operations with RAII semantics for automatic resource management.

License

BSD-3-Clause
struct Attribute

Types 1

structAttribute

RAII wrapper for HDF5 attribute handles.

This struct manages an HDF5 attribute handle and automatically closes it when the struct goes out of scope. Copy is disabled to prevent double-close issues; use move() for transferring ownership.

Example:

// Create an attribute
auto attr = Attribute.create(obj.handle(), "myattr", dtype.handle(), space.handle());

// Open an existing attribute
auto attr2 = Attribute.open(obj.handle(), "existing");

Fields
private hid_t _id
Methods
Attribute create(hid_t locId, string name, hid_t typeId, hid_t spaceId, hid_t acpl = H5P_DEFAULT, hid_t aapl = H5P_DEFAULT)Creates a new attribute.
Attribute open(hid_t locId, string name, hid_t aapl = H5P_DEFAULT)Opens an existing attribute.
bool exists(hid_t locId, string name)Checks if an attribute exists on an object.
void remove(hid_t locId, string name)Deletes an attribute from an object.
Attribute move(ref Attribute other)Moves ownership from another Attribute instance.
void close()Explicitly closes the attribute handle.
hid_t handle() const @nogc nothrow @safeReturns the underlying HDF5 attribute handle.
bool isValid() const @nogc nothrow @safeChecks if the attribute handle is valid.
hid_t space()Gets the dataspace of this attribute.
hid_t dtype()Gets the datatype of this attribute.
string name()Gets the name of this attribute.
hsize_t storageSize()Gets the storage size of this attribute in bytes.
void read(void * buffer, hid_t memTypeId)Reads data from the attribute.
void read(T)(T[] data, hid_t memTypeId)Reads data from the attribute into a D array.
void write(const void * buffer, hid_t memTypeId)Writes data to the attribute.
void write(T)(const T[] data, hid_t memTypeId)Writes data from a D array to the attribute.
Destructors
~thisDestructor that automatically closes the attribute handle.