h5gt 0.2.0
C++ wrapper for HDF5 library (based on HighFive project)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
h5gt::DataSet Class Reference

Class representing a dataset. More...

#include <H5DataSet.hpp>

Inheritance diagram for h5gt::DataSet:
h5gt::Object h5gt::SliceTraits< DataSet > h5gt::AnnotateTraits< DataSet >

Public Member Functions

uint64_t getStorageSize () const
 getStorageSize
 
uint64_t getOffset () const
 getOffset
 
DataType getDataType () const
 getDataType
 
LinkInfo getLinkInfo () const
 
DataSpace getSpace () const
 getSpace
 
DataSpace getMemSpace () const
 getMemSpace
 
File getFile () const
 
std::string unpackSoftLink () const
 unpackSoftLink retrieve target path to this dataset
 
void unlink () const
 
bool rename (const std::string &dest_path, const LinkCreateProps &linkCreateProps=LinkCreateProps(), const LinkAccessProps &linkAccessProps=LinkAccessProps()) const
 rename move link within container
 
Group getParent (const GroupAccessProps &groupAccessProps=GroupAccessProps()) const
 
DataSetCreateProps getCreateProps () const
 
DataSetAccessProps getAccessProps () const
 
void resize (const std::vector< size_t > &dims)
 Change the size of the dataset.
 
std::vector< size_t > getDimensions () const
 Get the dimensions of the whole DataSet. This is a shorthand for getSpace().getDimensions()
 
size_t getElementCount () const
 Get the total number of elements in the current dataset. E.g. 2x2x2 matrix has size 8. This is a shorthand for getSpace().getTotalCount()
 
bool operator== (const DataSet &other) const
 operator == Check if objects reside in the same file and equal to each other
 
bool operator!= (const DataSet &other) const
 
- Public Member Functions inherited from h5gt::Object
void flush (bool globalScope=true)
 flush
 
bool isValid () const noexcept
 isValid
 
hid_t getId (const bool &increaseRefCount=false) const noexcept
 getId
 
std::string getFileName () const
 
std::string getPath () const
 return the path to the current group, dataset, datatype or attribute's holder
 
int getIdRefCount () const noexcept
 
ObjectInfo getObjectInfo () const
 Retrieve several infos about the current object (address, dates, etc)
 
ObjectType getObjectType () const
 Gets the fundamental type of the object (dataset, group, etc)
 
- Public Member Functions inherited from h5gt::SliceTraits< DataSet >
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.
 
void read (T &array) const
 
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())
 
void write (const T &buffer)
 
void write_raw (const T *buffer, const DataType &dtype=DataType())
 
- Public Member Functions inherited from h5gt::AnnotateTraits< DataSet >
Attribute createAttribute (const std::string &attr_name, const DataSpace &space, const DataType &type)
 create a new attribute with the name attr_name
 
Attribute createAttribute (const std::string &attr_name, const DataSpace &space)
 createAttribute create a new attribute on the current dataset with size specified by space
 
Attribute createAttribute (const std::string &attr_name, const T &data)
 createAttribute create a new attribute on the current dataset and write to it, inferring the DataSpace from data.
 
void deleteAttribute (const std::string &attr_name)
 deleteAttribute let you delete an attribute by its name.
 
Attribute getAttribute (const std::string &attr_name) const
 open an existing attribute with the name attr_name
 
size_t getNumberAttributes () const
 return the number of attributes of the object
 
std::vector< std::string > listAttributeNames () const
 list all attribute name of the object
 
bool hasAttribute (const std::string &attr_name) const
 checks an attribute exists
 

Static Public Member Functions

static DataSet FromId (const hid_t &id, const bool &increaseRefCount=false)
 

Static Public Attributes

static const ObjectType type = ObjectType::Dataset
 

Protected Member Functions

 DataSet (const Object &obj)
 
 DataSet (Object &&o) noexcept
 
 Object ()
 
 Object (const Object &other)
 
 Object (Object &&other) noexcept
 
 Object (const hid_t &)
 
 Object (const hid_t &, const ObjectType &, const bool &)
 
- Protected Member Functions inherited from h5gt::Object
 Object (const Object &other)
 
 Object (Object &&other) noexcept
 
 Object (const hid_t &)
 
 Object (const hid_t &, const ObjectType &, const bool &)
 
LinkInfo _getLinkInfo (const std::string &objPath) const
 getLinkInfo retrieve link info from an object with 'objPath'. This object must reside in the same container as current one.
 
std::string _unpackSoftLink (const std::string &objName) const
 
std::string _unpackExternalLink (const std::string &objName, std::string &fileName_out) const
 
void _unlink (const std::string &obj_name) const
 
Objectoperator= (const Object &other)
 
bool operator== (const Object &other) const
 When coparing objects h5gt::File must be open.
 

Friends

class Reference
 
class Selection
 
template<typename Derivate >
class NodeTraits
 

Additional Inherited Members

- Protected Attributes inherited from h5gt::Object
hid_t _hid
 

Detailed Description

Class representing a dataset.

Member Function Documentation

◆ getDataType()

DataType h5gt::DataSet::getDataType ( ) const
inline

getDataType

Returns
return the datatype associated with this dataset

◆ getDimensions()

std::vector< size_t > h5gt::DataSet::getDimensions ( ) const
inline

Get the dimensions of the whole DataSet. This is a shorthand for getSpace().getDimensions()

Returns
The shape of the current h5gt::DataSet

◆ getElementCount()

size_t h5gt::DataSet::getElementCount ( ) const
inline

Get the total number of elements in the current dataset. E.g. 2x2x2 matrix has size 8. This is a shorthand for getSpace().getTotalCount()

Returns
The shape of the current h5gt::DataSet

◆ getMemSpace()

DataSpace h5gt::DataSet::getMemSpace ( ) const
inline

getMemSpace

Returns
same as getSpace for DataSet, compatibility with Selection class

◆ getOffset()

uint64_t h5gt::DataSet::getOffset ( ) const
inline

getOffset

Returns
returns DataSet address in file

◆ getSpace()

DataSpace h5gt::DataSet::getSpace ( ) const
inline

getSpace

Returns
return the dataspace associated with this dataset

◆ getStorageSize()

uint64_t h5gt::DataSet::getStorageSize ( ) const
inline

getStorageSize

Returns
returns the amount of storage allocated for a dataset.

◆ operator==()

bool h5gt::DataSet::operator== ( const DataSet & other) const
inline

operator == Check if objects reside in the same file and equal to each other

Parameters
other
Returns

◆ rename()

bool h5gt::DataSet::rename ( const std::string & dest_path,
const LinkCreateProps & linkCreateProps = LinkCreateProps(),
const LinkAccessProps & linkAccessProps = LinkAccessProps() ) const
inline

rename move link within container

Parameters
dest_path
linkCreatePropsimportant as they create intermediate groups
linkAccessProps
Returns

◆ resize()

void h5gt::DataSet::resize ( const std::vector< size_t > & dims)
inline

Change the size of the dataset.

This requires that the dataset was created with chunking, and you would generally want to have set a larger maxdims setting

Parameters
dimsNew size of the dataset

◆ unpackSoftLink()

std::string h5gt::DataSet::unpackSoftLink ( ) const
inline

unpackSoftLink retrieve target path to this dataset

Returns

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