2023-01-20 01:05:24 +01:00
|
|
|
|
|
|
|
#ifndef __cxz_h5_table_h__
|
|
|
|
#define __cxz_h5_table_h__
|
|
|
|
|
|
|
|
#include "h5_content_base.h"
|
|
|
|
|
|
|
|
namespace CNORXZ
|
|
|
|
{
|
|
|
|
namespace hdf5
|
|
|
|
{
|
|
|
|
class Table : public ContentBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DEFAULT_MEMBERS(Table);
|
|
|
|
Table(const String& name, const ContentBase* _parent);
|
|
|
|
~Table();
|
|
|
|
|
|
|
|
virtual ContentType type() const override final;
|
|
|
|
virtual bool ro() const override final;
|
|
|
|
virtual Table& open() override final;
|
|
|
|
virtual Table& close() override final;
|
|
|
|
virtual String path() const override final;
|
|
|
|
virtual String filename() const override final;
|
2023-01-22 15:41:42 +01:00
|
|
|
|
2023-01-22 23:34:30 +01:00
|
|
|
Table& initFieldNames(const Vector<String>& fnames);
|
2023-01-23 19:22:42 +01:00
|
|
|
Table& appendRecord(SizeT n, const char* data);
|
|
|
|
Table& readRecord(SizeT pos, SizeT n, char* data);
|
2023-01-22 15:41:42 +01:00
|
|
|
|
2023-01-20 01:05:24 +01:00
|
|
|
private:
|
|
|
|
RangePtr mRecords;
|
|
|
|
RangePtr mFields; // -> FIndex (position -> offset)
|
2023-01-22 15:41:42 +01:00
|
|
|
MArray<SizeT> mSizes;
|
|
|
|
MArray<SizeT> mOffsets;
|
|
|
|
MArray<hid_t> mTypes;
|
2023-01-23 19:22:42 +01:00
|
|
|
hid_t mType = 0;
|
2023-01-22 23:34:30 +01:00
|
|
|
bool mCheckedFile = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename... Ts>
|
|
|
|
class STabel : public Table
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DEFAULT_MEMBERS(STabel);
|
2023-01-23 19:22:42 +01:00
|
|
|
STabel(const String& name, const ContentBase* _parent, const RangePtr& fields);
|
2023-01-22 23:34:30 +01:00
|
|
|
|
|
|
|
Table& appendRecord(const Tuple<Ts...>& t);
|
|
|
|
Table& appendRecord(const MArray<Tuple<Ts...>>& t);
|
|
|
|
|
2023-01-23 19:22:42 +01:00
|
|
|
template <class F>
|
|
|
|
decltype(auto) iterRecords(F&& f) const;
|
2023-01-20 01:05:24 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|