From f3c6d8332b6c12d157eeaa9bbfca95ebd359e875 Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Mon, 29 Jan 2018 09:12:15 +0100 Subject: [PATCH] Renamed n_images into n_frames --- src/WriterManager.cpp | 12 ++++++------ src/WriterManager.hpp | 4 ++-- src/h5_zmq_writer.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/WriterManager.cpp b/src/WriterManager.cpp index ad528ff..518ca1c 100644 --- a/src/WriterManager.cpp +++ b/src/WriterManager.cpp @@ -4,11 +4,11 @@ using namespace std; -WriterManager::WriterManager(map* parameters_type, uint64_t n_images): - parameters_type(parameters_type), n_images(n_images), running_flag(true), killed_flag(false), n_received_frames(0), n_written_frames(0) +WriterManager::WriterManager(map* parameters_type, uint64_t n_frames): + parameters_type(parameters_type), n_frames(n_frames), running_flag(true), killed_flag(false), n_received_frames(0), n_written_frames(0) { #ifdef DEBUG_OUTPUT - cout << "[WriterManager::WriterManager] Writer manager for n_images " << n_images << endl; + cout << "[WriterManager::WriterManager] Writer manager for n_frames " << n_frames << endl; #endif } @@ -49,7 +49,7 @@ map WriterManager::get_statistics() { map result = {{"n_received_frames", n_received_frames.load()}, {"n_written_frames", n_written_frames.load()}, - {"total_expected_frames", n_images}}; + {"total_expected_frames", n_frames}}; return result; } @@ -76,8 +76,8 @@ map* WriterManager::get_parameters_type() { bool WriterManager::is_running() { - // Take into account n_images only if it is <> 0. - if (n_images && n_received_frames.load() >= n_images) { + // Take into account n_frames only if it is <> 0. + if (n_frames && n_received_frames.load() >= n_frames) { running_flag = false; } diff --git a/src/WriterManager.hpp b/src/WriterManager.hpp index af336c2..fcc8614 100644 --- a/src/WriterManager.hpp +++ b/src/WriterManager.hpp @@ -17,14 +17,14 @@ class WriterManager // Initialize in constructor. std::map* parameters_type; - size_t n_images; + size_t n_frames; std::atomic_bool running_flag; std::atomic_bool killed_flag; std::atomic n_received_frames; std::atomic n_written_frames; public: - WriterManager(std::map* parameters_type, uint64_t n_images=0); + WriterManager(std::map* parameters_type, uint64_t n_frames=0); void stop(); void kill(); bool is_running(); diff --git a/src/h5_zmq_writer.cpp b/src/h5_zmq_writer.cpp index 881d8fa..be8756e 100644 --- a/src/h5_zmq_writer.cpp +++ b/src/h5_zmq_writer.cpp @@ -151,13 +151,13 @@ void receive_zmq(WriterManager *manager, RingBuffer *ring_buffer, string connect #endif } -void run_writer(string connect_address, string output_file, uint64_t n_images, uint16_t rest_port){ +void run_writer(string connect_address, string output_file, uint64_t n_frames, uint16_t rest_port){ size_t n_slots = config::ring_buffer_n_slots; int n_io_threads = config::zmq_n_io_threads; int receive_timeout = config::zmq_receive_timeout; - WriterManager manager(get_input_value_type(), n_images); + WriterManager manager(get_input_value_type(), n_frames); RingBuffer ring_buffer(n_slots); // TODO: Remove this. This is needed only for testing. @@ -265,10 +265,10 @@ int main (int argc, char *argv[]) { if (argc != 6) { cout << endl; - cout << "Usage: h5_zmq_writer [connection_address] [output_file] [n_images] [rest_port]" << endl; + cout << "Usage: h5_zmq_writer [connection_address] [output_file] [n_frames] [rest_port]" << endl; cout << "\tconnection_address: Address to connect to the stream (PULL). Example: tcp://127.0.0.1:40000" << endl; cout << "\toutput_file: Name of the output file." << endl; - cout << "\tn_images: Number of images to acquire. 0 for infinity (untill /stop is called)." << endl; + cout << "\n_frames: Number of images to acquire. 0 for infinity (untill /stop is called)." << endl; cout << "\trest_port: Port to start the REST Api on." << endl; cout << "\tuser_id: uid under which to run the writer. -1 to leave it as it is." << endl; cout << endl;