66 lines
1.8 KiB
C++
66 lines
1.8 KiB
C++
#include "kernel.hpp"
|
|
#include <stdexcept>
|
|
|
|
namespace Basalt::Shared::Kernel {
|
|
|
|
#pragma region Engine
|
|
|
|
IEngine::IEngine() : config(), status(EngineStatus::Ready) {}
|
|
|
|
IEngine::~IEngine() {
|
|
if (this->status != EngineStatus::Stop) {
|
|
this->Shutdown();
|
|
}
|
|
}
|
|
|
|
Guid IEngine::GetGuid() const {
|
|
throw std::logic_error("unimplemented function");
|
|
}
|
|
|
|
void IEngine::Startup(EngineConfig &&config) {
|
|
if (this->status != EngineStatus::Ready) throw std::runtime_error("unexpected engine status");
|
|
this->config = std::move(config);
|
|
this->status = EngineStatus::Running;
|
|
}
|
|
|
|
bool IEngine::Tick() {
|
|
if (this->status != EngineStatus::Running) throw std::runtime_error("unexpected engine status");
|
|
return false;
|
|
}
|
|
|
|
void IEngine::Shutdown() {
|
|
if (this->status != EngineStatus::Running) throw std::runtime_error("unexpected engine status");
|
|
this->status = EngineStatus::Stop;
|
|
}
|
|
|
|
#pragma endregion
|
|
|
|
#pragma region Deliver
|
|
|
|
IDeliver::IDeliver() {}
|
|
|
|
IDeliver::~IDeliver() {}
|
|
|
|
Guid IDeliver::GetGuid() const {
|
|
throw std::logic_error("unimplemented function");
|
|
}
|
|
|
|
void IDeliver::Startup(DeliverConfig &&config) {
|
|
if (this->status != DeliverStatus::Ready) throw std::runtime_error("unexpected deliver status");
|
|
this->config = std::move(config);
|
|
this->status = DeliverStatus::Running;
|
|
}
|
|
|
|
void IDeliver::Transmit() {
|
|
if (this->status != DeliverStatus::Running) throw std::runtime_error("unexpected deliver status");
|
|
}
|
|
|
|
void IDeliver::Shutdown() {
|
|
if (this->status != DeliverStatus::Running) throw std::runtime_error("unexpected deliver status");
|
|
this->status = DeliverStatus::Stop;
|
|
}
|
|
|
|
#pragma endregion
|
|
|
|
} // namespace Basalt::Shared::Kernel
|