VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
DtAisDataManager Class Reference

The DtAisDataManager loads and manages Automatic Identification System (AIS) data, which is used to track and monitor real world ships. This data can be used to create and simulate clutter entities in a simulation.

Inheritance diagram for DtAisDataManager:
Inheritance graph
[legend]

Public Types

typedef std::vector< DtAisTrackDtAisTrackBuffer
 
typedef std::list< DtAisTrack * > DtAisTrackList
 
typedef std::unordered_map
< DtMmsi, DtAisTrack * > 
DtAisTrackMap
 
- Public Types inherited from DtAisDataServiceInterface
using DtMmsi = int
 
using DtMmsiSet = std::set< DtMmsi >
 
using DtPathPoints = std::map< double, DtPathPoint >
 
using DtPathPointIter = std::map< double, DtPathPoint >::const_iterator
 

Public Member Functions

 DtAisDataManager (DtSimulationServices *simServices)
 
virtual ~DtAisDataManager ()
 
virtual bool init ()
 
virtual void tick ()
 
virtual bool isDataLoaded () const override
 
virtual DtAisDataJob::Ptr findTracksInArea (const DtVertexList &areaVertices, bool unownedOnly=true) override
 
virtual DtAisDataJob::Ptr findTracksInAreaDuringTime (const DtVertexList &areaVertices, double startSimTime, double endSimTime, bool unownedOnly) override
 
virtual const DtAisTracktrackInfo (DtMmsi trackId) const override
 
virtual DtAisDataJob::Ptr requestOwnershipOfTracks (const DtMmsiSet &trackIds) override
 
virtual DtAisDataJob::Ptr releaseOwnershipOfTracks (const DtMmsiSet &trackIds) override
 
virtual double aisTimeFromSimTime (double simTime) const override
 
virtual double simTimeFromAisTime (double aisTime) const override
 
virtual double finalDataSimTime () const override
 
virtual bool getFirstPointAfterTime (const DtAisTrack &track, double simTime, DtPathPointIter &pathPointIter) const override
 
virtual bool getLastPointBeforeTime (const DtAisTrack &track, double simTime, DtPathPointIter &pathPointIter) const override
 
virtual DtPathPointIter getEndOfpath (const DtAisTrack &track) const override
 
virtual void resetData () override
 
virtual void clearData () override
 
virtual void loadAisData ()
 
virtual bool isDataLoading () const
 
virtual bool timeToStop () const
 
virtual void stop ()
 
- Public Member Functions inherited from DtAisDataServiceInterface
 DtAisDataServiceInterface ()
 
virtual ~DtAisDataServiceInterface ()
 

Static Public Member Functions

static void tickCallback (void *usr)
 

Protected Types

typedef tbb::spin_mutex QueryQueueMutex
 
typedef std::list
< DtAisDataJob::Ptr
JobQueue
 

Protected Member Functions

virtual void performDataClear ()
 
virtual void performDataReset ()
 
virtual void startAisDataLoad ()
 
virtual void calculateTrackTimeOffset ()
 

Protected Attributes

DtAisTrackBuffer myTracks
 
DtAisTrackMap myTracksByMmsi
 
DtMmsiSet myUnusedTracks
 
DtMmsiSet myTracksInUse
 
QueryQueueMutex myQueryQueueMutex
 
JobQueue myJobQueue
 
DtSimulationServicesmySimulationServices
 
DtTime myTrackTimeAtSimTime0
 
DtTime myFirstDataAisTime
 
DtTime myFirstDataSimTime
 
DtTime myFinalDataAisTime
 
DtTime myFinalDataSimTime
 
std::atomic< boolmyClearData
 
std::atomic< boolmyResetData
 
std::atomic< boolmyResetTimeOffset
 
std::atomic< boolmyDataIsLoaded
 
std::atomic< boolmyLoadInProgress
 
std::atomic< boolmyWarnedOnce
 
std::atomic< boolmyTimeToStop
 

Private Member Functions

 DtAisDataManager (const DtAisDataManager &orig)
 
DtAisDataManageroperator= (const DtAisDataManager &other)
 

Friends

class DtAisDataManagerJob
 

Member Typedef Documentation

typedef std::unordered_map<DtMmsi, DtAisTrack*> DtAisDataManager::DtAisTrackMap
typedef tbb::spin_mutex DtAisDataManager::QueryQueueMutex
protected
typedef std::list<DtAisDataJob::Ptr> DtAisDataManager::JobQueue
protected

Constructor & Destructor Documentation

DtAisDataManager::DtAisDataManager ( DtSimulationServices simServices)

Constructs the AIS data manager.

virtual DtAisDataManager::~DtAisDataManager ( )
virtual

The destructor.

DtAisDataManager::DtAisDataManager ( const DtAisDataManager orig)
private

copy constructor not defined

Member Function Documentation

virtual bool DtAisDataManager::init ( )
virtual

Initializes the AIS data manager.

Returns
a boolean signifying success or failure.
static void DtAisDataManager::tickCallback ( void *  usr)
static

Static tick method that is registered with DtSimulationServices callbacks. Calls tick().

virtual void DtAisDataManager::tick ( )
virtual

Tick the AIS data manager. Determines whether tracks have entered or exited areas of interest and calls registered functions to notify them of the change.

virtual bool DtAisDataManager::isDataLoaded ( ) const
overridevirtual

Returns true if AIS data has been loaded.

Implements DtAisDataServiceInterface.

virtual DtAisDataJob::Ptr DtAisDataManager::findTracksInArea ( const DtVertexList areaVertices,
bool  unownedOnly = true 
)
overridevirtual

Starts a query for all tracks in the specified area. If unownedOnly is true (the default) then only unowned tracks are returned.

Implements DtAisDataServiceInterface.

virtual DtAisDataJob::Ptr DtAisDataManager::findTracksInAreaDuringTime ( const DtVertexList areaVertices,
double  startSimTime,
double  endSimTime,
bool  unownedOnly 
)
overridevirtual

Starts a query for all tracks in the specified area. If unownedOnly is true (the default) then only unowned tracks are returned.

Implements DtAisDataServiceInterface.

virtual const DtAisTrack* DtAisDataManager::trackInfo ( DtMmsi  trackId) const
overridevirtual

Returns information for the track with the specified MMSI, or nullptr if it could not be found. Will always return nullptr if isDataLoaded() returns false;.

Implements DtAisDataServiceInterface.

virtual DtAisDataJob::Ptr DtAisDataManager::requestOwnershipOfTracks ( const DtMmsiSet trackIds)
overridevirtual

Request ownership of the specified given tracks.

Implements DtAisDataServiceInterface.

virtual DtAisDataJob::Ptr DtAisDataManager::releaseOwnershipOfTracks ( const DtMmsiSet trackIds)
overridevirtual

Release ownership of the specified tracks.

Implements DtAisDataServiceInterface.

virtual double DtAisDataManager::aisTimeFromSimTime ( double  simTime) const
overridevirtual

Converts a sim time to AIS data time. Needed to understand how sim time relates to the timestamps in the AIS track data.

Implements DtAisDataServiceInterface.

virtual double DtAisDataManager::simTimeFromAisTime ( double  aisTime) const
overridevirtual

Converts the AIS data time to sim time. Needed to understand how sim time relates to the timestamps in the AIS track data.

Implements DtAisDataServiceInterface.

virtual double DtAisDataManager::finalDataSimTime ( ) const
overridevirtual

Returns the sim time for the last point of AIS data available.

Implements DtAisDataServiceInterface.

virtual bool DtAisDataManager::getFirstPointAfterTime ( const DtAisTrack track,
double  simTime,
DtPathPointIter pathPointIter 
) const
overridevirtual

Find the first point in the track's path that occurs after (or at) the specified sim time. If no points meet this criteria, returns false and sets pathPointIter to the end of the path. (i.e. path.end()) Otherwise, returns true and pathPointIter parameter is set to the iterator to this point.

Implements DtAisDataServiceInterface.

virtual bool DtAisDataManager::getLastPointBeforeTime ( const DtAisTrack track,
double  simTime,
DtPathPointIter pathPointIter 
) const
overridevirtual

Find the last point in the track's path that occurs before (or at) the specified sim time. If no points meet this criteria, returns false and sets pathPointIter to the end of the path. (i.e. path.end()) Otherwise, returns true and pathPointIter parameter is set to the iterator to this point.

Implements DtAisDataServiceInterface.

virtual DtPathPointIter DtAisDataManager::getEndOfpath ( const DtAisTrack track) const
overridevirtual

Returns an iterator to the end of the path (i.e. path.end()).

Implements DtAisDataServiceInterface.

virtual void DtAisDataManager::resetData ( )
overridevirtual

Marks AIS data to be reset. Data will not be unloaded, but ownership of all tracks will be reset to unowned.

Implements DtAisDataServiceInterface.

virtual void DtAisDataManager::clearData ( )
overridevirtual

Marks AIS data to be cleared. Data will be completely unloaded.

Implements DtAisDataServiceInterface.

virtual void DtAisDataManager::loadAisData ( )
virtual

Loads the AIS data.

Warning
Should only be called by the thread spawned to load AIS data. DO NOT CALL THIS FUNCTION DIRECTLY.
virtual bool DtAisDataManager::isDataLoading ( ) const
virtual
virtual bool DtAisDataManager::timeToStop ( ) const
virtual
virtual void DtAisDataManager::stop ( )
virtual
virtual void DtAisDataManager::performDataClear ( )
protectedvirtual

Clears out all loaded AIS data.

virtual void DtAisDataManager::performDataReset ( )
protectedvirtual

Resets all AIS data to be unowned.

virtual void DtAisDataManager::startAisDataLoad ( )
protectedvirtual

Spawns a thread to begin loading AIS data.

virtual void DtAisDataManager::calculateTrackTimeOffset ( )
protectedvirtual

Calculates and sets myTrackTimeAtSimTime0, which is used to translate between sim time and AIS track data time.

DtAisDataManager& DtAisDataManager::operator= ( const DtAisDataManager other)
private

assignment operator not defined

Friends And Related Function Documentation

friend class DtAisDataManagerJob
friend

Member Data Documentation

DtAisTrackBuffer DtAisDataManager::myTracks
protected

Buffer containing information on all loaded AIS tracks.

DtAisTrackMap DtAisDataManager::myTracksByMmsi
protected

Index into the track data by MMSI.

DtMmsiSet DtAisDataManager::myUnusedTracks
protected

List of the subset of tracks that are not in use.

DtMmsiSet DtAisDataManager::myTracksInUse
protected

List of the subset of tracks that are in use.

QueryQueueMutex DtAisDataManager::myQueryQueueMutex
mutableprotected
JobQueue DtAisDataManager::myJobQueue
protected
DtSimulationServices* DtAisDataManager::mySimulationServices
protected
DtTime DtAisDataManager::myTrackTimeAtSimTime0
protected
DtTime DtAisDataManager::myFirstDataAisTime
protected
DtTime DtAisDataManager::myFirstDataSimTime
protected
DtTime DtAisDataManager::myFinalDataAisTime
protected
DtTime DtAisDataManager::myFinalDataSimTime
protected
std::atomic<bool> DtAisDataManager::myClearData
protected
std::atomic<bool> DtAisDataManager::myResetData
protected
std::atomic<bool> DtAisDataManager::myResetTimeOffset
protected
std::atomic<bool> DtAisDataManager::myDataIsLoaded
protected
std::atomic<bool> DtAisDataManager::myLoadInProgress
protected
std::atomic<bool> DtAisDataManager::myWarnedOnce
protected
std::atomic<bool> DtAisDataManager::myTimeToStop
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)