![]() |
VR-Link API Documentation for HLA 1.3
|
The testObj example shows how to add a new object class to a FOM.
You must extend the VR-Link top-level API by adding a new kind of state repository, publisher, reflected object, and reflected object list. You also need to create mappings between the new FOM class and the API extensions.
This example adds an object class called Test to the FED file VrlExtend.fed. It has two attributes:
To add this class:
Create a new subclass of DtStateRepository, called TestStateRepository, to hold the state of a new object of this kind. (For more information, please see testSR.h and testSR.cxx.)
Create new subclasses of DtObjectPublisher, DtReflectedObject, and DtReflectedObjectList. Most of their functionality is in their base classes, but the derived classes provide an important element of type safety by localizing casts from base DtStateRepositories to our new TestStateRepository subclass. (For more information, please see testPub.h, testPub.cxx, refTest.h, refTest.cxx, refTestList.h and refTestList.cxx.)
While this may seem like a lot of classes to create, most of them are fairly trivial because they inherit most of their behavior from base classes, and you can use the files in ./examples/testObj as templates from which to create your own classes.
This example covers the following subjects: