Template Function husarion_ugv_utils::diagnostics::AddKeyValueIfTrue

Function Documentation

template<typename ValueT>
void husarion_ugv_utils::diagnostics::AddKeyValueIfTrue(diagnostic_updater::DiagnosticStatusWrapper &status, const std::map<std::string, ValueT> &kv_map, const std::string &key_prefix = "", const std::string &key_suffix = "")

Adds key-value pairs to a diagnostic status if the value is true.

This function iterates over a map of key-value pairs and adds each pair to the diagnostic status if the value is true. The key prefix and suffix can be optionally provided to modify the keys before adding them to the status.

Template Parameters:

ValueT – The type of the values in the map, must be evaluable to boolean context.

Parameters:
  • status – The diagnostic status wrapper to add the key-value pairs to.

  • kv_map – The map of key-value pairs.

  • key_prefix – The optional prefix to add to each key.

  • key_suffix – The optional suffix to add to each key.