1
0
Files
BasaltMeter/BasaltPresenter/Shared/basalt/deliver.cpp

34 lines
938 B
C++
Raw Normal View History

2026-01-08 19:23:19 +08:00
#include "deliver.hpp"
#include <stdexcept>
namespace basalt::shared::deliver {
IDeliver::IDeliver() {}
2026-01-08 19:37:25 +08:00
IDeliver::~IDeliver() {
if (this->status != DeliverStatus::Stop) {
this->shutdown();
}
}
2026-01-08 19:23:19 +08:00
2026-01-08 19:37:25 +08:00
guid::Guid IDeliver::get_guid() const {
2026-01-08 19:23:19 +08:00
throw std::logic_error("unimplemented function");
}
2026-01-08 19:37:25 +08:00
void IDeliver::startup(DeliverConfig &&config) {
2026-01-08 19:23:19 +08:00
if (this->status != DeliverStatus::Ready) throw std::runtime_error("unexpected deliver status");
this->config = std::move(config);
this->status = DeliverStatus::Running;
}
2026-01-08 19:37:25 +08:00
void IDeliver::transmit() {
2026-01-08 19:23:19 +08:00
if (this->status != DeliverStatus::Running) throw std::runtime_error("unexpected deliver status");
}
2026-01-08 19:37:25 +08:00
void IDeliver::shutdown() {
2026-01-08 19:23:19 +08:00
if (this->status != DeliverStatus::Running) throw std::runtime_error("unexpected deliver status");
this->status = DeliverStatus::Stop;
}
}