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

@@ -53,12 +53,13 @@ namespace Entities {
Entity(const SimCore::Identifier OwnID,
std::string EnttityName,
WHISPER::SourceType OwnType,
double RadarCrossSection,
SimCore::Kind::EntityKind EntityKind,
SimCore::Side::EntitySide EntitySide,
std::string GroundTruthAddr,
std::uint32_t GroundTruthPort,
ushort CommandPort,
bool online);
bool online);
~Entity();
void start();
@@ -73,6 +74,7 @@ namespace Entities {
virtual void childWorker() = 0;
virtual void stopChild() = 0;
protected:
@@ -82,6 +84,7 @@ namespace Entities {
std::string EntityName_;
SimCore::Kind::EntityKind EntityKind_;
SimCore::Side::EntitySide EntitySide_;
double RCS_;
ushort MovemntWorkerPort_;
@@ -91,6 +94,9 @@ namespace Entities {
std::shared_ptr<WHISPER::InternalUDPSender> BroadcastServer_;
std::string GroundTruthAddr_;
std::uint32_t GroundTruthPort_;
private:

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_;
};