GDAL

progress.h
1/******************************************************************************
2 * (c) 2024 info@hobu.co
3 *
4 * SPDX-License-Identifier: MIT
5 ****************************************************************************/
6
7#ifndef VIEWSHED_PROGRESS_H_INCLUDED
8#define VIEWSHED_PROGRESS_H_INCLUDED
9
10#include <functional>
11#include <mutex>
12
13#include "cpl_progress.h"
14
15 namespace gdal
16{
17 namespace viewshed
18{
19
22 class Progress
23{
24 public:
25 Progress(GDALProgressFunc pfnProgress, void *pProgressArg,
26 size_t expectedLines);
27
28 bool lineComplete();
29 bool emit(double fraction);
30
31 private:
32 using ProgressFunc = std::function<bool(double frac, const char *msg)>;
33
34 size_t m_lines{0};
35 size_t m_expectedLines;
36 std::mutex m_mutex{};
37 ProgressFunc m_cb{};
38};
39
40} // namespace viewshed
41} // namespace gdal
42
43#endif
gdal::viewshed::Progress
Support for progress reporting in viewshed construction.
Definition: progress.h:23
gdal::viewshed::Progress::emit
bool emit(double fraction)
Emit progress information saying that a fraction of work has been completed.
Definition: progress.cpp:51
gdal::viewshed::Progress::lineComplete
bool lineComplete()
Emit progress information saying that a line has been written to output.
Definition: progress.cpp:35
gdal::viewshed::Progress::Progress
Progress(GDALProgressFunc pfnProgress, void *pProgressArg, size_t expectedLines)
Constructor.
Definition: progress.cpp:22