From 671f763f4532d9880500c7c8574cc6493c3bef2f Mon Sep 17 00:00:00 2001 From: Henry Winkel Date: Thu, 14 Mar 2024 18:23:00 +0100 Subject: [PATCH] ADD: added function to get all sensors as vector and map --- include/Entities/SensorManager.hpp | 15 +++++++++++++++ src/Entities/SensorManager.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/include/Entities/SensorManager.hpp b/include/Entities/SensorManager.hpp index 84273cf..81d57c4 100644 --- a/include/Entities/SensorManager.hpp +++ b/include/Entities/SensorManager.hpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace Entities { @@ -69,6 +70,20 @@ namespace Entities */ std::shared_ptr getSensorByUUID(std::string uuid); + /** + * @brief Get the Sensor List As Vector of shared pointer of sensorcontrols + * + * @return std::vector> + */ + std::vector> getSensorListAsVector(); + + + /** + * @brief Get the Sensor List As Map of shared pointer of sensorcontrols + * + * @return std::map> + */ + std::map> getSensorListAsMap(); /** diff --git a/src/Entities/SensorManager.cpp b/src/Entities/SensorManager.cpp index 184c7cf..a2e5486 100644 --- a/src/Entities/SensorManager.cpp +++ b/src/Entities/SensorManager.cpp @@ -87,6 +87,26 @@ namespace Entities } + + std::vector> SensorManager::getSensorListAsVector() + { + std::vector> SensorVector; + for (auto [key, value] : SensorStore) + { + SensorVector.push_back(value); + } + + return SensorVector; + + } + + + std::map> SensorManager::getSensorListAsMap() + { + return SensorStore; + } + + size_t SensorManager::getSensorCount() { return SensorStore.size(); @@ -96,6 +116,7 @@ namespace Entities + void SensorManager::handlSensorMessages(std::string Message) { WHISPER::Message msg(Message); @@ -263,6 +284,9 @@ namespace Entities return Update; + + + }