Add NodesCount and fix comment to aos/configuration.h
Jim points out that a comment is confusing, so fix it.
Also, a number of users want to count the number of nodes both in
multinode and single node. Put that in a library.
Change-Id: I5619d60255de19d730db528f060aac5da758d876
diff --git a/aos/configuration.cc b/aos/configuration.cc
index 4a66358..912f91e 100644
--- a/aos/configuration.cc
+++ b/aos/configuration.cc
@@ -962,6 +962,14 @@
LOG(FATAL) << "Node " << name << " not found in the configuration.";
}
+size_t NodesCount(const Configuration *config) {
+ if (!MultiNode(config)) {
+ return 1u;
+ }
+
+ return config->nodes()->size();
+}
+
std::vector<const Node *> GetNodes(const Configuration *config) {
std::vector<const Node *> nodes;
if (MultiNode(config)) {