ADD: SensorManager with Trackfusion Trackstore and Sensor List wich contains every contact a sensor has
This commit is contained in:
84
include/Entities/Tracklist/Trackfusion.hpp
Normal file
84
include/Entities/Tracklist/Trackfusion.hpp
Normal file
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <SimCore/Messages/TracklistItem.hpp>
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include "SimCore/Messages/SimTrack.hpp"
|
||||
#include <SimCore/Messages/TracklistUpdate.hpp>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace TrackList
|
||||
{
|
||||
|
||||
|
||||
|
||||
class Trackfusion
|
||||
{
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief adds or updates track
|
||||
*
|
||||
* @param track shared pointer of a simtrack
|
||||
* @param sensorData
|
||||
*/
|
||||
void addOrUpdateTrack(std::shared_ptr<SimCore::SimTrack> track,std::shared_ptr<SimCore::SensorData> sensorData);
|
||||
|
||||
/**
|
||||
* @brief deltets a track based on a SimCore::Identifier
|
||||
*
|
||||
*/
|
||||
void deleteTrack(SimCore::Identifier id);
|
||||
|
||||
/**
|
||||
* @brief deletes a track based on a string uuid
|
||||
*
|
||||
* @param UUID
|
||||
*/
|
||||
void deleteTrack(std::string UUID);
|
||||
|
||||
/**
|
||||
* @brief Get the Tracklist As String
|
||||
*
|
||||
* @return std::string
|
||||
*/
|
||||
std::string getTracklistAsString();
|
||||
|
||||
/**
|
||||
* @brief retruns a shared pointer of a track
|
||||
*
|
||||
* @param id
|
||||
* @return std::shared_ptr<TracklistItem>
|
||||
*/
|
||||
std::shared_ptr<SimCore::TracklistItem> findTrack(SimCore::Identifier id);
|
||||
|
||||
/**
|
||||
* @brief returns a shared pointer of a track
|
||||
*
|
||||
* @param UUID
|
||||
* @return std::shared_ptr<TracklistItem>
|
||||
*/
|
||||
std::shared_ptr<SimCore::TracklistItem> findTrack(std::string UUID);
|
||||
|
||||
/**
|
||||
* @brief Get the Track List Update object
|
||||
*
|
||||
* @return std::unique_ptr<SimCore::TracklistUpdate>
|
||||
*/
|
||||
std::unique_ptr<SimCore::TracklistUpdate> getTrackListUpdate(SimCore::Identifier ID);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
mutable std::mutex mx_;
|
||||
|
||||
std::unordered_map<SimCore::Identifier, std::shared_ptr<SimCore::TracklistItem>> TrackStore_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <SimCore/Position.hpp>
|
||||
#include <SimCore/SafeMap.hpp>
|
||||
#include <Entities/Tracklist/TracklistItem.hpp>
|
||||
// #include <Entities/Tracklist/TracklistItem.hpp>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <loguru.hpp>
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include "SimCore/Messages/SimTrack.hpp"
|
||||
#include "SimCore/SimCore.hpp"
|
||||
#include <SimCore/Position.hpp>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace TrackList {
|
||||
|
||||
struct SensorData {
|
||||
SimCore::Identifier sensorID;
|
||||
// SimCore::Identifier SensorTrackID;
|
||||
std::string Sensorname;
|
||||
|
||||
|
||||
};
|
||||
|
||||
inline bool operator==(const SensorData& lhs, const SensorData& rhs)
|
||||
{
|
||||
return lhs.sensorID == rhs.sensorID;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class TracklistItem: public SimCore::SimTrack
|
||||
{
|
||||
public:
|
||||
TracklistItem(std::shared_ptr<SimCore::SimTrack> track,SensorData sensorData);
|
||||
TracklistItem(std::shared_ptr<SimCore::SimTrack> track);
|
||||
|
||||
|
||||
std::chrono::time_point<std::chrono::steady_clock> getLastUpdateTimestamp();
|
||||
|
||||
void updateTrack(std::shared_ptr<SimCore::SimTrack> track,SensorData sensorData);
|
||||
|
||||
void updateTrack(std::shared_ptr<SimCore::SimTrack> track);
|
||||
|
||||
bool checkIfSensorIDIsIn(SimCore::Identifier SensorTrackID);
|
||||
|
||||
bool isSensorIDKnown(SimCore::Identifier);
|
||||
|
||||
void addSensorDataToSensorList(SensorData sensorData);
|
||||
|
||||
size_t getSensorCount();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
std::chrono::time_point<std::chrono::steady_clock> lastUpdateTimestamp_;
|
||||
|
||||
std::vector<SensorData> SensorList;
|
||||
|
||||
|
||||
bool isSensorinSensorlist(SensorData sensorData);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user