-
Notifications
You must be signed in to change notification settings - Fork 1
/
LoadingQueue.cpp
35 lines (29 loc) · 959 Bytes
/
LoadingQueue.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**************************************************************************
** Code written by Hesam Gholami.
**
** Email: [email protected]
** Website: http://hesam.org
**
** This file created in 12.
**************************************************************************/
#include "DataProvider.hpp"
#include "FutureEventList.hpp"
#include "LoadingQueue.hpp"
LoadingQueue::LoadingQueue(QObject *parent) : Queue(parent)
{
}
void LoadingQueue::addTruck(DumpTruck *truck)
{
Queue::addTruck(truck);
truck->setState(DumpTruck::InLoaderQueue);
}
void LoadingQueue::processEvents(Event* nextEvent)
{
// Handle arrived items from ALQ
auto futureList = FutureEventList::getInstance();
// Add arrived trucks to loading queue
if(nextEvent->getEventType() == Event::ALQ && nextEvent->getTime() == DataProvider::getCurrentClock()) {
this->addTruck(nextEvent->getTruck());
futureList->removeEvent(nextEvent);
}
}