#ifndef WRITERMANAGER_H #define WRITERMANAGER_H #include #include #include #include #include #include #include "date.h" #include #include "H5Format.hpp" namespace writer_utils { void set_process_id(int user_id); void create_destination_folder(const std::string& output_file); } struct WriterManagerLog { std::string filename; uint64_t n_requested_frames; uint64_t n_received_frames; uint64_t n_written_frames; }; class WriterManager { // Initialize in constructor. const std::unordered_map& parameters_type; const std::deque logs; std::atomic writing_flag; std::atomic killed_flag; std::atomic n_frames_to_receive; std::atomic n_frames_to_write; public: WriterManager(const std::unordered_map& parameters_type); virtual ~WriterManager(); void start(const std::unordered_map& new_parameters); void stop(); void kill(); std::string get_status(); std::unordered_map get_statistics() const; std::unordered_map get_parameters(); const std::unordered_map& get_parameters_type() const; // Return True if the frame is to be received, False if is to be dropped. bool receive_frame(); // True if the process should conitnue. bool is_running() const; // Return True if the frame is to be written, False otherwise. bool write_frame(); // True if the writing should continue. bool is_writing() const; // Signal that the writing has completed. void writing_completed(); }; #endif