Add channel method to fetchers and senders.

This makes it easy to figure out which channel a fetcher or sender
is connected to.

Also add a test to confirm that the channel pointer points to a channel
inside configuration() for the event loop.

Change-Id: Iee0edca66394ef825dac482d7e3f568c6ed3441f
diff --git a/aos/events/event_loop.cc b/aos/events/event_loop.cc
new file mode 100644
index 0000000..6891f92
--- /dev/null
+++ b/aos/events/event_loop.cc
@@ -0,0 +1,18 @@
+#include "aos/events/event_loop.h"
+
+#include "aos/configuration.h"
+#include "aos/configuration_generated.h"
+#include "glog/logging.h"
+
+namespace aos {
+
+void EventLoop::ValidateChannel(const Channel *channel) {
+  CHECK(configuration_->channels() != nullptr) << ": No channels";
+
+  CHECK(std::find(configuration_->channels()->begin(),
+                  configuration_->channels()->end(),
+                  channel) != configuration_->channels()->end())
+      << ": Channel pointer not found in configuration()->channels()";
+}
+
+}  // namespace aos