echelon  0.8.0
Public Member Functions | Friends | List of all members
echelon::dataset Class Reference

A handle to an echelon dataset. More...

#include <dataset.hpp>

Public Member Functions

 dataset ()=default
 Initializes the handle with its null state.
 
template<typename Container >
void extend_along (std::size_t dimension_index, const Container &container)
 Extends the dataset along a given dimension. More...
 
std::vector< hsize_t > shape () const
 The shape of the dataset.
 
std::size_t rank () const
 The rank of the dataset.
 
type datatype () const
 The value type of the dataset.
 
template<typename... Args>
slice operator() (Args...args) const
 Slices the dataset. More...
 
object_reference ref () const
 A echelon object reference to this dataset.
 
native_handle_type native_handle () const
 The underlying HDF5 low-level handle.
 
 operator bool () const
 Tests the validity of the handle.
 
attribute_repository< datasetattributes () const
 The attributes, which are attached to the dataset.
 
dataset_dimensions dimensions () const
 The dimensions of the dataset.
 

Friends

template<typename T >
void operator<<= (dataset &sink, const T &source)
 Writes the content of a data source into the dataset. More...
 
template<typename T >
void operator<<= (T &sink, const dataset &source)
 Reads the content of the dataset into a data sink. More...
 

Detailed Description

A handle to an echelon dataset.

Member Function Documentation

template<typename Container >
void echelon::dataset::extend_along ( std::size_t  dimension_index,
const Container &  container 
)
inline

Extends the dataset along a given dimension.

Template Parameters
Containertype of the container; Container must satisfy the data sink requirements.
Parameters
dimension_indexindex of the extended dimension
containercontainer, which is used to fill the new portions of the dataset
template<typename... Args>
slice echelon::dataset::operator() ( Args...  args) const
inline

Slices the dataset.

The boundaries of the slice within the dataset are specified by index ranges, which can be constructed using echelon::range. Currently the following index range specifiers are supported (N and M are non-negative integral values and step is a positive integral value):

index range semantic
range(N,M) restrict the dimension to the interval $ [N,M) $.
range(N,M,step) restrict the dimension to the interval $ [N,M) $ and only include every step-th value.
N restrict the dimension to the single value N. This is equivalent to range(N,N+1)
_ do not restrict the dimension, but use the full range of indices

Within the range syntax the wildcard _ can be used as the lower or upper bound to specifiy, that the dimension should not be restricted through this bound.

The number of index range specifiers must match the rank of the dataset.

If an index range only contains one value, the rank of the slice is reduced by one. If none of the index range satisfies this condition, the rank of the slice equals the rank of the dataset.

The following example shows, how a slice can be used to access a portion of a dataset:

auto foo = some_group.create_dataset<double>("foo",{10,10,10});
multi_array<double> data({6,10},1.0);
// set the first dimension to 2 and clamp the second dimension between 2
// and 8. Afterwards the data is written into the 2-slice.
foo(2,range(2,8),_) <<= data;

It should be noted, that only the sliced portion of the dataset is loaded into the main memory. Therefore slicing is an efficient way to work on large datasets and even allows us to deal with datasets , which do not fit into the main memory.

At the time of writing, slice does support most operations, which are valid on a dataset.

Template Parameters
Argstypes of the index range specifiers
Parameters
argsindex range specifiers

Friends And Related Function Documentation

template<typename T >
void operator<<= ( dataset sink,
const T &  source 
)
friend

Writes the content of a data source into the dataset.

The shape of the data source must match the shape of the dataset.

Template Parameters
Ttype of the container; T must satisfy the data source requirements.
Parameters
sinkthe dataset, which is used as a sink
sourcethe data source
template<typename T >
void operator<<= ( T &  sink,
const dataset source 
)
friend

Reads the content of the dataset into a data sink.

Template Parameters
Ttype of the container; T must satisfy the data sink requirements.
Parameters
sinkthe data sink
sourcethe dataset, which is used as a source

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