CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
CNORXZ::hdf5::Group Class Reference

#include <h5_group.h>

Inheritance diagram for CNORXZ::hdf5::Group:
CNORXZ::hdf5::ContentBase CNORXZ::hdf5::File

Public Member Functions

 DEFAULT_MEMBERS (Group)
 
 Group (const String &gname, const ContentBase *_parent)
 
 ~Group ()
 
virtual ContentType type () const override
 
virtual bool ro () const override
 
virtual Groupopen () override
 
virtual Groupclose () override
 
virtual String path () const override
 
virtual String filename () const override
 
virtual bool exists () const override
 
const ContentPtrget (const String &name) const
 
Sptr< GroupgetGroup (const String &name) const
 
Sptr< TablegetTable (const String &name) const
 
Sptr< DatasetgetDataset (const String &name) const
 
template<typename... Ts>
Sptr< STable< Ts... > > getTable (const String &name, Tuple< Ts... > proto)
 
template<typename T >
Sptr< SDataset< T > > getDataset (const String &name, T proto)
 
const MArray< ContentPtr > & get () const
 
GroupaddGroup (const String &name)
 
template<typename... Ts>
GroupaddTable (const String &name, const ArrayBase< Tuple< Ts... > > &data, const Arr< String, sizeof...(Ts)> &fnames)
 
template<typename T >
GroupaddDataset (const String &name, const ArrayBase< T > &data)
 
template<class F >
decltype(autoiter (F &&f) const
 
template<class F >
decltype(autoiterRecursive (F &&f) const
 
template<class F >
decltype(autoiter (F &&f)
 
template<class F >
decltype(autoiterRecursive (F &&f)
 
- Public Member Functions inherited from CNORXZ::hdf5::ContentBase
 DEFAULT_MEMBERS (ContentBase)
 
 ContentBase (const String &_name, const ContentBase *_parent=nullptr)
 
virtual ~ContentBase ()=default
 
const Stringname () const
 
const ContentBaseparent () const
 
hid_t id () const
 
bool isOpen () const
 
template<typename T >
ContentBaseaddAttribute (const String &name, const T &value)
 
DType getAttribute (const String &name) const
 
bool attributeExists (const String &name) const
 
std::map< String, DTypegetAttributes () const
 
std::map< String, DTypegetRecursiveAttributes () const
 

Protected Member Functions

void mkCont ()
 
AIndex< ContentPtrgetIndexTo (const String &name) const
 
BIndex< ContentPtrgetIndexTo (const String &name)
 

Static Protected Member Functions

template<typename C , class F >
static void recursion (const C &c, F &&f)
 

Protected Attributes

MArray< ContentPtrmCont
 
- Protected Attributes inherited from CNORXZ::hdf5::ContentBase
String mName
 
const ContentBasemParent = nullptr
 
hid_t mId = 0
 

Detailed Description


Class to handle hdf5 groups.

Definition at line 25 of file h5_group.h.

Constructor & Destructor Documentation

◆ Group()

CNORXZ::hdf5::Group::Group ( const String & gname,
const ContentBase * _parent )

Construct the class.

Parameters
gnameGroup name.
_parentParent content object.

Definition at line 20 of file h5_group.cc.

◆ ~Group()

CNORXZ::hdf5::Group::~Group ( )

Destructor. Release all involved hdf5 ids.

Definition at line 24 of file h5_group.cc.

Member Function Documentation

◆ addDataset()

template<typename T >
Group & CNORXZ::hdf5::Group::addDataset ( const String & name,
const ArrayBase< T > & data )

Add a new dataset to this group.

Template Parameters
TValue type.
Parameters
nameName of the created dataset.
dataDataset data.

Definition at line 83 of file h5_group.cc.h.

◆ addGroup()

Group & CNORXZ::hdf5::Group::addGroup ( const String & name)

Add a new group to this group.

Parameters
nameName of the created group.

Definition at line 132 of file h5_group.cc.

◆ addTable()

template<typename... Ts>
Group & CNORXZ::hdf5::Group::addTable ( const String & name,
const ArrayBase< Tuple< Ts... > > & data,
const Arr< String, sizeof...(Ts)> & fnames )

Add a new table to this group.

Template Parameters
TsTable element types.
Parameters
nameName of the created table.
dataTable data.
fnamesTable field names.

Definition at line 96 of file h5_group.cc.h.

◆ close()

Group & CNORXZ::hdf5::Group::close ( )
overridevirtual

Close object.

Returns
Reference to this object.

Implements CNORXZ::hdf5::ContentBase.

Reimplemented in CNORXZ::hdf5::File.

Definition at line 57 of file h5_group.cc.

◆ DEFAULT_MEMBERS()

CNORXZ::hdf5::Group::DEFAULT_MEMBERS ( Group )

Default constructors and assignments.

◆ exists()

bool CNORXZ::hdf5::Group::exists ( ) const
overridevirtual

Check if group exists in the parent object.

Returns
True if object exists, else false.

Implements CNORXZ::hdf5::ContentBase.

Reimplemented in CNORXZ::hdf5::File.

Definition at line 82 of file h5_group.cc.

◆ filename()

String CNORXZ::hdf5::Group::filename ( ) const
overridevirtual

Get the file name.

Returns
Name of the hdf5 file this object is stored in.

Implements CNORXZ::hdf5::ContentBase.

Reimplemented in CNORXZ::hdf5::File.

Definition at line 74 of file h5_group.cc.

◆ get() [1/2]

const MArray< ContentPtr > & CNORXZ::hdf5::Group::get ( ) const

Get objects contained by this group.

Returns
MArray of object pointers.

Definition at line 126 of file h5_group.cc.

◆ get() [2/2]

const ContentPtr & CNORXZ::hdf5::Group::get ( const String & name) const

Get object contained by this group.

Parameters
nameObject name.
Returns
Pointer to the object.

Definition at line 87 of file h5_group.cc.

◆ getDataset() [1/2]

Sptr< Dataset > CNORXZ::hdf5::Group::getDataset ( const String & name) const

Get object contained by this group as dataset. Checks if the object is a table.

Parameters
nameDataset name.
Returns
Pointer to the dataset.

Definition at line 118 of file h5_group.cc.

◆ getDataset() [2/2]

template<typename T >
Sptr< SDataset< T > > CNORXZ::hdf5::Group::getDataset ( const String & name,
T proto )

Get object contained by this group as dataset for given value type. Checks if the object is a dataset.

Template Parameters
TDataset value type.
Parameters
nameDataset name.
protoEmpty prototype (template argument resolution).
Returns
Pointer to the dataset.

Definition at line 63 of file h5_group.cc.h.

◆ getGroup()

Sptr< Group > CNORXZ::hdf5::Group::getGroup ( const String & name) const

Get object contained by this group as group. Checks if the object is a group.

Parameters
nameGroup name.
Returns
Pointer to the group.

Definition at line 102 of file h5_group.cc.

◆ getIndexTo() [1/2]

BIndex< ContentPtr > CNORXZ::hdf5::Group::getIndexTo ( const String & name)
protected

Get index to requested group element.

Parameters
nameElement name.

Definition at line 242 of file h5_group.cc.

◆ getIndexTo() [2/2]

AIndex< ContentPtr > CNORXZ::hdf5::Group::getIndexTo ( const String & name) const
protected

Get index to requested group element (const).

Parameters
nameElement name.

Definition at line 233 of file h5_group.cc.

◆ getTable() [1/2]

Sptr< Table > CNORXZ::hdf5::Group::getTable ( const String & name) const

Get object contained by this group as table. Checks if the object is a table.

Parameters
nameTable name.
Returns
Pointer to the table.

Definition at line 110 of file h5_group.cc.

◆ getTable() [2/2]

template<typename... Ts>
Sptr< STable< Ts... > > CNORXZ::hdf5::Group::getTable ( const String & name,
Tuple< Ts... > proto )

Get object contained by this group as table for given value type. Checks if the object is a table.

Template Parameters
TsTable entry types.
Parameters
nameTable name.
protoEmpty prototype (template argument resolution).
Returns
Pointer to the table.

Definition at line 43 of file h5_group.cc.h.

◆ iter() [1/2]

template<class F >
decltype(auto) CNORXZ::hdf5::Group::iter ( F && f)

Iterate over all group elements.

Parameters
ffunction object to be executed on each group element.

Definition at line 130 of file h5_group.cc.h.

◆ iter() [2/2]

template<class F >
decltype(auto) CNORXZ::hdf5::Group::iter ( F && f) const

Iterate over all group elements (const).

Parameters
ffunction object to be executed on each group element.

Definition at line 112 of file h5_group.cc.h.

◆ iterRecursive() [1/2]

template<class F >
decltype(auto) CNORXZ::hdf5::Group::iterRecursive ( F && f)

Iterate recursively over all group elements.

Parameters
ffunction object to be executed on each group element.

Definition at line 139 of file h5_group.cc.h.

◆ iterRecursive() [2/2]

template<class F >
decltype(auto) CNORXZ::hdf5::Group::iterRecursive ( F && f) const

Iterate recursively over all group elements (const).

Parameters
ffunction object to be executed on each group element.

Definition at line 121 of file h5_group.cc.h.

◆ mkCont()

void CNORXZ::hdf5::Group::mkCont ( )
protected

Setup group content.

Definition at line 219 of file h5_group.cc.

◆ open()

Group & CNORXZ::hdf5::Group::open ( )
overridevirtual

Open object.

Returns
Reference to this object.

Implements CNORXZ::hdf5::ContentBase.

Reimplemented in CNORXZ::hdf5::File.

Definition at line 42 of file h5_group.cc.

◆ path()

String CNORXZ::hdf5::Group::path ( ) const
overridevirtual

Get object path.

Returns
Absolute hdf5 file internal path of this object.

Implements CNORXZ::hdf5::ContentBase.

Reimplemented in CNORXZ::hdf5::File.

Definition at line 66 of file h5_group.cc.

◆ recursion()

template<typename C , class F >
static void CNORXZ::hdf5::Group::recursion ( const C & c,
F && f )
inlinestaticprotected

Recursion helper functon.

Parameters
cGroup element.
fFunction to be executed.

Definition at line 155 of file h5_group.h.

◆ ro()

bool CNORXZ::hdf5::Group::ro ( ) const
overridevirtual

Check if in read-only mode

Returns
True if read-only else false.

Implements CNORXZ::hdf5::ContentBase.

Reimplemented in CNORXZ::hdf5::File.

Definition at line 34 of file h5_group.cc.

◆ type()

ContentType CNORXZ::hdf5::Group::type ( ) const
overridevirtual

Get the content type.

Returns
Content type.

Implements CNORXZ::hdf5::ContentBase.

Reimplemented in CNORXZ::hdf5::File.

Definition at line 29 of file h5_group.cc.

Member Data Documentation

◆ mCont

MArray<ContentPtr> CNORXZ::hdf5::Group::mCont
protected

Group elements.

Definition at line 148 of file h5_group.h.


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