mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-05 13:04:14 +02:00
465369a322
The pulse_id stream can be used to synchronize components. For example, the writer can listen for the current pulse_id and write with 1 second delay to a file. This will help us eliminate the need to wait for the run to complete to start the data write request.
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#ifndef SF_DAQ_BUFFER_ZMQLIVESENDER_HPP
|
|
#define SF_DAQ_BUFFER_ZMQLIVESENDER_HPP
|
|
|
|
#include <string>
|
|
#include <fstream>
|
|
#include <rapidjson/istreamwrapper.h>
|
|
#include <rapidjson/document.h>
|
|
#include <rapidjson/stringbuffer.h>
|
|
#include <rapidjson/writer.h>
|
|
|
|
#include "formats.hpp"
|
|
|
|
|
|
struct LiveStreamConfig {
|
|
const std::string streamvis_address;
|
|
const int reduction_factor_streamvis;
|
|
const std::string live_analysis_address;
|
|
const int reduction_factor_live_analysis;
|
|
const std::string PEDE_FILENAME;
|
|
const std::string GAIN_FILENAME;
|
|
const std::string DETECTOR_NAME;
|
|
const int n_modules;
|
|
const std::string pulse_address;
|
|
};
|
|
|
|
LiveStreamConfig read_json_config(const std::string filename);
|
|
|
|
class ZmqLiveSender {
|
|
const void* ctx_;
|
|
const LiveStreamConfig config_;
|
|
|
|
void* socket_streamvis_;
|
|
void* socket_live_;
|
|
void* socket_pulse_;
|
|
|
|
public:
|
|
ZmqLiveSender(void* ctx,
|
|
const LiveStreamConfig& config);
|
|
~ZmqLiveSender();
|
|
|
|
void send(const ModuleFrameBuffer* meta, const char* data);
|
|
};
|
|
|
|
|
|
#endif //SF_DAQ_BUFFER_ZMQLIVESENDER_HPP
|