ddn.data.hdf5.file

HDF5 File Wrapper

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

License

BSD-3-Clause

Types 3

enumFileIntent : uint

File intent flags indicating how the file was opened.

READ_ONLY = H5F_ACC.RDONLYFile is opened for read-only access
READ_WRITE = H5F_ACC.RDWRFile is opened for read-write access
structFileInfo

D-friendly structure containing comprehensive information about an HDF5 file.

This is a high-level wrapper around the HDF5 H5F_info2_t structure, providing information about the file's superblock, free space, and shared object header messages.

Fields
SuperblockInfo superblockSuperblock information
FreeSpaceInfo freeSpaceFree space manager information
SharedObjectInfo sharedObjectsShared object header message information
Nested Templates
SuperblockInfoSuperblock information.
FreeSpaceInfoFree space manager information.
SharedObjectInfoShared object header message information.
structFile

RAII wrapper for HDF5 file handles.

This struct manages an HDF5 file 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 a new file
auto file = File.create("data.h5");

// Open an existing file
auto file2 = File.open("existing.h5", FileAccessMode.readOnly);

Fields
private hid_t _id
Methods
File create(string filename, FileCreateMode mode = FileCreateMode.truncate, hid_t fcpl = H5P_DEFAULT, hid_t fapl = H5P_DEFAULT)Creates a new HDF5 file.
File open(string filename, FileAccessMode mode = FileAccessMode.readOnly, hid_t fapl = H5P_DEFAULT)Opens an existing HDF5 file.
File move(ref File other)Moves ownership from another File instance.
void close()Explicitly closes the file handle.
hid_t handle() const @nogc nothrow @safeReturns the underlying HDF5 file handle.
bool isValid() const @nogc nothrow @safeChecks if the file handle is valid.
void flush(H5F_scope_t scope_ = H5F_scope_t.GLOBAL)Flushes all buffers associated with the file to disk.
hsize_t getFileSize()Gets the size of the file in bytes.
string getFileName()Gets the file name.
ptrdiff_t getObjectCount(uint types = H5F_OBJ.ALL)Gets the number of open object IDs in the file.
hid_t getCreatePlist()Gets the file creation property list used when creating this file.
hid_t getAccessPlist()Gets the file access property list used when opening this file.
FileIntent getIntent()Gets the intent (access mode) the file was opened with.
hssize_t getFreeSpace()Gets the amount of free space in the file.
FileInfo getInfo()Gets comprehensive information about the file.
void mount(string mountPoint, ref File childFile, hid_t plist = H5P_DEFAULT)Mounts another HDF5 file at a specified location in this file.
void unmount(string mountPoint)Unmounts a previously mounted file from the specified location.
void startSwmrWrite()Enables SWMR (Single Writer Multiple Reader) write mode for the file.
Destructors
~thisDestructor that automatically closes the file handle.