| Line |
Branch |
Decision |
Call |
Exec |
Source |
| 1 |
|
|
|
|
#ifndef CHRYSALIS_TASKEXECUTOR_H |
| 2 |
|
|
|
|
#define CHRYSALIS_TASKEXECUTOR_H |
| 3 |
|
|
|
|
|
| 4 |
|
|
|
|
#include <memory> |
| 5 |
|
|
|
|
#include <functional> |
| 6 |
|
|
|
|
#include <shared_mutex> |
| 7 |
|
|
|
|
#include <unordered_map> |
| 8 |
|
|
|
|
|
| 9 |
|
|
|
|
#include "BaseTask.h" |
| 10 |
|
|
|
|
#include "CLO3DExtensionExport.h" |
| 11 |
|
|
|
|
|
| 12 |
|
|
|
|
namespace CLO3D { |
| 13 |
|
|
|
|
class CLO3D_EXTENSION TaskExecutor { |
| 14 |
|
|
|
|
public: |
| 15 |
|
|
8/8
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
|
16 |
TaskExecutor() = default; |
| 16 |
|
|
|
|
|
| 17 |
|
|
|
|
TaskExecutor(const TaskExecutor&) = delete; |
| 18 |
|
|
|
|
TaskExecutor& operator=(const TaskExecutor&) = delete; |
| 19 |
|
|
|
|
|
| 20 |
|
|
|
|
void wait(const QString& task); |
| 21 |
|
|
|
|
void submit(std::unique_ptr<BaseTask> task); |
| 22 |
|
|
|
|
void submit( |
| 23 |
|
|
|
|
std::unique_ptr<BaseTask> task, |
| 24 |
|
|
|
|
const std::function<void()>& onSuccess, |
| 25 |
|
|
|
1 |
const std::function<void(const BaseTaskException&)>& onException = [](const BaseTaskException&) -> void {} |
| 26 |
|
|
|
|
); |
| 27 |
|
|
|
|
private: |
| 28 |
|
|
|
|
std::shared_mutex mutex_; |
| 29 |
|
|
|
|
std::unordered_map<std::string, std::unique_ptr<BaseTask>> tasks_{}; |
| 30 |
|
|
|
|
}; |
| 31 |
|
|
|
|
} |
| 32 |
|
|
|
|
|
| 33 |
|
|
|
|
#endif // CHRYSALIS_TASKEXECUTOR_H |
| 34 |
|
|
|
|
|