#pragma once #include #include 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 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 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 */