some hopefully final preparations for delay manager

This commit is contained in:
Blue 2023-03-08 23:28:48 +03:00
parent 9fff409630
commit 5ba97ecc25
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
8 changed files with 148 additions and 56 deletions

View file

@ -18,17 +18,39 @@
Core::DelayManager::Info::Info(Id p_id, Type p_type) :
Job(p_id, p_type),
stage(Stage::waitingForVCard)
stage(Stage::waitingForVCard),
info(nullptr)
{}
Core::DelayManager::Info::Info(const Info& other) :
Job(other),
stage(other.stage)
stage(other.stage),
info(nullptr)
{}
Core::DelayManager::Info::~Info() {
if (stage == Stage::waitingForBundles) {
delete info;
}
}
Core::DelayManager::Info::Stage Core::DelayManager::Info::getStage() const {
return stage;
}
void Core::DelayManager::Info::receivedVCard(const Shared::VCard& card) {
if (stage != Stage::waitingForVCard)
throw 245;
info = new Shared::VCard(card);
stage = Stage::waitingForBundles;
}
Shared::VCard * Core::DelayManager::Info::claim() {
if (stage != Stage::waitingForBundles)
throw 246;
Shared::VCard* res = info;
info = nullptr;
return res;
}