ADD: added function to get all sensors as vector and map
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <sys/types.h>
|
||||
#include <vector>
|
||||
namespace Entities
|
||||
{
|
||||
|
||||
@@ -69,6 +70,20 @@ namespace Entities
|
||||
*/
|
||||
std::shared_ptr<Sensor::SensorControl> getSensorByUUID(std::string uuid);
|
||||
|
||||
/**
|
||||
* @brief Get the Sensor List As Vector of shared pointer of sensorcontrols
|
||||
*
|
||||
* @return std::vector<std::shared_ptr<Sensor::SensorControl>>
|
||||
*/
|
||||
std::vector<std::shared_ptr<Sensor::SensorControl>> getSensorListAsVector();
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the Sensor List As Map of shared pointer of sensorcontrols
|
||||
*
|
||||
* @return std::map<std::string, std::shared_ptr<Sensor::SensorControl>>
|
||||
*/
|
||||
std::map<std::string, std::shared_ptr<Sensor::SensorControl>> getSensorListAsMap();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -87,6 +87,26 @@ namespace Entities
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::vector<std::shared_ptr<Sensor::SensorControl>> SensorManager::getSensorListAsVector()
|
||||
{
|
||||
std::vector<std::shared_ptr<Sensor::SensorControl>> SensorVector;
|
||||
for (auto [key, value] : SensorStore)
|
||||
{
|
||||
SensorVector.push_back(value);
|
||||
}
|
||||
|
||||
return SensorVector;
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::map<std::string, std::shared_ptr<Sensor::SensorControl>> 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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user