ReUseX  0.0.1
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
processing_observer.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6#include "reusex/types.hpp"
7
8#include <string_view>
9
10namespace ReUseX::core {
11
18
20 public:
21 virtual ~IProcessingObserver() = default;
22
23 virtual void on_process_started(std::string_view, size_t) {}
24 virtual void on_process_finished(std::string_view) {}
25 virtual void on_process_updated(std::string_view, size_t) {}
26};
27
29
30// Register a global processing observer. The caller retains ownership and must
31// keep the observer alive until reset or replacement. Passing nullptr clears
32// it.
36
38 public:
39 ProgressObserver(std::string_view stage, size_t total = 0);
41
42 void update(size_t progress = 1);
43
44 inline void operator++() { update(1); };
45 inline void operator+=(size_t increment) { update(increment); };
46
47 private:
48 std::string_view stage_;
49 size_t total_ = 0;
50};
51
52// void emit_visualization(std::string_view stage, CloudConstPtr cloud);
53
54} // namespace ReUseX::core
virtual void on_process_started(std::string_view, size_t)
virtual ~IProcessingObserver()=default
virtual void on_process_updated(std::string_view, size_t)
virtual void on_process_finished(std::string_view)
ProgressObserver(std::string_view stage, size_t total=0)
void update(size_t progress=1)
auto get_processing_observer() -> IProcessingObserver *
void set_processing_observer(IProcessingObserver *observer)
void reset_processing_observer()