diff --git a/src/msgPrintControl.cpp b/src/msgPrintControl.cpp index a5b0c1b..f7e5251 100644 --- a/src/msgPrintControl.cpp +++ b/src/msgPrintControl.cpp @@ -111,4 +111,8 @@ size_t msgPrintControl::repetitionCount(msgPrintControlKey &key) { return map_[key]; } +void msgPrintControl::incrementRepetitionCount(msgPrintControlKey &key) { + map_[key]++; +} + char *msgPrintControl::getSuffix() { return suffix_; } \ No newline at end of file diff --git a/src/msgPrintControl.h b/src/msgPrintControl.h index 74e3bb0..8ac21aa 100644 --- a/src/msgPrintControl.h +++ b/src/msgPrintControl.h @@ -197,13 +197,24 @@ class HIDDEN msgPrintControl { * @brief Returns the repetition count for the given key. * * If the key does not exist in the internal map of msgPrintControl, this - * method returns 0. + * method inserts it with value 0 and returns 0. * * @param key * @return size_t */ size_t repetitionCount(msgPrintControlKey &key); + /** + * @brief Increment the repetition count for the given key by 1. + * + * If the key does not exist in the internal map of msgPrintControl, this + * method inserts it with value 1. + * + * @param key + * @return size_t + */ + void incrementRepetitionCount(msgPrintControlKey &key); + /** * @brief shouldBePrinted might create a suffix ("maximum number of * repetitions reached, further messages will be suppressed until reset.").