VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtWeaponFireConnector Class Reference

Detailed Description

DtWeaponFireConnector processes weapon fire interactions from VR-Link and translates them to VREngage fire messages. It also handles caching of fire interactions when necessary entity information is not yet available.

#include <weaponFireConnector.h>

Inheritance diagram for makVre::DtWeaponFireConnector:
[legend]

Public Member Functions

 DtWeaponFireConnector ()
 
virtual ~DtWeaponFireConnector () override
 
virtual void install (DtPlayerStationApp *app, makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection *connection) override
 
virtual void tick () override
 
virtual void shutdown () override
 
void handleFireMessage (DtFireInteraction *fire)
 
- Public Member Functions inherited from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector
 DtSimEventConnector ()
 
virtual ~DtSimEventConnector () override
 
- Public Member Functions inherited from makVre::DtConnector
 DtConnector ()
 
virtual ~DtConnector ()
 
virtual DtConnectorType type ()
 
virtual std::string name ()
 

Protected Types

using PendingFireInteractions = std::vector<std::pair<double, DtFireInteraction*>>
 

Protected Member Functions

DtEntityIdentifier findEntityId (const DtGlobalObjectDesignator &globalId)
 
bool fireMessageReadyToSend (DtFireInteraction *fire)
 
void sendFireMessage (DtFireInteraction *fire)
 

Protected Attributes

DtReflectedEntityList * myReflectedEntityList
 
PendingFireInteractions myPendingFireInteractions
 
- Protected Attributes inherited from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector
DtPlayerStationAppmyApp
 
makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection * myConnection
 
- Protected Attributes inherited from makVre::DtConnector
std::string myName
 
DtConnectorType myType
 

Additional Inherited Members

- Public Types inherited from makVre::DtConnector
enum  DtConnectorType {
  DIS , HLA13 , HLA1516 , HLA1516E ,
  HLA4
}
 
- Static Public Member Functions inherited from makVre::DtConnector
static std::string extension (DtConnectorType type)
 

Member Typedef Documentation

◆ PendingFireInteractions

using makVre::DtWeaponFireConnector::PendingFireInteractions = std::vector<std::pair<double, DtFireInteraction*>>
protected

Type alias for pending fire interactions.

Each pair contains the timestamp when the interaction was received and a pointer to the fire interaction

Constructor & Destructor Documentation

◆ DtWeaponFireConnector()

makVre::DtWeaponFireConnector::DtWeaponFireConnector ( )

Default constructor.

Initializes the connector with name "WeaponFire"

◆ ~DtWeaponFireConnector()

virtual makVre::DtWeaponFireConnector::~DtWeaponFireConnector ( )
overridevirtual

Virtual destructor.

Member Function Documentation

◆ install()

virtual void makVre::DtWeaponFireConnector::install ( DtPlayerStationApp * app,
makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection * connection )
overridevirtual

Installs the weapon fire connector with the application and connection.

Parameters
appPointer to the player station application
connectionPointer to the protocol-specific VR-Link connection

Calls the base class implementation, registers the fire callback, and retrieves the reflected entity list from the application

Reimplemented from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector.

◆ tick()

virtual void makVre::DtWeaponFireConnector::tick ( )
overridevirtual

Performs periodic processing of pending fire interactions.

Checks if any pending fire interactions are ready to send or have timed out, and processes them accordingly

Reimplemented from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector.

◆ shutdown()

virtual void makVre::DtWeaponFireConnector::shutdown ( )
overridevirtual

Shuts down the weapon fire connector.

Removes the fire callback from the connection

Reimplemented from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector.

◆ handleFireMessage()

void makVre::DtWeaponFireConnector::handleFireMessage ( DtFireInteraction * fire)

Handles an incoming fire interaction.

Parameters
firePointer to the fire interaction to process

Either sends the fire message immediately if all necessary entity information is available, or caches it for later processing

◆ findEntityId()

DtEntityIdentifier makVre::DtWeaponFireConnector::findEntityId ( const DtGlobalObjectDesignator & globalId)
protected

Finds the entity identifier for a global object designator.

Parameters
globalIdThe global object designator to look up
Returns
The entity identifier if found, or nullId if not found

Looks up an entity in the reflected entity list by its global object designator

◆ fireMessageReadyToSend()

bool makVre::DtWeaponFireConnector::fireMessageReadyToSend ( DtFireInteraction * fire)
protected

Determines if a fire interaction is ready to be sent.

Parameters
firePointer to the fire interaction to check
Returns
True if the interaction is ready to send, false otherwise

Makes sure that the firing entity and munition entity (if specified) have been discovered in the simulation

◆ sendFireMessage()

void makVre::DtWeaponFireConnector::sendFireMessage ( DtFireInteraction * fire)
protected

Sends a fire message for a fire interaction.

Parameters
firePointer to the fire interaction to send

Creates and queues a fire message with the information from the fire interaction

Member Data Documentation

◆ myReflectedEntityList

DtReflectedEntityList* makVre::DtWeaponFireConnector::myReflectedEntityList
protected

Pointer to the reflected entity list.

Used to look up entities by their global object designators

◆ myPendingFireInteractions

PendingFireInteractions makVre::DtWeaponFireConnector::myPendingFireInteractions
protected

Cached fire interactions.

These interactions are delayed until the firing entity and munition entity have been discovered in the simulation


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