|
VR-Engage
2.2
|
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>
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 | |
| DtVreMessageFactory * | myMessageFactory |
| UInt64 | myId |
| std::vector< DtVreMessageBundle * > | myMessageBundles |
| std::string | myApplicationName |
Additional Inherited Members | |
Static Public Member Functions inherited from makVre::DtNetworkForwarder | |
| static int | maxBundleSize () |
| makVre::DtExerciseConnNetworkForwarder::DtExerciseConnNetworkForwarder | ( | makVre::DtVreMessageFactory * | factory, |
| DtCommunicationManager * | exerciseConn ) |
Constructor.
| factory | Pointer to the message factory for creating messages from raw data |
| exerciseConn | Pointer 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.
|
overridevirtual |
Virtual destructor.
Cleans up resources, including any remaining message bundles.
|
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.
Implements makVre::DtNetworkForwarder.
|
overridevirtual |
Enables the network forwarder.
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.
|
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.
|
protectedvirtual |
Handles incoming data events from the exercise connection.
| data | Reference 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.
|
overrideprotectedvirtual |
Sends a message through the network.
| msg | Pointer to the message to send |
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.
|
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.
|
protected |