From d9de3e2d08350db02fea8b316987659d5375cf13 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Maheux Date: Mon, 15 Jan 2024 15:02:42 -0500 Subject: [PATCH] Fix loggers. --- README.md | 8 ++++---- include/hbba_lite/core/Strategy.h | 3 ++- src/hbba_lite_cpp/core/RosFilterPool.cpp | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 24cd89a..c81e69e 100644 --- a/README.md +++ b/README.md @@ -313,7 +313,7 @@ HbbaLite hbba(desireSet, // Add desires to the set. ``` -#### Strategy State Logger +#### Strategy State Logger Usage To log the strategy state changed of the strategy, you can use the `RosLogStrategyStateLogger` class. ```cpp @@ -338,8 +338,8 @@ HbbaLite hbba(desireSet, // Add desires to the set. ``` -#### Filter State Logger -To log the filter state changed of the strategy, you can use the `RosLogStrategyStateLogger` class. +#### Filter State Logger Usage +To log the filter state changed of the strategy, you can use the `RosLogFilterPoolDecorator` class. ```cpp constexpr bool WAIT_FOR_SERVICE = true; @@ -348,7 +348,7 @@ auto desireSet = make_shared(); // Create the desire set. // Create the filter pool useful to change the filter states. // If WAIT_FOR_SERVICE is true, the pool will wait until the service become available. auto rosFilterPool = make_unique(nodeHandle, WAIT_FOR_SERVICE); -auto filterPoos = make_shared(move(rosFilterPool)); +auto filterPool = make_shared(move(rosFilterPool)); vector> strategies; // Add the strategies related to the application into the vector. diff --git a/include/hbba_lite/core/Strategy.h b/include/hbba_lite/core/Strategy.h index 8813f0d..d4ade94 100644 --- a/include/hbba_lite/core/Strategy.h +++ b/include/hbba_lite/core/Strategy.h @@ -116,9 +116,10 @@ inline bool operator!=(const FilterConfiguration& a, const FilterConfiguration& class FilterPool { + std::unordered_map m_countsByName; + protected: std::unordered_map m_typesByName; - std::unordered_map m_countsByName; std::unordered_map m_lastFilterConfigurationByName; std::recursive_mutex m_mutex; diff --git a/src/hbba_lite_cpp/core/RosFilterPool.cpp b/src/hbba_lite_cpp/core/RosFilterPool.cpp index b8ef288..b6a7803 100644 --- a/src/hbba_lite_cpp/core/RosFilterPool.cpp +++ b/src/hbba_lite_cpp/core/RosFilterPool.cpp @@ -90,6 +90,8 @@ RosLogFilterPoolDecorator::RosLogFilterPoolDecorator(unique_ptr filt void RosLogFilterPoolDecorator::add(const std::string& name, FilterType type) { + lock_guard lock(m_mutex); + FilterPool::add(name, type); m_filterPool->add(name, type); }