CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
h5_group.h
Go to the documentation of this file.
1// -*- C++ -*-
12#ifndef __cxz_h5_group_h__
13#define __cxz_h5_group_h__
14
15#include "h5_types.h"
16#include "h5_content_base.h"
17
18namespace CNORXZ
19{
20 namespace hdf5
21 {
25 class Group : public ContentBase
26 {
27 public:
34 Group(const String& gname, const ContentBase* _parent);
35
37 ~Group();
38
39 virtual ContentType type() const override;
40 virtual bool ro() const override;
41 virtual Group& open() override; // load group if existing, else create new group
42 virtual Group& close() override;
43 virtual String path() const override;
44 virtual String filename() const override;
45 virtual bool exists() const override;
46
51 const ContentPtr& get(const String& name) const;
52
58 Sptr<Group> getGroup(const String& name) const;
59
65 Sptr<Table> getTable(const String& name) const;
66
72 Sptr<Dataset> getDataset(const String& name) const;
73
81 template <typename... Ts>
83
91 template <typename T>
93
97 const MArray<ContentPtr>& get() const;
98
102 Group& addGroup(const String& name);
103
110 template <typename... Ts>
111 Group& addTable(const String& name, const ArrayBase<Tuple<Ts...>>& data,
112 const Arr<String,sizeof...(Ts)>& fnames);
113
119 template <typename T>
120 Group& addDataset(const String& name, const ArrayBase<T>& data);
121
125 template <class F>
126 decltype(auto) iter(F&& f) const;
127
131 template <class F>
132 decltype(auto) iterRecursive(F&& f) const;
133
137 template <class F>
138 decltype(auto) iter(F&& f);
139
143 template <class F>
144 decltype(auto) iterRecursive(F&& f);
145
146 protected:
147
154 template <typename C, class F>
155 static void recursion(const C& c, F&& f)
156 {
157 if(c->type() == ContentType::GROUP){
158 auto cx = std::dynamic_pointer_cast<Group>(c);
159 cx->open();
160 if(cx->get().range() != nullptr){
161 cx->iterRecursive(std::forward<F>(f))();
162 }
163 }
164 }
165
167 void mkCont();
168
173
178 };
179 }
180}
181
182#endif
const String & name() const
Group & addDataset(const String &name, const ArrayBase< T > &data)
Definition h5_group.cc.h:83
const MArray< ContentPtr > & get() const
Definition h5_group.cc:126
virtual String filename() const override
Definition h5_group.cc:74
Sptr< Group > getGroup(const String &name) const
Definition h5_group.cc:102
decltype(auto) iterRecursive(F &&f) const
Sptr< Dataset > getDataset(const String &name) const
Definition h5_group.cc:118
decltype(auto) iter(F &&f) const
static void recursion(const C &c, F &&f)
Definition h5_group.h:155
MArray< ContentPtr > mCont
Definition h5_group.h:148
Sptr< Table > getTable(const String &name) const
Definition h5_group.cc:110
virtual Group & close() override
Definition h5_group.cc:57
Group & addTable(const String &name, const ArrayBase< Tuple< Ts... > > &data, const Arr< String, sizeof...(Ts)> &fnames)
Definition h5_group.cc.h:96
Group & addGroup(const String &name)
Definition h5_group.cc:132
virtual Group & open() override
Definition h5_group.cc:42
virtual bool exists() const override
Definition h5_group.cc:82
virtual ContentType type() const override
Definition h5_group.cc:29
virtual bool ro() const override
Definition h5_group.cc:34
AIndex< ContentPtr > getIndexTo(const String &name) const
Definition h5_group.cc:233
virtual String path() const override
Definition h5_group.cc:66
Group(const String &gname, const ContentBase *_parent)
Definition h5_group.cc:20
Abstract content base class declaration.
Declaration of hdf5 related library types.
Sptr< ContentBase > ContentPtr
std::string String
Definition types.h:42
Sptr< Range > rangeCast(const RangePtr r)
std::tuple< T... > Tuple
Definition types.h:60
std::array< T, N > Arr
Definition types.h:45
std::shared_ptr< T > Sptr
Definition types.h:48