forked from hep-cce2/root_serialization
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpds_reading.h
More file actions
44 lines (30 loc) · 1.46 KB
/
pds_reading.h
File metadata and controls
44 lines (30 loc) · 1.46 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
#if !defined(pds_reading_h)
#define pds_reading_h
#include <istream>
#include <vector>
#include "DeserializeStrategy.h"
#include "EventIdentifier.h"
#include "DataProductRetriever.h"
namespace cce::tf::pds {
uint32_t readword(std::istream& iFile);
uint32_t readwordNoCheck(std::istream& iFile);
std::vector<uint32_t> readWords(std::istream& iFile, uint32_t bufferSize) ;
struct ProductInfo{
ProductInfo(std::string iName, uint32_t iIndex, std::string iClassName) : name_(std::move(iName)), index_{iIndex}, className_{iClassName} {}
uint32_t classIndex() const {return index_;}
std::string const& name() const { return name_;}
std::string const& className() const { return className_;}
std::string className_;
std::string name_;
uint32_t index_;
};
enum class Compression {kNone, kLZ4, kZSTD};
enum class Serialization {kRoot, kRootUnrolled};
std::vector<ProductInfo> readFileHeader(std::istream&, Compression&, Serialization&);
constexpr size_t kEventHeaderSizeInWords = 5;
bool skipToNextEvent(std::istream&); //returns true if an event was skipped
bool readCompressedEventBuffer(std::istream&, EventIdentifier&, std::vector<uint32_t>& buffer);
std::vector<uint32_t> uncompressEventBuffer(pds::Compression, std::vector<uint32_t> const& buffer);
void deserializeDataProducts(std::vector<uint32_t>::const_iterator, std::vector<uint32_t>::const_iterator, std::vector<DataProductRetriever>&, DeserializeStrategy const&);
}
#endif