blob: 5141cc18671ed80736e45ca6e3e3f28c2b56792f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "Swift/Controllers/EventController.h"
#include <boost/bind.hpp>
#include <algorithm>
namespace Swift {
void EventController::handleIncomingEvent(boost::shared_ptr<MessageEvent> event) {
if (event->isReadable()) {
events_.push_back(event);
event->onRead.connect(boost::bind(&EventController::handleEventRead, this, event));
onEventQueueLengthChange(events_.size());
onEventQueueEventAdded(event);
}
}
void EventController::handleEventRead(boost::shared_ptr<MessageEvent> event) {
events_.erase(std::remove(events_.begin(), events_.end(), event), events_.end());
onEventQueueLengthChange(events_.size());
}
}
|