MeshLib C++ Docs
Loading...
Searching...
No Matches
MRParallelProgressReporter.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include <MRPch/MRBindingMacros.h>
4#include <forward_list>
5#include <atomic>
6#include <thread>
7#include <mutex>
8
9
10namespace MR
11{
14
15
21{
22public:
23 MRMESH_API ParallelProgressReporter( const ProgressCallback& cb );
24
25 struct TaskInfo
26 {
27 float progress = 0.f;
28 float weight = 1.f;
29 };
30
34 {
35 MRMESH_API bool operator()( float p ) const;
36 ParallelProgressReporter* reporter_ = nullptr;
37 TaskInfo* task_ = nullptr;
38 };
39
40
44 MRMESH_API PerTaskReporter newTask( float weight = 1.f );
45
49 MRMESH_API bool operator()();
50
51private:
53 bool updateTask_( float delta );
54
55 const ProgressCallback& cb_;
56
58 std::forward_list<TaskInfo> perTaskInfo_;
59
61 float totalWeight_ = 0;
62
64 float progress_ = 0;
65
66 bool continue_ = true;
67
68 std::mutex mutex_;
69
71 std::thread::id mainThreadId_;
72};
73
74}
Definition MRParallelProgressReporter.h:21
MRMESH_API bool operator()()
MRMESH_API ParallelProgressReporter(const ProgressCallback &cb)
std::array< Vector3f, 3 > MR_BIND_IGNORE
Definition MRMeshBuilderTypes.h:13
MRMESH_API bool operator()(float p) const
MRMESH_API PerTaskReporter newTask(float weight=1.f)
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRParallelProgressReporter.h:34
Definition MRParallelProgressReporter.h:26