ADD: added a sanitising function for the tracklist and tests

This commit is contained in:
Henry Winkel
2023-12-20 15:38:24 +01:00
parent 5e829298fd
commit b932c4a917
4 changed files with 234 additions and 66 deletions

View File

@@ -6,13 +6,18 @@
#include "nlohmann/json_fwd.hpp"
#include <SimCore/Identifier.hpp>
#include <SimCore/Messages/SimTrack.hpp>
#include <cstddef>
#include <nlohmann/json.hpp>
#include <map>
#include <memory>
#include <mutex>
#include <vector>
namespace SimControl
{
class TrackList
{
public:
@@ -26,12 +31,19 @@ namespace SimControl
void getJsonTRackList(nlohmann::json &message);
size_t getTracklistSize();
private:
mutable std::mutex mx_;
std::map<std::string, std::shared_ptr<SimCore::SimTrack>> TrackStore_;
std::map<std::string, std::time_t> markedAsDeletedTracks_;
void checkTracksTimeout();
const int TrackTimeoutTime = 6;
};
}