ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
GenericProgressCallback.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // Local
11 #include "CVConst.h"
12 #include "CVCoreLib.h"
13 
14 class AtomicCounter;
15 
16 namespace cloudViewer {
17 
21 public:
23  virtual ~GenericProgressCallback() = default;
24 
26 
32  virtual void update(float percent) = 0;
33 
35 
38  virtual void setMethodTitle(const char* methodTitle) = 0;
39 
41 
44  virtual void setInfo(const char* infoStr) = 0;
45 
48 
51  virtual void start() = 0;
52 
54 
57  virtual void stop() = 0;
58 
60 
67  virtual bool isCancelRequested() = 0;
68 
70  virtual bool textCanBeEdited() const { return true; }
71 };
72 
75 
79 public:
81 
86  unsigned totalSteps,
87  unsigned totalPercentage = 100);
88 
90  virtual ~NormalizedProgress();
91 
94  void scale(unsigned totalSteps,
95  unsigned totalPercentage = 100,
96  bool updateCurrentProgress = false);
97 
99  void reset();
100 
102  bool oneStep();
103 
105  bool steps(unsigned n);
106 
107 protected:
109  float m_percent;
110 
113  unsigned m_step;
114 
117 
119 
122 
125 };
126 
127 } // namespace cloudViewer
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
AtomicCounter
Fake QAtomicInt.
Definition: NormalizedProgress.cpp:27
CVConst.h
CVCoreLib.h
cloudViewer::GenericProgressCallback
Definition: GenericProgressCallback.h:20
cloudViewer::NormalizedProgress::progressCallback
GenericProgressCallback * progressCallback
associated GenericProgressCallback
Definition: GenericProgressCallback.h:124
cloudViewer::NormalizedProgress::m_percentAdd
float m_percentAdd
Percentage added to total progress value at each step.
Definition: GenericProgressCallback.h:116
cloudViewer::NormalizedProgress::m_step
unsigned m_step
Definition: GenericProgressCallback.h:113
cloudViewer::NormalizedProgress::m_counter
AtomicCounter * m_counter
Current number of calls to 'oneStep'.
Definition: GenericProgressCallback.h:121
callback
std::function< void(std::shared_ptr< core::Tensor >)> callback
Definition: FilamentRenderer.cpp:183
cloudViewer::GenericProgressCallback::textCanBeEdited
virtual bool textCanBeEdited() const
Returns whether the dialog title and info can be updated or not.
Definition: GenericProgressCallback.h:70
cloudViewer::NormalizedProgress
Definition: GenericProgressCallback.h:78
cloudViewer::NormalizedProgress::m_percent
float m_percent
Total progress value (in percent)
Definition: GenericProgressCallback.h:109
CV_CORE_LIB_API
#define CV_CORE_LIB_API
Definition: CVCoreLibWin.h:15