VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtBallisticGunController Class Reference

DtBallisticGunController provides ammunition loading, unloading, and trigger inputs for use by a ballistic gun actuator. More...

Inheritance diagram for DtBallisticGunController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtBallisticGunController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtBallisticGunController ()
 destructor
virtual bool postAddComponentsInit ()
 Override to call lookupAndCacheProcessSR() (another component creates it - we just look it up and keep a pointer to it).
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual bool init ()
 Sets up weapon component interface.
virtual void tick ()
 Calculate new control values.
virtual bool createTriggerPort ()
 These are called in init to create the ports used to communicate with the actuator.
virtual DtBooleanOutputPorttriggerPort () const
virtual bool createQuantityOutputPort ()
virtual DtIntegerOutputPortquantityOutputPort () const
virtual bool createLoadedPort ()
virtual DtBooleanOutputPortloadedPort () const
virtual bool createLosOutputPort ()
virtual DtIntegerOutputPortlosOutputPort () const
virtual bool createLosInputPort ()
virtual DtIntegerInputPortlosInputPort () const
virtual bool createWeaponsHoldInputPort ()
virtual bool createTargetToAcquireOutputPort ()
virtual void setLoadAmmoTime (DtTime loadAmmoTime)
virtual DtTime loadAmmoTime () const
virtual void setUnloadAmmoTime (DtTime unloadAmmoTime)
virtual DtTime unloadAmmoTime () const
virtual void fire ()
 Sets myTriggerPort to true and myLoaded to false.
virtual bool chooseAmmo (DtVrfObject *entity, DtSimMunition &munition, DtDetonatorFuze &fuze, int &ammoAvailable)
 The chooseAmmo() function is passed a pointer to a target entity and returns the best ammunition to use for the target’s entity type.
virtual void initProcessSR ()
 Sets the load & unload ammo time from the component descriptor.

Static Public Member Functions

static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,

Protected Member Functions

virtual bool createPorts ()
 Called by init to create the output ports.
virtual bool createPortGroups ()
 Called by init to create myGunControlPortGroup.
virtual void lookupAndCacheProcessSR ()
 This function looks up a process state repository in the process state repository manager by name, and caches a pointer to it in

myProcessState.


virtual bool weaponsHoldState ()
 DtBallisticGunController ()
 Not implemented.
 DtBallisticGunController (const DtBallisticGunController &orig)
 Not implemented.
const DtBallisticGunControlleroperator= (const DtBallisticGunController &orig)
 Not implemented.

Protected Attributes

DtEntityIdentifier myPreviousTarget
 Maintain the target we had last tick (if any) to detect changes in target (which will kick off possible ammo reload.
DtSimMunition myCurrentMunition
 The correct munition and fuze for our current target.
DtDetonatorFuze myCurrentFuze
int myRoundsAvailable
 The quantity of the current munition in the resources store.
DtVrfBalGunPSRmyProcessState
 Pointer to a process state repository used to store state data associated with this component.
const
DtBallisticGunControllerDescriptor
myGunDescriptor
 Get ammo select tables from here.
bool myWaitingForFire
 This flag is set to true when the controller pulls the trigger, and set back to false when the controllers sees that the loaded munition has been unloaded (by the gun).
bool myFirstTick
bool myOutOfAmmoWarn
 Flag so an out-of-ammo warning is only sent once per target.
DtWeaponComponentInterfacemyWeaponComponentInterface
 Interface between this weapon controller and the entity's DtTargetSelectionController.
Ports and Port Groups
DtIntegerInputPortmyLosInputPort
 Input Port Name: line-of-sight
Input Port Description: Indicates the result of a line of sight calculation to the current target.
DtBooleanOutputPortmyTriggerPort
 Output Port Name: trigger
Output Port Description: Sends a new True value when trigger is pulled.
DtIntegerOutputPortmyQuantityOutputPort
 Output Port Name: quantity
Output Port Description: Sends the number of rounds to be fired with a single trigger pull.
DtBooleanOutputPortmyLoadedPort
 Output Port Name: loaded
Output Port Description: True when the gun is loaded.
DtIntegerOutputPortmyLosOutputPort
 Output Port Name: line-of-sight
Output Port Description: Indicates the result of a line of sight calculation to the current target.
DtOutputPortGroupmyGunControlPortGroup
 Output Port Group Name: gun-control
Output Port Group Description:
DtBooleanInputPortmyWeaponsHoldInputPort
 Input Port Name: weapons-hold
Input Port Description: When true, all firing is disabled.
DtEntityListOutputPortmyTargetToAcquireOutputPort
 Output Port Name: target-to-acquire
Output Port Description: When there is a target in the weapon interface, it is put onto this output port.

Detailed Description

DtBallisticGunController provides ammunition loading, unloading, and trigger inputs for use by a ballistic gun actuator.

End User Description: It chooses ammunition to load based on entity type according to criteria specified in the DtBallisticGunControllerDescriptor used to specify the component. Load and unload times are also provided in this manner. If the entity has permission to fire, has acquired a target, and has the appropriate ammunition loaded, the DtBallisticGunController sets the trigger port to true, firing the ballistic gun.

Uses Descriptor Type: DtBallisticGunControllerDescriptor

Examples

Constructor & Destructor Documentation

DtBallisticGunController::DtBallisticGunController ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

destructor

Not implemented.

Not implemented.


Member Function Documentation

Override to call lookupAndCacheProcessSR() (another component creates it - we just look it up and keep a pointer to it).

Also calls initProcessSR().

Reimplemented from DtSimComponent.

virtual DtString DtBallisticGunController::type ( ) const [virtual]

Returns a string identifies the class type of component.

Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.

Returns:
DtBallisticGunControllerType

Reimplemented from DtControllerComponent.

Reimplemented in DtBallisticGunJoyController.

virtual bool DtBallisticGunController::init ( ) [virtual]

Sets up weapon component interface.

Reimplemented from DtControllerComponent.

virtual void DtBallisticGunController::tick ( ) [virtual]

Calculate new control values.

The first call to tick will restore the checkpointed values of myCurrentMunition and myCurrentFuze from the the munition loader of the DtVrfBalGunPSR.

Reimplemented from DtSimComponent.

Reimplemented in DtBallisticGunJoyController.

These are called in init to create the ports used to communicate with the actuator.

virtual void DtBallisticGunController::setLoadAmmoTime ( DtTime  loadAmmoTime) [virtual]
virtual DtTime DtBallisticGunController::loadAmmoTime ( ) const [virtual]
virtual void DtBallisticGunController::setUnloadAmmoTime ( DtTime  unloadAmmoTime) [virtual]
virtual DtTime DtBallisticGunController::unloadAmmoTime ( ) const [virtual]
virtual void DtBallisticGunController::fire ( ) [virtual]

Sets myTriggerPort to true and myLoaded to false.

It also looks up the resource named by myCurrentMunitionName and if found, calls DtIntegerResource::deplete().

virtual bool DtBallisticGunController::chooseAmmo ( DtVrfObject entity,
DtSimMunition munition,
DtDetonatorFuze &  fuze,
int &  ammoAvailable 
) [virtual]

The chooseAmmo() function is passed a pointer to a target entity and returns the best ammunition to use for the target’s entity type.

Type of ammunition and availability, if any, is from the Ammo Select Table specified in the DtBallisticGunControllerDescriptor. chooseAmmo() starts at the beginning of the list of appropriate ammunition types, and returns the first one for which the resource is available. DtFuzeOther is returned for the fuze.

virtual void DtBallisticGunController::initProcessSR ( ) [virtual]

Sets the load & unload ammo time from the component descriptor.

static DtSimComponent* DtBallisticGunController::creator ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
) [static]

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

Returns:
New instance of this class.

Reimplemented in DtBallisticGunJoyController.

virtual bool DtBallisticGunController::createPorts ( ) [protected, virtual]

Called by init to create the output ports.

Reimplemented from DtSimComponent.

Reimplemented in DtBallisticGunJoyController.

virtual bool DtBallisticGunController::createPortGroups ( ) [protected, virtual]

Called by init to create myGunControlPortGroup.

Reimplemented from DtSimComponent.

virtual void DtBallisticGunController::lookupAndCacheProcessSR ( ) [protected, virtual]

This function looks up a process state repository in the process state repository manager by name, and caches a pointer to it in

myProcessState.

The name (if it exists) is given in the component descriptor (DtComponentDescriptor::processStateRepositoryName). If the name does not exist, it uses the appropriate default name defined in procSRTypes.h. Another component is responsible for creating and destroying the process state repository.

virtual bool DtBallisticGunController::weaponsHoldState ( ) [protected, virtual]
Returns:
The value on the weapons-hold input port. If there is no connection to the port, value defaults to false.
const DtBallisticGunController& DtBallisticGunController::operator= ( const DtBallisticGunController orig) [protected]

Not implemented.


Member Data Documentation

Input Port Name: line-of-sight
Input Port Description: Indicates the result of a line of sight calculation to the current target.


Input Port Range: 0 = Unknown, 1 = Blocked, 2 = Clear
Input Port Default Value:
Input Group Parent:

Output Port Name: trigger
Output Port Description: Sends a new True value when trigger is pulled.


Output Port Range:
Output Port Default Value:
Output Group Parent: gun-control

Output Port Name: quantity
Output Port Description: Sends the number of rounds to be fired with a single trigger pull.


Output Port Range:
Output Port Default Value:
Output Group Parent: gun-control

Output Port Name: loaded
Output Port Description: True when the gun is loaded.


Output Port Range:
Output Port Default Value:
Output Group Parent: gun-control

Output Port Name: line-of-sight
Output Port Description: Indicates the result of a line of sight calculation to the current target.


Output Port Range: 0 = Unkown, 1 = Blocked, 2 = Clear
Output Port Default Value:
Output Group Parent: gun-control

Output Port Group Name: gun-control
Output Port Group Description:

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

Output Port Name: target-to-acquire
Output Port Description: When there is a target in the weapon interface, it is put onto this output port.


DtEntityIdentifier DtBallisticGunController::myPreviousTarget [protected]

Maintain the target we had last tick (if any) to detect changes in target (which will kick off possible ammo reload.

The correct munition and fuze for our current target.

DtDetonatorFuze DtBallisticGunController::myCurrentFuze [protected]

The quantity of the current munition in the resources store.

Pointer to a process state repository used to store state data associated with this component.

This process state repository is shared with other components. Another component is responsible for creating and destroying the process state repository. This state is saved and restored as part of a scenario (or checkpoint).

Get ammo select tables from here.

This flag is set to true when the controller pulls the trigger, and set back to false when the controllers sees that the loaded munition has been unloaded (by the gun).

Flag so an out-of-ammo warning is only sent once per target.

Interface between this weapon controller and the entity's DtTargetSelectionController.


The documentation for this class was generated from the following file:

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)