summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa/raspberrypi/controller')
-rw-r--r--src/ipa/raspberrypi/controller/algorithm.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ipa/raspberrypi/controller/algorithm.cpp b/src/ipa/raspberrypi/controller/algorithm.cpp
index 6d91ee29..a957fde5 100644
--- a/src/ipa/raspberrypi/controller/algorithm.cpp
+++ b/src/ipa/raspberrypi/controller/algorithm.cpp
@@ -34,14 +34,23 @@ void Algorithm::process([[maybe_unused]] StatisticsPtr &stats,
/* For registering algorithms with the system: */
-static std::map<std::string, AlgoCreateFunc> algorithms;
-std::map<std::string, AlgoCreateFunc> const &RPiController::getAlgorithms()
+namespace {
+
+std::map<std::string, AlgoCreateFunc> &algorithms()
{
+ static std::map<std::string, AlgoCreateFunc> algorithms;
return algorithms;
}
+} /* namespace */
+
+std::map<std::string, AlgoCreateFunc> const &RPiController::getAlgorithms()
+{
+ return algorithms();
+}
+
RegisterAlgorithm::RegisterAlgorithm(char const *name,
AlgoCreateFunc createFunc)
{
- algorithms[std::string(name)] = createFunc;
+ algorithms()[std::string(name)] = createFunc;
}