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

Detailed Description

This class implements a network forwarder that uses the exercise connection (via a communication manager) to send and receive VREngage messages over the network. It bundles outgoing messages for efficient transmission and processes incoming data events from the network. The forwarder ensures messages are only processed once by tracking the originating application ID of each message.

#include <exerciseConnNetForwarder.h>

Inheritance diagram for makVre::DtExerciseConnNetworkForwarder:
[legend]

Public Member Functions

 DtExerciseConnNetworkForwarder (makVre::DtVreMessageFactory *factory, DtCommunicationManager *exerciseConn)
 
virtual ~DtExerciseConnNetworkForwarder () override
 
virtual void flush () override
 
virtual bool enable () override
 
virtual void disable () override
 
- Public Member Functions inherited from makVre::DtNetworkForwarder
 DtNetworkForwarder (DtVreMessageFactory *factory)
 
virtual ~DtNetworkForwarder ()
 
virtual void forwardEvents (const std::string &messageType)
 
virtual void stopForwardingEvents (const std::string &messageType)
 
virtual void setApplicationName (const std::string &applicationName)
 
virtual std::string applicationName ()
 

Protected Member Functions

virtual void handleDataInteraction (const makVrfEvents::DtEvent &data)
 
virtual makVre::DtVreMessageResult netSendMessage (makVre::DtVreMessage *msg) override
 
- Protected Member Functions inherited from makVre::DtNetworkForwarder
virtual makVre::DtVreMessageResult handleForwardMessage (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleStopForwardMessage (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleRequestForwardMessage (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleRequestStopForwardMessage (makVre::DtVreMessage *msg)
 

Protected Attributes

DtCommunicationManager * myCommunicationManager
 
boost::signals2::scoped_connection myDataInteractionConnection
 
- Protected Attributes inherited from makVre::DtNetworkForwarder
DtVreMessageFactorymyMessageFactory
 
UInt64 myId
 
std::vector< DtVreMessageBundle * > myMessageBundles
 
std::string myApplicationName
 

Additional Inherited Members

- Static Public Member Functions inherited from makVre::DtNetworkForwarder
static int maxBundleSize ()
 

Constructor & Destructor Documentation

◆ DtExerciseConnNetworkForwarder()

makVre::DtExerciseConnNetworkForwarder::DtExerciseConnNetworkForwarder ( makVre::DtVreMessageFactory * factory,
DtCommunicationManager * exerciseConn )

Constructor.

Parameters
factoryPointer to the message factory for creating messages from raw data
exerciseConnPointer to the communication manager for the exercise connection

Initializes a new exercise connection network forwarder with the specified message factory and communication manager. The message factory is used to create messages from incoming raw data, and the communication manager is used to send outgoing messages through the exercise connection.

◆ ~DtExerciseConnNetworkForwarder()

virtual makVre::DtExerciseConnNetworkForwarder::~DtExerciseConnNetworkForwarder ( )
overridevirtual

Virtual destructor.

Cleans up resources, including any remaining message bundles.

Member Function Documentation

◆ flush()

virtual void makVre::DtExerciseConnNetworkForwarder::flush ( )
overridevirtual

Flushes bundled messages to the network.

This method sends all accumulated message bundles to the network through the exercise connection. Because messages are bundled for efficiency, this method should be called once per frame to ensure timely delivery of messages. After sending, each bundle is reset for reuse in the next frame.

Note
This must be called once per frame to ensure messages are transmitted

Implements makVre::DtNetworkForwarder.

◆ enable()

virtual bool makVre::DtExerciseConnNetworkForwarder::enable ( )
overridevirtual

Enables the network forwarder.

Returns
True if the forwarder was successfully enabled

This method enables the network forwarder by connecting to the data event signal of the communication manager's event manager. When enabled, the forwarder will process incoming data events and forward outgoing messages.

Reimplemented from makVre::DtNetworkForwarder.

◆ disable()

virtual void makVre::DtExerciseConnNetworkForwarder::disable ( )
overridevirtual

Disables the network forwarder.

This method disables the network forwarder by disconnecting from the data event signal. When disabled, the forwarder will not process incoming data events or forward outgoing messages.

Reimplemented from makVre::DtNetworkForwarder.

◆ handleDataInteraction()

virtual void makVre::DtExerciseConnNetworkForwarder::handleDataInteraction ( const makVrfEvents::DtEvent & data)
protectedvirtual

Handles incoming data events from the exercise connection.

Parameters
dataReference to the received data event

This method processes incoming data events from the exercise connection. If the event contains VREngage messages (identified by DtVrEngageDatumParamId), it extracts the messages from the data buffer and queues them for processing by the message manager, excluding any messages that originated from this application instance to prevent loops.

◆ netSendMessage()

virtual makVre::DtVreMessageResult makVre::DtExerciseConnNetworkForwarder::netSendMessage ( makVre::DtVreMessage * msg)
overrideprotectedvirtual

Sends a message through the network.

Parameters
msgPointer to the message to send
Returns
Message processing result (HANDLED or NOT_HANDLED)

This method bundles the message for efficient network transmission. If the message was not previously forwarded (originatingApplicationId is 0), it is added to an appropriate message bundle and tagged with this forwarder's ID. The actual transmission occurs when flush() is called.

Reimplemented from makVre::DtNetworkForwarder.

Member Data Documentation

◆ myCommunicationManager

DtCommunicationManager* makVre::DtExerciseConnNetworkForwarder::myCommunicationManager
protected

Pointer to the communication manager for the exercise connection.

This communication manager is used to send outgoing messages through the exercise connection and to receive incoming data events.

◆ myDataInteractionConnection

boost::signals2::scoped_connection makVre::DtExerciseConnNetworkForwarder::myDataInteractionConnection
protected

Connection to the data event signal.

This connection is used to receive data events from the communication manager's event manager. It is established in enable() and terminated in disable().


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