VR-Forces 4.10 Class Documentation
 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"
17 #include <map>
18 #include <list>
20 #include "targetRankOperator.h"
21 
30 class DtSimMessage;
31 class DtVrfObjectMessage;
35 //enum DtWeaponStatus;
36 
37 typedef std::map<DtArtPartType, std::list<const DtWeaponComponentInterface*> > artPartWeaponMap;
38 
52 
80 {
81 private:
88  const DtTargetSelectionController& orig);
89 public:
90 
91  typedef std::list<DtWeaponComponentInterface*> DtWeaponInterfaceList;
92 
96  DtSimManager* simManager, DtComponentDescriptor* desc=0,
97  DtReaderWriterRegistry *parentRegistry=0);
98 
100  virtual ~DtTargetSelectionController();
101 
103  virtual bool init();
104 
107  virtual const char* type() const;
108 
110  virtual void registerTaskMsgCallbacks();
111 
114  virtual void updateWeaponInterfaceTaskState(DtWeaponComponentInterface* weapIf);
115 
116 
119  virtual void updateTargetPriorityListState();
120 
124 
125  static void fireAtTargetTaskCallback(DtSimMessage* msg, void* usr);
126  virtual void processFireAtTargetTask(DtSimMessage* msg);
127 
130  virtual bool processFireAtTargetTask(DtFireAtTargetTask*, bool& foundValidWeapon);
132 
135 
136  static void weaponListRequestCallback(const DtVrfObjectMessage* msg, void* usr);
137  virtual void processWeaponListRequest(const DtVrfObjectMessage* msg);
139 
141 
142  static void fireNowCallback(DtSimMessage* msg, void* usr);
143  virtual void processFireNow(DtSimMessage* msg);
145 
147  virtual void taskComplete(bool success = true);
148 
150  virtual bool postAddComponentsInit();
151 
154  virtual void preFirstTickInit();
155 
161  virtual void tick();
162 
166  static DtSimComponent* creator(const DtString& name,
167  DtVrfObject* owner,
168  DtSimManager* simManager,
169  DtComponentDescriptor* desc = 0,
170  DtReaderWriterRegistry* parentRegistry = 0);
171 
172 protected:
173  typedef std::set<DtRwSensorContactInfo*, DtTargetRankOperatorWrapper> DtOrderedTargetSet;
174 
176  static void objectAddedCb(const DtVrfObject*, void*);
177  virtual void processObjectAdded(const DtVrfObject*);
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 DtVrfObject* 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 DtVrfObject* 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 
457 };
std::map< DtWeaponComponentInterface *, int > myOldInterfaceStatus
A record of the status of each weapon interface (last tick).
Definition: targetSelectionController.h:449
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
virtual bool postAddComponentsInit()
Called after all components have been created, initialized and added to the component manager...
Definition: simComponent.h:146
DtVrfObject is used to represent any type of simulated object (entities, aggregate, control objects) in a VR-Forces application.
Definition: vrfObject.h:215
DtTargetSelectionControllerPSR * myProcessState
Container for state data associated with this component.
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
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:42
Definition: readerWriterRegistry.h:39
Definition: entityTargetInformation.h:28
virtual const char * type() const =0
Returns a string identifies the class type of component.
This class represents the data gathered by a sensor about a particular single sensor contact...
Definition: rwSensorContactInfo.h:67
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.
Definition: targetSelectionCriteria.h:27
Functor class which is used in a std::set to rank targets against each other.
Definition: targetRankOperator.h:25
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:43
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.
An abstract base class for all evaluators of spatial filters.
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.
Definition: vrfObjectMessage.h:30
This class is for monitoring a DtSensorContactInfoList for changes.
Definition: sensorContactInfoList.h:143
virtual bool createPorts()
Called by init.
DtSensorContactInfoListChangeMonitor myContactListChangeMonitor
Definition: targetSelectionController.h:416
bool myHavePrintedNoNewContacts
Definition: targetSelectionController.h:454
std::map< DtArtPartType, std::list< const DtWeaponComponentInterface * > > artPartWeaponMap
Definition: targetSelectionController.h:34
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:67
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
DtRwInt myNextPriorityValue
The next default priority level to use for a weapon.
Definition: targetSelectionController.h:434
DtObjectTypesListOutputPort * myTypesToDetectOutputPort
Port I/O Interface:
Definition: targetSelectionController.h:410
std::set< DtRwSensorContactInfo *, DtTargetRankOperatorWrapper > DtOrderedTargetSet
Definition: targetSelectionController.h:173
Task for firing at a target.
Definition: fireAtTargetTask.h:25
std::list< DtWeaponComponentInterface * > DtWeaponInterfaceList
Definition: targetSelectionController.h:91
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:103
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
bool myRegisteredAddCallback
Definition: targetSelectionController.h:456
DtTargetSelectionController is a controller that takes the list know object contacts from the entity&#39;...
Definition: targetSelectionController.h:79
Represents the interface between the DtTargetSelectionController and a weapon system.
Definition: weaponComponentInterface.h:21
DtForceType myForce
Force used to put information onto port for hostility matrix.
Definition: targetSelectionController.h:419

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)