h5cpp  0.5.0
A modern C++ wrapper for the HDF5 C library
hdf5::file::File Class Reference

#include <file.hpp>

Public Member Functions

 File ()=default
 default constructor More...
 
 File (const File &)=default
 copy constructor More...
 
 File (File &&)=default
 move constructor More...
 
 File (ObjectHandle &&handle)
 constructor More...
 
Fileoperator= (const File &)=default
 
AccessFlags intent () const
 get access flags for the file More...
 
size_t size () const
 get the file size in bytes More...
 
ssize_t buffer_size () const
 get the buffer size in bytes More...
 
void flush (Scope scope) const
 flush the file More...
 
void close ()
 close the file More...
 
fs::path path () const
 get path on file system More...
 
size_t count_open_objects (SearchFlags flag) const
 count number of open objects More...
 
size_t count_open_objects (SearchFlagsBase flags) const
 
node::Group root (const property::GroupAccessList &gapl=property::GroupAccessList()) const
 get root group More...
 
 operator hid_t () const
 
template<typename T >
size_t to_buffer (T &data) const
 retrieve a copy of the image of an existing, open file More...
 
template<typename T >
size_t to_buffer_reshape (T &data, const datatype::Datatype &mem_type, const dataspace::Dataspace &mem_space) const
 retrieve a copy of the image of an existing, open file More...
 
bool is_valid () const
 check validity of the instance More...
 
ObjectId id () const
 return a unique id for the file object More...
 

Constructor & Destructor Documentation

◆ File() [1/4]

hdf5::file::File::File ( )
default

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
is_valid()

◆ File() [2/4]

hdf5::file::File::File ( const File )
default

Use default implementation here.

◆ File() [3/4]

hdf5::file::File::File ( File &&  )
default

Use default implementation here.

◆ File() [4/4]

hdf5::file::File::File ( ObjectHandle &&  handle)
explicit

Construct a file from an rvalue reference to a handle.

Parameters
handlervalue reference to the file handler

Member Function Documentation

◆ buffer_size()

ssize_t hdf5::file::File::buffer_size ( ) const
Exceptions
std::runtime_errorin case of a failure

◆ close()

void hdf5::file::File::close ( )
Exceptions
std::runtime_errorin case of a failure

◆ count_open_objects() [1/2]

size_t hdf5::file::File::count_open_objects ( SearchFlags  flag) const

Return the number of open objects belonging to that very file instance.

◆ count_open_objects() [2/2]

size_t hdf5::file::File::count_open_objects ( SearchFlagsBase  flags) const

◆ flush()

void hdf5::file::File::flush ( Scope  scope) const
Exceptions
std::runtime_errorin case of a failure
Parameters
scopethe scope within which the file should be flushed

◆ id()

ObjectId hdf5::file::File::id ( ) const

Return an instance of ObjectId which uniquely identifies a file object.

◆ intent()

AccessFlags hdf5::file::File::intent ( ) const
Exceptions
std::runtime_errorin case of a failure

◆ is_valid()

bool hdf5::file::File::is_valid ( ) const

Return true if the instance refers to a valid HDF5 file instance.

Exceptions
std::runtime_errorin case of a failure
Returns
true if valid, false otherwise

◆ operator hid_t()

hdf5::file::File::operator hid_t ( ) const
inlineexplicit

◆ operator=()

File& hdf5::file::File::operator= ( const File )
default

◆ path()

fs::path hdf5::file::File::path ( ) const

Return the file system path of the file.

◆ root()

node::Group hdf5::file::File::root ( const property::GroupAccessList gapl = property::GroupAccessList()) const

Return an instance to the root group of the file.

Exceptions
std::runtime_errorin case of a failure
Parameters
gaplreference to a group access property list
Returns
new instance of node::Group

◆ size()

size_t hdf5::file::File::size ( ) const
Exceptions
std::runtime_errorin case of a failure

◆ to_buffer()

template<typename T >
size_t hdf5::file::File::to_buffer ( T &  data) const
Exceptions
std::runtime_errorin case of a failure
Template Parameters
Tsource type
Parameters
datareference to the source instance of T
Returns
size of used space in a buffer
See also
ImageFlags

◆ to_buffer_reshape()

template<typename T >
size_t hdf5::file::File::to_buffer_reshape ( T &  data,
const datatype::Datatype mem_type,
const dataspace::Dataspace mem_space 
) const

It reshapes the mem_space if its rank does not match to the selection rank

Exceptions
std::runtime_errorin case of a failure
Template Parameters
Tsource type
Parameters
datareference to the source instance of T
mem_typereference to the memory data type
mem_spacereference to the memory data space
Returns
size of used space in a buffer
See also
ImageFlags

The documentation for this class was generated from the following file: