|
musrfit 1.10.0
|
Common utilities for NeXus file handling. More...
Enumerations | |
| enum class | HDFType { HDF4 , HDF5 , Unknown } |
| Enumeration of supported HDF file types. More... | |
Functions | |
| HDFType | checkHDFType (const std::string &filename) |
| Determine the HDF format type of a file by reading its header. | |
| std::string | getIso8601TimestampLocal () |
| get the current time and return it as na IOS8601 time stamp. | |
Common utilities for NeXus file handling.
The nxs namespace provides utility functions that are common to both HDF4 and HDF5 implementations. This includes file type detection and shared enumerations.
|
strong |
Enumeration of supported HDF file types.
Used to identify whether a file is HDF4, HDF5, or of unknown format. This is determined by reading the file's magic bytes header.
| Enumerator | |
|---|---|
| HDF4 | HDF4 format (magic: 0x0e 0x03 0x13 0x01) |
| HDF5 | HDF5 format (magic: 0x89 'H' 'D' 'F' 0x0d 0x0a 0x1a 0x0a) |
| Unknown | Unrecognized file format. |
| nxs::HDFType nxs::checkHDFType | ( | const std::string & | filename | ) |
Determine the HDF format type of a file by reading its header.
Opens the file in binary mode and reads the first 8 bytes to compare against known HDF4 and HDF5 magic byte signatures. This allows automatic format detection before attempting to open the file with the appropriate library.
| filename | Path to the file to check |
Definition at line 100 of file PNeXus.cpp.
References HDF4, HDF5, and Unknown.
Referenced by dump_header_nexus(), and PRunDataHandler::ReadNexusFile().
| std::string nxs::getIso8601TimestampLocal | ( | ) |
get the current time and return it as na IOS8601 time stamp.
Definition at line 139 of file PNeXus.cpp.
Referenced by PRunDataHandler::WriteNexusFile().