forked from blue/squawk
some hopefully final preparations for delay manager
This commit is contained in:
parent
9fff409630
commit
5ba97ecc25
8 changed files with 148 additions and 56 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue