![]() |
VR-Forces Developer's Guide
|
The Simulation Interoperability Standards Organization (SISO) develops a reference document called SISO-REF-010, Reference for Enumerations for Simulation Interoperability. This document is available from SISO and includes both a PDF and an XML file. It defines the values to be used in DIS and the RPR FOM for various enumerations, including things like entity type, warhead type, articulated part type classes and metrics, and more. MAK also adds new enumeration types and extends existing ones with new values.
The XML files that define these enumerations are read in and stored by the sim engine, GUI, and SOE at run-time. This enumerations dictionary is maintained by the VR-Link class DtEnumDictionary. The enum dictionary can be accessed by code in each application in the following ways:
Sim engine:
GUI and SOE:
The DtEnumDictionary can be used to convert a enum value to a display name. It can also be used to lookup a value from a name (or portion of a name).
VR-Forces uses the DtEnumLoader class to populate the DtEnumDictionary from any available XML files. The DtEnumLoader will not read every enumeration in the file, just those it is configured for. The default enumerations loaded are those listed in DtSisoEnumUid in the enumDictionary.h header file. Others can be added through the API.
VR-Forces loads all of the XML files found in the folder appData/settings/enumerations. Each XML file will be loaded and merged together. Individual enumerations will also be merged. This means that if SISO-REF-010 defines a set of enumerated values, more enumerated values can be added in other files such as MAK-Enums.xml, or even user created XML files. This allows for custom extensions to standard enumerations.
Entity type enumerations are comprised of seven fields (for more information on entity types, please see the DIS standard and SISO-REF-010). These fields are somewhat hierarchical, with values at higher levels determining the meanings of values at lower levels. As a result, the DtEnumDictionary has several methods for looking up names and types at distinct field "levels" (e.g. category, subcategory, etc.).
However, the most useful method is probably the displayName() method. This method takes an entity type and returns a display name for it. This is used for display purposes in the GUI and SOE, and can be used for logging in the sim engine. Unfortunately, a displayName() can be hard to generate using a broad rule. For instance, you cannot always base the name on the highest level of detail. For instance, if you based it solely on the extra field, you would sometimes lose context available at the higher levels, and the name would become meaningless. Therefore, you might want to concatenate fields together. However, often portions of the description would be repeated at every level, so a pure concatenation would be repetitive and hard to read. As a result, we have made this configurable. In the appData directory, you will find a file called enumDictionaryConfig.json. This defines how display names are constructed by entity type. It configures the default display names to be based on subcategory. Then it defines rules for specific entity type categories (using wild card matching, where -1 is wild). Using these, you can define specific fields that should be used or concatenated together to produce a display name.
The MAK-Enums.xml defines extensions to the standard SISO enumerations that are used across MAK products. These are primarily additional entity types and articulated part classes.
In addition to extending the available entity types, VR-Forces defines additional enumerations, as well. These are defined in VRF-Enums.xml and include:
The following example code demonstrates some typical uses for the DtEnumDictionary.