From 4a582511730af4f4cc256aed58f8a03079094c82 Mon Sep 17 00:00:00 2001 From: smathis Date: Thu, 17 Sep 2026 16:26:35 +0200 Subject: [PATCH] Added method for incrementing the repetition count manually. --- src/msgPrintControl.cpp | 4 ++++ src/msgPrintControl.h | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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.").