-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathSubTimeFrameDPL.h
More file actions
101 lines (75 loc) · 2.88 KB
/
Copy pathSubTimeFrameDPL.h
File metadata and controls
101 lines (75 loc) · 2.88 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
// 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_DPL_H_
#define ALICEO2_SUBTIMEFRAME_DPL_H_
#include "SubTimeFrameDataModel.h"
#include "SubTimeFrameVisitors.h"
#include <Headers/DataHeader.h>
namespace o2::DataDistribution
{
////////////////////////////////////////////////////////////////////////////////
/// StfDplAdapter
////////////////////////////////////////////////////////////////////////////////
class StfToDplAdapter : public ISubTimeFrameVisitor
{
public:
StfToDplAdapter() = delete;
StfToDplAdapter(fair::mq::Channel& pDplBridgeChan, SyncMemoryResources &pMemRes)
: mChan(pDplBridgeChan),
mMemRes(pMemRes)
{
mMessages.reserve(1 << 20);
if (getenv("DATADIST_DEBUG_DPL_CHAN")) {
IDDLOG("Inspection of DPL messages is enabled");
mInspectChannel = true;
}
if (getenv("DATADIST_NEW_DPL_CHAN")) {
if ("0" == std::string(getenv("DATADIST_NEW_DPL_CHAN"))) {
mReducedHdr = false;
}
}
IDDLOG("StfToDplAdapter: sending reduced-header split-payload messages={}", mReducedHdr);
}
virtual ~StfToDplAdapter() = default;
void sendToDpl(std::unique_ptr<SubTimeFrame>&& pStf);
void sendEosToDpl();
inline void stop() { mRunning = false; }
protected:
void visit(SubTimeFrame& pStf, void*) override;
void inspect() const;
private:
std::atomic_bool mRunning = true;
bool mInspectChannel = false;
bool mReducedHdr = true;
std::vector<fair::mq::MessagePtr> mMessages;
fair::mq::Channel& mChan;
SyncMemoryResources& mMemRes;
};
////////////////////////////////////////////////////////////////////////////////
/// DplToStfAdapter
////////////////////////////////////////////////////////////////////////////////
class DplToStfAdapter : public ISubTimeFrameVisitor
{
constexpr static std::uint64_t sCurrentTfId = 0;
public:
DplToStfAdapter() = default;
virtual ~DplToStfAdapter() = default;
std::unique_ptr<SubTimeFrame> deserialize(fair::mq::Channel& pChan, bool logError = false);
std::unique_ptr<SubTimeFrame> deserialize(fair::mq::Parts& pMsgs);
protected:
std::unique_ptr<SubTimeFrame> deserialize_impl();
void visit(SubTimeFrame& pStf, void*) override;
private:
std::vector<fair::mq::MessagePtr> mMessages;
};
} /* o2::DataDistribution */
#endif /* ALICEO2_SUBTIMEFRAME_DPL_H_ */