ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Task.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 #include <functional>
11 #include <memory>
12 
13 namespace cloudViewer {
14 namespace visualization {
15 namespace gui {
16 
17 class Task {
18 public:
21  Task(std::function<void()> f);
22 
23  Task(const Task&) = delete;
24  Task& operator=(const Task& other) = delete;
25 
27  ~Task();
28 
29  void Run();
30 
31  bool IsFinished() const;
32 
35  void WaitToFinish();
36 
37 private:
38  struct Impl;
39  std::unique_ptr<Impl> impl_;
40 };
41 
42 } // namespace gui
43 } // namespace visualization
44 } // namespace cloudViewer
Task & operator=(const Task &other)=delete
Task(std::function< void()> f)
Definition: Task.cpp:30
~Task()
Will call WaitToFinish(), which may block.
Definition: Task.cpp:36
Generic file read and write utility for python interface.