mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-27 01:30:43 +02:00
Renamed n_images into n_frames
This commit is contained in:
@@ -4,11 +4,11 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
WriterManager::WriterManager(map<string, DATA_TYPE>* 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<string, DATA_TYPE>* 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<string, uint64_t> WriterManager::get_statistics()
|
||||
{
|
||||
map<string, uint64_t> 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<string, DATA_TYPE>* 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@ class WriterManager
|
||||
|
||||
// Initialize in constructor.
|
||||
std::map<std::string, DATA_TYPE>* parameters_type;
|
||||
size_t n_images;
|
||||
size_t n_frames;
|
||||
std::atomic_bool running_flag;
|
||||
std::atomic_bool killed_flag;
|
||||
std::atomic<uint64_t> n_received_frames;
|
||||
std::atomic<uint64_t> n_written_frames;
|
||||
|
||||
public:
|
||||
WriterManager(std::map<std::string, DATA_TYPE>* parameters_type, uint64_t n_images=0);
|
||||
WriterManager(std::map<std::string, DATA_TYPE>* parameters_type, uint64_t n_frames=0);
|
||||
void stop();
|
||||
void kill();
|
||||
bool is_running();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user