Rename replay zmq sender to BlockZmqSender

This commit is contained in:
2020-05-27 11:35:08 +02:00
parent ed84e7d0b6
commit 1f7c292d86
4 changed files with 31 additions and 31 deletions
+23
View File
@@ -0,0 +1,23 @@
#ifndef SF_DAQ_BUFFER_BLOCKZMQSENDER_HPP
#define SF_DAQ_BUFFER_BLOCKZMQSENDER_HPP
#include <string>
#include <jungfrau.hpp>
#include <formats.hpp>
class BlockZmqSender {
void* ctx_;
void* socket_;
public:
BlockZmqSender(const std::string& ipc_id, const int source_id);
virtual ~BlockZmqSender();
void close();
void send(const BufferBinaryBlock* block_data);
};
#endif //SF_DAQ_BUFFER_BLOCKZMQSENDER_HPP
-23
View File
@@ -1,23 +0,0 @@
#ifndef SF_DAQ_BUFFER_REPLAYZMQSENDER_HPP
#define SF_DAQ_BUFFER_REPLAYZMQSENDER_HPP
#include <string>
#include <jungfrau.hpp>
#include <formats.hpp>
class ReplayZmqSender {
void* ctx_;
void* socket_;
public:
ReplayZmqSender(const std::string& ipc_id, const int source_id);
virtual ~ReplayZmqSender();
void close();
void send(const BufferBinaryBlock* block_data);
};
#endif //SF_DAQ_BUFFER_REPLAYZMQSENDER_HPP
@@ -1,4 +1,4 @@
#include "ReplayZmqSender.hpp"
#include "BlockZmqSender.hpp"
#include <sstream>
#include <zmq.h>
@@ -9,7 +9,7 @@ using namespace std;
using namespace core_buffer;
ReplayZmqSender::ReplayZmqSender(const string& ipc_id, const int source_id)
BlockZmqSender::BlockZmqSender(const string& ipc_id, const int source_id)
{
auto ipc_base = REPLAY_STREAM_IPC_URL + ipc_id + "-";
stringstream ipc_stream;
@@ -31,17 +31,17 @@ ReplayZmqSender::ReplayZmqSender(const string& ipc_id, const int source_id)
throw runtime_error(zmq_strerror (errno));
}
ReplayZmqSender::~ReplayZmqSender()
BlockZmqSender::~BlockZmqSender()
{
close();
}
void ReplayZmqSender::close() {
void BlockZmqSender::close() {
zmq_close(socket_);
zmq_ctx_destroy(ctx_);
}
void ReplayZmqSender::send(const BufferBinaryBlock* block_data)
void BlockZmqSender::send(const BufferBinaryBlock* block_data)
{
zmq_send(socket_, block_data, sizeof(BufferBinaryBlock), ZMQ_SNDMORE);
}
}
+2 -2
View File
@@ -4,7 +4,7 @@
#include "FastQueue.hpp"
#include "buffer_config.hpp"
#include "BufferBinaryReader.hpp"
#include "ReplayZmqSender.hpp"
#include "BlockZmqSender.hpp"
using namespace std;
using namespace core_buffer;
@@ -87,7 +87,7 @@ int main (int argc, char *argv[]) {
uint64_t max_send_us = 0;
uint64_t n_stats = 0;
ReplayZmqSender sender(ipc_id, source_id);
BlockZmqSender sender(ipc_id, source_id);
uint64_t start_block = start_pulse_id / BUFFER_BLOCK_SIZE;
uint64_t stop_block = stop_pulse_id / BUFFER_BLOCK_SIZE;