PODIO v00-16-03
An Event-Data-Model Toolkit for High Energy Physics Experiments
Loading...
Searching...
No Matches
SIOFrameData.h
Go to the documentation of this file.
1#ifndef PODIO_SIOFRAMEDATA_H
2#define PODIO_SIOFRAMEDATA_H
3
7#include "podio/SIOBlock.h"
8
9#include <sio/buffer.h>
10#include <sio/definitions.h>
11
12#include <memory>
13#include <numeric>
14#include <optional>
15#include <string>
16#include <vector>
17
18namespace podio {
19/**
20 * The Frame data container for the SIO backend. It is constructed from the
21 * compressed sio::buffers that is read from file and does all the necessary
22 * unpacking and decompressing internally after construction.
23 */
25
26public:
27 SIOFrameData() = delete;
28 ~SIOFrameData() = default;
29
30 SIOFrameData(const SIOFrameData&) = delete;
32
35
36 /**
37 * Constructor from the collBuffers containing the collection data and a
38 * tableBuffer containing the necessary information for unpacking the
39 * collections. The two size parameters denote the uncompressed size of the
40 * respective buffers.
41 */
42 SIOFrameData(sio::buffer&& collBuffers, std::size_t dataSize, sio::buffer&& tableBuffer, std::size_t tableSize) :
43 m_recBuffer(std::move(collBuffers)),
44 m_tableBuffer(std::move(tableBuffer)),
45 m_dataSize(dataSize),
46 m_tableSize(tableSize) {
47 }
48
49 std::optional<podio::CollectionReadBuffers> getCollectionBuffers(const std::string& name);
50
52 if (m_idTable.empty()) {
53 readIdTable();
54 }
55 return {m_idTable.ids(), m_idTable.names()};
56 }
57
58 std::unique_ptr<podio::GenericParameters> getParameters();
59
60 std::vector<std::string> getAvailableCollections();
61
62private:
63 void unpackBuffers();
64
65 void readIdTable();
66
67 void createBlocks();
68
69 // Default initialization doesn't really matter here, because they are made
70 // the correct size on construction
71 sio::buffer m_recBuffer{sio::kbyte}; ///< The compressed record (data) buffer
72 sio::buffer m_tableBuffer{sio::kbyte}; ///< The compressed collection id table buffer
73
74 std::size_t m_dataSize{}; ///< Uncompressed data buffer size
75 std::size_t m_tableSize{}; ///< Uncompressed table size
76
77 std::vector<short> m_availableBlocks{}; ///< The blocks that have already been retrieved
78
79 sio::block_list m_blocks{};
80
81 podio::CollectionIDTable m_idTable{};
82 std::vector<std::string> m_typeNames{};
83 std::vector<short> m_subsetCollectionBits{};
84
85 podio::GenericParameters m_parameters{};
86};
87} // namespace podio
88
89#endif // PODIO_SIOFRAMEDATA_H
bool empty() const
Does this table hold any information?
const std::vector< int > & ids() const
return the ids
const std::vector< std::string > & names() const
return registered names
std::unique_ptr< podio::GenericParameters > getParameters()
Definition: SIOFrameData.cc:29
SIOFrameData(sio::buffer &&collBuffers, std::size_t dataSize, sio::buffer &&tableBuffer, std::size_t tableSize)
Definition: SIOFrameData.h:42
SIOFrameData(SIOFrameData &&)=default
~SIOFrameData()=default
podio::CollectionIDTable getIDTable()
Definition: SIOFrameData.h:51
SIOFrameData & operator=(SIOFrameData &&)=default
std::vector< std::string > getAvailableCollections()
Definition: SIOFrameData.cc:35
SIOFrameData & operator=(const SIOFrameData &)=delete
std::optional< podio::CollectionReadBuffers > getCollectionBuffers(const std::string &name)
Definition: SIOFrameData.cc:10
SIOFrameData(const SIOFrameData &)=delete