VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
spotReportManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2026 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
6 #pragma once
7 
9 #include <vlpi/simulationAddress.h>
10 
11 #include <vrfutil/uuid.h>
13 
14 #include <boost/signals2.hpp>
15 
16 #include <set>
17 #include <map>
18 #include <unordered_map>
19 
21 class DtSpotReport;
22 class DtVrfObjectMessage;
26 
27 namespace makVrf
28 {
29  class DtStateData;
30 }
31 
35 {
36 public:
38  virtual ~DtSpotReportManager();
39 
40  virtual void requestSpotReports(const DtSimulationAddress&);
41 
43  virtual bool isSpotReport(const DtUUID&) const;
44 
46  virtual bool removeSpotReport(const DtUUID&);
47 
49  virtual void setSuspended(bool);
50  bool suspended() const
51  {
52  return mySuspended;
53  }
54 
56  virtual std::set<DtUUID> observedBy(const DtUUID&) const;
57 
59  virtual std::set<DtUUID> observing(const DtUUID&) const;
60 
62  virtual DtSpotReportDataHandler* spotReportDataHandlerFor(const DtUUID&) const;
63 
64 public:
66  using SpotReportHandlersByC = std::map<DtUUID, std::unique_ptr<DtSpotReport>>;
67  using SpotReportHandlersBySC = std::map<DtUUID, SpotReportHandlersByC>;
68 
70  {
71  return mySpotReportHandlersBySC;
72  }
73 
74  virtual void unmanageAndDeleteAllPerspectives();
75  virtual void removeAllSpotReports();
76 
78  virtual void reset();
79 
85  template <typename Perspective_Name>
86  Perspective_Name* createAndManagePerspective(bool andRefresh = true)
87  {
88  DtVrfSingleton* iface = instance(Perspective_Name::ClassName());
89 
90  if (iface)
91  {
92  Perspective_Name* perspective = dynamic_cast<Perspective_Name*>(
93  dynamic_cast<DtSpotReportPerspectiveCreatorInterface*>(iface)->create(*this));
94 
95  if (andRefresh)
96  {
97  perspective->refresh();
98  }
99 
100  managePerspective(perspective);
101 
102  return perspective;
103  }
104 
105  return nullptr;
106  }
107 
108  virtual void managePerspective(DtSpotReportPerspectiveInterface* p);
109  virtual bool unmanagePerspective(DtSpotReportPerspectiveInterface*);
110  virtual void deleteAndUnmanagePerspective(DtSpotReportPerspectiveInterface*);
111 
112  virtual void registerPerspectiveCreator(DtSpotReportPerspectiveCreatorInterface*);
113 
114  const std::vector<int>& certaintyLevels() const;
115  virtual void setCertaintyLevels(const std::vector<int>&);
116  virtual void setCertaintyLevel(int level, int time);
117 
120  virtual int certaintyLevelForTime(double d) const;
121 
122  virtual void setSpotReportGatherTime(int);
123  virtual int spotReportGatherTime() const
124  {
125  return mySpotReportGatherTime;
126  }
127 
128  virtual DtSpotReportDataHandler* createSpotReportDataHandler(const DtSpotReport*) const;
129 
130 protected:
131  virtual void processReceiveSpotReport(const DtVrfObjectMessage* msg);
132  virtual void processReceiveSpotReports(const DtVrfObjectMessage* msg);
133 
134  virtual DtSpotReport* addOrUpdateSpotReport(DtSpotReport*, bool* createdNew = nullptr);
135 
137  virtual void requestSpotReports();
138 
139  virtual void objectEntryRemoved(const DtUUID&);
140  virtual void spotterRemoved(const DtUUID&);
141  virtual void contactRemoved(const DtUUID&);
142 
143  virtual void tick();
144 
146  virtual DtSpotReport* createSpotReport(const DtSpotReport* rep);
147 
149  virtual void handlerAboutToBeDeleted(DtSpotReport*);
150  virtual void spotReportCreated(DtSpotReport*);
151  virtual void spotReportUpdated(DtSpotReport*);
152 
153  virtual void updateFlushTime();
154 
155 public:
156  boost::signals2::signal<void()> signal_allSpotReportsRemoved;
157  boost::signals2::signal<void(DtSpotReport*)> signal_spotReportCreated;
158  boost::signals2::signal<void(const DtUUID&)> signal_contactDeleted;
159  boost::signals2::signal<void(const DtUUID&)> signal_spotterDeleted;
160  boost::signals2::signal<void(const DtSpotReport*)> signal_reportAboutToBeDeleted;
161  boost::signals2::signal<void(const DtSpotReport*)> signal_reportUpdated;
162 
163 public:
165  virtual void createAndDeliverMessage(const DtSimulationAddress&, const DtSimInterfaceContent&) = 0;
166  virtual std::set<DtSimulationAddress> backendsLoaded() const = 0;
167  virtual unsigned long generateRequestId() = 0;
168  virtual double simTime() const = 0;
169 
170  virtual const makVrf::DtStateData* dataFor(const DtUUID&) const = 0;
171  virtual bool anyBackendsPlaying() const = 0;
172  virtual int numberOfBackends() const = 0;
173  virtual double dateAndTimeOfDay() const = 0;
174 
175 protected:
176  using SpotReportRequests = std::map<unsigned long, std::set<DtSimulationAddress>>;
177  unsigned long myResendId = 0;
179 
180  using Observed = std::unordered_map<DtUUID, std::set<DtUUID>>;
183 
187 
188  using Perspectives = std::set<DtSpotReportPerspectiveInterface*>;
190 
191  int mySpotReportGatherTime = 3;
192  std::vector<int> myCertaintyLevels;
193 };
UUID is a unique ID wrapper class.
Definition: uuid.h:59
std::vector< int > myCertaintyLevels
Definition: spotReportManager.h:192
virtual int spotReportGatherTime() const
Definition: spotReportManager.h:123
The DtSpotReportManager class is used manage and keep track of spot reports. by spotter and who they ...
Definition: spotReportManager.h:34
Definition: vrfSingletonRoot.h:17
#define DT_DLL_vrfcontrol
This file is used to determine how to build.
Definition: vrfcontrolDefines.h:28
SpotReportHandlersBySC mySpotReportHandlersBySC
Definition: spotReportManager.h:178
boost::signals2::signal< void(const DtUUID &)> signal_contactDeleted
Definition: spotReportManager.h:158
bool suspended() const
Definition: spotReportManager.h:50
bool mySuspended
Definition: spotReportManager.h:184
const SpotReportHandlersBySC & spotReportHandlersByHandler() const
Definition: spotReportManager.h:69
DT_DLL_VRVCORE DtTaitBryan level(const DtCoordinateSystem &cs, const DtVector &localOrigin, double topoHeading)
Returns a level orientation with the topographic heading.
Contains the DtUUID class declaration.
boost::signals2::signal< void(const DtSpotReport *)> signal_reportUpdated
Definition: spotReportManager.h:161
T_Class * instance() const
Returns an instance, if exists, else nullptr.
Definition: vrfSingletonRoot.h:29
DtVrfSingleton is a class that all singletons that can be registered with the DtVrfSingletonRoot are ...
Definition: vrfSingleton.h:15
std::map< DtUUID, SpotReportHandlersByC > SpotReportHandlersBySC
Definition: spotReportManager.h:67
std::map< DtUUID, std::unique_ptr< DtSpotReport >> SpotReportHandlersByC
Spot report handlers are organized by spotter and contact.
Definition: spotReportManager.h:66
std::unordered_map< DtUUID, std::set< DtUUID >> Observed
Definition: spotReportManager.h:180
int myPauseFlushUpdate
Definition: spotReportManager.h:186
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
double myNextFlushDataTime
Definition: spotReportManager.h:185
std::map< unsigned long, std::set< DtSimulationAddress >> SpotReportRequests
Definition: spotReportManager.h:176
Definition: spotReportPerspectiveInterface.h:19
boost::signals2::signal< void()> signal_allSpotReportsRemoved
Definition: spotReportManager.h:156
The base class for all messages to/from a specific DtVrfObject. Various subclasses of this class will...
Definition: vrfObjectMessage.h:30
Perspectives myPerspectives
Definition: spotReportManager.h:189
Perspective_Name * createAndManagePerspective(bool andRefresh=true)
Creates a new perspective from a creator registered with this class and manages it in the tick() meth...
Definition: spotReportManager.h:86
std::set< DtSpotReportPerspectiveInterface * > Perspectives
Definition: spotReportManager.h:188
boost::signals2::signal< void(const DtUUID &)> signal_spotterDeleted
Definition: spotReportManager.h:159
boost::signals2::signal< void(const DtSpotReport *)> signal_reportAboutToBeDeleted
Definition: spotReportManager.h:160
boost::signals2::signal< void(DtSpotReport *)> signal_spotReportCreated
Definition: spotReportManager.h:157
Definition: simInterfaceContent.h:45
Observed myObservedBy
Definition: spotReportManager.h:181
Observed myObserving
Definition: spotReportManager.h:182
Definition: spotReportPerspectiveInterface.h:93
DtSpotReport; subclass of DtSimReport.
Definition: spotReport.h:35
Definition: spotReportDataHandler.h:30

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)