VR-Forces 4.8 Class Documentation
 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 <vl/hostStructs.h>
17 #include "vrfutil/simMunition.h"
18 #include <vlpi/disEnums.h>
20 
23 class DtIntegerInputPort;
25 class DtVrfBalGunPSR;
26 class DtOutputPortGroup;
27 class DtBooleanInputPort;
30 
46 {
47 
48 public:
49 
53  DtVrfObject* owner,
54  DtSimManager* simManager,
55  DtComponentDescriptor* desc = 0,
56  DtReaderWriterRegistry* parentRegistry = 0);
57 
59  virtual ~DtBallisticGunController();
60 
64  virtual bool postAddComponentsInit();
65 
68  virtual const char* type() const;
69 
71  virtual bool init();
72 
76  virtual void preFirstTickInit();
77 
79  virtual void tick();
80 
83  virtual bool createTriggerPort();
84  virtual DtBooleanOutputPort * triggerPort() const;
85 
86  virtual bool createQuantityOutputPort();
87  virtual DtIntegerOutputPort* quantityOutputPort() const;
88 
89  virtual bool createLoadedPort();
90  virtual DtBooleanOutputPort * loadedPort() const;
91 
92  virtual bool createLosOutputPort();
93  virtual DtIntegerOutputPort * losOutputPort() const;
94 
95  virtual bool createLosInputPort();
96  virtual DtIntegerInputPort * losInputPort() const;
97 
98  virtual bool createWeaponsHoldInputPort();
99 
100  virtual bool createTargetToAcquireOutputPort();
101 
102  virtual void setLoadAmmoTime(DtTime loadAmmoTime);
103  virtual DtTime loadAmmoTime() const;
104 
105  virtual void setUnloadAmmoTime(DtTime unloadAmmoTime);
106  virtual DtTime unloadAmmoTime() const;
107 
111  virtual void fire();
112 
122  virtual bool chooseAmmo(const DtEntityType& targetType,
123  const DtUUID& target, DtSimMunition&
124  munition, DtDetonatorFuze& fuze, int& ammoAvailable);
125 
128  virtual bool ammoOKToUse(const DtEntityType& targetType);
129 
131  virtual void initProcessSR();
132 
136  static DtSimComponent * creator(const DtString& name,
137  DtVrfObject* owner,
138  DtSimManager* simManager,
139  DtComponentDescriptor* desc = 0,
140  DtReaderWriterRegistry* parentRegistry = 0);
141 
142 
143  virtual void enable();
144 
145 
146  virtual void disable();
147 
148 protected:
149 
151  virtual bool createPorts();
152 
154  virtual bool createPortGroups();
155 
163  virtual void lookupAndCacheProcessSR();
164 
168  static DtReaderWriter* roundsPerTriggerPullCallback(void* ctrlr);
169  virtual DtReaderWriter* provideRoundsPerTriggerPull();
171 
174  virtual DtIntegerResource * lookupMunitionResource(const DtString &
175  resource) const;
176 
178  void getMunitionResources(std::list<DtString>& resourceList);
179 
181  virtual void updateResourceList();
182 
185  virtual bool weaponsHoldState();
186 
190  static void setResourceCallback(DtSimMessage * msg, void * usrData);
191  virtual void processSetResource(DtSimMessage * msg);
193 
197  static void setRestoreCallback(DtSimMessage * msg, void * usrData);
198  virtual void processSetRestore(DtSimMessage * msg);
200 
202  bool outOfAmmo() const;
203 
204 protected:
207 
210 
213  orig);
214 
215 protected:
216 
219 
227 
234 
242 
249 
257 
261 
269 
270 
276 
280 
283  DtDetonatorFuze myCurrentFuze;
284 
287 
294 
297 
304 
307 
311 };
DtWeaponComponentInterface * myWeaponComponentInterface
Interface between this weapon controller and the entity&#39;s DtTargetSelectionController.
Definition: ballisticGunController.h:310
UUID is a unique ID wrapper class.
Definition: rwUUID.h:222
#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:144
DtBooleanOutputPort * myTriggerPort
Output Port Name: trigger Output Port Description: Sends a new True value when trigger is pulled...
Definition: ballisticGunController.h:233
DtVrfObject is used to represent any type of simulated object (entities, aggregate, control objects) in a VR-Forces application.
Definition: vrfObject.h:215
const DtControllerComponent & operator=(const DtControllerComponent &orig)
assignment operator
DtOutputPortGroup * myGunControlPortGroup
Output Port Group Name: gun-control Output Port Group Description:
Definition: ballisticGunController.h:260
DtEntityListOutputPort * myTargetToAcquireOutputPort
Output Port Name: target-to-acquire Output Port Description: When there is a target in the weapon int...
Definition: ballisticGunController.h:274
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:256
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:303
bool myOutOfAmmoWarn
Flag so an out-of-ammo warning is only sent once per target.
Definition: ballisticGunController.h:306
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:42
Definition: readerWriterRegistry.h:39
DtOutputPortGroup is a data port group of a data provider.
Definition: outputPortGroup.h:30
DtBooleanInputPort * myWeaponsHoldInputPort
Input Port Name: weapons-hold Input Port Description: When true, all firing is disabled.
Definition: ballisticGunController.h:268
virtual bool init()
Calls setRadio()
This file contains the class declaration for the.
virtual void disable()
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:286
virtual void enable()
Is this component enabled or not.
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
File: vlClock.h.
virtual void tick()
This gives the thread of control to the component.
DtBallisticGunController provides ammunition loading, unloading, and trigger inputs for use by a ball...
Definition: ballisticGunController.h:45
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:293
virtual bool createPorts()
Called by init.
End User Description: DtControllerComponent is the base class for all controllers components...
Definition: controllerComponent.h:29
virtual bool createPortGroups()
Called by init.
DtSimMunition myCurrentMunition
The correct munition and fuze for our current target.
Definition: ballisticGunController.h:282
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:67
DtIntegerOutputPort * myQuantityOutputPort
Output Port Name: quantity Output Port Description: Sends the number of rounds to be fired with a sin...
Definition: ballisticGunController.h:241
DtDetonatorFuze myCurrentFuze
Definition: ballisticGunController.h:283
DtIntegerInputPort * myLosInputPort
Input Port Name: line-of-sight Input Port Description: Indicates the result of a line of sight calcul...
Definition: ballisticGunController.h:226
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:102
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:296
DtSimMunition class.
Definition: simMunition.h:34
DtUUID myPreviousTarget
Maintain the target we had last tick (if any) to detect changes in target (which will kick off possib...
Definition: ballisticGunController.h:279
DtBallisticGunControllerDescriptor, descriptor for the DtBallisticGunController component.
Definition: ballisticGunControllerDescriptor.h:24
DtBooleanOutputPort * myLoadedPort
Output Port Name: loaded Output Port Description: True when the gun is loaded.
Definition: ballisticGunController.h:248
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:21

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)