echelon  0.8.0
Public Types | Public Member Functions | List of all members
echelon::group Class Reference

A handle to a group object. More...

#include <group.hpp>

Public Types

using native_handle_type = hdf5::group
 Type of the underlying HDF5 low-level handle.
 

Public Member Functions

 group ()=default
 Initializes the handle with its null state.
 
group create_group (const std::string &name)
 Creates a new group within this group. More...
 
dataset create_dataset (const std::string &name, const type &datatype, const std::vector< hsize_t > &dims, const dataset_options &options=dataset_options())
 Creates a new dataset within this group. More...
 
dataset create_dataset (const std::string &name, const type &datatype, const std::vector< hsize_t > &dims, const std::vector< hsize_t > &max_dims, const dataset_options &options=dataset_options())
 Creates a new dataset within this group. More...
 
template<typename T >
dataset create_dataset (const std::string &name, const std::vector< hsize_t > &dims, const dataset_options &options=dataset_options())
 Creates a new dataset within this group. More...
 
template<typename T >
dataset create_dataset (const std::string &name, const std::vector< hsize_t > &dims, const std::vector< hsize_t > &max_dims, const dataset_options &options=dataset_options())
 Creates a new dataset within this group. More...
 
scalar_dataset create_scalar_dataset (const std::string &name, const type &datatype)
 Creates a new scalar dataset within this group. More...
 
template<typename T >
scalar_dataset create_scalar_dataset (const std::string &name)
 Creates a new scalar dataset within this group. More...
 
template<typename T >
scalar_dataset create_scalar_dataset (const std::string &name, const T &value)
 Creates a new scalar dataset within this group and initializes it with a given value. More...
 
object operator[] (const std::string &name) const
 Accessor function for this group. More...
 
void remove (const std::string &name) const
 Removes the specified object from the group. More...
 
group require_group (const std::string &name)
 Returns the requested group, if it already exists, otherwise a new group is created. More...
 
dataset require_dataset (const std::string &name, const type &datatype, const std::vector< hsize_t > &dims, const dataset_options &options=dataset_options())
 Returns the requested dataset, if it already exists, otherwise a new dataset is created. More...
 
template<typename T >
dataset require_dataset (const std::string &name, const std::vector< hsize_t > &dims, const dataset_options &options=dataset_options())
 Returns the requested dataset, if it already exists, otherwise a new dataset is created. More...
 
scalar_dataset require_scalar_dataset (const std::string &name, const type &datatype)
 Returns the requested scalar dataset, if it already exists, otherwise a new scalar dataset is created. More...
 
template<typename T >
scalar_dataset require_scalar_dataset (const std::string &name)
 Returns the requested scalar dataset, if it already exists, otherwise the scalar dataset is created. More...
 
template<typename T >
scalar_dataset require_scalar_dataset (const std::string &name, const T &value)
 Returns the requested scalar dataset, if it already exists, otherwise a new scalar dataset is created. More...
 
void iterate_links (const std::function< void(const link &)> &op) const
 Iterates over every link within this group. More...
 
void visit_links (const std::function< void(const link &)> &visitor) const
 Visits every link, which is reachable from this group. More...
 
void visit_objects (const std::function< void(const object &)> &visitor) const
 Visits every object, which is reachable from this group (including this group) More...
 
object_reference ref () const
 An object reference to this group.
 
native_handle_type native_handle () const
 The underlying HDF5 low-level handle.
 
 operator bool () const
 Tests the validity of the handle.
 
attribute_repository< groupattributes () const
 The attributes, which are attached to the group.
 

Detailed Description

A handle to a group object.

Member Function Documentation

dataset echelon::group::create_dataset ( const std::string &  name,
const type datatype,
const std::vector< hsize_t > &  dims,
const dataset_options options = dataset_options() 
)

Creates a new dataset within this group.

Parameters
namename of the new dataset
datatypevalue type of the new dataset
dimsshape of the new dataset
optionsadditional dataset creation options
keyword semantic
compression_level level of the deflate compression (0 - 9)
shuffle_filter enable/disable the shuffle filter
auto_chunking enable/disable auto-chunking
chunk_shape shape of a dataset chunk
Returns
a handle to the new dataset
dataset echelon::group::create_dataset ( const std::string &  name,
const type datatype,
const std::vector< hsize_t > &  dims,
const std::vector< hsize_t > &  max_dims,
const dataset_options options = dataset_options() 
)

Creates a new dataset within this group.

If the maximal extent of the dataset is specified any value might be set to echelon::unlimited to not restrict this dimension.

Parameters
namename of the new dataset
datatypevalue type of the new dataset
dimsshape of the new dataset
max_dimsmaximal extent of the dataset (each value might be 'unlimited')
optionsadditional dataset creation options
keyword semantic
compression_level level of the deflate compression (0 - 9)
shuffle_filter enable/disable the shuffle filter
auto_chunking enable/disable auto-chunking
chunk_shape shape of a dataset chunk
Returns
a handle to the new dataset
template<typename T >
dataset echelon::group::create_dataset ( const std::string &  name,
const std::vector< hsize_t > &  dims,
const dataset_options options = dataset_options() 
)
inline

Creates a new dataset within this group.

Parameters
namename of the new dataset
dimsshape of the new dataset
optionsadditional dataset creation options
keyword semantic
compression_level level of the deflate compression (0 - 9)
shuffle_filter enable/disable the shuffle filter
auto_chunking enable/disable auto-chunking
chunk_shape shape of a dataset chunk
Template Parameters
TC++ type, which should be used to determine the dataset's value type
Returns
a handle to the new dataset
template<typename T >
dataset echelon::group::create_dataset ( const std::string &  name,
const std::vector< hsize_t > &  dims,
const std::vector< hsize_t > &  max_dims,
const dataset_options options = dataset_options() 
)
inline

Creates a new dataset within this group.

If the maximal extent of the dataset is specified any value might be set to echelon::unlimited to not restrict this dimension.

Parameters
namename of the new dataset
dimsshape of the new dataset
max_dimsmaximal extent of the dataset (each value might be 'unlimited')
optionsadditional dataset creation options
keyword semantic
compression_level level of the deflate compression (0 - 9)
shuffle_filter enable/disable the shuffle filter
auto_chunking enable/disable auto-chunking
chunk_shape shape of a dataset chunk
Template Parameters
TC++ type, which should be used to determine the dataset's value type
Returns
a handle to the new dataset
group echelon::group::create_group ( const std::string &  name)

Creates a new group within this group.

Parameters
namename of the new group
Returns
a handle to the new group
scalar_dataset echelon::group::create_scalar_dataset ( const std::string &  name,
const type datatype 
)

Creates a new scalar dataset within this group.

Parameters
namename of the new dataset
datatypevalue type of the new dataset
Returns
a handle to the new scalar dataset
template<typename T >
scalar_dataset echelon::group::create_scalar_dataset ( const std::string &  name)
inline

Creates a new scalar dataset within this group.

Parameters
namename of the new dataset
Template Parameters
TC++ type, which should be used to determine the dataset's value type
Returns
a handle to the new scalar dataset
template<typename T >
scalar_dataset echelon::group::create_scalar_dataset ( const std::string &  name,
const T &  value 
)
inline

Creates a new scalar dataset within this group and initializes it with a given value.

Parameters
namename of the new dataset
valuevalue, which should be used to intialize the dataset
Template Parameters
TC++ type, which should be used to determine the dataset's value type
Returns
a handle to the new scalar dataset
void echelon::group::iterate_links ( const std::function< void(const link &)> &  op) const

Iterates over every link within this group.

Parameters
opfunction, which is applied to every link
object echelon::group::operator[] ( const std::string &  name) const

Accessor function for this group.

Parameters
namename of the requested object
Returns
a handle to the requested object
void echelon::group::remove ( const std::string &  name) const

Removes the specified object from the group.

Parameters
namename of the removed object
dataset echelon::group::require_dataset ( const std::string &  name,
const type datatype,
const std::vector< hsize_t > &  dims,
const dataset_options options = dataset_options() 
)

Returns the requested dataset, if it already exists, otherwise a new dataset is created.

The new dataset is created using the given parameters.

This method allows the user to make a contract with the library, that an object with certain properties exists after the method has terminated.

If the dataset already exists and its shape or datatype differ from their requested value and an exception is thrown, since the contract can't be fulfilled.

Parameters
namename of the requested dataset
datatypevalue type of the new dataset
dimsshape of the new dataset
optionsadditional dataset creation options
keyword semantic
compression_level level of the deflate compression (0 - 9)
shuffle_filter enable/disable the shuffle filter
auto_chunking enable/disable auto-chunking
chunk_shape shape of a dataset chunk
Exceptions
broken_contract_exceptionis thrown, if the contract can't be fulfilled.
Returns
the requested dataset, if it is already existing, or a new dataset otherwise
template<typename T >
dataset echelon::group::require_dataset ( const std::string &  name,
const std::vector< hsize_t > &  dims,
const dataset_options options = dataset_options() 
)
inline

Returns the requested dataset, if it already exists, otherwise a new dataset is created.

The new dataset is created using the given parameters.

This method allows the user to make a contract with the library, that an object with certain properties exists after the method has terminated.

If the dataset already exists and its shape or datatype differ from their requested value and an exception is thrown, since the contract can't be fulfilled.

Parameters
namename of the requested dataset
dimsshape of the new dataset
optionsadditional dataset creation options
keyword semantic
compression_level level of the deflate compression (0 - 9)
shuffle_filter enable/disable the shuffle filter
auto_chunking enable/disable auto-chunking
chunk_shape shape of a dataset chunk
Template Parameters
TC++ type, which should be used to determine the dataset's value type
Exceptions
broken_contract_exceptionis thrown, if the contract can't be fulfilled.
Returns
the requested dataset, if it is already existing, or a new dataset otherwise
group echelon::group::require_group ( const std::string &  name)

Returns the requested group, if it already exists, otherwise a new group is created.

Parameters
namename of the requested group
Returns
the requested group, if it is already existing, or a new group otherwise
scalar_dataset echelon::group::require_scalar_dataset ( const std::string &  name,
const type datatype 
)

Returns the requested scalar dataset, if it already exists, otherwise a new scalar dataset is created.

The new dataset is created using the given parameters.

This method allows the user to make a contract with the library, that an object with certain properties exists after the method has terminated.

If the scalar dataset already exists and its datatype differs from its requested value and an exception is thrown, since the contract can't be fulfilled.

Parameters
namename of the requested dataset
datatypevalue type of the new dataset
Exceptions
broken_contract_exceptionis thrown, if the contract can't be fulfilled.
Returns
the requested scalar dataset, if it is already existing, or a new scalar dataset otherwise
template<typename T >
scalar_dataset echelon::group::require_scalar_dataset ( const std::string &  name)
inline

Returns the requested scalar dataset, if it already exists, otherwise the scalar dataset is created.

The new dataset is created using the given parameters.

This method allows the user to make a contract with the library, that an object with certain properties exists after the method has terminated.

If the scalar dataset already exists and its datatype differs from its requested value and an exception is thrown, since the contract can't be fulfilled.

Parameters
namename of the requested dataset
Template Parameters
TC++ type, which should be used to determine the dataset's value type
Exceptions
broken_contract_exceptionis thrown, if the contract can't be fulfilled.
Returns
the requested scalar dataset, if it is already existing, or a new scalar dataset otherwise
template<typename T >
scalar_dataset echelon::group::require_scalar_dataset ( const std::string &  name,
const T &  value 
)
inline

Returns the requested scalar dataset, if it already exists, otherwise a new scalar dataset is created.

The new dataset is created using the given parameters and is initialized with the given value.

This method allows the user to make a contract with the library, that an object with certain properties exists after the method has terminated.

If the scalar dataset already exists and its datatype differs from its requested value and an exception is thrown, since the contract can't be fulfilled.

Parameters
namename of the requested dataset
valuevalue, which should be used to intialize the dataset
Template Parameters
TC++ type, which should be used to determine the dataset's value type
Exceptions
broken_contract_exceptionis thrown, if the contract can't be fulfilled.
Returns
the requested scalar dataset, if it is already existing, or a new scalar dataset otherwise
void echelon::group::visit_links ( const std::function< void(const link &)> &  visitor) const

Visits every link, which is reachable from this group.

Parameters
visitorvisitor, which is applied to every visited link
void echelon::group::visit_objects ( const std::function< void(const object &)> &  visitor) const

Visits every object, which is reachable from this group (including this group)

Parameters
visitorvisitor, which is applied to every visited object

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