mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-30 19:22:23 +02:00
Rename zmq pulse receiver
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef SF_DAQ_BUFFER_ZMQPULSERECEIVER_HPP
|
||||
#define SF_DAQ_BUFFER_ZMQPULSERECEIVER_HPP
|
||||
#ifndef SF_DAQ_BUFFER_ZMQPULSESYNCRECEIVER_HPP
|
||||
#define SF_DAQ_BUFFER_ZMQPULSESYNCRECEIVER_HPP
|
||||
|
||||
|
||||
#include <cstddef>
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "formats.hpp"
|
||||
|
||||
class ZmqPulseReceiver {
|
||||
class ZmqPulseSyncReceiver {
|
||||
|
||||
void* ctx_;
|
||||
const int n_modules_;
|
||||
@@ -16,14 +16,14 @@ class ZmqPulseReceiver {
|
||||
std::vector<void*> sockets_;
|
||||
|
||||
public:
|
||||
ZmqPulseReceiver(
|
||||
ZmqPulseSyncReceiver(
|
||||
void* ctx,
|
||||
const std::string& detector_name,
|
||||
const int n_modules);
|
||||
~ZmqPulseReceiver();
|
||||
~ZmqPulseSyncReceiver();
|
||||
|
||||
uint64_t get_next_pulse_id() const;
|
||||
};
|
||||
|
||||
|
||||
#endif //SF_DAQ_BUFFER_ZMQPULSERECEIVER_HPP
|
||||
#endif //SF_DAQ_BUFFER_ZMQPULSESYNCRECEIVER_HPP
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "ZmqPulseReceiver.hpp"
|
||||
#include "ZmqPulseSyncReceiver.hpp"
|
||||
#include "BufferUtils.hpp"
|
||||
|
||||
#include <zmq.h>
|
||||
@@ -16,7 +16,7 @@ using namespace buffer_config;
|
||||
using namespace stream_config;
|
||||
|
||||
|
||||
ZmqPulseReceiver::ZmqPulseReceiver(
|
||||
ZmqPulseSyncReceiver::ZmqPulseSyncReceiver(
|
||||
void * ctx,
|
||||
const string& detector_name,
|
||||
const int n_modules) :
|
||||
@@ -31,14 +31,14 @@ ZmqPulseReceiver::ZmqPulseReceiver(
|
||||
}
|
||||
}
|
||||
|
||||
ZmqPulseReceiver::~ZmqPulseReceiver()
|
||||
ZmqPulseSyncReceiver::~ZmqPulseSyncReceiver()
|
||||
{
|
||||
for (auto& socket:sockets_) {
|
||||
zmq_close(socket);
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t ZmqPulseReceiver::get_next_pulse_id() const
|
||||
uint64_t ZmqPulseSyncReceiver::get_next_pulse_id() const
|
||||
{
|
||||
uint64_t pulses[n_modules_];
|
||||
|
||||
+3
-12
@@ -1,17 +1,14 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include <zmq.h>
|
||||
#include <RamBuffer.hpp>
|
||||
|
||||
#include "buffer_config.hpp"
|
||||
#include "stream_config.hpp"
|
||||
#include "ZmqLiveSender.hpp"
|
||||
#include "ZmqPulseReceiver.hpp"
|
||||
#include "ZmqPulseSyncReceiver.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace chrono;
|
||||
using namespace buffer_config;
|
||||
using namespace stream_config;
|
||||
|
||||
@@ -34,15 +31,9 @@ int main (int argc, char *argv[])
|
||||
string RECV_IPC_URL = BUFFER_LIVE_IPC_URL + config.DETECTOR_NAME + "-";
|
||||
|
||||
auto ctx = zmq_ctx_new();
|
||||
zmq_ctx_set (ctx, ZMQ_IO_THREADS, STREAM_ZMQ_IO_THREADS);
|
||||
zmq_ctx_set(ctx, ZMQ_IO_THREADS, STREAM_ZMQ_IO_THREADS);
|
||||
|
||||
// TODO: This should be passed to the service and not calculated here.
|
||||
vector<string> ipc_urls;
|
||||
for (int i=0; i<config.n_modules; i++) {
|
||||
ipc_urls.push_back(RECV_IPC_URL + to_string(i));
|
||||
}
|
||||
|
||||
ZmqPulseReceiver receiver(ipc_urls, ctx);
|
||||
ZmqPulseSyncReceiver receiver(ctx, config.DETECTOR_NAME, config.n_modules);
|
||||
RamBuffer ram_buffer(config.DETECTOR_NAME, config.n_modules);
|
||||
ZmqLiveSender sender(ctx, config);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user