Skip to content

Commit

Permalink
ulog_info example: directly iterate over subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasDebrunner committed Nov 13, 2023
1 parent d30b888 commit ebb4a98
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions examples/ulog_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,9 @@ int main(int argc, char** argv)
// Messages
printf("\n");
printf("Name (multi id) - number of data points\n");

// Sort by name & multi id
const auto& subscriptions = data_container->subscriptionsByNameAndMultiId();
std::vector<ulog_cpp::DataContainer::NameAndMultiIdKey> sorted_subscription_keys(
subscriptions.size());
std::transform(subscriptions.begin(), subscriptions.end(), sorted_subscription_keys.begin(),
[](const auto& pair) { return pair.first; });
for (const auto& key : sorted_subscription_keys) {
const auto& subscription = subscriptions.at(key);
printf(" %s (%i) - %zu\n", key.name.c_str(), key.multi_id, subscription->size());
for (const auto& item : data_container->subscriptionsByNameAndMultiId()) {
printf(" %s (%i) - %zu\n", item.first.name.c_str(), item.first.multi_id,
item.second->size());
}

printf("Formats:\n");
Expand Down

0 comments on commit ebb4a98

Please sign in to comment.