CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
h5_content_base.h
Go to the documentation of this file.
1// -*- C++ -*-
12#ifndef __cxz_h5_content_base_h__
13#define __cxz_h5_content_base_h__
14
15#include "cnorxz.h"
16#include <hdf5.h>
17#include <hdf5_hl.h>
18
19namespace CNORXZ
20{
21 namespace hdf5
22 {
23 // TODO: IO save error handling !!!
24
29 enum class ContentType {
30 NONE = 0,
31 FILE = 1,
32 GROUP = 2,
33 DSET = 3,
34 TABLE = 4,
35 };
36
41 {
42 public:
49 ContentBase(const String& _name, const ContentBase* _parent = nullptr);
50
52 virtual ~ContentBase() = default;
53
57 virtual ContentType type() const = 0;
58
62 virtual bool ro() const = 0;
63
67 virtual ContentBase& open() = 0;
68
72 virtual ContentBase& close() = 0;
73
77 virtual String path() const = 0;
78
82 virtual String filename() const = 0;
83
87 virtual bool exists() const = 0;
88
92 const String& name() const;
93
97 const ContentBase* parent() const;
98
102 hid_t id() const;
103
107 bool isOpen() const;
108
114 template <typename T>
115 ContentBase& addAttribute(const String& name, const T& value);
116
121 DType getAttribute(const String& name) const;
122
127 bool attributeExists(const String& name) const;
128
132 std::map<String,DType> getAttributes() const;
133
137 std::map<String,DType> getRecursiveAttributes() const; // + all parent's attributes
138
139 protected:
141 const ContentBase* mParent = nullptr;
142 hid_t mId = 0;
143 };
144
147
148 }
149}
150
151#endif
virtual ContentBase & close()=0
const ContentBase * parent() const
virtual bool ro() const =0
const String & name() const
virtual bool exists() const =0
ContentBase & addAttribute(const String &name, const T &value)
std::map< String, DType > getAttributes() const
ContentBase(const String &_name, const ContentBase *_parent=nullptr)
bool attributeExists(const String &name) const
DEFAULT_MEMBERS(ContentBase)
std::map< String, DType > getRecursiveAttributes() const
virtual String path() const =0
const ContentBase * mParent
virtual String filename() const =0
DType getAttribute(const String &name) const
virtual ContentBase & open()=0
virtual ContentType type() const =0
virtual ~ContentBase()=default
cnorxz main header
Sptr< ContentBase > ContentPtr
std::string String
Definition types.h:42
Sptr< Range > rangeCast(const RangePtr r)
std::shared_ptr< T > Sptr
Definition types.h:48