Utopia  2
Framework for studying models of complex & adaptive systems.
Public Member Functions | Private Attributes | List of all members
Utopia::DataIO::HDFFile Class Referencefinal

Class representing a HDF5 file. More...

#include <hdffile.hh>

Inheritance diagram for Utopia::DataIO::HDFFile:
Inheritance graph
[legend]
Collaboration diagram for Utopia::DataIO::HDFFile:
Collaboration graph
[legend]

Public Member Functions

void swap (HDFFile &other)
 Function for exchanging states. More...
 
void open (std::string path, std::string access)
 Open a file at location 'path' with access specifier 'access'. Keep in mind that if the object refers to another file, it has to be closed first before opening another. More...
 
std::shared_ptr< HDFGroupget_basegroup ()
 Get the basegroup object via shared ptr. More...
 
std::shared_ptr< HDFGroupopen_group (std::string path)
 Open group at path 'path', creating all intermediate objects in the path. Separation character is: /. More...
 
std::shared_ptr< HDFDatasetopen_dataset (std::string path, std::vector< hsize_t > capacity={}, std::vector< hsize_t > chunksizes={}, std::size_t compresslevel=0)
 open dataset More...
 
void delete_group (std::string &&path)
 deletes the group pointed to by absolute path 'path' More...
 
void flush ()
 Initiates an immediate write to disk of the data of the file. More...
 
 HDFFile ()=default
 Construct a new default HDFFile object. More...
 
 HDFFile (HDFFile &&other)=default
 Move constructor Construct a new HDFFile object via move semantics. More...
 
HDFFileoperator= (const HDFFile &other)=delete
 Copy assignment operator, explicitly deleted, hence cannot be used. More...
 
HDFFileoperator= (HDFFile &&other)=default
 Move assigment operator. More...
 
 HDFFile (const HDFFile &other)=delete
 Copy constructor. Explicitly deleted, hence cannot be used. More...
 
 HDFFile (std::string path, std::string access)
 Construct a new HDFFile object. More...
 
virtual ~HDFFile ()=default
 Destroy the HDFFile object. More...
 
- Public Member Functions inherited from Utopia::DataIO::HDFObject< HDFCategory::file >
void swap (HDFObject &other)
 swap the state of the caller with the state of the argument More...
 
std::string get_path () const
 Get the name or path object. More...
 
auto get_id_object () const
 Get the id object. More...
 
auto get_logger () const
 Get the logger object. More...
 
hid_t get_C_id () const
 Get the C id object. More...
 
auto get_refcount ()
 Get the reference count of object. More...
 
virtual bool is_valid () const
 Check if the object is still valid. More...
 
void close ()
 Close function which takes care of correctly closing the object and managing the reference counter. More...
 
void bind_to (hid_t id, std::function< herr_t(hid_t) > closing_func, std::string path={})
 Open the object and bind it to a HDF5 object identified by 'id' with name 'path'. Object should be created beforehand. More...
 
 HDFObject ()
 Construct HDFObject from the given arguments. More...
 
 HDFObject (HDFObject &&other)
 Construct HDFObject by moving. More...
 
 HDFObject (const HDFObject &other)=default
 Construct HDFObject by copying another object. More...
 
 HDFObject (hid_t id, std::function< herr_t(hid_t) > closing_func, std::string path={})
 Construct HDFObject from the given argument. More...
 
HDFObjectoperator= (const HDFObject &other)
 Copy assignment operator. More...
 
HDFObjectoperator= (HDFObject &&other)
 move assignment operator More...
 
virtual ~HDFObject ()
 Destroy the HDFObject object. Has to be implemented in subclass! More...
 

Private Attributes

std::shared_ptr< HDFGroup_base_group
 Pointer to base group of the file. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Utopia::DataIO::HDFObject< HDFCategory::file >
static constexpr HDFCategory category
 Named variable for template arg. More...
 
- Protected Attributes inherited from Utopia::DataIO::HDFObject< HDFCategory::file >
HDFIdentifier _id
 Identifier object that binds an instance of this class to an HDF5 object. More...
 
std::string _path
 Name of the object. More...
 
std::shared_ptr< spdlog::logger > _log
 pointer to the logger for dataio More...
 

Detailed Description

Class representing a HDF5 file.

Constructor & Destructor Documentation

◆ HDFFile() [1/4]

Utopia::DataIO::HDFFile::HDFFile ( )
default

Construct a new default HDFFile object.

◆ HDFFile() [2/4]

Utopia::DataIO::HDFFile::HDFFile ( HDFFile &&  other)
default

Move constructor Construct a new HDFFile object via move semantics.

Parameters
otherrvalue reference to HDFFile object

◆ HDFFile() [3/4]

Utopia::DataIO::HDFFile::HDFFile ( const HDFFile other)
delete

Copy constructor. Explicitly deleted, hence cannot be used.

Parameters
other
Returns
HDFFile&

◆ HDFFile() [4/4]

Utopia::DataIO::HDFFile::HDFFile ( std::string  path,
std::string  access 
)
inline

Construct a new HDFFile object.

Parameters
pathPath to the new file
accessAccess specifier for the new file, possible values: 'r' (readonly, file must exist), 'r+' (read/write, file must exist), 'w' (create file, truncate if exists), 'x' (create file, fail if exists), or 'a' (read/write if exists, create otherwise)

◆ ~HDFFile()

virtual Utopia::DataIO::HDFFile::~HDFFile ( )
virtualdefault

Destroy the HDFFile object.

Member Function Documentation

◆ delete_group()

void Utopia::DataIO::HDFFile::delete_group ( std::string &&  path)
inline

deletes the group pointed to by absolute path 'path'

Parameters
pathabsolute path to the group to be deleted

◆ flush()

void Utopia::DataIO::HDFFile::flush ( )
inline

Initiates an immediate write to disk of the data of the file.

◆ get_basegroup()

std::shared_ptr< HDFGroup > Utopia::DataIO::HDFFile::get_basegroup ( )
inline

Get the basegroup object via shared ptr.

Returns
std::shared_ptr<HDFGroup>

◆ open()

void Utopia::DataIO::HDFFile::open ( std::string  path,
std::string  access 
)
inline

Open a file at location 'path' with access specifier 'access'. Keep in mind that if the object refers to another file, it has to be closed first before opening another.

Parameters
pathPath to open the file at
accessAccess specifier for the new file, possible values: 'r' (readonly, file must exist), 'r+' (read/write, file must exist), 'w' (create file, truncate if exists), 'x' (create file, fail if exists), or 'a' (read/write if exists, create otherwise)

◆ open_dataset()

std::shared_ptr< HDFDataset > Utopia::DataIO::HDFFile::open_dataset ( std::string  path,
std::vector< hsize_t >  capacity = {},
std::vector< hsize_t >  chunksizes = {},
std::size_t  compresslevel = 0 
)
inline

open dataset

Parameters
pathThe path to the dataset
Returns
std::shared_ptr<HDFDataset>

◆ open_group()

std::shared_ptr< HDFGroup > Utopia::DataIO::HDFFile::open_group ( std::string  path)
inline

Open group at path 'path', creating all intermediate objects in the path. Separation character is: /.

Parameters
pathThe path to the group
Returns
std::shared_ptr<HDFGroup>

◆ operator=() [1/2]

HDFFile& Utopia::DataIO::HDFFile::operator= ( const HDFFile other)
delete

Copy assignment operator, explicitly deleted, hence cannot be used.

Parameters
other
Returns
HDFFile&

◆ operator=() [2/2]

HDFFile& Utopia::DataIO::HDFFile::operator= ( HDFFile &&  other)
default

Move assigment operator.

Parameters
otherreference to HDFFile object
Returns
HDFFile&

◆ swap()

void Utopia::DataIO::HDFFile::swap ( HDFFile other)
inline

Function for exchanging states.

Parameters
otherThe other

Member Data Documentation

◆ _base_group

std::shared_ptr< HDFGroup > Utopia::DataIO::HDFFile::_base_group
private

Pointer to base group of the file.


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