Class File¶
Defined in File h5ppFile.h
Class Documentation¶
-
class
h5pp
::
File
¶ Writes and reads data to a binary hdf5-file.
Public Functions
-
File
()¶
-
File
(const std::string &filePath_, h5pp::FilePermission permission_ = h5pp::FilePermission::RENAME, size_t logLevel_ = 2, bool logTimestamp_ = false)¶
-
File
(const std::string &filePath_, unsigned int H5F_ACC_FLAGS, size_t logLevel_ = 2, bool logTimestamp_ = false)¶
-
~File
()¶
-
void
flush
()¶
-
h5pp::FilePermission
getFilePermission
() const¶
-
std::string
getFileName
() const¶
-
std::string
getFilePath
() const¶
-
void
setFilePermission
(h5pp::FilePermission permission_)¶
-
void
setDriver_sec2
()¶
-
void
setDriver_stdio
()¶
-
void
setDriver_core
(bool writeOnClose = true, size_t bytesPerMalloc = 10240000)¶
-
fs::path
copyFileTo
(const std::string &targetFilePath, const FilePermission &perm = FilePermission::COLLISION_FAIL) const¶
-
fs::path
moveFileTo
(const std::string &targetFilePath, const FilePermission &perm = FilePermission::COLLISION_FAIL)¶
-
void
copyLinkToFile
(const std::string &localLinkPath, const std::string &targetFilePath, const std::string &targetLinkPath, const FilePermission &targetFileCreatePermission = FilePermission::READWRITE) const¶
-
void
copyLinkFromFile
(const std::string &localLinkPath, const std::string &sourceFilePath, const std::string &sourceLinkPath)¶
-
template<typename
h5x_tgt
, typename = h5pp::type::sfinae::enable_if_is_h5_loc<h5x_tgt>>
voidcopyLinkToLocation
(const std::string &localLinkPath, const h5x_tgt &targetLocationId, const std::string &targetLinkPath) const¶
-
template<typename
h5x_src
, typename = h5pp::type::sfinae::enable_if_is_h5_loc<h5x_src>>
voidcopyLinkFromLocation
(const std::string &localLinkPath, const h5x_src &sourceLocationId, const std::string &sourceLinkPath)¶
-
size_t
getLogLevel
() const¶
-
void
setLogLevel
(size_t logLevelZeroToFive)¶
-
void
setCompressionLevel
(unsigned int compressionLevelZeroToNine)¶
-
unsigned int
getCompressionLevel
() const¶
-
unsigned int
getCompressionLevel
(std::optional<unsigned int> desiredCompressionLevel) const¶
-
void
createGroup
(std::string_view group_relative_name)¶
-
void
resizeDataset
(DsetInfo &info, const DimsType &newDimensions, std::optional<h5pp::ResizeMode> mode_override = std::nullopt)¶
-
template<typename
DsetDimsType
= std::initializer_list<hsize_t>, typename = h5pp::type::sfinae::enable_if_is_integral_iterable_or_num<DsetDimsType>>
DsetInforesizeDataset
(std::string_view dsetPath, const DsetDimsType &newDimensions, std::optional<h5pp::ResizeMode> mode = std::nullopt)¶
-
DsetInfo
createDataset
(std::optional<hid::h5t> h5Type, std::string_view dsetPath, const DimsType &dsetDims, std::optional<H5D_layout_t> h5Layout = std::nullopt, const OptDimsType &dsetDimsChunk = std::nullopt, const OptDimsType &dsetDimsMax = std::nullopt, std::optional<unsigned int> compression = std::nullopt)¶
-
template<typename
DataType
>
DsetInfocreateDataset
(const DataType &data, std::string_view dsetPath, const OptDimsType &dataDims = std::nullopt, std::optional<H5D_layout_t> h5Layout = std::nullopt, const OptDimsType &dsetDimsChunk = std::nullopt, const OptDimsType &dsetDimsMax = std::nullopt, std::optional<unsigned int> compression = std::nullopt)¶
-
template<typename
DataType
>
voidwriteDataset
(const DataType &data, DsetInfo &dsetInfo, const Options &options = Options())¶
-
template<typename
DataType
>
voidwriteDataset
(const DataType &data, const DataInfo &dataInfo, DsetInfo &dsetInfo)¶
-
template<typename
DataType
>
DsetInfowriteDataset
(const DataType &data, std::string_view dsetPath, const OptDimsType &dataDims = std::nullopt, std::optional<H5D_layout_t> h5Layout = std::nullopt, const OptDimsType &dsetDimsChunk = std::nullopt, const OptDimsType &dsetDimsMax = std::nullopt, std::optional<hid::h5t> h5Type = std::nullopt, std::optional<ResizeMode> resizeMode = std::nullopt, std::optional<unsigned int> compression = std::nullopt)¶ - Parameters
data
: Eigen, stl-like object or pointer to data bufferdsetPath
: Path to HDF5 dataset relative to the file rootdataDims
: Data dimensions hint. Required for pointer datah5Layout
: (On create) Layout of dataset. Choose between H5D_CHUNKED,H5D_COMPACT and H5D_CONTIGUOUSdsetDimsChunk
: (On create) Chunking dimensions. Only valid for H5D_CHUNKED datasetsdsetDimsMax
: (On create) Maximum dimensions. Only valid for H5D_CHUNKED datasetsh5Type
: (On create) Type of dataset. Override automatic type detection.resizeMode
: Type of resizing if needed. Choose INCREASE_ONLY, RESIZE_TO_FIT,DO_NOT_RESIZEcompression
: (On create) Compression level 0-9, 0 = off, 9 is gives best compression and is slowest
-
template<typename
DataType
>
DsetInfowriteDataset
(const DataType &data, std::string_view dsetPath, hid::h5t &h5Type, const OptDimsType &dataDims = std::nullopt, std::optional<H5D_layout_t> h5Layout = std::nullopt, const OptDimsType &dsetDimsChunk = std::nullopt, const OptDimsType &dsetDimsMax = std::nullopt, std::optional<ResizeMode> resizeMode = std::nullopt, std::optional<unsigned int> compression = std::nullopt)¶ - Parameters
data
: Eigen, stl-like object or pointer to data bufferdsetPath
: Path to HDF5 dataset relative to the file rooth5Type
: (On create) Type of dataset. Override automatic type detection.dataDims
: Data dimensions hint. Required for pointer datah5Layout
: (On create) Layout of dataset. Choose between H5D_CHUNKED,H5D_COMPACT and H5D_CONTIGUOUSdsetDimsChunk
: (On create) Chunking dimensions. Only valid for H5D_CHUNKED datasetsdsetDimsMax
: (On create) Maximum dimensions. Only valid for H5D_CHUNKED datasetsresizeMode
: Type of resizing if needed. Choose INCREASE_ONLY, RESIZE_TO_FIT,DO_NOT_RESIZEcompression
: (On create) Compression level 0-9, 0 = off, 9 is gives best compression and is slowest
-
template<typename
DataType
>
DsetInfowriteDataset
(const DataType &data, std::string_view dsetPath, H5D_layout_t h5Layout, const OptDimsType &dataDims = std::nullopt, const OptDimsType &dsetDimsChunk = std::nullopt, const OptDimsType &dsetDimsMax = std::nullopt, std::optional<hid::h5t> h5Type = std::nullopt, std::optional<ResizeMode> resizeMode = std::nullopt, std::optional<unsigned int> compression = std::nullopt)¶ - Parameters
data
: Eigen, stl-like object or pointer to data bufferdsetPath
: Path to HDF5 dataset relative to the file rooth5Layout
: (On create) Layout of dataset. Choose between H5D_CHUNKED,H5D_COMPACT and H5D_CONTIGUOUSdataDims
: Data dimensions hint. Required for pointer datadsetDimsChunk
: (On create) Chunking dimensions. Only valid for H5D_CHUNKED datasetsdsetDimsMax
: (On create) Maximum dimensions. Only valid for H5D_CHUNKED datasetsh5Type
: (On create) Type of dataset. Override automatic type detection.resizeMode
: Type of resizing if needed. Choose INCREASE_ONLY, RESIZE_TO_FIT,DO_NOT_RESIZEcompression
: (On create) Compression level 0-9, 0 = off, 9 is gives best compression and is slowest
-
template<typename
DataType
>
DsetInfowriteDataset_compact
(const DataType &data, std::string_view dsetPath, const OptDimsType &dataDims = std::nullopt, std::optional<hid::h5t> h5Type = std::nullopt)¶
-
template<typename
DataType
>
DsetInfowriteDataset_contiguous
(const DataType &data, std::string_view dsetPath, const OptDimsType &dataDims = std::nullopt, std::optional<hid::h5t> h5Type = std::nullopt)¶
-
template<typename
DataType
>
DsetInfowriteDataset_chunked
(const DataType &data, std::string_view dsetPath, const OptDimsType &dataDims = std::nullopt, const OptDimsType &dsetDimsChunk = std::nullopt, const OptDimsType &dsetDimsMax = std::nullopt, std::optional<hid::h5t> h5Type = std::nullopt, std::optional<unsigned int> compression = std::nullopt)¶
-
void
writeSymbolicLink
(std::string_view src_path, std::string_view tgt_path)¶
-
template<typename
DataType
, typename = std::enable_if_t<not std::is_const_v<DataType>>>
voidreadDataset
(DataType &data, const DataInfo &dataInfo, const DsetInfo &dsetInfo) const¶
-
template<typename
DataType
, typename = std::enable_if_t<not std::is_const_v<DataType>>>
DataTypereadDataset
(const DataInfo &dataInfo, const DsetInfo &dsetInfo) const¶
-
template<typename
DataType
, typename = std::enable_if_t<not std::is_const_v<DataType>>>
voidreadDataset
(DataType &data, const DsetInfo &dsetInfo, const Options &options = Options()) const¶
-
template<typename
DataType
, typename = std::enable_if_t<not std::is_const_v<DataType>>>
DataTypereadDataset
(DsetInfo &dsetInfo, const Options &options = Options()) const¶
-
template<typename
DataType
, typename = std::enable_if_t<not std::is_const_v<DataType>>>
DataTypereadDataset
(DsetInfo &dsetInfo, const DimsType &dataDims) const¶
-
template<typename
DataType
, typename = std::enable_if_t<not std::is_const_v<DataType>>>
voidreadDataset
(DataType &data, const Options &options) const¶
-
template<typename
DataType
>
voidreadDataset
(DataType &data, std::string_view dsetPath, const OptDimsType &dataDims = std::nullopt) const¶
-
template<typename
DataType
, typename = std::enable_if_t<not std::is_const_v<DataType>>>
DataTypereadDataset
(std::string_view datasetPath, const OptDimsType &dataDims = std::nullopt) const¶
-
template<typename
DataType
>
voidappendToDataset
(DataType &data, const DataInfo &dataInfo, DsetInfo &dsetInfo, size_t axis)¶
-
template<typename
DataType
>
voidappendToDataset
(DataType &data, DsetInfo &dsetInfo, size_t axis, const OptDimsType &dataDims = std::nullopt)¶
-
template<typename
DataType
>
DsetInfoappendToDataset
(DataType &data, size_t axis, const Options &options = Options())¶
-
template<typename
DataType
>
DsetInfoappendToDataset
(DataType &data, std::string_view dsetPath, size_t axis, const OptDimsType &dataDims = std::nullopt)¶
-
template<typename
DataType
>
voidcreateAttribute
(const DataType &data, const DimsType &dataDims, std::string_view attrName, std::string_view linkPath)¶
-
template<typename
DataType
>
voidwriteAttribute
(const DataType &data, std::string_view attrName, std::string_view linkPath, const OptDimsType &dataDims = std::nullopt, std::optional<hid::h5t> h5Type = std::nullopt)¶
-
template<typename
DataType
, typename = std::enable_if_t<not std::is_const_v<DataType>>>
voidreadAttribute
(DataType &data, const Options &options) const¶
-
template<typename
DataType
, typename = std::enable_if_t<not std::is_const_v<DataType>>>
voidreadAttribute
(DataType &data, std::string_view attrName, std::string_view linkPath, const OptDimsType &dataDims = std::nullopt) const¶
-
template<typename
DataType
, typename = std::enable_if_t<not std::is_const_v<DataType>>>
DataTypereadAttribute
(std::string_view attrName, std::string_view linkPath, const OptDimsType &dataDims = std::nullopt) const¶
-
std::vector<std::string>
getAttributeNames
(std::string_view linkPath) const¶
-
TableInfo
createTable
(const hid::h5t &h5EntryType, std::string_view tableName, std::string_view tableTitle, const std::optional<hsize_t> desiredChunkSize = std::nullopt, const std::optional<unsigned int> desiredCompressionLevel = std::nullopt)¶
-
template<typename
DataType
>
TableInfoappendTableEntries
(const DataType &data, std::string_view tableName)¶
-
void
addTableEntriesFrom
(const h5pp::TableInfo &srcInfo, h5pp::TableInfo &tgtInfo, TableSelection tableSelection, const std::optional<hsize_t> desiredChunkSize = std::nullopt, const std::optional<unsigned int> desiredCompressionLevel = std::nullopt)¶
-
TableInfo
addTableEntriesFrom
(const h5pp::TableInfo &srcInfo, std::string_view tgtTableName, TableSelection tableSelection, const std::optional<hsize_t> desiredChunkSize = std::nullopt, const std::optional<unsigned int> desiredCompressionLevel = std::nullopt)¶
-
template<typename
h5x_src
, typename = h5pp::type::sfinae::enable_if_is_h5_loc<h5x_src>>
TableInfoaddTableEntriesFrom
(const h5x_src &srcLocation, std::string_view srcTableName, std::string_view tgtTableName, TableSelection tableSelection, const std::optional<hsize_t> desiredChunkSize = std::nullopt, const std::optional<unsigned int> desiredCompressionLevel = std::nullopt)¶
-
void
addTableEntriesFrom
(const h5pp::TableInfo &srcInfo, h5pp::TableInfo &tgtInfo, hsize_t srcStartEntry, hsize_t tgtStartEntry, hsize_t numEntries, const std::optional<hsize_t> desiredChunkSize = std::nullopt, const std::optional<unsigned int> desiredCompressionLevel = std::nullopt)¶
-
template<typename
h5x_src
, typename = h5pp::type::sfinae::enable_if_is_h5_loc<h5x_src>>
TableInfoaddTableEntriesFrom
(const h5pp::TableInfo &srcInfo, std::string_view tgtTableName, hsize_t srcStartEntry, hsize_t tgtStartEntry, hsize_t numEntries, const std::optional<hsize_t> desiredChunkSize = std::nullopt, const std::optional<unsigned int> desiredCompressionLevel = std::nullopt)¶
-
template<typename
h5x_src
, typename = h5pp::type::sfinae::enable_if_is_h5_loc<h5x_src>>
TableInfoaddTableEntriesFrom
(const h5x_src &srcLocation, std::string_view srcTableName, std::string_view tgtTableName, hsize_t srcStartIdx, hsize_t tgtStartIdx, hsize_t numRecords, const std::optional<hsize_t> desiredChunkSize = std::nullopt, const std::optional<unsigned int> desiredCompressionLevel = std::nullopt)¶
-
template<typename
DataType
>
voidreadTableEntries
(DataType &data, std::string_view tableName, std::optional<size_t> startEntry = std::nullopt, std::optional<size_t> numEntries = std::nullopt) const¶
-
template<typename
DataType
>
DataTypereadTableEntries
(std::string_view tablePath, std::optional<size_t> startEntry = std::nullopt, std::optional<size_t> numEntries = std::nullopt) const¶
-
template<typename
DataType
>
voidreadTableField
(DataType &data, std::string_view tablePath, std::string_view fieldNames, std::optional<size_t> startEntry = std::nullopt, std::optional<size_t> numEntries = std::nullopt) const¶
-
template<typename
DataType
>
DataTypereadTableField
(std::string_view tablePath, std::string_view fieldName, std::optional<size_t> startEntry = std::nullopt, std::optional<size_t> numEntries = std::nullopt) const¶
-
template<typename
DataType
>
voidreadTableField
(DataType &data, std::string_view tablePath, std::string_view fieldNames, TableSelection tableSelection) const¶
-
template<typename
DataType
>
DataTypereadTableField
(std::string_view tablePath, std::string_view fieldName, TableSelection tableSelection) const¶
-
int
getDatasetRank
(std::string_view datasetPath) const¶
-
std::vector<hsize_t>
getDatasetDimensions
(std::string_view datasetPath) const¶
-
std::optional<std::vector<hsize_t>>
getDatasetMaxDimensions
(std::string_view datasetPath) const¶
-
std::optional<std::vector<hsize_t>>
getDatasetChunkDimensions
(std::string_view datasetPath) const¶
-
bool
linkExists
(std::string_view link) const¶
-
std::vector<std::string>
findLinks
(std::string_view searchKey = "", std::string_view searchRoot = "/", long maxHits = -1, long maxDepth = -1) const¶
-
std::vector<std::string>
findDatasets
(std::string_view searchKey = "", std::string_view searchRoot = "/", long maxHits = -1, long maxDepth = -1) const¶
-
std::vector<std::string>
findGroups
(std::string_view searchKey = "", std::string_view searchRoot = "/", long maxHits = -1, long maxDepth = -1) const¶
-
bool
fileIsValid
() const¶
Public Members
-
PropertyLists
plists
¶
-