![]() |
VR-Link API Documentation for DIS
|
This file contains the main class MyFomMapper which is created by the plugin manager.
There are several ways to configure a FOM Mapper to work with this new FOM. For example, you could allow the DtExerciseConn constructor to create an empty FOM Mapper, and then add mappings to that FOM Mapper later.
However, this example creates a subclass of DtFomMapper called MyFomMapper, whose implementation of the virtual init() function self registers all of the mappings we want. Then it can either create an instance of this class and pass it to the DtExerciseConn constructor, or create a shared library containing a function called DtCreateFomMapper() that returns a new'ed instance of MyFomMapper, and pass the name of the shared library to the DtExerciseConn constructor. This example uses the shared library option.
Regardless of how an instance of a DtFomMapper is passed to a DtExerciseConn constructor, DtExerciseConn calls init() on that FOM Mapper after reading the FED file and initializing the RTI.
The MyFomMapper class is defined in myFomMap.h and myFomMap.cxx. The code is included below. Notice that MyFomMapper is derived from DtEmptyFomMapper. Within MyFomMapper::init(), call down to the DtEmptyFomMapper::init(), which initializes the FOM Mapper with empty factories and tables. Then add your own mappings to the tables, including adding instances of our encoders and decoders to the FOM Mapper's encoder and decoder factories.