mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-23 02:52:42 +02:00
38 lines
892 B
C++
38 lines
892 B
C++
#ifndef ZMQRECVMODULE_H
|
|
#define ZMQRECVMODULE_H
|
|
|
|
#include <thread>
|
|
#include "ZmqReceiver.hpp"
|
|
#include "RingBuffer.hpp"
|
|
|
|
class ZmqRecvModule
|
|
{
|
|
typedef std::unordered_map<std::string, HeaderDataType> header_map;
|
|
|
|
RingBuffer<FrameMetadata>& ring_buffer_;
|
|
const header_map& header_values_;
|
|
std::atomic_bool is_receiving_;
|
|
std::atomic_bool is_saving_;
|
|
std::vector<std::thread> receiving_threads_;
|
|
|
|
protected:
|
|
void receive_thread(
|
|
const std::string& connect_address);
|
|
|
|
public:
|
|
ZmqRecvModule(
|
|
RingBuffer<FrameMetadata>& ring_buffer,
|
|
const header_map& header_values);
|
|
|
|
virtual ~ZmqRecvModule();
|
|
|
|
void start_recv(const std::string& connect_address,
|
|
const uint8_t n_receiving_threads);
|
|
void stop_recv();
|
|
bool is_receiving();
|
|
|
|
void start_saving();
|
|
void stop_saving_and_clear_buffer();
|
|
};
|
|
|
|
#endif |