forked from Dr15Jones/root_serialization
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathHDFSource.h
More file actions
58 lines (48 loc) · 1.72 KB
/
HDFSource.h
File metadata and controls
58 lines (48 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#if !defined(HDFSource_h)
#define HDFSource_h
#include <iostream>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "DataProductRetriever.h"
#include "DelayedProductRetriever.h"
#include "SourceBase.h"
#include "HDFCxx.h"
namespace cce::tf {
class HDFDelayedRetriever : public DelayedProductRetriever {
void getAsync(DataProductRetriever&, int index, TaskHolder) override {}
};
class HDFSource : public SourceBase {
public:
HDFSource(std::string const& iName);
HDFSource(HDFSource&&) = default;
HDFSource(HDFSource const&) = default;
~HDFSource();
struct ProductInfo{
ProductInfo(std::string iName, size_t iIndex) : name_(std::move(iName)), index_{iIndex} {}
size_t classIndex() const {return index_;}
std::string const& name() const { return name_;}
std::string name_;
size_t index_;
};
size_t numberOfDataProducts() const final {return productInfos_.size();}
std::vector<DataProductRetriever>& dataProducts() final {return dataProducts_;}
EventIdentifier eventIdentifier() final { return eventID_;}
using buffer_iterator = std::vector<std::vector<char>>::const_iterator;
private:
std::vector<std::string> readClassNames();
std::pair<long unsigned int, long unsigned int> getEventOffsets(long eventindex, std::string const& pname);
bool readEvent(long iEventIndex) final; //returns true if an event was read
void deserializeDataProducts(buffer_iterator, buffer_iterator);
hdf5::File file_;
hdf5::Group lumi_;
EventIdentifier eventID_;
std::vector<DataProductRetriever> dataProducts_;
std::vector<void*> dataBuffers_;
std::vector<ProductInfo> productInfos_;
std::vector<std::string> classnames_;
HDFDelayedRetriever delayedRetriever_;
};
}
#endif