Initial commit
This commit is contained in:
Executable
+49
@@ -0,0 +1,49 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
|
||||
namespace wfr {
|
||||
|
||||
// Forward declarations
|
||||
namespace scheduling {
|
||||
class SchedulingDecision;
|
||||
}
|
||||
|
||||
namespace execution {
|
||||
|
||||
|
||||
enum class ExecutionHandleState
|
||||
: int { Unknown,
|
||||
Pending,
|
||||
Running,
|
||||
Finished,
|
||||
Error };
|
||||
|
||||
class ExecutionHandle {
|
||||
|
||||
// Invariant properties that can be accessed directly.
|
||||
public:
|
||||
std::shared_ptr<wfr::scheduling::SchedulingDecision> schedulingDecision = nullptr;
|
||||
|
||||
// Mutable properties that need to be accessed via getter-/setter-functions.
|
||||
private:
|
||||
ExecutionHandleState state = ExecutionHandleState::Unknown;
|
||||
std::exception_ptr errorCause = nullptr;
|
||||
|
||||
public:
|
||||
ExecutionHandle(std::shared_ptr<wfr::scheduling::SchedulingDecision> schedulingDecision) noexcept :
|
||||
schedulingDecision(schedulingDecision), state(ExecutionHandleState::Pending) {}
|
||||
|
||||
std::exception_ptr getErrorCause() const noexcept { return errorCause; }
|
||||
|
||||
void setErrorCause(std::exception_ptr errorCause) noexcept { this->errorCause = errorCause; }
|
||||
|
||||
ExecutionHandleState getState() const noexcept { return state; }
|
||||
|
||||
void setState(ExecutionHandleState state) noexcept { this->state = state; }
|
||||
};
|
||||
|
||||
} /* namespace execution */
|
||||
} /* namespace wfr */
|
||||
Reference in New Issue
Block a user