|
TRIQS/h5 1.3.0
C++ interface to HDF5
|
#include <h5/file.hpp>
A handle to an HDF5 file.
This class inherits from the general h5::object class. It simply wraps the HDF5 functions to open an existing file or to create a new file.
An h5::file is automatically closed when it goes out of scope, i.e. its reference count is decreased.
Public Member Functions | |
| file () | |
| Default constructor creates a buffered memory file. | |
| file (const char *name, char mode) | |
| Constructor to open an existing file or to create a new file on disk. | |
| file (std::span< std::byte > const &buf) | |
| Constructor to create a buffered memory file from a byte buffer. | |
| file (std::string const &name, char mode) | |
| Constructor to open an existing file or to create a new file on disk. | |
| file (std::vector< std::byte > const &buf) | |
| Constructor to create a buffered memory file from a byte buffer. | |
| std::vector< std::byte > | as_buffer () const |
| Get a copy of the associated byte buffer. | |
| void | flush () |
| Flush the file by calling H5Fflush. | |
| std::string | name () const |
| Get the name of the file. | |
| Public Member Functions inherited from h5::object | |
| object (hid_t id=0) | |
| Construct a new h5::object for a given HDF5 ID by taking ownership, i.e. without increasing the reference count. | |
| object (object &&x) noexcept | |
| Move constructor steals the underlying HDF5 ID without increasing its reference count. | |
| object (object const &x) | |
| Copy constructor copies the underlying HDF5 ID and increases its reference count. | |
| ~object () | |
| Destructor decreases the reference count and sets the object's ID to zero. | |
| void | close () |
| Release the HDF5 handle by decreasing the reference count and by setting the object's ID to zero. | |
| int | get_ref_count () const |
| Get the current reference count. | |
| bool | is_valid () const |
| Ensure that the wrapped HDF5 ID is valid (by calling H5Iis_valid). | |
| operator hid_t () const | |
| User-defined conversion to h5::hid_t. | |
| object & | operator= (object &&x) noexcept |
| Move assignment operator steals the underlying HDF5 ID without increasing its reference count. | |
| object & | operator= (object const &x) |
| Copy assignment operator copies the underlying HDF5 ID and increases its reference count. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from h5::object | |
| static object | from_borrowed (hid_t id) |
| Create an h5::object for a given HDF5 ID and increase its reference count. | |
| h5::file::file | ( | ) |
Default constructor creates a buffered memory file.
It modifies the file access property list to use the H5FD_CORE driver. It can be used for serializing and deserializing data (see h5::serialize and h5::deserialize).
| h5::file::file | ( | const char * | name, |
| char | mode ) |
Constructor to open an existing file or to create a new file on disk.
The file is opened in the specified mode. The following modes are available:
| name | Name of the file. |
| mode | Mode in which to open the file. |
|
inline |
Constructor to open an existing file or to create a new file on disk.
See file::file(const char*, char) for a more detailed description.
|
inline |
|
inline |