ADD: added new Tracklist and some changes to Entity class

This commit is contained in:
Henry Winkel
2023-11-08 15:08:05 +01:00
parent ab32c5e8df
commit 6d20c8de43
4 changed files with 99 additions and 194 deletions

View File

@@ -4,6 +4,7 @@
#include "SimCore/Identifier.hpp"
#include "SimCore/IdentifierMaker.hpp"
#include "SimCore/Messages/SimTrack.hpp"
#include "nlohmann/json.hpp"
#include <atomic>
#include <cstddef>
#include <list>
@@ -19,49 +20,25 @@
namespace TrackList
{
class TrackList
class TrackList
{
public:
TrackList(SimCore::Identifier OwnID);
~TrackList();
public:
TrackList();
void addTrack(std::shared_ptr<SimCore::SimTrack> Track);
std::shared_ptr<SimCore::SimTrack> getTrack(SimCore::Identifier);
void deleteTrack(std::string ID);
void deleteTrack(SimCore::Identifier);
std::shared_ptr<SimCore::SimTrack> getTrackBySringID(std::string ID);
void stopSanitizer();
size_t getSize();
// SimCore::Identifier getTrackID(SimCore::ObjectSource source);
void addTrack(std::shared_ptr<SimCore::SimTrack> track);
void addTrack(std::shared_ptr<SimCore::SimTrack> track,SensorData sensorData);
std::shared_ptr<TracklistItem> getTrack(SimCore::Identifier TrackID);
std::vector<SimCore::Identifier> getAllIDs();
size_t size();
void setTrackTimeout(int millseconds);
int getTrackTimeoutValue();
private:
const SimCore::Identifier OwnID_;
SimCore::IdentifierMaker IDMaker;
void tracklistSanitizer();
void addNewTrack(std::shared_ptr<SimCore::SimTrack> track,SensorData sensorData);
void addNewTrack(std::shared_ptr<SimCore::SimTrack> track);
std::map<std::string, std::shared_ptr<TracklistItem>> TrackList_;
mutable std::mutex mutex_;
std::thread sanitizerThread_;
std::atomic_bool sanitizerIsRunning_;
std::atomic_bool stopSanitizer_;
int TrackTimeout_ = 1000;
void getJsonTRackList(nlohmann::json &message);
private:
mutable std::mutex mx_;
std::map<std::string, std::shared_ptr<SimCore::SimTrack>> TrackStore_;
};