|
| ~Hdf5DataFormat () |
|
bool | isOpen () const |
|
bool | openFile (const std::string &filename_, OpenMode mode=ReadWriteAppend) |
| openFile Open a file for use by this reader/writer. More...
|
|
std::string | filename () const |
|
bool | closeFile () |
| closeFile Close the file and reset the reader/writer. Another file may be opened after calling this function. More...
|
|
void | setThreshold (size_t bytes) |
| setThreshold Set the threshold size in bytes that will be used in the exceedsThreshold functions. The threshold can be used to determine which data is considered "large enough" to be stored in HDF5, rather than an accompanying format. More...
|
|
size_t | threshold () const |
|
bool | exceedsThreshold (size_t bytes) const |
| exceedsThreshold Test if a data set is "large enough" to be stored in HDF5 format. If this function returns true, the number of bytes tested is larger than the threshold and the data should be written into the HDF5 file. If false, the data should be written into the accompanying format. More...
|
|
bool | exceedsThreshold (const MatrixX &data) const |
| exceedsThreshold Test if a data set is "large enough" to be stored in HDF5 format. If this function returns true, the size of the data in the object is larger than the threshold and should be written into the HDF5 file. If false, the data should be written into the accompanying format. More...
|
|
bool | exceedsThreshold (const std::vector< double > &data) const |
| exceedsThreshold Test if a data set is "large enough" to be stored in HDF5 format. If this function returns true, the size of the data in the object is larger than the threshold and should be written into the HDF5 file. If false, the data should be written into the accompanying format. More...
|
|
bool | exceedsThreshold (const Core::Array< double > &data) const |
| exceedsThreshold Test if a data set is "large enough" to be stored in HDF5 format. If this function returns true, the size of the data in the object is larger than the threshold and should be written into the HDF5 file. If false, the data should be written into the accompanying format. More...
|
|
bool | datasetExists (const std::string &path) const |
| datasetExists Test if the currently open file contains a dataset at the HDF5 absolute path path. More...
|
|
bool | removeDataset (const std::string &path) const |
| removeDataset Remove a dataset from the currently opened file. More...
|
|
std::vector< int > | datasetDimensions (const std::string &path) const |
| datasetDimensions Find the dimensions of a dataset. More...
|
|
bool | writeDataset (const std::string &path, const MatrixX &data) const |
| writeDataset Write the data to the currently opened file at the specified absolute HDF5 path. More...
|
|
bool | writeDataset (const std::string &path, const std::vector< double > &data, int ndims=1, size_t *dims=nullptr) const |
| writeDataset Write the data to the currently opened file at the specified absolute HDF5 path. More...
|
|
bool | writeDataset (const std::string &path, const Core::Array< double > &data, int ndims=1, size_t *dims=nullptr) const |
| writeDataset Write the data to the currently opened file at the specified absolute HDF5 path. More...
|
|
bool | readDataset (const std::string &path, MatrixX &data) const |
| readDataset Populate the data container @data with data at from the specified path in the currently opened HDF5 file. More...
|
|
std::vector< int > | readDataset (const std::string &path, std::vector< double > &data) const |
| readDataset Populate the data container @data with data at from the specified path in the currently opened HDF5 file. More...
|
|
std::vector< int > | readDataset (const std::string &path, Core::Array< double > &data) const |
| readDataset Populate the data container @data with data at from the specified path in the currently opened HDF5 file. More...
|
|
std::vector< std::string > | datasets () const |
| datasets Traverse the currently opened file and return a list of all dataset objects in the file. More...
|
|
- Author
- Allison Vacanti
This class is intended to supplement an existing format reader/writer by providing the option to write large data to an HDF5 file store. The purpose is to keep text format files at a managable size.
To use this class, open or create an HDF5 file with the openFile method, using the appropriate OpenMode for the intended operation. Data can be written to the file using the writeDataset methods and retrieved using the readDataset methods. When finished, call closeFile to release the file resources from the HDF5 library.
A complete set of datasets available in an open file can be retrieved with the datasets() method, and the existence of a particular dataset can be tested with datasetExists(). removeDataset() can be used to unlink an existing dataset from the file, though this will not free any space on disk. The space occupied by an unlinked dataset may be reclaimed by new write operations, but only if they occur before the file is closed.
A convenient thresholding system is implemented to help the accompanying text format writer determine which data is "large" enough to be stored in HDF5. A size threshold (in bytes) may be set with the setThreshold() function (the default is 1KB). A data object may be passed to the exceedsThreshold method to see if the size of the data in the container exceeds the currently set threshold. If so, it should be written into the HDF5 file by writeDataset. If not, it should be serialized into the text file in a suitable format. The thresholding operations are optional; the threshold size does not affect the behavior of the read/write methods and are only for user convenience.