Change n_frames to size_t

This commit is contained in:
2020-04-07 17:18:31 +02:00
parent 9fc3e49bc0
commit 01bb292d40
2 changed files with 21 additions and 7 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ class H5WriteModule {
protected:
void write_thread(
const std::string& output_file,
const int n_frames,
const size_t n_frames,
const int user_id);
public:
@@ -29,7 +29,7 @@ public:
void start_writing(
const std::string& output_file,
const int n_frames = 0,
const size_t n_frames = 0,
const int user_id = -1
);
+19 -5
View File
@@ -19,7 +19,7 @@ H5WriteModule::H5WriteModule(
void H5WriteModule::start_writing(
const string& output_file,
const int n_frames,
const size_t n_frames,
const int user_id)
{
if (is_writing_ == true) {
@@ -74,7 +74,7 @@ void H5WriteModule::stop_writing()
void H5WriteModule::write_thread(
const std::string& output_file,
const int n_frames,
const size_t n_frames,
const int user_id)
{
if (user_id != -1) {
@@ -85,11 +85,10 @@ void H5WriteModule::write_thread(
MetadataBuffer metadata_buffer(n_frames, header_values_);
BufferedWriter writer(output_file, n_frames, metadata_buffer);
writer.create_file();
auto raw_frames_dataset_name = config::raw_image_dataset_name;
writer.create_file();
uint64_t last_pulse_id = 0;
size_t n_written_frames = 0;
while(is_writing_.load(memory_order_relaxed)) {
@@ -173,6 +172,21 @@ void H5WriteModule::write_thread(
value.get());
}
n_written_frames++;
if (n_written_frames == n_frames) {
is_writing_ = false;
#ifdef DEBUG_OUTPUT
using namespace date;
using namespace chrono;
cout << "[" << system_clock::now() << "]";
cout << "[H5WriteModule::write_thread]";
cout << " Written all n_frames " << n_written_frames;
cout << endl;
#endif
}
#ifdef PERF_OUTPUT
using namespace date;
using namespace chrono;