diff --git a/lib/src/WriterManager.cpp b/lib/src/WriterManager.cpp index 036945d..6243b98 100644 --- a/lib/src/WriterManager.cpp +++ b/lib/src/WriterManager.cpp @@ -118,23 +118,19 @@ void WriterManager::start(const unordered_map& new_parameter stringstream output_message; using namespace date; output_message << "[" << std::chrono::system_clock::now() << "]"; - output_message << "[WriterManager::set_parameters] Setting parameters: "; - #endif + output_message << "[WriterManager::sttart] Starting with parameters: "; - for (const auto& parameter : new_parameters) { - auto& parameter_name = parameter.first; - auto& parameter_value = parameter.second; + for (const auto& parameter : new_parameters) { + auto& parameter_name = parameter.first; + auto& parameter_value = parameter.second; - parameters[parameter_name] = parameter_value; + output_message << parameter_name << ": " << parameter_value << ", "; + } - #ifdef DEBUG_OUTPUT - output_message << parameter_name << ", "; - #endif - } - - #ifdef DEBUG_OUTPUT cout << output_message.str() << endl; #endif + + boost::thread writer_thread(&ProcessManager::write_h5, this, "output_file", 123); } const unordered_map& WriterManager::get_parameters_type() const @@ -178,3 +174,12 @@ bool WriterManager::receive_frame() { return false; } + +bool WriterManager::write_frame() { + if (n_frames_to_write > 0) { + return (n_frames_to_write.fetch_sub(1) >= 0); + } + + return false; +} + diff --git a/lib/src/WriterManager.hpp b/lib/src/WriterManager.hpp index a48aacd..87f2bd2 100644 --- a/lib/src/WriterManager.hpp +++ b/lib/src/WriterManager.hpp @@ -53,9 +53,14 @@ class WriterManager // Return True if the frame is to be received, False if is to be dropped. bool receive_frame(); - // True if the writer process should conitnue. + // 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; + bool is_killed() const; bool are_all_parameters_set(); std::string get_output_file() const;