VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ballisticGunController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 
12 #pragma once
13 
15 #include "vrfutil/simClock.h"
16 #include "vrfutil/simMunition.h"
17 #include <vlpi/disEnums.h>
19 
22 class DtIntegerInputPort;
24 class DtVrfBalGunPSR;
25 class DtOutputPortGroup;
26 class DtBooleanInputPort;
29 
45 {
46 
47 public:
48 
52  DtLocalObject* owner,
53  DtSimulationServices* simManager,
54  DtComponentDescriptor* desc = 0,
55  DtReaderWriterRegistry* parentRegistry = 0);
56 
58  virtual ~DtBallisticGunController();
59 
63  virtual bool postAddComponentsInit();
64 
67  virtual const char* type() const;
68 
70  virtual bool init();
71 
75  virtual void preFirstTickInit();
76 
78  virtual void tick();
79 
82  virtual bool createTriggerPort();
83  virtual DtBooleanOutputPort * triggerPort() const;
84 
85  virtual bool createQuantityOutputPort();
86  virtual DtIntegerOutputPort* quantityOutputPort() const;
87 
88  virtual bool createLoadedPort();
89  virtual DtBooleanOutputPort * loadedPort() const;
90 
91  virtual bool createLosOutputPort();
92  virtual DtIntegerOutputPort * losOutputPort() const;
93 
94  virtual bool createLosInputPort();
95  virtual DtIntegerInputPort * losInputPort() const;
96 
97  virtual bool createWeaponsHoldInputPort();
98 
99  virtual bool createTargetToAcquireOutputPort();
100 
101  virtual void setLoadAmmoTime(DtTime loadAmmoTime);
102  virtual DtTime loadAmmoTime() const;
103 
104  virtual void setUnloadAmmoTime(DtTime unloadAmmoTime);
105  virtual DtTime unloadAmmoTime() const;
106 
110  virtual void fire();
111 
121  virtual bool chooseAmmo(const DtEntityType& targetType,
122  const DtUUID& target, DtSimMunition&
123  munition, DtDetonatorFuze& fuze, int& ammoAvailable);
124 
126  virtual bool checkCurrentAmmo(int& ammoAvailable);
127 
130  virtual bool ammoOKToUse(const DtEntityType& targetType);
131 
133  virtual void initProcessSR();
134 
138  static DtSimComponent * creator(const DtString& name,
139  DtLocalObject* owner,
140  DtSimulationServices* simManager,
141  DtComponentDescriptor* desc = 0,
142  DtReaderWriterRegistry* parentRegistry = 0);
143 
144 
145  virtual void enable();
146 
147 
148  virtual void disable();
149 
150 protected:
151 
153  virtual bool createPorts();
154 
156  virtual bool createPortGroups();
157 
165  virtual void lookupAndCacheProcessSR();
166 
170  static DtReaderWriter* roundsPerTriggerPullCallback(void* ctrlr);
171  virtual DtReaderWriter* provideRoundsPerTriggerPull();
173 
176  virtual DtIntegerResource * lookupMunitionResource(const DtString &
177  resource) const;
178 
180  void getMunitionResources(std::list<DtString>& resourceList);
181 
183  virtual void updateResourceList();
184 
187  virtual bool weaponsHoldState();
188 
192  static void setResourceCallback(DtSimMessage * msg, void * usrData);
193  virtual void processSetResource(DtSimMessage * msg);
195 
199  static void setRestoreCallback(DtSimMessage * msg, void * usrData);
200  virtual void processSetRestore(DtSimMessage * msg);
202 
204  bool outOfAmmo() const;
205 
206 protected:
209 
212 
215  orig);
216 
217 protected:
218 
221 
229 
236 
244 
251 
259 
263 
271 
272 
278 
282 
285  DtDetonatorFuze myCurrentFuze;
286 
289 
296 
299 
306 
309 
313 };
DtWeaponComponentInterface * myWeaponComponentInterface
Interface between this weapon controller and the entity&#39;s DtTargetSelectionController.
Definition: ballisticGunController.h:312
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
DtBooleanOutputPort * myTriggerPort
Output Port Name: trigger Output Port Description: Sends a new True value when trigger is pulled...
Definition: ballisticGunController.h:235
const DtControllerComponent & operator=(const DtControllerComponent &orig)
assignment operator
DtOutputPortGroup * myGunControlPortGroup
Output Port Group Name: gun-control Output Port Group Description:
Definition: ballisticGunController.h:262
DtEntityListOutputPort * myTargetToAcquireOutputPort
Output Port Name: target-to-acquire Output Port Description: When there is a target in the weapon int...
Definition: ballisticGunController.h:276
Instances of DtBooleanOutputPort are output ports through which data producers can send boolean data...
Definition: boolIOPort.h:45
DtIntegerOutputPort * myLosOutputPort
Output Port Name: line-of-sight Output Port Description: Indicates the result of a line of sight calc...
Definition: ballisticGunController.h:258
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
virtual const char * type() const =0
This returns a string from compTypes.h, and identifies the type of component.
bool myWaitingForFire
This flag is set to true when the controller pulls the trigger; it won&#39;t do anything in the tick func...
Definition: ballisticGunController.h:305
bool myOutOfAmmoWarn
Flag so an out-of-ammo warning is only sent once per target.
Definition: ballisticGunController.h:308
Definition: readerWriter.h:85
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
DtOutputPortGroup is a data port group of a data provider. It may contain any number of DtOutputPorts...
Definition: outputPortGroup.h:34
DtBooleanInputPort * myWeaponsHoldInputPort
Input Port Name: weapons-hold Input Port Description: When true, all firing is disabled. Connecting to this port is optional. If no connection is made, it will default to false. Input Port Range: True/False Input Port Default Value: False .
Definition: ballisticGunController.h:270
virtual bool init()
Calls setRadio()
This file contains the class declaration for the.
virtual void disable()
Is this component enabled or not. If enabled, component&#39;s tick function will be called, otherwise it will not. Default is true (enabled).
Contains class declarations for DtIntegerInputPort, DtIntegerOutputPort, and DtIntegerPortData.
Definition: integerIOPort.h:25
int myRoundsAvailable
The quantity of the current munition in the resources store.
Definition: ballisticGunController.h:288
virtual void enable()
Is this component enabled or not. If enabled, component&#39;s tick function will be called, otherwise it will not. Default is true (enabled).
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
File: vlClock.h.
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
DtBallisticGunController provides ammunition loading, unloading, and trigger inputs for use by a ball...
Definition: ballisticGunController.h:44
Contains class declarations for DtBooleanInputPort, DtBooleanOutputPort, and DtBooleanPortData.
Definition: boolIOPort.h:25
DtIntegerResource implements the required functions for a resource that can be measured by an integer...
Definition: integerResource.h:17
DtVrfBalGunPSR * myProcessState
Pointer to a process state repository used to store state data associated with this component...
Definition: ballisticGunController.h:295
virtual bool createPorts()
Called by init. Derived classes should override this method to create all their input/output ports an...
End User Description: DtControllerComponent is the base class for all controllers components...
Definition: controllerComponent.h:31
virtual bool createPortGroups()
Called by init. Derived classes should override this method to create all their input/output port gro...
DtSimMunition myCurrentMunition
The correct munition and fuze for our current target.
Definition: ballisticGunController.h:284
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:90
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:70
DtIntegerOutputPort * myQuantityOutputPort
Output Port Name: quantity Output Port Description: Sends the number of rounds to be fired with a sin...
Definition: ballisticGunController.h:243
DtDetonatorFuze myCurrentFuze
Definition: ballisticGunController.h:285
DtIntegerInputPort * myLosInputPort
Input Port Name: line-of-sight Input Port Description: Indicates the result of a line of sight calcul...
Definition: ballisticGunController.h:228
Instances of DtIntegerOutputPort are output ports through which data producers can send integer value...
Definition: integerIOPort.h:45
const DtBallisticGunControllerDescriptor * myGunDescriptor
Get ammo select tables from here.
Definition: ballisticGunController.h:298
DtSimMunition class.
Definition: simMunition.h:31
DtUUID myPreviousTarget
Maintain the target we had last tick (if any) to detect changes in target (which will kick off possib...
Definition: ballisticGunController.h:281
DtBallisticGunControllerDescriptor, descriptor for the DtBallisticGunController component.
Definition: ballisticGunControllerDescriptor.h:26
virtual bool postAddComponentsInit()
Calls enableTaskTypes()
DtBooleanOutputPort * myLoadedPort
Output Port Name: loaded Output Port Description: True when the gun is loaded. Output Port Range: Ou...
Definition: ballisticGunController.h:250
Class DtVrfBalGunPSR: Used to hold checkpointable state for the processes associated with ballistic g...
Definition: vrfBalGunPSR.h:38
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

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)