mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-06 18:34:13 +02:00
Change bind and connect socket helper functions to take string
This commit is contained in:
@@ -36,9 +36,14 @@ namespace BufferUtils
|
||||
void create_destination_folder(const std::string& output_file);
|
||||
|
||||
void* bind_socket(
|
||||
void* ctx, const std::string& detector_name, const int source_id);
|
||||
void* ctx,
|
||||
const std::string& detector_name,
|
||||
const std::string& stream_name);
|
||||
|
||||
void* connect_socket(
|
||||
void* ctx, const std::string& detector_name, const int source_id);
|
||||
void* ctx,
|
||||
const std::string& detector_name,
|
||||
const std::string& stream_name);
|
||||
|
||||
DetectorConfig read_json_config(const std::string& filename);
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ void BufferUtils::create_destination_folder(const string& output_file)
|
||||
}
|
||||
|
||||
void* BufferUtils::connect_socket(
|
||||
void* ctx, const string& detector_name, const int source_id)
|
||||
void* ctx, const string& detector_name, const string& stream_name)
|
||||
{
|
||||
string ipc_address = BUFFER_LIVE_IPC_URL +
|
||||
detector_name + "-" +
|
||||
to_string(source_id);
|
||||
stream_name;
|
||||
|
||||
void* socket = zmq_socket(ctx, ZMQ_SUB);
|
||||
if (socket == nullptr) {
|
||||
@@ -102,11 +102,11 @@ void* BufferUtils::connect_socket(
|
||||
}
|
||||
|
||||
void* BufferUtils::bind_socket(
|
||||
void* ctx, const string& detector_name, const int source_id)
|
||||
void* ctx, const string& detector_name, const string& stream_name)
|
||||
{
|
||||
string ipc_address = BUFFER_LIVE_IPC_URL +
|
||||
detector_name + "-" +
|
||||
to_string(source_id);
|
||||
stream_name;
|
||||
|
||||
void* socket = zmq_socket(ctx, ZMQ_PUB);
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ int main (int argc, char *argv[]) {
|
||||
BufferStats stats(config.detector_name, module_id, STATS_MODULO);
|
||||
|
||||
auto ctx = zmq_ctx_new();
|
||||
auto socket = connect_socket(ctx, config.detector_name, module_id);
|
||||
auto socket = connect_socket(
|
||||
ctx, config.detector_name, to_string(module_id));
|
||||
|
||||
auto file_buff = new BufferBinaryFormat();
|
||||
uint64_t pulse_id;
|
||||
|
||||
@@ -36,7 +36,7 @@ int main (int argc, char *argv[]) {
|
||||
FrameStats stats(config.detector_name, module_id, STATS_MODULO);
|
||||
|
||||
auto ctx = zmq_ctx_new();
|
||||
auto socket = bind_socket(ctx, config.detector_name, module_id);
|
||||
auto socket = bind_socket(ctx, config.detector_name, to_string(module_id));
|
||||
|
||||
ModuleFrame meta;
|
||||
char* data = new char[MODULE_N_BYTES];
|
||||
|
||||
@@ -27,7 +27,7 @@ ZmqPulseSyncReceiver::ZmqPulseSyncReceiver(
|
||||
|
||||
for (int i=0; i<n_modules_; i++) {
|
||||
sockets_.push_back(
|
||||
BufferUtils::connect_socket(ctx_, detector_name, i));
|
||||
BufferUtils::connect_socket(ctx_, detector_name, to_string(i)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user