VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Creating New Publisher, Reflected Object, and Object List Classes

Next, we need to create subclasses of DtObjectPublisher, DtReflectedObject, and DtReflectedObjectList for our Test objects.

Technically, these classes are not strictly necessary. We can do just about everything we need to using the base classes, but then we would need to configure each instance of those base classes with the appropriate FOM classes, state repositories, encoders, and decoders every time we create one. By subclassing, we encapsulate the configuration of each base class for our new object type into one place. In addition, we hide the casting from base DtStateRepositories to the derived TestStateRepository, so that application code that uses our derived classes will be able to automatically obtain pointers to TestStateRepositories.

Defining Functions

Definitions of functions in these classes are very straightforward, and rely mostly on the base class versions. TestPublisher, ReflectedTest, and ReflectedTestList hard-code their own FOM mapping information, rather than relying on the default behavior, which is to obtain it from the FOM Mapper. This makes things simpler, by saving the step of configuring the FOM Mapper with mappings for the new class. But this choice means that it would be more difficult to change the way this kind of interaction is represented in the FOM.

Specifically, the TestPublisher and ReflectedTest constructors tell their base classes what kinds of encoders and decoders to use. The TestPublisher constructor chooses its own class to use to represent its objects, and the ReflectedTestList constructor chooses what FOM classes to manage.



Document ID: Generated on Mon Apr 8 04:49:21 EDT 2019 from SVN revision 197403
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)