h5gt 0.2.0
C++ wrapper for HDF5 library (based on HighFive project)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
h5gt::SliceTraits< Derivate > Class Template Reference

Public Member Functions

Selection select (const std::vector< size_t > &offset, const std::vector< size_t > &count, const std::vector< size_t > &stride=std::vector< size_t >(), const std::vector< size_t > &block=std::vector< size_t >()) const
 Select a region in the current Slice/Dataset of count points at offset separated by stride. If strides are not provided they will default to 1 in all dimensions.
 
Selection select (const ElementSet &elements) const
 Select a region in the current Slice/Dataset out of a list of elements.
 
Selection select_rows (const std::vector< size_t > &ind, size_t offset=0, size_t count=0) const
 Select a set of rows in the first dimension of this dataset. NOTE: Selection is done in memory layout order (be careful with chunked dsets). Most likely the order of rows read will be mixed.
 
Selection select_cols (const std::vector< size_t > &ind, size_t offset=0, size_t count=0) const
 Select a set of columns in the last dimension of this dataset. NOTE: Selection is done in memory layout order (be careful with chunked dsets). Most likely the order of rows read will be mixed.
 
template<typename T >
void read (T &array) const
 
template<typename T >
void read (T *array, const DataType &dtype=DataType()) const
 SliceTraits::read DONT USE THIS WITH VARIABLE LENGTH STRING (i.e. with std::string or std::vector<std::string>) as you will need to manually free allocated const char * memory (using H5Treclaim())
 
template<typename T >
void write (const T &buffer)
 
template<typename T >
void write_raw (const T *buffer, const DataType &dtype=DataType())
 

Member Function Documentation

◆ read() [1/2]

template<typename Derivate >
template<typename T >
void h5gt::SliceTraits< Derivate >::read ( T & array) const
inline

Read the entire dataset into a buffer An exception is raised is if the numbers of dimension of the buffer and of the dataset are different. The array type can be a N-pointer or a N-vector. For plain pointers not dimensionality checking will be performed, it is the user's responsibility to ensure that the right amount of space has been allocated.

◆ read() [2/2]

template<typename Derivate >
template<typename T >
void h5gt::SliceTraits< Derivate >::read ( T * array,
const DataType & dtype = DataType() ) const
inline

SliceTraits::read DONT USE THIS WITH VARIABLE LENGTH STRING (i.e. with std::string or std::vector<std::string>) as you will need to manually free allocated const char * memory (using H5Treclaim())

Read the entire dataset into a raw buffer No dimensionality checks will be performed, it is the user's responsibility to ensure that the right amount of space has been allocated.

Parameters
arrayA buffer containing enough space for the data
dtypeThe type of the data, in case it cannot be automatically guessed
array
dtype

◆ select()

template<typename Derivate >
Selection h5gt::SliceTraits< Derivate >::select ( const std::vector< size_t > & offset,
const std::vector< size_t > & count,
const std::vector< size_t > & stride = std::vector<size_t>(),
const std::vector< size_t > & block = std::vector<size_t>() ) const
inline

Select a region in the current Slice/Dataset of count points at offset separated by stride. If strides are not provided they will default to 1 in all dimensions.

vector offset and count have to be from the same dimension

◆ select_cols()

template<typename Derivate >
Selection h5gt::SliceTraits< Derivate >::select_cols ( const std::vector< size_t > & ind,
size_t offset = 0,
size_t count = 0 ) const
inline

Select a set of columns in the last dimension of this dataset. NOTE: Selection is done in memory layout order (be careful with chunked dsets). Most likely the order of rows read will be mixed.

Parameters
indcol indices
offsetalong each column (0 dim): 0-from the beginning
countnumber of elements along each column (0 dim): 0-whole column starting from the offset

◆ select_rows()

template<typename Derivate >
Selection h5gt::SliceTraits< Derivate >::select_rows ( const std::vector< size_t > & ind,
size_t offset = 0,
size_t count = 0 ) const
inline

Select a set of rows in the first dimension of this dataset. NOTE: Selection is done in memory layout order (be careful with chunked dsets). Most likely the order of rows read will be mixed.

Parameters
indrow indices
offsetoffset along each row (1 dim): 0-from the beginning
countnumber of elements along each row (1 dim): 0-whole row starting from the offset

◆ write()

template<typename Derivate >
template<typename T >
void h5gt::SliceTraits< Derivate >::write ( const T & buffer)
inline

Write the integrality N-dimension buffer to this dataset An exception is raised is if the numbers of dimension of the buffer and of the dataset are different The array type can be a N-pointer or a N-vector ( e.g int** integer two dimensional array )

◆ write_raw()

template<typename Derivate >
template<typename T >
void h5gt::SliceTraits< Derivate >::write_raw ( const T * buffer,
const DataType & dtype = DataType() )
inline

Write from a raw buffer into this dataset No dimensionality checks will be performed, it is the user's responsibility to ensure that the buffer holds the right amount of elements. For n-dimensional matrices the buffer layout follows H5 default conventions.

Parameters
bufferA buffer containing the data to be written
dtypeThe type of the data, in case it cannot be automatically guessed

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