-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathSubTimeFrameVisitors.h
More file actions
106 lines (72 loc) · 2.75 KB
/
Copy pathSubTimeFrameVisitors.h
File metadata and controls
106 lines (72 loc) · 2.75 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright 2019-2022 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \author Gvozden Nešković, Frankfurt Institute for Advanced Studies and Goethe University Frankfurt
#ifndef ALICEO2_SUBTIMEFRAME_VISITORS_H_
#define ALICEO2_SUBTIMEFRAME_VISITORS_H_
#include "SubTimeFrameDataModel.h"
#include "SubTimeFrameBuilder.h"
#include <Headers/DataHeader.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <discovery.pb.h>
#pragma GCC diagnostic pop
#include <vector>
#include <fairmq/FwdDecls.h>
namespace o2::DataDistribution
{
////////////////////////////////////////////////////////////////////////////////
/// IovSerializer
////////////////////////////////////////////////////////////////////////////////
class IovSerializer : public ISubTimeFrameVisitor
{
public:
IovSerializer() = delete;
IovSerializer(fair::mq::Channel& pChan)
: mChan(pChan)
{
mData.reserve(25600);
}
virtual ~IovSerializer() = default;
void serialize(std::unique_ptr<SubTimeFrame>&& pStf);
void stop() { mRunning = false; }
protected:
void visit(SubTimeFrame& pStf, void*) override;
private:
std::atomic_bool mRunning = true;
std::vector<fair::mq::MessagePtr> mData;
IovStfHeader mIovHeader;
fair::mq::Channel& mChan;
};
////////////////////////////////////////////////////////////////////////////////
/// IovDeserializer
////////////////////////////////////////////////////////////////////////////////
class IovDeserializer : public ISubTimeFrameVisitor
{
public:
IovDeserializer() = delete;
IovDeserializer(TimeFrameBuilder &pTfBld)
: mTfBld(pTfBld) { }
virtual ~IovDeserializer() = default;
std::unique_ptr<SubTimeFrame> deserialize(const IovStfHdrMeta &pHdrMeta, std::vector<fair::mq::MessagePtr>& pDataMsgs);
SubTimeFrame::Header peek_tf_header(const IovStfHdrMeta &pHdrMeta) const;
bool copy_to_region(std::vector<fair::mq::MessagePtr>& pMsgs /* in/out */);
protected:
std::unique_ptr<SubTimeFrame> deserialize_impl();
void visit(SubTimeFrame& pStf, void*) override;
private:
// IovStfHeader mIovHeader;
IovStfHdrMeta mIovStfHeader;
std::vector<fair::mq::MessagePtr> mHdrs;
std::vector<fair::mq::MessagePtr> mData;
TimeFrameBuilder &mTfBld;
};
} /* o2::DataDistribution */
#endif /* ALICEO2_SUBTIMEFRAME_VISITORS_H_ */