mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-25 03:30:44 +02:00
Rename buffer project
This commit is contained in:
+1
-2
@@ -29,9 +29,8 @@ add_subdirectory(
|
||||
EXCLUDE_FROM_ALL)
|
||||
|
||||
add_subdirectory("core-buffer")
|
||||
add_subdirectory("sf-buffer")
|
||||
add_subdirectory("sf-buffer-recv")
|
||||
add_subdirectory("sf-buffer-writer")
|
||||
add_subdirectory("sf-stream")
|
||||
add_subdirectory("sf-writer")
|
||||
#add_subdirectory("jf-live-writer")
|
||||
#add_subdirectory("jf-live-daq")
|
||||
@@ -0,0 +1,18 @@
|
||||
file(GLOB SOURCES
|
||||
src/*.cpp)
|
||||
|
||||
add_library(sf-buffer-recv-lib STATIC ${SOURCES})
|
||||
target_include_directories(sf-buffer-recv-lib PUBLIC include/)
|
||||
target_link_libraries(sf-buffer-recv-lib
|
||||
external
|
||||
core-buffer-lib)
|
||||
|
||||
add_executable(sf-buffer-recv src/main.cpp)
|
||||
set_target_properties(sf-buffer-recv PROPERTIES OUTPUT_NAME sf_buffer)
|
||||
target_link_libraries(sf-buffer-recv
|
||||
sf-buffer-recv-lib
|
||||
zmq
|
||||
rt)
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory(test/)
|
||||
@@ -0,0 +1,8 @@
|
||||
add_executable(sf-buffer-recv-tests main.cpp)
|
||||
|
||||
target_link_libraries(sf-buffer-recv-tests
|
||||
core-buffer-lib
|
||||
sf-buffer-recv-lib
|
||||
gtest
|
||||
)
|
||||
|
||||
@@ -15,33 +15,6 @@ using namespace std;
|
||||
using namespace chrono;
|
||||
using namespace buffer_config;
|
||||
|
||||
void* get_live_stream_socket(const string& detector_name, const int source_id)
|
||||
{
|
||||
stringstream ipc_stream;
|
||||
string LIVE_IPC_URL = BUFFER_LIVE_IPC_URL + detector_name + "-";
|
||||
ipc_stream << LIVE_IPC_URL << source_id;
|
||||
const auto ipc_address = ipc_stream.str();
|
||||
|
||||
void* ctx = zmq_ctx_new();
|
||||
void* socket = zmq_socket(ctx, ZMQ_PUB);
|
||||
|
||||
const int sndhwm = BUFFER_ZMQ_SNDHWM;
|
||||
if (zmq_setsockopt(socket, ZMQ_SNDHWM, &sndhwm, sizeof(sndhwm)) != 0) {
|
||||
throw runtime_error(zmq_strerror(errno));
|
||||
}
|
||||
|
||||
const int linger = 0;
|
||||
if (zmq_setsockopt(socket, ZMQ_LINGER, &linger, sizeof(linger)) != 0) {
|
||||
throw runtime_error(zmq_strerror(errno));
|
||||
}
|
||||
|
||||
if (zmq_bind(socket, ipc_address.c_str()) != 0) {
|
||||
throw runtime_error(zmq_strerror(errno));
|
||||
}
|
||||
|
||||
return socket;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
|
||||
if (argc != 6) {
|
||||
@@ -67,16 +40,19 @@ int main (int argc, char *argv[]) {
|
||||
string root_folder = string(argv[5]);
|
||||
int source_id = atoi(argv[6]);
|
||||
|
||||
|
||||
string LIVE_IPC_URL = BUFFER_LIVE_IPC_URL + detector_name + "-";
|
||||
ipc_stream << LIVE_IPC_URL << source_id;
|
||||
const auto ipc_address = ipc_stream.str();
|
||||
|
||||
uint64_t stats_counter(0);
|
||||
uint64_t n_missed_packets = 0;
|
||||
uint64_t n_corrupted_frames = 0;
|
||||
|
||||
BufferBinaryWriter writer(root_folder, device_name);
|
||||
FrameUdpReceiver receiver(udp_port, source_id);
|
||||
RamBuffer buffer(detector_name, n_modules);
|
||||
|
||||
auto binary_buffer = new BufferBinaryFormat();
|
||||
auto socket = get_live_stream_socket(detector_name, source_id);
|
||||
|
||||
while (true) {
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
file(GLOB SOURCES
|
||||
src/*.cpp)
|
||||
|
||||
add_library(sf-buffer-lib STATIC ${SOURCES})
|
||||
target_include_directories(sf-buffer-lib PUBLIC include/)
|
||||
target_link_libraries(sf-buffer-lib
|
||||
external
|
||||
core-buffer-lib)
|
||||
|
||||
add_executable(sf-buffer src/main.cpp)
|
||||
set_target_properties(sf-buffer PROPERTIES OUTPUT_NAME sf_buffer)
|
||||
target_link_libraries(sf-buffer
|
||||
sf-buffer-lib
|
||||
zmq
|
||||
rt)
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory(test/)
|
||||
@@ -1,8 +0,0 @@
|
||||
add_executable(sf-buffer-tests main.cpp)
|
||||
|
||||
target_link_libraries(sf-buffer-tests
|
||||
core-buffer-lib
|
||||
sf-buffer-lib
|
||||
gtest
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user