Add SourceNodeIndex to compute the source node per channel
We keep doing this type of thing. Time to go write a function. Doing a
bunch of string compares is slow, so we should really cache it up front.
It feels like it might be getting close to time to try to write a class
which will let us compute and cache all these things reasonably
efficiently and move logger and others over to it. Let's start with a
function to compute the things we care about.
Change-Id: I4b788b1395656e8e6e6c3c7eb28f4d410080c636
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/configuration.h b/aos/configuration.h
index c22a1cf..f9b772d 100644
--- a/aos/configuration.h
+++ b/aos/configuration.h
@@ -156,6 +156,9 @@
std::vector<std::string_view> SourceNodeNames(const Configuration *config,
const Node *my_node);
+// Returns the source node index for each channel in a config.
+std::vector<size_t> SourceNodeIndex(const Configuration *config);
+
// Returns the all nodes that are logging timestamps on our node.
std::vector<const Node *> TimestampNodes(const Configuration *config,
const Node *my_node);