![]() |
VR-Link API Documentation for HLA 1516
|
The HLA version of the DtInteraction class is defined in hInteraction.h.
HLA-specific data is available through a DtInteraction, much as HLA-specific object data is available through a DtHlaObject.
Much of this data is not available (unable to be determined by a DtInteraction) until the DtInteraction is told which FOM interaction class is being used to represent it, and which DtExerciseConn it is associated with. For example, you cannot determine if the DtInteraction's FOM interaction class has been subscribed to by remote federates unless you know what FOM class you wish to use and which DtExerciseConn to ask for subscription information.
DtInteraction has a member function called setExConn() that lets you set the DtExerciseConn and DtInterClassDesc (interaction class descriptor) that are currently associated with a particular instance. setExConn() must be called on an interaction before many of DtInteraction's member functions can return meaningful results. If the class descriptor argument to setExConn() is omitted, the DtInteraction subclass will choose a reasonable default (For details, please see Choosing An Interaction Class to Publish.)
Application code rarely needs to call setExConn() explicitly. VR-Link typically calls it for you. When sending a DtInteraction, DtExerciseConn's send() or sendStamped() functions call setExConn() on the DtInteraction before trying to actually send. That DtExerciseConn passes itself as the exConn argument, and passes NULL as the classDesc argument, allowing the DtInteraction to choose a FOM class to use for sending. On the incoming side, after creating the DtInteraction instance to represent a received interaction, but before passing it to user callbacks, VR-Link calls setExConn() on the interaction, passing the DtExerciseConn on which the interaction was received, along with the interaction class of the received interaction.
Interaction classes typically store their parameter values in their own native representation, but you can obtain this data in the RTI's representation. In fact, this is what DtExerciseConn's send() and sendStamped() functions use to obtain the object to pass to the RTI for sending.
For RTI 1.3, the parameter values are stored as an RTI::ParameterHandleValuePairSet, which you can obtain using DtInteraction::phvps().
For RTI 1516, the parameter values are stored as an RTI::ParameterHandleValueMap, which you can obtain using DtInteraction::phvm().
A DtInteraction can be assigned from an RTI representation using the member function setFromPhvps() (for RTI 1.3) or setFromPhvm() (for RTI 1516). DtExerciseConn uses this function to initialize a DtInteraction as a result of a receiveInteraction() RTI service invocation.
The following table describes functions that require that a DtInteraction instance have a valid current exercise connection and class descriptor.
| Additional DtInteraction Functions | |
|---|---|
| Function | Description |
| interactionClassHandle() | Returns the current interaction class’s handle. |
| interactionClassName() | Returns the current interaction class’s name. |
| numParameters() | Returns the number of parameters in the current interaction class. |
| neededByFederation() | Returns whether the class has been subscribed to by remote federates. |
The following table describes DtInteraction's virtual printing functions.
| DtInteraction Print Functions | |
|---|---|
| Function | Description |
| print() | The standard printing function, used by the netdumpHLA utility. It uses the virtual name() function to print the name of the interaction, then calls printParams() and printData(). |
| printHeader() | Prints information about the FOM class being used for the object. |
| printParams() | Calls printHeader(), then prints the set of parameters included in the interaction message, along with raw parameter values if its withHex argument is set to true. |
| printData() | A pure virtual function that is implemented by derived classes to print the specific data contained in the interaction, in the form that is available through inspector functions. |
Both printHeader() and printParams() require that the interaction have a current exercise connection and class descriptor to fully do their jobs.
If you want to print the data in a DtInteraction that you create before you send it through a DtExerciseConn, you can explicitly call setExConn() before printing, to insure that all data can be printed. For example:
DtExerciseConn exConn(...); ... DtFireInteraction inter; inter.setAttacker(...); ... inter.setExConn(&exConn); inter.print();
[<< Using DDM] [Home] [Top of Page] [General HLA Issues >>]