18 lines
455 B
C++
18 lines
455 B
C++
// Copyright (2019-2023) Paul Scherrer Institute
|
|
|
|
#include "PreviewCounter.h"
|
|
|
|
PreviewCounter::PreviewCounter(int64_t in_stride) : stride(in_stride) {}
|
|
|
|
bool PreviewCounter::GeneratePreview(int64_t image_number) {
|
|
std::unique_lock<std::mutex> ul(m);
|
|
if (stride == 0)
|
|
return false;
|
|
int64_t curr_part = image_number / stride;
|
|
if (curr_part > last_part) {
|
|
last_part = curr_part;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|