VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
targetSelectionController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 
12 #pragma once
13 
16 #include "vlpi/disEnums.h"
18 #include <map>
19 #include <list>
21 #include "targetRankOperator.h"
22 
31 class DtSimMessage;
32 class DtVrfObjectMessage;
36 //enum DtWeaponStatus;
37 
38 typedef std::map<DtArtPartType, std::list<const DtWeaponComponentInterface*> > artPartWeaponMap;
39 
53 
81 {
82 private:
89  const DtTargetSelectionController& orig);
90 public:
91 
92  typedef std::list<DtWeaponComponentInterface*> DtWeaponInterfaceList;
93 
97  DtSimulationServices* simManager, DtComponentDescriptor* desc=0,
98  DtReaderWriterRegistry *parentRegistry=0);
99 
101  virtual ~DtTargetSelectionController();
102 
104  virtual bool init();
105 
108  virtual const char* type() const;
109 
111  virtual void registerTaskMsgCallbacks();
112 
115  virtual void updateWeaponInterfaceTaskState(DtWeaponComponentInterface* weapIf);
116 
117 
120  virtual void updateTargetPriorityListState();
121 
125 
126  static void fireAtTargetTaskCallback(DtSimMessage* msg, void* usr);
127  virtual void processFireAtTargetTask(DtSimMessage* msg);
128 
131  virtual bool processFireAtTargetTask(DtFireAtTargetTask*, bool& foundValidWeapon);
133 
136 
137  static void weaponListRequestCallback(const DtVrfObjectMessage* msg, void* usr);
138  virtual void processWeaponListRequest(const DtVrfObjectMessage* msg);
140 
142 
143  static void fireNowCallback(DtSimMessage* msg, void* usr);
144  virtual void processFireNow(DtSimMessage* msg);
146 
148  virtual void taskComplete(bool success = true);
149 
151  virtual bool postAddComponentsInit();
152 
155  virtual void preFirstTickInit();
156 
162  virtual void tick();
163 
167  static DtSimComponent* creator(const DtString& name,
168  DtLocalObject* owner,
169  DtSimulationServices* simManager,
170  DtComponentDescriptor* desc = 0,
171  DtReaderWriterRegistry* parentRegistry = 0);
172 
173 protected:
174  typedef std::set<DtRwSensorContactInfo*, DtTargetRankOperatorWrapper> DtOrderedTargetSet;
175 
177  virtual void processSimObjectAdded(DtSimObjectReference);
178 
180  virtual bool createPorts();
181 
185  virtual bool createOutputPorts();
186 
192  virtual bool createPSR();
193 
195  virtual void registerRadioMessageCallbacks();
196 
198  static void setTargetCallback(DtSimMessage* msg, void* usr);
199 
202  virtual void processSetTarget(DtSimMessage* msg);
203 
212  virtual void selectTargets();
213 
216  virtual bool targetForce(DtForceType force) const;
217 
221  virtual bool validTarget(const DtRwSensorContactInfo& contactInfo,
222  const DtWeaponComponentInterface& weapIf) const;
223 
226  virtual DtEntityTargetInformation targetInfoFromContactInfo(
227  const DtRwSensorContactInfo& contactInfo) const;
228 
231  virtual void updateRegionEvaluators();
232 
236  virtual DtTargetRankOperator* createTargetRankOperator(
237  const DtTargetSelectionCriteria& criteria) const;
238 
241  virtual void setupDetectableForces(DtForceType);
242 
245 
246  static void hostilitiesChangedCallback(DtU8 force, void* usr);
247  virtual void processHostilitiesChanged(DtU8 force);
249 
251  virtual void clearTargets();
252 
254  virtual bool isSurrenderedLifeform(const DtSimObject* entity) const;
255 
256  virtual bool findFusedTargets(const std::map<DtUUID, DtRwSensorContactInfo*>& contactList,
257  const DtWeaponComponentInterface& weapIf, DtRwSensorContactInfo& userTargetInfo,
258  DtOrderedTargetSet & orderedTargets);
259 
262  virtual const DtRwSensorContactInfo* setTargetsToWeaponInterface(DtWeaponComponentInterface& weapIf, DtRwSensorContactInfo& userTargetInfo, DtOrderedTargetSet& orderedTargets);
263 
269  virtual void findWeaponControlInterfaces();
270 
275  virtual bool permissionToFire() const;
276 
277 
280  virtual bool canFireAtBasedOnTargetPriorityListRoe(const DtSimObject* entity) const;
281 
283  virtual bool suppressed() const;
284 
291  virtual bool allowedToFire() const;
292 
296  virtual bool haveCommonMount(DtWeaponComponentInterface *weapon1,
297  DtWeaponComponentInterface *weapon2) const;
298 
302  virtual int nextPriorityValue();
304  virtual void setNextPriorityValue(const int val);
306 
310  virtual const artPartWeaponMap & articulatedPartWeapons() const;
311  virtual void addArtPartWeaponToMap(const DtArtPartType part,
312  const DtWeaponComponentInterface* weaponInterface);
313  virtual void setArticulatedPartWeapons(
314  const artPartWeaponMap &artPartMap);
316 
334  virtual bool yieldsFiringPrecedenceTo(
336  bool weapon1IsBeingTasked,
337  DtWeaponComponentInterface* weapon2);
338 
344  virtual bool tokenConflict(
346  DtWeaponComponentInterface* weapon2);
347 
352  virtual bool artPartConflict(
355  DtArtPartType* conflictingPart);
356 
375  virtual bool otherWeaponBlocksWeapon(
376  DtWeaponComponentInterface* weapon, bool weaponIsBeingTasked,
377  DtWeaponComponentInterface** conflictingWeapon,
378  bool* controlExternalTurret);
379 
387  virtual void clearLowerPriorityWeaponTargets(
389 
392  virtual void assembleListOfFiredUponTargets(std::set<DtUUID>& targets);
393 
394 protected:
395 
403 
411 
415 
417 
419  DtForceType myForce;
420 
425 
431 
435 
444 
448  std::map<DtWeaponComponentInterface*, int>
450 
451  //---------------------------------
455 
456  boost::signals2::scoped_connection mySimObjectAddedConnection;
457 };
std::map< DtWeaponComponentInterface *, int > myOldInterfaceStatus
A record of the status of each weapon interface (last tick). If the status changes, it will make the controller re-select targets for the weapon interfaces.
Definition: targetSelectionController.h:449
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
DtTargetSelectionControllerPSR * myProcessState
Container for state data associated with this component. This state is saved and restored as part of ...
Definition: targetSelectionController.h:414
DtTargetSelectionControllerPSR is a process state repository which holds state variables for the DtTa...
Definition: targetSelectionControllerPSR.h:19
virtual void registerTaskMsgCallbacks()
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:20
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
Definition: readerWriterRegistry.h:39
Definition: entityTargetInformation.h:27
virtual const char * type() const =0
Returns a string identifies the class type of component. Type values are defined in compTypes...
This class represents the data gathered by a sensor about a particular single sensor contact...
Definition: rwSensorContactInfo.h:68
virtual bool init()
Calls setRadio()
virtual void taskComplete(bool success=true)
If we are currently tasked, this will cause us to notify the entity that we&#39;re done and delete the ta...
Defines a criteria for choosing targets for a single weapon system. This class stores all the informa...
Definition: targetSelectionCriteria.h:27
Functor class which is used in a std::set to rank targets against each other. This abstract base clas...
Definition: targetRankOperator.h:28
File: sensorContactListIOPort.h.
Definition: sensorContactListIOPort.h:31
artPartWeaponMap myArticulatedPartWeapons
A map of articulated part numbers to lists of weapons that are attached to the part directly or indir...
Definition: targetSelectionController.h:443
Instances of DtEntityListOutputPort are output ports through which data producers can send a list of ...
Definition: entListIOPort.h:45
File: simMsg.h.
Definition: simMessage.h:35
Description: Readable, Writable int.
Definition: rwInt.h:25
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
An abstract base class for all evaluators of spatial filters. The evaluation of spatial filters is sp...
Definition: spatialFilterEvaluator.h:30
Instances of DtObjectTypesListOutputPort are output ports through which data producers can send a lis...
Definition: objectTypesListIOPort.h:46
bool myHavePrintedSurrender
For debugging print statements.
Definition: targetSelectionController.h:453
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:145
virtual bool createPorts()
Called by init. Derived classes should override this method to create all their input/output ports an...
DtSensorContactInfoListChangeMonitor myContactListChangeMonitor
Definition: targetSelectionController.h:416
bool myHavePrintedNoNewContacts
Definition: targetSelectionController.h:454
std::map< DtArtPartType, std::list< const DtWeaponComponentInterface * > > artPartWeaponMap
Definition: targetSelectionController.h:35
boost::signals2::scoped_connection mySimObjectAddedConnection
Definition: targetSelectionController.h:456
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:89
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:70
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:79
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
DtRwInt myNextPriorityValue
The next default priority level to use for a weapon. Starts at 1 and increments each time it is used...
Definition: targetSelectionController.h:434
DtObjectTypesListOutputPort * myTypesToDetectOutputPort
Port I/O Interface:
Definition: targetSelectionController.h:410
std::set< DtRwSensorContactInfo *, DtTargetRankOperatorWrapper > DtOrderedTargetSet
Definition: targetSelectionController.h:174
Task for firing at a target.
Definition: fireAtTargetTask.h:25
std::list< DtWeaponComponentInterface * > DtWeaponInterfaceList
Definition: targetSelectionController.h:92
DtWeaponInterfaceList myWeaponInterfaceList
List of weapon interfaces through which the target selection controller communicates with weapon syst...
Definition: targetSelectionController.h:430
Abstract base class for all psrs that will serve as an interface between a controlling component on t...
Definition: baseWeaponComponentInterface.h:28
bool mySetupDetectableForcesRequired
Flag set to true if a re-run of the setupDetectableForces() is required on the next tick...
Definition: targetSelectionController.h:424
DtTargetSelectionController is a controller that takes the list know object contacts from the entity&#39;...
Definition: targetSelectionController.h:80
virtual bool postAddComponentsInit()
Calls enableTaskTypes()
Represents the interface between the DtTargetSelectionController and a weapon system.
Definition: weaponComponentInterface.h:20
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86
DtForceType myForce
Force used to put information onto port for hostility matrix.
Definition: targetSelectionController.h:419

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)