mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[ion] Events::Journal has isEmpty
This commit is contained in:
@@ -57,6 +57,7 @@ class Journal {
|
||||
public:
|
||||
virtual void pushEvent(Event e) = 0;
|
||||
virtual Event popEvent() = 0;
|
||||
virtual bool isEmpty() = 0;
|
||||
};
|
||||
|
||||
void replayFrom(Journal * l);
|
||||
|
||||
@@ -125,11 +125,10 @@ void logTo(Journal * l) { sDestinationJournal = l; }
|
||||
|
||||
Event getEvent(int * timeout) {
|
||||
if (sSourceJournal != nullptr) {
|
||||
Event e = sSourceJournal->popEvent();
|
||||
if (e == None) {
|
||||
if (sSourceJournal->isEmpty()) {
|
||||
sSourceJournal = nullptr;
|
||||
} else {
|
||||
return e;
|
||||
return sSourceJournal->popEvent();
|
||||
}
|
||||
}
|
||||
Event e = innerGetEvent(timeout);
|
||||
|
||||
@@ -12,10 +12,16 @@ public:
|
||||
m_eventStorage.push(e);
|
||||
}
|
||||
virtual Event popEvent() override {
|
||||
if (isEmpty()) {
|
||||
return Ion::Events::None;
|
||||
}
|
||||
Event e = m_eventStorage.front();
|
||||
m_eventStorage.pop();
|
||||
return e;
|
||||
}
|
||||
virtual bool isEmpty() override {
|
||||
return m_eventStorage.empty();
|
||||
}
|
||||
private:
|
||||
std::queue<Event> m_eventStorage;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user