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:
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;
37 TaskInfo* task_ = nullptr;
38 };
39
40
44 MRMESH_API PerTaskReporter newTask( float weight = 1.f );
45
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}
#define MRMESH_API
Definition MRMeshFwd.h:80
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:753
PerTaskReporter newTask(float weight=1.f)
float weight
Definition MRParallelProgressReporter.h:28
TaskInfo * task_
Definition MRParallelProgressReporter.h:37
float progress
Definition MRParallelProgressReporter.h:27
std::array< Vector3f, 3 > MR_BIND_IGNORE
Definition MRMeshBuilderTypes.h:13
ParallelProgressReporter(const ProgressCallback &cb)
ParallelProgressReporter * reporter_
Definition MRParallelProgressReporter.h:36
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRParallelProgressReporter.h:34
Definition MRParallelProgressReporter.h:26