WSF
WsfLocalTrack.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFLOCALTRACK_HPP
13#define WSFLOCALTRACK_HPP
14
15#include "wsf_export.h"
16
17#include <memory>
18#include <string>
19
20#include "UtGenericMappedList.hpp"
21class UtScriptClass;
22class UtScriptTypes;
23class UtInput;
24class WsfFilter;
25#include "WsfTrack.hpp"
26class WsfTrackManager;
27
30
32{
33public:
34 using RawTrackIdList = UtMappedList<WsfTrackId, WsfTrackId>;
35
37 WsfLocalTrack(const WsfLocalTrack& aTrack);
38 WsfLocalTrack(const WsfTrack& aTrack);
39 ~WsfLocalTrack() override;
40
42 WsfLocalTrack* Clone() const override;
43
44 const char* GetScriptClassName() const override;
45
46 void ReplacementUpdate(const WsfTrack& aSource) override;
47
48 void UpdateFromMeasurement(double aSimTime, const WsfTrack& aMeasurement) override;
49
53 WsfTrackManager* GetTrackManager() const { return mManagerPtr; }
54
58 void SetTrackManager(WsfTrackManager* aManagerPtr) { mManagerPtr = aManagerPtr; }
59
60 static std::unique_ptr<UtScriptClass> CreateScriptClass(const std::string& aClassName, UtScriptTypes* aScriptTypesPtr);
61
63
64
65 virtual bool Correlate(const WsfTrackId& aFusedTrackId);
66 virtual bool Decorrelate(const WsfTrackId& aFusedTrackId);
67 virtual bool IsCorrelatedWith(const WsfTrackId& aTrackId) const;
68
69 void DecorrelateAll();
70
72 bool IsCorrelated() const { return (mFusedTrackIds.GetCount() > 0); }
73
75 const RawTrackIdList& GetRawTrackIds() const { return mFusedTrackIds; }
76
78
83
84
85 void SetPurgeable(bool aIsPurgeable) override;
86
88 void IncrementUseCount() { ++mUseCount; }
89
91 int GetUseCount() const { return mUseCount; }
92
95 {
96 --mUseCount;
97 if (mUseCount < 0)
98 {
99 mUseCount = 0;
100 }
101 }
102
104 void ResetUseCount() { mUseCount = 0; }
105
107
109
110
111 // Return a pointer to the filter. If no filter is present, the pointer will be zero.
112 WsfFilter* GetFilter() override { return mFilterPtr; }
113
115 const WsfFilter* GetFilter() const override { return mFilterPtr; }
116
117 void SetFilter(WsfFilter* aFilterPtr);
118
119 virtual bool UpdateFilter(double aSimTime, const WsfTrack& aMeasurement);
120 //
122
124
125
126 WsfTrack* GetRawTrack() { return static_cast<WsfTrack*>(this); }
127
130 const WsfTrackId& GetHighestTrackQualityId() const { return mHighestQualityTrackId; }
131
133 void SetHighestTrackQualityId(const WsfTrackId& aTrackId) { mHighestQualityTrackId = aTrackId; }
134
135 bool IsMirrorTrack(const WsfTrack& aTrack) const;
136 void SetMirrorTrack(const WsfTrack& aTrack);
137 void ClearMirrorTrack();
138
139 void UpdateSignalList();
140
143
144 // ================================= WARNING: New member variables =================================
145 //
146 // This class is transmitted over the network. If you add a new member variable, it is
147 // YOUR RESPONSIBILITY to verify that the member is serialized correctly.
148 // Please see the implementation of WsfLocalTrack::SerializeP in xio/WsfXIO_SerializeTypes.cpp
149 //
150 // =================================================================================================
151
153 template<typename T>
154 void SerializeP(T& aBuff);
155
156private:
157 WsfLocalTrack& operator=(const WsfTrack& aRhs); // Not Allowed.
158
161 WsfTrackManager* mManagerPtr;
162
163 RawTrackIdList mFusedTrackIds;
164 int mUseCount;
165 WsfFilter* mFilterPtr;
166 WsfTrackId mHighestQualityTrackId;
167
171 WsfTrackId mMirrorTrackId;
172};
173#endif
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Implement a filter as an adapter.
Definition WsfFilter.hpp:24
Definition WsfLocalTrack.hpp:32
void SetTrackManager(WsfTrackManager *aManagerPtr)
Definition WsfLocalTrack.hpp:58
WsfTrackManager * GetTrackManager() const
Definition WsfLocalTrack.hpp:53
void DecrementUseCount()
Decrement the usage count.
Definition WsfLocalTrack.hpp:94
void DecorrelateAll()
Definition WsfLocalTrack.cpp:115
const WsfFilter * GetFilter() const override
Return a pointer to the filter (const version). If no filter is present, the pointer will be zero.
Definition WsfLocalTrack.hpp:115
void IncrementUseCount()
Increment the usage count.
Definition WsfLocalTrack.hpp:88
virtual bool Correlate(const WsfTrackId &aFusedTrackId)
Definition WsfLocalTrack.cpp:81
WsfFilter * GetFilter() override
Return a pointer to the filter. If no filter is present, the pointer will be zero.
Definition WsfLocalTrack.hpp:112
static std::unique_ptr< UtScriptClass > CreateScriptClass(const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
int GetUseCount() const
Return the current value of the usage count.
Definition WsfLocalTrack.hpp:91
void SetHighestTrackQualityId(const WsfTrackId &aTrackId)
Set the contributing track id with the highest quality.
Definition WsfLocalTrack.hpp:133
const RawTrackIdList & GetRawTrackIds() const
Get the list of track ID's that went into forming this track.
Definition WsfLocalTrack.hpp:75
const WsfTrackId & GetHighestTrackQualityId() const
Definition WsfLocalTrack.hpp:130
void ResetUseCount()
Reset the usage count back to zero.
Definition WsfLocalTrack.hpp:104
void SerializeP(T &aBuff)
For XIO (de)serialization.
virtual bool IsCorrelatedWith(const WsfTrackId &aTrackId) const
Definition WsfLocalTrack.cpp:109
bool IsCorrelated() const
Return whether this track is correlated with any non-local track.
Definition WsfLocalTrack.hpp:72
virtual bool Decorrelate(const WsfTrackId &aFusedTrackId)
Definition WsfLocalTrack.cpp:100
WsfTrack * GetRawTrack()
Return this same object as a WsfTrack.
Definition WsfLocalTrack.hpp:126
WsfLocalTrack()
Definition WsfLocalTrack.cpp:19
UtMappedList< WsfTrackId, WsfTrackId > RawTrackIdList
Definition WsfLocalTrack.hpp:34
Definition WsfTrackId.hpp:33
Definition WsfTrackManager.hpp:62
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
const char * GetScriptClassName() const override
Definition WsfTrack.cpp:1497
WsfTrack * Clone() const override
Definition WsfTrack.cpp:613
virtual void SetPurgeable(bool aIsPurgeable)
Set whether this track can be purged.
Definition WsfTrack.hpp:339
WsfTrack()
Use this constructor if the track is a 'predefined track'.
Definition WsfTrack.cpp:42
virtual void ReplacementUpdate(const WsfTrack &aSource)
Definition WsfTrack.cpp:947
virtual void UpdateFromMeasurement(double aSimTime, const WsfTrack &aMeasurement)
Definition WsfTrack.cpp:712
WsfTrack & operator=(const WsfTrack &aRhs)
Assignment operator.
Definition WsfTrack.cpp:1358
Copyrights Multiple, All Rights Reserved