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

Class that wraps an HDF5 dataspace and takes care of managing its resources. More...

#include <hdfdataspace.hh>

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

Public Types

using Base = HDFObject< HDFCategory::dataspace >
 

Public Member Functions

hsize_t rank ()
 Get thet dataspace's rank, i.e., number of dimensions. More...
 
std::pair< arma::Row< hsize_t >, arma::Row< hsize_t > > get_properties ()
 Get the properties object: size and capacity. @notice The dimensions can be infered from the size of the returned vectors. More...
 
arma::Row< hsize_t > size ()
 Get the current size of the dataspace in each dimension. More...
 
arma::Row< hsize_t > capacity ()
 Get the capacity of the dataspace in each dimension. More...
 
void open ()
 Open the dataspace - set it to be equivalent to any data that later will be used to write or read. More...
 
template<typename Object >
void open (Object &&object)
 Open the dataspace with an HDF5 object, i.e., dataset or attribute. More...
 
void open (std::string name, hsize_t rank, arma::Row< hsize_t > extent, arma::Row< hsize_t > capacity)
 Open a new dataset of type 'simple', which is equivalent to a N-dimensional array of dimension N = 'rank', a given extent, and a given maximum capacity that in each dimension must be greater or equal to the extent. More...
 
std::pair< arma::Row< hsize_t >, arma::Row< hsize_t > > get_selection_bounds ()
 Get the selection bounding box, i.e., the start and end vector of the currently selected subset of the dataspace. More...
 
void select_slice (arma::Row< hsize_t > start, arma::Row< hsize_t > end, arma::Row< hsize_t > stride)
 Select a slice in the dataspace defined by [start, end, stride] in the manner of numpy. Overwrites old selections. More...
 
void select_all ()
 Select the entire dataspace as hyperslap to be read/written to. More...
 
void resize (arma::Row< hsize_t > new_size)
 Resize the dataspace. The new size needs to fit into the dataspaces capacity. More...
 
void release_selection ()
 Release a previously defined selection. More...
 
 HDFDataspace ()
 Construct HDFDataspace per default. Equivalent to using H5S_ALL when employing the pure C interface. More...
 
 HDFDataspace (const HDFDataspace &)=default
 Copy constructor. More...
 
 HDFDataspace (HDFDataspace &&)=default
 Move constructor. More...
 
HDFDataspaceoperator= (const HDFDataspace &)=default
 Copy assign dataspace. More...
 
HDFDataspaceoperator= (HDFDataspace &&)=default
 Move assign dataspace. More...
 
 HDFDataspace (std::string name, hsize_t rank, std::vector< hsize_t > extent, std::vector< hsize_t > capacity)
 Construct HDFDataspace from the given arguments. More...
 
template<typename Object >
 HDFDataspace (Object &&object, std::enable_if_t< not std::is_same_v< std::decay_t< Object >, HDFDataspace >, int >=0)
 Construct a new HDFDataspace object from an HDFDataset or HDFAttribute. This loads the file-dataspace that belongs to the dataset or attribute such that it gets managed by this class. More...
 
virtual ~HDFDataspace ()=default
 Destroy the HDFDataspace object. More...
 
void swap (HDFDataspace &other)
 Swap state with argument. More...
 
- Public Member Functions inherited from Utopia::DataIO::HDFObject< HDFCategory::dataspace >
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...
 

Additional Inherited Members

- Static Public Attributes inherited from Utopia::DataIO::HDFObject< HDFCategory::dataspace >
static constexpr HDFCategory category
 Named variable for template arg. More...
 
- Protected Attributes inherited from Utopia::DataIO::HDFObject< HDFCategory::dataspace >
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 that wraps an HDF5 dataspace and takes care of managing its resources.


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