A wrapper class handling storage to HDF. More...
#include <Storage.h>
A wrapper class handling storage to HDF.
Acts as a thin wrapper for HighFive. The class implements methods that are intended to be called from SolutionArray.
Public Member Functions | |
| Storage (string fname, bool write) | |
| void | setCompressionLevel (int level) |
| Set compression level (0..9) | |
| bool | hasGroup (const string &id) const |
Check whether location id represents a group. | |
| bool | checkGroup (const string &id, bool permissive=false) |
| Check whether path location exists. | |
| void | deleteGroup (const string &id) |
| Delete group. | |
| pair< size_t, set< string > > | contents (const string &id) const |
| Retrieve contents of file from a specified location. | |
| bool | hasAttribute (const string &id, const string &attr) const |
| Read attributes from a specified location. | |
| AnyMap | readAttributes (const string &id, bool recursive) const |
| Read attributes from a specified location. | |
| void | writeAttributes (const string &id, const AnyMap &meta) |
| Write attributes to a specified location. | |
| AnyValue | readData (const string &id, const string &name, size_t rows, size_t cols=npos) const |
| Read dataset from a specified location. | |
| void | writeData (const string &id, const string &name, const AnyValue &data) |
| Write dataset to a specified location. | |
| Storage | ( | string | fname, |
| bool | write | ||
| ) |
Definition at line 575 of file Storage.cpp.
| ~Storage | ( | ) |
Definition at line 581 of file Storage.cpp.
| void setCompressionLevel | ( | int | level | ) |
Set compression level (0..9)
Compression is only applied to matrix-type data; note that compression may increase file size for small data sets (compression requires setting of chunk sizes, which involves considerable overhead for metadata).
Definition at line 585 of file Storage.cpp.
| bool hasGroup | ( | const string & | id | ) | const |
Check whether location id represents a group.
Definition at line 591 of file Storage.cpp.
| bool checkGroup | ( | const string & | id, |
| bool | permissive = false |
||
| ) |
Check whether path location exists.
If the location does not exist, an exception is thrown unless the permissive flag is set; in this case, the method attempts to create a new location if the file is accessed in write mode.
| id | storage location within file |
| permissive | if true, do not raise exceptions (default=false) |
Definition at line 597 of file Storage.cpp.
| void deleteGroup | ( | const string & | id | ) |
| pair< size_t, set< string > > contents | ( | const string & | id | ) | const |
Retrieve contents of file from a specified location.
| id | storage location within file |
Definition at line 609 of file Storage.cpp.
| bool hasAttribute | ( | const string & | id, |
| const string & | attr | ||
| ) | const |
Read attributes from a specified location.
| id | storage location within file |
| attr | name of attribute to be checked |
Definition at line 615 of file Storage.cpp.
| AnyMap readAttributes | ( | const string & | id, |
| bool | recursive | ||
| ) | const |
Read attributes from a specified location.
| id | storage location within file |
| recursive | boolean indicating whether subgroups should be included |
Definition at line 621 of file Storage.cpp.
| void writeAttributes | ( | const string & | id, |
| const AnyMap & | meta | ||
| ) |
Write attributes to a specified location.
| id | storage location within file |
| meta | AnyMap containing attributes |
Definition at line 627 of file Storage.cpp.
Read dataset from a specified location.
| id | storage location within file |
| name | name of vector/matrix entry |
| rows | number of vector length or matrix rows |
| cols | number of matrix columns, if applicable; if 0, a vector is expected, if npos, the size is detected automatically; otherwise, an exact number of columns needs to be matched. |
vector<double>, vector<long int>, vector<string>, vector<vector<double>>, vector<vector<long int>> and vector<vector<string>> Definition at line 633 of file Storage.cpp.
| void writeData | ( | const string & | id, |
| const string & | name, | ||
| const AnyValue & | data | ||
| ) |
Write dataset to a specified location.
| id | storage location within file |
| name | name of matrix entry |
| data | vector or matrix containing data; implemented for types vector<double>, vector<long int>, vector<string> vector<vector<double>>, vector<vector<long int>> and vector<vector<string>> |
Definition at line 640 of file Storage.cpp.