1 #ifndef SLA_JOBCONTROLLER_HPP
2 #define SLA_JOBCONTROLLER_HPP
3 
4 #include <functional>
5 #include <string>
6 
7 namespace Slic3r { namespace sla {
8 
9 /// A Control structure for the support calculation. Consists of the status
10 /// indicator callback and the stop condition predicate.
11 struct JobController
12 {
13     using StatusFn = std::function<void(unsigned, const std::string&)>;
14     using StopCond = std::function<bool(void)>;
15     using CancelFn = std::function<void(void)>;
16 
17     // This will signal the status of the calculation to the front-end
__anon86e6b2f00102Slic3r::sla::JobController18     StatusFn statuscb = [](unsigned, const std::string&){};
19 
20     // Returns true if the calculation should be aborted.
__anon86e6b2f00202Slic3r::sla::JobController21     StopCond stopcondition = [](){ return false; };
22 
23     // Similar to cancel callback. This should check the stop condition and
24     // if true, throw an appropriate exception. (TriangleMeshSlicer needs this)
25     // consider it a hard abort. stopcondition is permits the algorithm to
26     // terminate itself
__anon86e6b2f00302Slic3r::sla::JobController27     CancelFn cancelfn = [](){};
28 };
29 
30 }} // namespace Slic3r::sla
31 
32 #endif // JOBCONTROLLER_HPP
33