Namespace hdf5::file
¶
Enumerations¶
The File
class¶
-
class hdf5::file::File¶
Public Functions
-
File() = default¶
default constructor
Use default implementation here. We need this to store instances of this class in an STL container. A default constructed instance of File is in an invalid state. This can be checked using the is_valid() method.
See also
-
explicit File(ObjectHandle &&handle)¶
constructor
Construct a file from an rvalue reference to a handle.
- Parameters
handle – rvalue reference to the file handler
-
AccessFlags intent() const¶
get access flags for the file
- Throws
std::runtime_error – in case of a failure
-
size_t size() const¶
get the file size in bytes
- Throws
std::runtime_error – in case of a failure
-
ssize_t buffer_size() const¶
get the buffer size in bytes
- Throws
std::runtime_error – in case of a failure
-
void flush(Scope scope) const¶
flush the file
- Throws
std::runtime_error – in case of a failure
- Parameters
scope – the scope within which the file should be flushed
-
void close()¶
close the file
- Throws
std::runtime_error – in case of a failure
-
fs::path path() const¶
get path on file system
Return the file system path of the file.
-
size_t count_open_objects(SearchFlags flag) const¶
count number of open objects
Return the number of open objects belonging to that very file instance.
-
node::Group root(const property::GroupAccessList &gapl = property::GroupAccessList()) const¶
get root group
Return an instance to the root group of the file.
- Throws
std::runtime_error – in case of a failure
- Parameters
gapl – reference to a group access property list
- Returns
new instance of node::Group
-
template<typename T>
size_t to_buffer(T &data) const¶ retrieve a copy of the image of an existing, open file
See also
ImageFlags
- Throws
std::runtime_error – in case of a failure
- Template Parameters
T – source type
- Parameters
data – reference to the source instance of T
- Returns
size of used space in a buffer
-
bool is_valid() const¶
check validity of the instance
Return true if the instance refers to a valid HDF5 file instance.
- Throws
std::runtime_error – in case of a failure
- Returns
true if valid, false otherwise
-
File() = default¶
Functions¶
-
File hdf5::file::create(const fs::path &path, AccessFlags flags = AccessFlags::EXCLUSIVE, const property::FileCreationList &fcpl = property::FileCreationList(), const property::FileAccessList &fapl = property::FileAccessList())¶
create a new file
See also
See also
FileCreationList
See also
FileAccessList
- Parameters
path – the path to the new file
flags – HDF5 file creation flags
fcpl – reference to a file creation property list
fapl – reference to a file access property list
- Throws
std::runtime_error – in case of a failure
- Returns
new instance of File
-
File hdf5::file::open(const fs::path &path, AccessFlags flags = AccessFlags::READONLY, const property::FileAccessList &fapl = property::FileAccessList())¶
open an existing file
See also
See also
FileAccessList
- Parameters
path – the path to the file to open
flags – file open flags
fapl – reference to a file access property list
- Throws
std::runtime_error – in case of a failure
- Returns
a new File instance
-
bool hdf5::file::is_hdf5_file(const fs::path &path)¶
check if the file reference by the path is an HDF5 file
- Parameters
path – reference to the files path
- Throws
std::runtime_error – in case of a failure
- Returns
true if the path references an HDF5 file, false otherwise
Flags¶
-
enum hdf5::file::AccessFlags¶
flags controlling file opening and creation
Values:
-
enumerator TRUNCATE¶
-
enumerator EXCLUSIVE¶
-
enumerator READWRITE¶
-
enumerator READONLY¶
-
enumerator TRUNCATE¶
-
AccessFlagsBase hdf5::file::operator|(const AccessFlags &lhs, const AccessFlags &rhs)¶
-
std::ostream &hdf5::file::operator<<(std::ostream &stream, const AccessFlags &flags)¶
-
enum hdf5::file::SearchFlags¶
flags controlling object search in a file
Values:
-
enumerator FILE¶
-
enumerator DATASET¶
-
enumerator GROUP¶
-
enumerator DATATYPE¶
-
enumerator ATTRIBUTE¶
-
enumerator ALL¶
-
enumerator LOCAL¶
-
enumerator FILE¶
-
SearchFlagsBase hdf5::file::operator|(const SearchFlags &lhs, const SearchFlags &rhs)¶
-
std::ostream &hdf5::file::operator<<(std::ostream &stream, const SearchFlags &flags)¶
Driver classes¶
Driver
¶
-
class hdf5::file::Driver¶
abstract class for file drivers
Driver classes in h5cpp do not hold a real reference to a driver object. They rather store information about how to setup the driver. This is mainly due to the fact that we are currently accessing the drivers only via the file access property list.
Subclassed by hdf5::file::MemoryDriver, hdf5::file::PosixDriver
Public Functions
-
virtual void operator()(const hdf5::property::FileAccessList &fapl) const = 0¶
set a driver
Sets a driver to a particular file access property list.
-
virtual void operator()(const hdf5::property::FileAccessList &fapl) const = 0¶
PosixDriver
¶
-
class hdf5::file::PosixDriver : public hdf5::file::Driver¶
Public Functions
-
virtual void operator()(const property::FileAccessList &fapl) const¶
set a driver
Sets a driver to a particular file access property list.
-
virtual void operator()(const property::FileAccessList &fapl) const¶
MemoryDriver
¶
-
class hdf5::file::MemoryDriver : public hdf5::file::Driver¶
memory file driver
Using this driver HDF5 writes the file not to disk but in memory which can reduce the overhead from disk IO. If backing_store option is enabled the file will be written to disk with the same file name used to create the file in memory.
Public Functions
-
MemoryDriver() noexcept¶
default constructor
Sets the increment to 1MByte and backing store to false.
-
MemoryDriver(size_t increment, bool backing_store) noexcept¶
constructor
- Parameters
increment – number of bytes used to increment the memory buffer if it runs out of storage
backing_store – enable disk storage after file close
-
MemoryDriver(const MemoryDriver&) = default¶
copy constructor
Use the default implementation here.
-
bool backing_store() const noexcept¶
get backing store status
-
void backing_store(bool value) noexcept¶
set backing store status
-
size_t increment() const noexcept¶
get increment value
-
void increment(size_t value)¶
set increment
-
virtual void operator()(const property::FileAccessList &fapl) const¶
set a driver
Sets a driver to a particular file access property list.
-
MemoryDriver() noexcept¶