#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 receiving_flag; std::atomic writing_flag; std::atomic killed_flag; std::atomic n_received_frames; std::atomic n_written_frames; std::atomic n_expected_frames; 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; bool is_running(); bool is_killed() const; bool are_all_parameters_set(); std::string get_output_file() const; void received_frame(size_t frame_index); void written_frame(size_t frame_index); void lost_frame(size_t frame_index); }; #endif