VR-Link API Documentation for HLA 1516
Test Object Example

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:

  1. 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.)

  2. 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.)

  3. Create TestEncoder and TestDecoder classes, subclasses of DtHlaStateEncoder and DtHlaStateDecoder respectively. These classes contain encoding and decoding functions for the attributes of the Test object class. (For more information, please see testDec.h, testDec.cxx, testEnc.h and testEnc.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:


Document ID: Generated on Wed Oct 23 22:25:48 EDT 2013 from SVN revision 132765
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)