Move node() == nullptr check into //aos:configuration
This simplifies the code surprisingly significantly for dealing with
single node systems.
Change-Id: Ib317e16a9055fbf1341a194120a5b34f05b2d8f8
diff --git a/aos/events/simulated_event_loop.cc b/aos/events/simulated_event_loop.cc
index 578e151..a2740e4 100644
--- a/aos/events/simulated_event_loop.cc
+++ b/aos/events/simulated_event_loop.cc
@@ -473,13 +473,11 @@
ChannelIndex(channel);
Take(channel);
- if (node() != nullptr) {
- if (!configuration::ChannelIsReadableOnNode(channel, node())) {
- LOG(FATAL) << "Channel { \"name\": \"" << channel->name()->string_view()
- << "\", \"type\": \"" << channel->type()->string_view()
- << "\" } is not able to be watched on this node. Check your "
- "configuration.";
- }
+ if (!configuration::ChannelIsReadableOnNode(channel, node())) {
+ LOG(FATAL) << "Channel { \"name\": \"" << channel->name()->string_view()
+ << "\", \"type\": \"" << channel->type()->string_view()
+ << "\" } is not able to be watched on this node. Check your "
+ "configuration.";
}
std::unique_ptr<SimulatedWatcher> shm_watcher(
@@ -500,13 +498,11 @@
const Channel *channel) {
ChannelIndex(channel);
- if (node() != nullptr) {
- if (!configuration::ChannelIsReadableOnNode(channel, node())) {
- LOG(FATAL) << "Channel { \"name\": \"" << channel->name()->string_view()
- << "\", \"type\": \"" << channel->type()->string_view()
- << "\" } is not able to be fetched on this node. Check your "
- "configuration.";
- }
+ if (!configuration::ChannelIsReadableOnNode(channel, node())) {
+ LOG(FATAL) << "Channel { \"name\": \"" << channel->name()->string_view()
+ << "\", \"type\": \"" << channel->type()->string_view()
+ << "\" } is not able to be fetched on this node. Check your "
+ "configuration.";
}
return GetSimulatedChannel(channel)->MakeRawFetcher(this);