GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4HDF5DataHandle.h
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4HDF5DATAHANDLE_H
15 #define TGO4HDF5DATAHANDLE_H
16 
17 
18 #include "Go4HDF5.h"
19 #include "TString.h"
20 #include "TObject.h"
21 
22 #ifndef __CINT__
23 #include "H5Cpp.h"
24 #endif
25 
26 class TClass;
27 class TDataMember;
28 class TGo4EventElement;
29 class TGo4HDF5Source;
30 
31 class TGo4HDF5DataHandle;
32 
34 {
35 public:
36 
38 
40  TGo4HDF5DataHandle* CreateDataHandle(const char *name, size_t datasize, const char *type);
41 };
42 
43 
52 
53 public:
54 
56  TGo4HDF5DataHandle(const char *name, size_t datasize);
57  virtual ~TGo4HDF5DataHandle();
58 
60  H5::CompType *GetType() const { return fxType; }
61 
62  const char *GetTypeName() const { return fxTypeName.Data(); }
63 
64  void *Data() const { return fxData; }
65 
67  void InsertTypeMember(const H5std_string &name, size_t offset, const H5::DataType &new_member);
68 
70  void SetParentOffset(size_t off) { fiParentOffset = off; }
71 
72 
74  virtual void SetObjectPointer(void *memptr);
75 
78  void SetTopEvent(TGo4EventElement *eve);
79 
80 
83  void SetTopEventClass(const char *classname);
84 
86  void SetMemberName(const char *name) { fxMemberHandle = name; }
87 
89  void SetMemberClass(const char *clname) { fxMemberClass = clname; }
90 
93  virtual void BuildReadDataset(H5::H5File *file, TGo4HDF5Source* parent);
94 
96  virtual void BuildWriteDataset(H5::H5File *file);
97 
99  virtual void Read(hsize_t sequencenum, H5::H5File *file);
100 
102  virtual void Write(hsize_t sequencenum, H5::H5File *file);
103 
107  TGo4HDF5DataHandle *AddSubMember(const char *name, size_t datasize, const char *collectiontype = nullptr);
108 
109  TGo4HDF5DataHandle *GetSubMember(UInt_t ix) { return ix < fxSubcomponents.size() ? fxSubcomponents[ix] : nullptr; }
110 
113  TGo4HDF5DataHandle *FindSubMember(const char *name);
114 
115  void SetActive(Bool_t on) { fbDataSetActive = on; }
116 
117  void SetAllSubMembersActive(Bool_t on);
118 
120 
121  protected:
123  TString fxTypeName;
124 
125 #ifndef __CINT__
126 
128  H5::CompType* fxType{nullptr};
129 
130 
132  H5::DataSet fxDataSet;
133 
135  H5::DataSpace* fxDataSpace{nullptr};
136 
138  H5::DataSpace fxFileSpace;
139 
141  ULong_t fiEntries{0};
142 
143 #endif
144 
146  void *fxData{nullptr};
147 
149  size_t fiParentOffset{0};
150 
151 
153  size_t fiDataSize{0};
154 
155 
157  size_t fiReadOffset{0};
158 
159 
161  std::vector<TGo4HDF5DataHandle*> fxSubcomponents;
162 
164  TString fxMemberHandle;
165 
167  TString fxMemberClass;
168 
170  TGo4EventElement *fxEvent{nullptr};
171 
173  TString fxEventClass;
174 
176  TGo4HDF5Source* fxParentSource{nullptr};
177 
179  Bool_t fbDataSetExists{kFALSE};
180 
183  Bool_t fbDataSetActive{kFALSE};
184 
185 };
186 
187 
188 
190 
191 
198 {
199 
200 public:
201 
203  TGo4HDF5BasicDataHandle(const char *name, size_t datasize);
204  virtual ~TGo4HDF5BasicDataHandle();
205 
208  void BuildReadDataset(H5::H5File*file, TGo4HDF5Source* parent) override;
209 
211  void BuildWriteDataset(H5::H5File* file) override;
212 
213 
215  void Read(hsize_t sequencenum, H5::H5File*file) override;
216 
218  void Write(hsize_t sequencenum, H5::H5File*file) override;
219 
220 
221 protected:
222 
224  void AllocReadBuffer(size_t size);
225 
226 
228  Char_t *fxReadBuffer{nullptr};
229 
230 };
231 
232 
233 
235 
236 
237 
238 
245 
246 {
247 
248 public:
249 
251  TGo4HDF5CompositeDataHandle(const char *name, size_t datasize);
252  virtual ~TGo4HDF5CompositeDataHandle();
253 
254 
255 
258  void BuildReadDataset(H5::H5File*file, TGo4HDF5Source* parent) override;
259 
261  void BuildWriteDataset(H5::H5File* file) override;
262 
263 
265  void Read(hsize_t sequencenum, H5::H5File* file) override;
266 
268  void Write(hsize_t sequencenum, H5::H5File* file) override;
269 
270 };
271 
272 
274 
277 {
278  hvl_t fxArray;
279 };
280 
281 
282 
290 {
291 
292 public:
293 
295  TGo4HDF5VectorDataHandle(const char *name, size_t datasize);
296  virtual ~TGo4HDF5VectorDataHandle();
297 
298 
300  void SetElementSize(size_t len) {fiElementSize=len;}
301 
303  void SetObjectPointer(void *memptr) override;
304 
307  void BuildReadDataset(H5::H5File*file, TGo4HDF5Source* parent) override;
308 
310  void BuildWriteDataset(H5::H5File* file) override;
311 
313  void Read(hsize_t sequencenum, H5::H5File* file) override;
314 
316  void Write(hsize_t sequencenum, H5::H5File* ile) override;
317 
318 protected:
319 
320 
321 #ifndef __CINT__
322 
325  H5::CompType* fxCollection{nullptr};
326 
327 
330 
331 #endif
332 
333 
335  size_t fiElementSize{0};//
336 
337 };
338 
339 
341 {
342 public:
343 
344  unsigned long fx_Begin_ptr;
345  unsigned long fx_End_ptr;
346  unsigned long fx_Cap_ptr;
347 };
348 
349 
350 
359 {
360 
361 public:
362 
364  TGo4HDF5SubVectorDataHandle(const char *name, size_t datasize);
365  virtual ~TGo4HDF5SubVectorDataHandle();
366 
368  void SetObjectPointer(void *memptr) override;
369 
372  void BuildReadDataset(H5::H5File*file, TGo4HDF5Source* parent) override;
373 
375  void BuildWriteDataset(H5::H5File* file) override;
376 
378  void Read(hsize_t sequencenum, H5::H5File* file) override;
379 
381  void Write(hsize_t sequencenum, H5::H5File* file) override;
382 
383  void SetInnerClassName(const char *nm) {fxInnerClassName=nm;}
384 
385 
386 protected:
387 
390 
391 };
392 
393 
394 #endif //TGO4HDF5DATAHANDLE_H
void SetInnerClassName(const char *nm)
void SetActive(Bool_t on)
H5::CompType * GetType() const
TGo4HDF5DataHandle * CreateDataHandle(const char *name, size_t datasize, const char *type)
H5::DataSpace fxFileSpace
std::vector< TGo4HDF5DataHandle * > fxSubcomponents
unsigned long fx_Begin_ptr
void SetParentOffset(size_t off)
static TGo4HDF5DataHandleFactory fxFactory
const char * GetTypeName() const
TGo4HDF5VarContainer fxVarHandle
TGo4HDF5DataHandle * GetSubMember(UInt_t ix)
void SetMemberName(const char *name)
void SetElementSize(size_t len)
void SetMemberClass(const char *clname)