Files
2017-04-11 15:49:21 +02:00

50 lines
1.2 KiB
C++
Executable File

#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 */