Easy3D 2.5.3
progress.h
1/********************************************************************
2 * Copyright (C) 2015-2021 by Liangliang Nan <liangliang.nan@gmail.com>
3 * Copyright (C) 2000-2005 INRIA - Project ALICE
4 *
5 * The code in this file is partly from OGF/Graphite (2.0 alpha-4) with
6 * modifications and enhancement:
7 * https://gforge.inria.fr/forum/forum.php?forum_id=11459
8 * The original code was distributed under the GNU GPL license.
9 ********************************************************************/
10
11#ifndef EASY3D_UTIL_PROGRESS_H
12#define EASY3D_UTIL_PROGRESS_H
13
14
15#include <string>
16
17
18namespace easy3d {
19
25 public:
27 virtual ~ProgressClient() = default;
28 virtual void notify(std::size_t percent, bool update_viewer) = 0;
29 virtual void cancel();
30 };
31
32 //_________________________________________________________
33
39 public:
43 ProgressLogger(std::size_t max_val, bool update_viewer, bool quiet = false);
44 virtual ~ProgressLogger();
45
46 virtual void notify(std::size_t new_value);
47 virtual void next();
48 virtual void done() { notify(max_val_); }
49
50 bool is_canceled() const;
51
53 void reset() { notify(0); }
55 void reset(std::size_t max_val);
56
57 protected:
58 virtual void update();
59
60 private:
61 std::size_t max_val_;
62 std::size_t cur_val_;
63 std::size_t cur_percent_;
64 bool quiet_;
65 bool update_viewer_;
66 };
67
70 void print_progress(float percentage);
71
72} // namespace easy3d
73
74
75#endif // EASY3D_UTIL_PROGRESS_H
76
The based class of GUI element reporting the progress.
Definition: progress.h:24
An implementation of progress logging mechanism.
Definition: progress.h:38
ProgressLogger(std::size_t max_val, bool update_viewer, bool quiet=false)
Definition: progress.cpp:85
void reset()
Resets the progress logger without changing the progress range.
Definition: progress.h:53
Definition: collider.cpp:182
void print_progress(float percentage)
Definition: progress.cpp:140