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
15namespace gdal
16{
17namespace viewshed
18{
19
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
Support for progress reporting in viewshed construction.
Definition: progress.h:23
bool emit(double fraction)
Emit progress information saying that a fraction of work has been completed.
Definition: progress.cpp:51
bool lineComplete()
Emit progress information saying that a line has been written to output.
Definition: progress.cpp:35
Progress(GDALProgressFunc pfnProgress, void *pProgressArg, size_t expectedLines)
Constructor.
Definition: progress.cpp:22