VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
DtFireManager Class Reference

The DtFireManager class exists to centralize the process of sending and receiving of fire interactions. While it is possible to do this through the makVrfEvents::DtEventManager, the DtFireManager is built on top of that class and provides an API designed specifically for fire events. Components register with the manager, providing a pointer to a DtSimObject as well as the object's global designator, and an under-fire determination function to call when the fire affects the registered object. This manager handles only the firing events. The DtDetonationManager handles detonation events. Detonation services can be accessed through the DtDetonationServiceInterface.

Classes

struct  DtFireRangeCallbackInfo
 
struct  DtFireRangeInfo
 

Public Types

typedef bool(* DtFireProcessingFunction )(const DtFireContext &fireContext, void *usr)
 
typedef std::map< DtUUID,
DtSimObjectReference
DtRegisteredVrfObjects
 
typedef std::map< DtUUID,
std::pair
< DtFireProcessingFunction,
void * > > 
DtFireCallbackFuncs
 
typedef std::map
< DtSimMunition, double
DtFireRangeMap
 
typedef std::list
< DtFireRangeCallbackInfo
DtFireRangeCallbackInfoList
 
typedef std::shared_ptr
< DtFireRangeInfo
DtFireRangeInfoPtr
 
typedef std::map< DtUUID,
DtFireRangeInfoPtr
DtFireRangeInfoMap
 

Public Member Functions

 DtFireManager (DtSimulationServices *simManager)
 
virtual ~DtFireManager ()
 
virtual bool init ()
 
virtual bool reinitialize ()
 
virtual void tick ()
 
virtual bool registerFireTarget (const DtUUID &entityId, double distance, void *callbackObject, DtFireProcessingFunction func)
 
virtual bool registerFireTargetForRemoval (const DtUUID &entity)
 
virtual bool unRegisterFireTarget (const DtUUID &entity)
 
virtual void sendFireInteraction (const makVrfEvents::DtFireEvent &fire)
 
virtual bool registerFireInArea (const DtUUID &entityId, DtSimMunition munition, double maxRadius, void *callbackObject, DtFireProcessingFunction func)
 
virtual bool unRegisterFireInAreaCallback (const DtUUID &entity, void *callbackObject, DtFireProcessingFunction func)
 
virtual bool isTargetInterestedInFire (const DtFireRangeCallbackInfo &target, double range, DtFireContext &fireContext) const
 
virtual double lookupMunitionInFireRangeMap (const DtFireRangeCallbackInfo &target, const DtSimMunition &munition) const
 

Protected Member Functions

virtual void processDetonation (const makVrfEvents::DtDetonationEvent &fire)
 
virtual void processFire (const makVrfEvents::DtFireEvent &fire)
 
virtual void processUUIDChanged (const DtUUID &oldUUID, const DtUUID &newUUID)
 
virtual void determineUnderFire (const makVrfEvents::DtDetonationEvent &detonation)
 
virtual void determineUnderFire (const makVrfEvents::DtFireEvent &fireInter)
 
virtual void removeQueuedFireTargets ()
 
virtual void fireEvent (const makVrfEvents::DtEvent &)
 
virtual void detonationEvent (const makVrfEvents::DtEvent &)
 
virtual void processFireForEntitiesInRange (const makVrfEvents::DtFireEvent &fireInter)
 
 DtFireManager (const DtFireManager &orig)
 
DtFireManageroperator= (const DtFireManager &other)
 

Protected Attributes

DtRegisteredVrfObjects myFireTargets
 
DtFireCallbackFuncs myFireCallbacks
 
std::vector< DtUUIDmyFireTargetsToBeRemoved
 
DtSimulationServicesmySimulationServices
 
std::recursive_mutex myMutex
 
DtFireRangeInfoMap myFireRangeInfoMap
 
bool myConnectionsMade = false
 
double myMaxDistance
 

Member Typedef Documentation

typedef bool(* DtFireManager::DtFireProcessingFunction)(const DtFireContext &fireContext, void *usr)

Constructor & Destructor Documentation

DtFireManager::DtFireManager ( DtSimulationServices simManager)

Constructs the fire manager.

Parameters
simManagerA pointer to the simulation manager for the simulation.
virtual DtFireManager::~DtFireManager ( )
virtual

The destructor. Removes the DtFireEvent callback.

DtFireManager::DtFireManager ( const DtFireManager orig)
protected

Not defined! copy constructor.

Member Function Documentation

virtual bool DtFireManager::init ( )
virtual

Initializes the fire manager.

  • removes any registered callbacks from the exercise connection
  • clears all managed lists
  • registers for fire interactions callbacks with the exercise connection
Returns
a boolean signifying success or failure.
virtual bool DtFireManager::reinitialize ( )
virtual

Same as init, but intended to be called after the object has already been created. Removes the registered callbacks from the connection manager, and then calls init() to finish initialization.

Returns
a boolean representing success or failure in reseting the object to initial state.
See Also
init
virtual void DtFireManager::tick ( )
virtual

Remove objects that were unregistered for fire events.

virtual bool DtFireManager::registerFireTarget ( const DtUUID entityId,
double  distance,
void *  callbackObject,
DtFireProcessingFunction  func 
)
virtual

Entities that wish to receive fire notifications (technically, it is usually the under-fire sensors which register for the entity) call this function. By supplying the entity, the entity ID, a callback function and a pointer to the expected callback object (usually the sensor component itself, as a void*, this manager can then notify the appropriate sensor when fire interactions occur so that they can determine under-fire status.

virtual bool DtFireManager::registerFireTargetForRemoval ( const DtUUID entity)
virtual

Registers the entity pointer for later removal from the fire targets containers. All elements registered to be removed will be removed the next time it determines under fire status.

Detailed description: Because sensors are not ticked when the entity is destroyed, they will only discover they should be unregistered when callbacks are called. But removing the registered entity then is problematic, so they register to be removed later.

virtual bool DtFireManager::unRegisterFireTarget ( const DtUUID entity)
virtual

Removes the entity from the fire manager's container of fire targets.

Parameters
entitythe address of the entity to be unregistered.
Note
If the entity pointer is NULL, then nothing is unregistered.
Returns
a boolean indicating the success or failure of the unregistration.
virtual void DtFireManager::sendFireInteraction ( const makVrfEvents::DtFireEvent fire)
virtual

Send the fully initialized fire interaction.

virtual bool DtFireManager::registerFireInArea ( const DtUUID entityId,
DtSimMunition  munition,
double  maxRadius,
void *  callbackObject,
DtFireProcessingFunction  func 
)
virtual

Use this function to register interest in fire in an area defined by a radius Supplies the entity, the entity ID, the munition being used, maximum radius, a callback function, and a pointer to the actuator (void *). The munition and maximum radius are stored in the collateralDetonationTargetInfoPtr's damageMap keyed by munition.

virtual bool DtFireManager::unRegisterFireInAreaCallback ( const DtUUID entity,
void *  callbackObject,
DtFireProcessingFunction  func 
)
virtual

Removes the given entity callback from the detonation manager's container of detonation target callbacks.

virtual bool DtFireManager::isTargetInterestedInFire ( const DtFireRangeCallbackInfo target,
double  range,
DtFireContext fireContext 
) const
virtual

Returns true if the target has registered interest in the given fire at the given range. If true, fills in the fire context with the range.

virtual double DtFireManager::lookupMunitionInFireRangeMap ( const DtFireRangeCallbackInfo target,
const DtSimMunition munition 
) const
virtual

If the munition is found returns the maximum radius of the munition.

virtual void DtFireManager::processDetonation ( const makVrfEvents::DtDetonationEvent fire)
protectedvirtual

Process the detonation interaction by properly creating a detonation context for the interaction, and then notifying all the appropriate entities.

For entity impact and proximate fire interactions, only the specified entity is notified. For fire and ground proximate interactions, all entities within range are notified. For ground impacts, entities in range are only notified if the munition was a missile.

See Also
getDirectFireSurfaceAndAngleOfIncidence
processIndirectFire
virtual void DtFireManager::processFire ( const makVrfEvents::DtFireEvent fire)
protectedvirtual

Process the fire interaction by properly creating a fire context for the interaction, and then notifying all the appropriate entities.

For entity impact and proximate fire interactions, only the specified entity is notified. For fire and ground proximate interactions, all entities within range are notified. For ground impacts, entities in range are only notified if the munition was a missile.

See Also
getDirectFireSurfaceAndAngleOfIncidence
processIndirectFire
virtual void DtFireManager::processUUIDChanged ( const DtUUID oldUUID,
const DtUUID newUUID 
)
protectedvirtual
virtual void DtFireManager::determineUnderFire ( const makVrfEvents::DtDetonationEvent detonation)
protectedvirtual

This is used for determining if the entity is under fire.

virtual void DtFireManager::determineUnderFire ( const makVrfEvents::DtFireEvent fireInter)
protectedvirtual

This is used for determining if the entity is under fire.

virtual void DtFireManager::removeQueuedFireTargets ( )
protectedvirtual

Unregisters all fire targets that have been registered to be removed.

virtual void DtFireManager::fireEvent ( const makVrfEvents::DtEvent )
protectedvirtual

Process events.

virtual void DtFireManager::detonationEvent ( const makVrfEvents::DtEvent )
protectedvirtual
virtual void DtFireManager::processFireForEntitiesInRange ( const makVrfEvents::DtFireEvent fireInter)
protectedvirtual

Checks all entities who've registered interest in the munition in fire interaction Checks the range of the fire to the entity against the entity's maximumRadius for that munition. If the fire is within that range then tell that entity to process this fire.

DtFireManager& DtFireManager::operator= ( const DtFireManager other)
protected

assignment operator

Member Data Documentation

DtRegisteredVrfObjects DtFireManager::myFireTargets
protected

A container of vrfObjects that have registered for fire interaction processing.

DtFireCallbackFuncs DtFireManager::myFireCallbacks
protected

The callback functions registered by the vrfObjects. When a fire interaction occurs, the callback associated with the appropriate entity is used.

std::vector<DtUUID> DtFireManager::myFireTargetsToBeRemoved
protected

This container contains all the fire targets to be removed.

DtSimulationServices* DtFireManager::mySimulationServices
protected
std::recursive_mutex DtFireManager::myMutex
protected
DtFireRangeInfoMap DtFireManager::myFireRangeInfoMap
protected
bool DtFireManager::myConnectionsMade = false
protected
double DtFireManager::myMaxDistance
protected

The maximum distance from a detonation that could result in a registered callback being called.


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

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)