VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
spotReportGeneratorController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 #pragma once
12 
15 #include <list>
18 #include "vrftasks/spotReport.h"
20 #include <tbb/mutex.h>
21 
24 class DtSimReport;
28 class DtSimMessage;
29 class DtVrfObjectMessage;
30 class DtSettingsObject;
31 class DtBoolSetting;
32 
51 {
52 private:
60 public:
61 
65  DtSimulationServices* simManager, DtComponentDescriptor* desc=0,
66  DtReaderWriterRegistry *parentRegistry=0);
67 
69  virtual ~DtSpotReportGeneratorController() override;
70 
74  virtual bool init() override;
75 
78  virtual const char* type() const override;
79 
83  virtual void tick() override;
84 
86  static void setSpotReportingCallback(DtSimMessage * msg, void * usr);
87 
88  virtual void processSetSpotReporting(DtSimMessage * msg);
89 
93  virtual void setLocalEnabled(bool on);
94 
102  virtual void setGlobalEnabledOverridingLocal();
103 
106  virtual void resendSpotReports(unsigned long requestId);
107 
111  static DtSimComponent * creator(const DtString& name,
112  DtLocalObject* owner,
113  DtSimulationServices* simManager,
114  DtComponentDescriptor* desc = 0,
115  DtReaderWriterRegistry* parentRegistry = 0);
116 
117 protected:
118 
123  virtual void turnSpotReportingOn();
124  virtual void turnSpotReportingOff();
126 
128  virtual bool createPorts() override;
129 
135  virtual bool createPSR();
136 
139  virtual void processObjectAboutToBeRemoved(const DtSimObject* object);
140 
142  virtual void registerRadioMessageCallbacks();
143 
147  virtual void sendDestroyedReports(unsigned long resendId, bool queueMissing = false);
148 
152  virtual DtSpotReport* createDestroyedReport(unsigned long resendId, const DtUUID& entity, bool& objectIsNoLongerDestroyed);
153 
164  virtual void generateAndSendSpotReports();
165 
173  virtual bool isTypeAndForceForReport(
174  DtRwSensorContactInfo* contact);
175 
180  virtual DtSpotReport* createSpotReportForContact(
181  const DtRwSensorContactInfo& contactInfo);
182 
184  virtual void updateSpotReportForContact(DtSpotReport& spotReport,
185  const DtRwSensorContactInfo& contact);
186 
191  virtual void sendSpotReport(DtSpotReport& spotReport, bool superiorOnly);
192 
193  std::vector<DtUUID> getSpotReportSuperiorPeers();
194 
196  virtual void sendSpotReports(const std::vector<DtSimReport*>& spotReports, bool superiorOnly);
197 
199  virtual void sendStopSpottingReports(const std::map<DtUUID, DtString>& stoppedSpotting);
200 
206  virtual bool spotReportNeedsUpdateAndResend(const DtSpotReport& spotRep,
207  const DtRwSensorContactInfo& contact, DtSpotReport::Reason& reason) const;
208 
211  virtual double heartbeatDeltaFor(const DtSpotReport& spotRep,
212  const DtRwSensorContactInfo& contact) const;
213 
220  virtual const DtSimReportMessageType& spotReportTypeString() const;
221 
228  virtual const DtSimReportMessageType& stopSpottingReportTypeString() const;
229 
233  static void settingConsumerCallback(const DtSettingsObject* settingsObject,
234  void* usr);
237  virtual void readGlobalEnabledSetting(const DtBoolSetting* enabledSetting);
238 
241 
242  static void hostilitiesChangedCallback(DtU8 force, void* usr);
243  virtual void processHostilitiesChanged(DtU8 force);
245 
250  virtual bool reportingEnabled() const;
251 
255  virtual bool checkSpotReportUpdateConditions(const DtSpotReport& spotRep,
256  const DtRwSensorContactInfo& contact, DtSpotReport::Reason& reason) const;
257 
260  virtual bool checkDeltaDistanceConditions(const DtSpotReport& spotRep,
261  const DtRwSensorContactInfo& contact) const;
262 
264  virtual bool checkDeltaHeartbeatConditions(const DtSpotReport& spotRep,
265  const DtRwSensorContactInfo& contact) const;
266 
268  virtual bool entityHasUpdateRate(const DtRwSensorContactInfo& contactInfo) const;
269 
271  virtual void timedTick() override;
272 
274  virtual void processSimObjectAdded(DtSimObjectReference);
275 
276  static void requestSpotReportsCallback(DtSimMessage* msg, void* usr);
277  virtual void processRequestSpotReports(DtSimMessage* msg);
278 
280  virtual void processSetRemoteSensorReceiver(DtSimMessage* msg);
281 
283  static void setRemoteSensorReceiverCallback(DtSimMessage* msg, void* usr);
284 
285 protected:
286 
295 
296  DtEntityTypesListOutputPort* myTypesToDetectOutputPort;
304 
307 
311 
314 
318 
322 
324 
326 
327  typedef std::map<DtUUID, std::vector<unsigned long> > MissingDestroyedObjectsMap;
329 
330  typedef std::map<DtUUID, boost::signals2::connection> RemovalSignalsMap;
332 
333  boost::signals2::scoped_connection mySimObjectAddedConnection;
334  tbb::spin_mutex myRemovalMutex;
335 };
336 
UUID is a unique ID wrapper class.
Definition: uuid.h:59
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
const DtSpotReportGeneratorControllerDescriptor * myDescriptor
Pointer to this components descriptor.
Definition: spotReportGeneratorController.h:306
bool myGlobalEnabled
Holds a copy of the global spot reports enabled setting. When the global value changes, this value will be updated by.
Definition: spotReportGeneratorController.h:321
const DtControllerComponent & operator=(const DtControllerComponent &orig)
assignment operator
std::map< DtUUID, std::vector< unsigned long > > MissingDestroyedObjectsMap
Definition: spotReportGeneratorController.h:327
Definition: boolSetting.h:30
DtSpotReportGeneratorControllerDescriptor; descriptor for the DtSpotReportGeneratorController compone...
Definition: spotReportGeneratorControllerDescriptor.h:23
virtual void timedTick()
This version of tick checks to see if the time to tick has arrived. It checks to see if myNextTickTim...
Reason
Definition: spotReport.h:38
Definition: vrfObjectMessageTypeTemplate.h:24
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
virtual const char * type() const override=0
This returns a string from compTypes.h, and identifies the type of component.
Definition: readerWriterRegistry.h:39
This class represents the data gathered by a sensor about a particular single sensor contact...
Definition: rwSensorContactInfo.h:68
RemovalSignalsMap myRemovalSignalsMap
Definition: spotReportGeneratorController.h:331
Definition: settingsObject.h:27
File: sensorContactListIOPort.h.
Definition: sensorContactListIOPort.h:31
Process State Repository for DtSpotReportGeneratorController.
Definition: spotReportGeneratorControllerPSR.h:20
virtual bool init() override
Calls setRadio()
std::map< DtUUID, boost::signals2::connection > RemovalSignalsMap
Definition: spotReportGeneratorController.h:330
File: simMsg.h.
Definition: simMessage.h:35
double myLastHeartbeatTime
Definition: spotReportGeneratorController.h:323
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
MissingDestroyedObjectsMap myMissingDestroyedObjectsMap
Definition: spotReportGeneratorController.h:328
Define constants for types of tasks, sets, admin messages, reports, and sim commands (all sent via ra...
The base class for all messages to/from a specific DtVrfObject. Various subclasses of this class will...
Definition: vrfObjectMessage.h:30
This class is for monitoring a DtSensorContactInfoList for changes. When instantiated, this class registers a callback with the list, and maintains internal state as to whether the callback has been invoked since the last time listChanged() was called.
Definition: sensorContactInfoList.h:161
virtual bool createPorts()
Called by init. Derived classes should override this method to create all their input/output ports an...
int myCurrentForceType
Definition: spotReportGeneratorController.h:312
bool myHostilitiesChangeFlag
Flag which gets set to true when hostilities changed, and cleared the following tick.
Definition: spotReportGeneratorController.h:317
End User Description: DtControllerComponent is the base class for all controllers components...
Definition: controllerComponent.h:31
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:96
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:80
DtSensorContactInfoListChangeMonitor myContactListMonitor
Definition: spotReportGeneratorController.h:313
tbb::spin_mutex myRemovalMutex
Definition: spotReportGeneratorController.h:334
bool myNeedsSpotReportFlush
Definition: spotReportGeneratorController.h:325
DtSpotReportGeneratorControllerPSR * myProcessState
Container for state data associated with this component. This state is saved and restored as part of ...
Definition: spotReportGeneratorController.h:310
DtSpotReportGeneratorController is a controller that sends spot reports based on the contact list in ...
Definition: spotReportGeneratorController.h:50
boost::signals2::scoped_connection mySimObjectAddedConnection
Definition: spotReportGeneratorController.h:333
Instances of DtEntityTypesListOutputPort are output ports through which data producers can send a lis...
Definition: objectTypesListIOPort.h:46
DtSpotReport; subclass of DtSimReport.
Definition: spotReport.h:35
A locally simulated VRF object.
Definition: localObject.h:98
DtSimReport is an abstract base class from which real reports can derive. It manages the read/write c...
Definition: simReport.h:25

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)