forked from wiechula/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEPNReceiverDevice.h
More file actions
57 lines (42 loc) · 1.56 KB
/
EPNReceiverDevice.h
File metadata and controls
57 lines (42 loc) · 1.56 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
#ifndef ALICEO2_DEVICES_EPNRECEIVER_H_
#define ALICEO2_DEVICES_EPNRECEIVER_H_
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <FairMQDevice.h>
namespace AliceO2 {
namespace Devices {
/// Container for (sub-)timeframes
struct TFBuffer
{
FairMQParts parts;
std::chrono::steady_clock::time_point start;
std::chrono::steady_clock::time_point end;
};
/// Receives sub-timeframes from the flpSenders and merges these into full timeframes.
class EPNReceiverDevice : public FairMQDevice
{
public:
EPNReceiverDevice() = default;
virtual ~EPNReceiverDevice() final = default;
virtual void InitTask() final;
/// Prints the contents of the timeframe container
void PrintBuffer(const std::unordered_map<uint16_t, TFBuffer> &buffer) const;
/// Discared incomplete timeframes after \p fBufferTimeoutInMs.
void DiscardIncompleteTimeframes();
protected:
/// Overloads the Run() method of FairMQDevice
virtual void Run();
std::unordered_map<uint16_t, TFBuffer> mTimeframeBuffer; ///< Stores (sub-)timeframes
std::unordered_set<uint16_t> mDiscardedSet; ///< Set containing IDs of dropped timeframes
int mNumFLPs = 0; ///< Number of flpSenders
int mBufferTimeoutInMs = 5000; ///< Time after which incomplete timeframes are dropped
int mTestMode = 0; ///< Run the device in test mode (only syncSampler+flpSender+epnReceiver)
std::string mInChannelName = "";
std::string mOutChannelName = "";
std::string mAckChannelName = "";
};
} // namespace Devices
} // namespace AliceO2
#endif