VR-Link JAVA API Documentation
 All Classes Namespaces Files Functions Variables Enumerator Pages
5.3 - Getting Information About the FOM

When an HLA DtExerciseConn is constructed, VR-Link reads the appropriate FED file and builds a database of information about the FOM that the application code can query.

This FOM information is stored in a DtFom (defined in fom.h). You can obtain a pointer to a DtExerciseConn's DtFom using the member function fom().

A DtFom contains a list of object class and interaction class descriptors. These descriptors are represented by the VR-Link classes DtObjClassDesc (defined in objClassDesc.h) and DtInterClassDesc (defined in interClassDesc.h) respectively. Class descriptors contain information about FOM classes, including:

The class descriptors also allow you to subscribe and publish, if you want to override the default way these are handled.

DtFom's member functions interClassByName(), interClassByHandle(), objClassByName() and objClassByHandle() allow you to obtain the class descriptor for a particular class. Alternatively, you can iterate through all of the classes in a FOM, using DtFom's firstObjClass() and nextObjClass(), or firstInterClass() and nextInterClass() member functions, for example:

// Print out the names of all object classes in the current FOM.
DtExerciseConn conn(...);
...
DtFom* fom = conn.fom();
for (DtObjClassDesc* desc = fom->firstObjClass(); desc;

desc = fom->nextObjClass(desc))

{
std::cout << "ClassName: " << desc->name() << std::endl;
}

The following example shows how to get a class descriptor in RTI 1516. It uses a list provided by the DtFom member functions objClassList() and interClassList(), which return a DtList of object classes to iterate through.

...
// Print out the names of all object classes in the current FOM.
DtExerciseConn conn(...);
DtFom *fom = con.fom();
#if DtHLA_1516
DtListItem *item;
for(item = objClassList()->first();
item;
item= item->next();
{
DtObjectClassDesc *objDesc =
static_cast<DtObjClassDesc *>item->data();
#else
for (DtObjClassDesc *objDesc = fom->firstObjClass()
objDesc;
objDesc = fom->nextObjClass(objDesc))
{
#endif
// Now code is independent
std::cout << "ClassName: " << objDesc->name() << std::endl;
...

DtFom has a print() member function that is similar to the example, but it prints out more information, such as attribute and parameter names and handles.

[<< Interacting Directly with the RTI] [Home] [Top of Page] [Publishing and Subscribing to FOM Classes and Attributes >>]


Document ID: Generated on Thu Feb 22 04:26:36 EST 2018 from SVN revision 186468
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)