ddn.data.hdf5.reference

HDF5 Reference Wrapper

This module provides a D wrapper for HDF5 reference operations with RAII semantics for automatic resource management. HDF5 references allow storing links to objects, regions, or attributes within an HDF5 file.

License

BSD-3-Clause

Types 2

Reference type enumeration for high-level API.

Provides a D-friendly enum for HDF5 reference types.

INVALID = H5R_type_t.BADTYPEInvalid reference type
OBJECT_V1 = H5R_type_t.OBJECT1Object reference (version 1, deprecated)
REGION_V1 = H5R_type_t.DATASET_REGION1Dataset region reference (version 1, deprecated)
OBJECT = H5R_type_t.OBJECT2Object reference (version 2)
REGION = H5R_type_t.DATASET_REGION2Dataset region reference (version 2)
ATTRIBUTE = H5R_type_t.ATTRAttribute reference
structReference

RAII wrapper for HDF5 reference handles.

This struct manages an HDF5 reference and automatically destroys it when the struct goes out of scope. References can point to objects, dataset regions, or attributes within an HDF5 file.

Example:

// Create an object reference
auto ref1 = Reference.createObject(file.handle(), "/mygroup");

// Create a region reference
auto ref2 = Reference.createRegion(file.handle(), "/dataset", spaceId);

// Create an attribute reference
auto ref3 = Reference.createAttribute(file.handle(), "/dataset", "myattr");

// Open referenced object
auto objId = ref1.openObject();
scope(exit) H5Oclose(objId);

Fields
private H5R_ref_t _ref
private bool _valid
Methods
Reference createObject(hid_t locId, string name, hid_t oapl = H5P_DEFAULT)Creates an object reference.
Reference createRegion(hid_t locId, string name, hid_t spaceId, hid_t oapl = H5P_DEFAULT)Creates a region reference.
Reference createAttribute(hid_t locId, string name, string attrName, hid_t oapl = H5P_DEFAULT)Creates an attribute reference.
void destroy()Destroys the reference and releases resources.
ReferenceType type() constReturns the reference type.
bool isValid() constChecks if the reference is valid.
bool equals(ref const Reference other) constCompares this reference with another reference.
hid_t openObject(hid_t rapl = H5P_DEFAULT, hid_t oapl = H5P_DEFAULT)Opens the referenced object.
hid_t openRegion(hid_t rapl = H5P_DEFAULT, hid_t oapl = H5P_DEFAULT)Opens the referenced region as a dataspace.
hid_t openAttribute(hid_t rapl = H5P_DEFAULT, hid_t aapl = H5P_DEFAULT)Opens the referenced attribute.
H5O_type_t getObjectType(hid_t rapl = H5P_DEFAULT)Gets the type of the referenced object.
string getFileName() constGets the file name containing the referenced object.
string getObjectName(hid_t rapl = H5P_DEFAULT)Gets the object name of the referenced object.
string getAttributeName() constGets the attribute name of the referenced attribute.
H5R_ref_t * ptr()Returns a pointer to the underlying reference structure.
const(H5R_ref_t) * ptr() constReturns a const pointer to the underlying reference structure.
Destructors
~thisDestructor that automatically destroys the reference.