VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions
DtDetonationManager Class Reference

The DtDetonationManager class exists to centralize the processing of detonation interactions. More...

Classes

struct  DtCollateralDetonationTargetInfo
struct  DtDetonationCallbackInfo
struct  DtDirectDetonationTargetInfo

Public Types

typedef bool(* DtDamageAdjudicationFunction )(const DtDetonationContext &detonationContext, void *usr)
typedef std::map
< DtSimMunition, double > 
DtMunitionDamageMap
typedef std::list
< DtDetonationCallbackInfo
DtDetonationCallbackInfoList
typedef DtBoost::shared_ptr
< DtDirectDetonationTargetInfo
DtDirectDetonationTargetInfoPtr
typedef std::list
< DtDirectDetonationTargetInfoPtr
DtDirectDetonationTargetList
typedef std::map< DtUUID,
DtDirectDetonationTargetInfoPtr
DtDirectDetonationTargetMap
typedef DtBoost::shared_ptr
< DtCollateralDetonationTargetInfo
DtCollateralDetonationTargetInfoPtr
typedef std::list
< DtCollateralDetonationTargetInfoPtr
DtCollateralDetonationTargetList
typedef std::map< DtUUID,
DtCollateralDetonationTargetInfoPtr
DtCollateralDetonationTargetMap

Public Member Functions

 DtDetonationManager (DtSimManager &simManager)
 Constructs the detonation manager.
virtual ~DtDetonationManager ()
 The destructor.
virtual bool init ()
 Initializes the detonation manager.
virtual bool reinitialize ()
 Resets the detonation manager to initial state.
virtual bool registerDirectDetonation (DtVrfObject &entity, DtGlobalObjectDesignator entityId, void *callbackObject, DtDamageAdjudicationFunction func)
 Entities that wish to receive detonation notifications (technically, it is usually the actuators which register for the entity) call these functions.
virtual bool registerCollateralDetonation (DtVrfObject &entity, DtGlobalObjectDesignator entityId, DtSimMunition munition, double maxDamageRadius, void *callbackObject, DtDamageAdjudicationFunction func)
 Use this function to register interest in collateral detonations ie ground detonations from indirect fire, missile detonations or direct fire detonations that would cause collateral damage to nearby entities.
virtual bool unRegisterDirectDetonationTarget (DtVrfObject &entity)
 Removes the entity from the detonation manager's container of detonation targets.
virtual bool unRegisterCollateralDetonationTarget (DtVrfObject &entity)
virtual bool unRegisterCollateralDetonationCallback (DtVrfObject &entity, void *callbackObject, DtDamageAdjudicationFunction func)
 Removes the given entity callback from the detonation manager's container of detonation target callbacks.
virtual double lookupMunitionInCollateralDetonationMap (const DtDetonationCallbackInfo &target, const DtSimMunition &munition)
 If the munition is found returns the maximum damage radius of the munition.
virtual void sendDetonationInteraction (DtDetonationInteraction &detonation)
 Send the fully initialized detonation interaction.

Protected Member Functions

virtual void processUUIDChange (const DtVrfObjectUUIDChangedCallbackInfo &change)
virtual void processDetonation (const DtDetonationInteraction &detonation)
 Process the detonation interaction by properly creating a detonation context for the interaction, and then notifying all the appropriate entities of the detonation.
virtual const DtPhysicalWorldphysicalWorld () const
virtual DtPhysicalWorldphysicalWorld ()
virtual Coordinate_SystemcoordinateSystem ()
virtual const Coordinate_SystemcoordinateSystem () const
virtual void processCollateralDetonationForEntitiesInRange (DtDetonationContext &detonationContext)
 Checks all entities who've registered interest in the munition in detonation context Checks the range of the detonation to the entity against the entity's maximumDamageRadius for that munition.
bool testInvariant () const
 The Detonation Manager's invariant:
void cleanOutDeadEntities ()

Static Protected Member Functions

static void detonationCallback (DtDetonationInteraction *detInter, void *usr)
 The callback that processes detonation interactions.
static void uuidChangeCallback (const DtVrfObjectUUIDChangedCallbackInfo &change, void *usr)

Protected Attributes

DtDirectDetonationTargetMap myDirectDetonationTargetMap
DtCollateralDetonationTargetMap myCollateralDetonationTargetMap
bool myQueueEntitiesToBeRemoved
 After all the callbacks have been made those who've been destroyed or asked to unregistered need to be removed from the collateral target map.
std::list< DtUUIDmyEntitiesQueuedToBeRemovedList
DtSimManagermySimManager

Private Member Functions

 DtDetonationManager (const DtDetonationManager &orig)
 Not defined! copy constructor.
DtDetonationManageroperator= (const DtDetonationManager &other)
 assignment operator

Detailed Description

The DtDetonationManager class exists to centralize the processing of detonation interactions.

Components register with the detonation manager, providing a pointer to a DtVrfObject as well as the objects global designator, and a damage adjudication function to call when the detonation affects the registered vrfobject. The detonation manager determines the entity or entities the detonation affects, and notifies them and only them through the supplied callback functions.

With regards to detonation interactions, for a result of "entity proximate", where the entity is specified as the target, or for a result of simply "detonation", the range to the detonation is determined, and the damage probability is determined using a surface of "front" and an angle of incidence of 0. The detonation manager fills in a detonation context with all the appropriate information, and looks up the entity to see if it has registered a callback. If so, it calls the registered callback, supplying the detonation context.

When a detonation manager receives a detonation of type DtDetResDetonation (sent by the indirect fire actuator for artillery), it again fills in the detonation context, but then calls all appropriate entities with registered callbacks.

Member Typedef Documentation

typedef bool(* DtDetonationManager::DtDamageAdjudicationFunction)(const DtDetonationContext &detonationContext, void *usr)

Constructor & Destructor Documentation

DtDetonationManager::DtDetonationManager ( DtSimManager simManager)

Constructs the detonation manager.

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

The destructor.

Removes the DtDetonationInteraction::removeCallback from the exercise connection.

DtDetonationManager::DtDetonationManager ( const DtDetonationManager orig)
private

Not defined! copy constructor.

Member Function Documentation

virtual bool DtDetonationManager::init ( )
virtual

Initializes the detonation manager.

  • clears all managed lists
  • registers for detonation callbacks with the exercise connection
Returns
a boolean signifying success or failure.
virtual bool DtDetonationManager::reinitialize ( )
virtual

Resets the detonation manager to initial state.

  • Removes any registered callbacks from the exercise connection
  • calls init to initialize the manager.
Returns
a boolean signifying success or failure.
See Also
init
virtual bool DtDetonationManager::registerDirectDetonation ( DtVrfObject entity,
DtGlobalObjectDesignator  entityId,
void *  callbackObject,
DtDamageAdjudicationFunction  func 
)
virtual

Entities that wish to receive detonation notifications (technically, it is usually the actuators which register for the entity) call these functions.

Use this function to register interest in direct detonations ie entity impact or 

entity proximate detonations. Supplies the entity, the entity ID, a callback function and a pointer to the actuator (void *)

virtual bool DtDetonationManager::registerCollateralDetonation ( DtVrfObject entity,
DtGlobalObjectDesignator  entityId,
DtSimMunition  munition,
double  maxDamageRadius,
void *  callbackObject,
DtDamageAdjudicationFunction  func 
)
virtual

Use this function to register interest in collateral detonations ie ground detonations from indirect fire, missile detonations or direct fire detonations that would cause collateral damage to nearby entities.

Supplies the entity, the entity ID, the munition being used, it's maximum radius that it can cause damage to the entity, a callback function, and a pointer to the actuator (void *). The munition and maximum damage radius are stored in the collateralDetonationTargetInfoPtr's damageMap keyed by munition.

virtual bool DtDetonationManager::unRegisterDirectDetonationTarget ( DtVrfObject entity)
virtual

Removes the entity from the detonation manager's container of detonation 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 bool DtDetonationManager::unRegisterCollateralDetonationTarget ( DtVrfObject entity)
virtual
virtual bool DtDetonationManager::unRegisterCollateralDetonationCallback ( DtVrfObject entity,
void *  callbackObject,
DtDamageAdjudicationFunction  func 
)
virtual

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

virtual double DtDetonationManager::lookupMunitionInCollateralDetonationMap ( const DtDetonationCallbackInfo target,
const DtSimMunition munition 
)
virtual

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

virtual void DtDetonationManager::sendDetonationInteraction ( DtDetonationInteraction detonation)
virtual

Send the fully initialized detonation interaction.

static void DtDetonationManager::detonationCallback ( DtDetonationInteraction detInter,
void *  usr 
)
staticprotected

The callback that processes detonation interactions.

Calls processDetonation to actually process the detonation interaction.

Parameters
detInterthe detonation interaction to process
usra void pointer to a DtDetonationManager. As this is a static function, this is provided when this function is registered in order to be able to properly handle the callback.
See Also
init
processDetonation
static void DtDetonationManager::uuidChangeCallback ( const DtVrfObjectUUIDChangedCallbackInfo change,
void *  usr 
)
staticprotected
virtual void DtDetonationManager::processUUIDChange ( const DtVrfObjectUUIDChangedCallbackInfo change)
protectedvirtual
virtual void DtDetonationManager::processDetonation ( const DtDetonationInteraction detonation)
protectedvirtual

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

For entity impact and proximate detonations, only the specified entity is notified. For detonation 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 const DtPhysicalWorld* DtDetonationManager::physicalWorld ( ) const
protectedvirtual
Returns
A pointer to the current physical world. This is guaranteed to either be a valid pointer or 0.
virtual DtPhysicalWorld* DtDetonationManager::physicalWorld ( )
protectedvirtual
virtual Coordinate_System* DtDetonationManager::coordinateSystem ( )
protectedvirtual
Returns
A pointer to the current coordinate system object to use. This is guaranteed to either be a valid pointer or 0.
virtual const Coordinate_System* DtDetonationManager::coordinateSystem ( ) const
protectedvirtual
virtual void DtDetonationManager::processCollateralDetonationForEntitiesInRange ( DtDetonationContext detonationContext)
protectedvirtual

Checks all entities who've registered interest in the munition in detonation context Checks the range of the detonation to the entity against the entity's maximumDamageRadius for that munition.

If the detonation is within that range then tell that entity to process this detonation and determine any collateral damage from it.

bool DtDetonationManager::testInvariant ( ) const
protected

The Detonation Manager's invariant:

  • The simulation manager must have a valid physical world in a valid state.
Returns
A boolean signifying whether or not the variant is still valid.
void DtDetonationManager::cleanOutDeadEntities ( )
protected
DtDetonationManager& DtDetonationManager::operator= ( const DtDetonationManager other)
private

assignment operator

Member Data Documentation

DtDirectDetonationTargetMap DtDetonationManager::myDirectDetonationTargetMap
protected
DtCollateralDetonationTargetMap DtDetonationManager::myCollateralDetonationTargetMap
protected
bool DtDetonationManager::myQueueEntitiesToBeRemoved
protected

After all the callbacks have been made those who've been destroyed or asked to unregistered need to be removed from the collateral target map.

std::list<DtUUID> DtDetonationManager::myEntitiesQueuedToBeRemovedList
protected
DtSimManager& DtDetonationManager::mySimManager
protected

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

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)