Change the event-loop restriction
It's weird but acceptable to create as many fetchers as you want.
RobotState is a common thing that multiple people want. We don't want
to support senders and watchers on the same loop (do you get your own
messages?) until there's a valid use case.
Change-Id: I215f452311d3f47ffd487d78885ae2848c6ffe9b
diff --git a/aos/events/simulated-event-loop.h b/aos/events/simulated-event-loop.h
index 79b48b8..b5c94bf 100644
--- a/aos/events/simulated-event-loop.h
+++ b/aos/events/simulated-event-loop.h
@@ -212,8 +212,7 @@
std::function<void(const aos::Message *message)> watcher) override;
TimerHandler *AddTimer(::std::function<void()> callback) override {
- timers_.emplace_back(
- new SimulatedTimerHandler(scheduler_, callback));
+ timers_.emplace_back(new SimulatedTimerHandler(scheduler_, callback));
return timers_.back().get();
}
@@ -232,19 +231,20 @@
SimulatedQueue *GetSimulatedQueue(
const ::std::pair<::std::string, QueueTypeInfo> &);
- void Take(const std::string &path);
+ void Take(const ::std::string &path);
private:
EventScheduler *scheduler_;
- std::map<::std::pair<::std::string, QueueTypeInfo>, SimulatedQueue> *queues_;
- std::unordered_set<std::string> taken_;
- std::vector<std::unique_ptr<TimerHandler>> timers_;
+ ::std::map<::std::pair<::std::string, QueueTypeInfo>, SimulatedQueue>
+ *queues_;
+ ::std::vector<std::string> taken_;
+ ::std::vector<std::unique_ptr<TimerHandler>> timers_;
};
class SimulatedEventLoopFactory {
public:
- std::unique_ptr<EventLoop> CreateEventLoop() {
- return std::unique_ptr<EventLoop>(
+ ::std::unique_ptr<EventLoop> CreateEventLoop() {
+ return ::std::unique_ptr<EventLoop>(
new SimulatedEventLoop(&scheduler_, &queues_));
}