diff --git a/lib/src/WriterManager.cpp b/lib/src/WriterManager.cpp index 3096734..dafcac6 100644 --- a/lib/src/WriterManager.cpp +++ b/lib/src/WriterManager.cpp @@ -2,6 +2,7 @@ #include #include "WriterManager.hpp" +#include using namespace std; @@ -86,17 +87,14 @@ string WriterManager::get_status() unordered_map WriterManager::get_statistics() const { - unordered_map result = {{"n_received_frames", n_received_frames.load()}, - {"n_written_frames", n_written_frames.load()}, - {"n_lost_frames", n_lost_frames.load()}}; + unordered_map result = { + {"n_frames_receive", n_frames_to_receive.load()}, + {"n_frames_to_write", n_frames_to_write.load()} + }; return result; } -unordered_map WriterManager::get_parameters() -{ - return parameters; -} void WriterManager::start(const string output_file, const int n_frames, @@ -119,21 +117,17 @@ void WriterManager::start(const string output_file, cout << output_message.str() << endl; #endif - uint64_t n_frames = 100; - string output_file = "output_file"; - - + n_frames_to_write = n_frames; writing_flag = true; + + n_frames_to_receive = n_frames; + receiving_flag = true; + boost::thread writer_thread(&ProcessManager::write_h5, this, output_file, n_frames); //TODO: Sent this event somewhere? } -const unordered_map& WriterManager::get_parameters_type() const -{ - return parameters_type; -} - bool WriterManager::is_running() { return running_flag.load(); diff --git a/lib/src/WriterManager.hpp b/lib/src/WriterManager.hpp index 7d35ab2..82487a5 100644 --- a/lib/src/WriterManager.hpp +++ b/lib/src/WriterManager.hpp @@ -32,9 +32,11 @@ class WriterManager // Initialize in constructor. const std::deque logs; - std::atomic writing_flag; std::atomic running_flag; + std::atomic writing_flag; + std::atomic receiving_flag; + std::atomic n_frames_to_receive; std::atomic n_frames_to_write; @@ -48,9 +50,6 @@ class WriterManager 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.