VR-Link API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HLA Netdump Example

Table of Contents

The HLA Netdump example is a simple program that prints all received HLA Interactions and all HLA Object updates to a console.

VR-Link includes this as a tool that can be used to monitor the information sent over the network. It particularly comes in handy as a debug tool, allowing users to see if packets are sent correctly, if there's anything flooding the network, and more.

Usage

  1. Launch 2 Command Windows from your VR-Link install's bin64 directory.
  2. Start a netdumpHLA application in one window using the HLA protocol of choice.
  3. In the other window, start another application such as the f18HLA example.
  4. Observe the netdumpHLA console window populate with HLA interactions and object updates.

Main Application

/****************************************************************************
* Copyright (c) 2017 MAK Technologies, Inc
* All rights reserved.
****************************************************************************/
#if DtHLA
#include <vl/fom.h>
#include <vl/interaction.h>
#include <vl/stateMsgHLA.h>
#include "stealthControlRegister.h"
#include "ddmFedAmb13.h"
#include "ddmFedAmb1516.h"
#include "ddmFedAmb1516e.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
void reflectCb( const DtStateMsg& msg, DtHlaObject* obj, void* usr );
void removeObjectCb( DtHlaObject* obj, void* usr );
void discoverObjectCb( DtHlaObject* obj, void* usr );
void receiveInterCb( DtInteraction* inter, void* usr );
// Control characters that are used to clear the screen. Empty string
// means don't clear.
std::string clearScreen("");
const std::string theSeperator("************************************************************\n");
DtCmdLine::SwitchArg raw("r", "raw", "Print Raw HLA Data", false);
DtCmdLine::SwitchArg fullReport("M", "noFullReport", "Disable Printing of Update Specifics", true);
DtCmdLine::SwitchArg clearScreenSwitch("c", "clearScreen", "Clear Screen Between Updates", false);
DtCmdLine::SwitchArg ddmDump("d", "ddmDump", "Print DDM region data", false);
DtCmdLine::SwitchArg showRegionData("", "showRegionData", "Show Region Data with Updates", false);
DtCmdLine::SwitchArg subWithDdm("", "subWithDdm", "Subscribe with DDM", false);
#if !DtHLA_1516
std::map<RTI::ObjectHandle, DtDdmFederateAmbassador::DtRegionInfo> myRegionInfo;
#else
std::map<RTI::ObjectInstanceHandle, DtDdmFederateAmbassador::DtRegionInfo> myRegionInfo;
#endif
RTI::DimensionHandle myXHandle;
RTI::DimensionHandle myYHandle;
#if VXWORKS
#define main realMain
DT_VXWORKS_APP(hlaNetdump)
#endif
void DtRtiShutdownHandler(const char * label, void* finished)
{
//This callback may occur multiple times, since it gets called
//every time we make an RTI call with an error. So, we mark this
//as finished and make sure that we only signal once.
int* finishedInt = (int*)finished;
if (*finishedInt)
{
DtWarn << "Shutting down: " << label << std::endl;
}
*finishedInt = 0; //Order a shutdown;
}
std::vector<DtString> selectFomModules(std::vector<DtString> cmdLineFomModuleNames, bool suppressDefaultModules)
{
std::vector<DtString> result;
if (!suppressDefaultModules) {
result.push_back("NETN-BASE.xml");
result.push_back("NETN-Physical.xml");
result.push_back("NETN-METOC.xml");
result.push_back("NETN-MRM.xml");
result.push_back("MAK-Physical-2_evolved.xml");
result.push_back("MAK-Aerodrome-1_evolved.xml");
result.push_back("MAK-METOC-1_evolved.xml");
result.push_back("MAK-VRFExt-9_evolved.xml");
result.push_back("MAK-DIGuy-7_evolved.xml");
result.push_back("MAK-LgrControl-2_evolved.xml");
result.push_back("MAK-VRFAggregate-6_evolved.xml");
result.push_back("MAK-DynamicTerrain-2_evolved.xml");
result.push_back("MAK-VRLExt-3_evolved.xml");
result.push_back("MAK-DER-1_evolved.xml");
result.push_back("RPR-Enumerations_Experimental_IFF.xml");
result.push_back("RPR-MAK_Experimental_IFF-3.xml");
}
//always add fom modules specified on cmd line
result.insert(result.end(), cmdLineFomModuleNames.begin(), cmdLineFomModuleNames.end());
return result;
}
int main( int argc, char* argv[] )
{
// Used for error handling
DtINIT_MINIDUMPER( "HLA-Netdump" );
DtString fedType = "hlaNetdump";
DtCmdLine::CmdLine cmd( "HLA Netdump", ' ' , DtExerciseConn::vrlinkVersion().c_str() );
DtCmdLine::ValueArg<DtString> fedFileName( "F", "fedFileName", "Fed File Name", false, DtDefaultRpr2Fom, "File Name",cmd );
DtCmdLine::ValueArg<DtString> execName( "x", "execName", "Fed Execution Name", false, "MAK-One-2024", "string", cmd );
DtCmdLine::ValueArg<DtString> fomMapperLib( "f", "fomMapperLib", "FOM Mapper Library Name", false, "", "string", cmd );
DtCmdLine::ValueArg<DtString> fomMapperInitData( "", "fomMapperInitData", "FOM Mapper Initialization String", false, "", "string", cmd );
DtCmdLine::ValueArg<double> rprFomVersion( "R", "rprFomVersion", "RPR FOM Version", false, 2.0, "double", cmd );
DtCmdLine::ValueArg<int> rprFomRevision( "", "rprFomRevision", "Internal revision of the implementation of the RPR FOM version", false, 1, "int", cmd );
DtCmdLine::SwitchArg includeMom( "m", "printMom", "print MOM HLA data", false, cmd );
DtCmdLine::SwitchArg passiveSubs( "p", "passive", "Passive Subscribe", false, cmd );
#if DtHLA_1516_EVOLVED
DtCmdLine::MultiArg<DtString> fomModuleNames( "", "fomModules", "Add a FOM module", false, "string", cmd );
DtCmdLine::SwitchArg suppressDefaultModules( "s", "suppressDefaultModules", "Do not load Default FOM Modules automatically", false, cmd );
#endif
DtCmdLine::ValueArg<double> regionOriginLat( "", "regionLat", "Region Origin Latitude (degrees)", false, 0.0, "double", cmd );
DtCmdLine::ValueArg<double> regionOriginLon( "", "regionLon", "Region Origin Longitude (degrees)", false, 0.0, "double", cmd );
DtCmdLine::ValueArg<double> regionSize( "", "regionSize", "Region Size (in meters)", false, 10.0, "double", cmd );
DtCmdLine::ValueArg<int> notifyLevelValue("n", "notifyLevel", "notify level (0-error, 1-warning, 2-info(default), 3-verbose, 4-debug)", false, 2, "int", cmd);
cmd.add( raw );
cmd.add( clearScreenSwitch );
cmd.add( fullReport );
cmd.add( ddmDump );
cmd.add( showRegionData );
cmd.add( subWithDdm );
cmd.parse( argc, argv );
DtNotifyLevel = notifyLevelValue.getValue();
if (clearScreenSwitch)
{
// will not work on all terminals
clearScreen = "\033[H\033[2J";
}
if (ddmDump || showRegionData)
{
}
DtExerciseConn* exConn = 0;
if ( !fomMapperLib.getValue().isEmpty() )
{ // A FOM Mapper shared library was specified
if ( fomMapperInitData.getValue().isEmpty() )
{
#if DtHLA_1516_EVOLVED
std::vector<DtString> fomModules = selectFomModules(fomModuleNames.getValue(), suppressDefaultModules.getValue());
exConn = new DtExerciseConn( execName.getValue().c_str(),
"", fedType.c_str(),
fedFileName.getValue().c_str(),
fomMapperLib.getValue().c_str(), (void*)0,
"", fomModules, &status);
#else
exConn = new DtExerciseConn( execName.getValue().c_str(),
fedType.c_str(), fomMapperLib.getValue().c_str(),
fedFileName.getValue().c_str(), (void*)0, &status );
#endif
}
else
{
#if DtHLA_1516_EVOLVED
std::vector<DtString> fomModules = selectFomModules(fomModuleNames.getValue(), suppressDefaultModules.getValue());
exConn = new DtExerciseConn( execName.getValue().c_str(),
"", fedType.c_str(),
fedFileName.getValue().c_str(),
fomMapperLib.getValue().c_str(),
(void*)fomMapperInitData.getValue().c_str(),
"", fomModules, &status );
#else
exConn = new DtExerciseConn( execName.getValue().c_str(),
fedType.c_str(), fomMapperLib.getValue().c_str(),
fedFileName.getValue().c_str(),
(void*)fomMapperInitData.getValue().c_str(), &status );
#endif
}
{
return 1;
}
}
else
{
// FOM Mapper shared lib was not specified
#if DtHLA_1516_EVOLVED
std::vector<DtString> fomModules = selectFomModules(fomModuleNames.getValue(), suppressDefaultModules.getValue());
//Create instace of Fom Mapper
DtFomMapper* mapper = new DtNetnFomMapper(3, 1, rprFomVersion, rprFomRevision);
exConn = new DtExerciseConn( execName.getValue().c_str(),
"", fedType.c_str(), fedFileName.getValue(),
mapper, "", fomModules,
&status );
#else
//Create instace of Fom Mapper
DtFomMapper* mapper = new DtRprFomMapper(rprFomVersion, rprFomRevision);
exConn = new DtExerciseConn( execName.getValue().c_str(),
fedType.c_str(), mapper, fedFileName.getValue().c_str(), &status );
#endif
{
return 1;
}
if (exConn->fom()->interClassByName("ViewControl"))
{
// Add view control interaction encoders and decoders
DtStealthControlRegister(exConn);
}
}
//Shutdown handler in order to smoothly end if the HLA exercise shuts down
int forever = 1;
#ifdef DtHLA
exConn->addRtiErrorCb(&DtRtiShutdownHandler, &forever);
#endif
if(passiveSubs)
{
exConn->setPassiveMode();
}
DtDDMRegionSet* regionSet = 0;
if (subWithDdm)
{
try
{
DtGeodeticRegionSP geodRegion(new DtGeodeticRegion(exConn));
DtVector geocentricPoint;
DtGeodeticCoord geodOrigin(DtDeg2Rad(regionOriginLat.getValue()),
DtDeg2Rad(regionOriginLon.getValue()), 0);
geodOrigin.getGeocentric(geocentricPoint);
geodRegion->setRegionBounds(geocentricPoint, regionSize.getValue(),
regionSize.getValue());
region = geodRegion;
regionSet = new DtDDMRegionSet();
regionSet->insert(region);
}
catch (RTI::Exception& except)
{
std::cout << "Caught exception creating region: " << except << std::endl;
std::cout << "Exiting..." << std::endl;
return -1;
}
catch (DtException& except)
{
std::cout << "Caught exception creating region: " << except << std::endl;
std::cout << "Exiting..." << std::endl;
return -1;
}
}
if (ddmDump || showRegionData)
{
exConn->fedAmb());
if (fedAmb)
{
try
{
#if !DtHLA_1516
RTI::SpaceHandle spaceHandle = exConn->rtiAmb()->getRoutingSpaceHandle(
"BenchmarkGeographicSpace");
myXHandle = exConn->rtiAmb()->getDimensionHandle(
"X", spaceHandle);
myYHandle = exConn->rtiAmb()->getDimensionHandle(
"Y", spaceHandle);
#else
myXHandle = exConn->rtiAmb()->getDimensionHandle(
DtToWString("X"));
myYHandle = exConn->rtiAmb()->getDimensionHandle(
DtToWString("Y"));
#endif
fedAmb->setXHandle(myXHandle);
fedAmb->setYHandle(myYHandle);
}
catch (RTI::Exception& )
{
// ignore
}
catch (...)
{
// ignore
}
}
}
DtFom* fom = exConn->fom();
DtObjClassDesc *rootObjectClass = fom->rootObjClass();
DtObjClassDesc *rootMomObjectClass = fom->rootMomObjClass();
DtInterClassDesc *rootInterClass = fom->rootInterClass();
DtInterClassDesc *rootMomInterClass = fom->rootMomInterClass();
// Can't really do anything if there is no root class
// Subscribe in reverse order so that its leaf -> root
// These iterations will skip the begin or root node which is what we want anyway
if (rootObjectClass)
{
std::list<DtObjClassDesc*>::const_reverse_iterator objIter = fom->objClassList().rbegin();
std::list<DtObjClassDesc*>::const_reverse_iterator objRend = fom->objClassList().rend();
for (objIter; objIter != objRend; ++objIter)
{
DtObjClassDesc* objClassDesc = const_cast<DtObjClassDesc*>(*objIter);
if (objClassDesc->handle() != rootObjectClass->handle()
&& (includeMom || !rootMomObjectClass || !objClassDesc->isOfClass(rootMomObjectClass->handle())))
{
objClassDesc->subscribe();
}
}
}
if (rootInterClass)
{
std::list<DtInterClassDesc*>::const_reverse_iterator interItr = fom->interClassList().rbegin();
std::list<DtInterClassDesc*>::const_reverse_iterator interRend = fom->interClassList().rend();
for (interItr; interItr != interRend; ++interItr)
{
DtInterClassDesc* intClassDesc = const_cast<DtInterClassDesc*>(*interItr);
if (intClassDesc->handle() != rootInterClass->handle()
&& (includeMom || !rootMomInterClass || !intClassDesc->isOfClass(rootMomInterClass->handle())))
{
intClassDesc->subscribe();
}
}
}
if ( !raw )
{
// Ensures that each hlaObject will be given an ESR.
// needed for non-raw mode
rel = new DtReflectedEntityList( exConn, false, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given an ASR.
// needed for non-raw mode
ral = new DtReflectedAggregateList( exConn, false, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given a DSR.
// needed for non-raw mode
rdl = new DtReflectedDesignatorList( exConn, regionSet );
}
if ( ! raw && exConn->fom()->objClassByName("DIGuyObject") )
{
// Ensures that each hlaObject will be given a DSR.
// needed for non-raw mode
rdgl = new DtReflectedDIGuyObjectList( exConn, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given a ESR.
// needed for non-raw mode
rsl = new DtReflectedEmitterSystemList( exConn, true, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given an RSR.
// needed for non-raw mode
rrl = new DtReflectedRadioReceiverList( exConn, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given an TSR.
// needed for non-raw mode
rtl = new DtReflectedRadioTransmitterList( exConn, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given an ISR.
// needed for non-raw mode
ril = new DtReflectedIffList( exConn, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given an EPSR.
// needed for non-raw mode
repl = new DtReflectedEnvironmentProcessList( exConn, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given an GDSR.
// needed for non-raw mode
rgdl = new DtReflectedGriddedDataList( exConn, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given an GDSR.
// needed for non-raw mode
rasl = new DtReflectedActiveSonarList( exConn, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given an GDSR.
// needed for non-raw mode
rpnl = new DtReflectedPropulsionNoiseList( exConn, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given an asr.
// needed for non-raw mode
rapal = new DtReflectedAdditionalPassiveActivitiesList( exConn, regionSet );
}
if ( !raw )
{
// Ensures that each hlaObject will be given an asr.
// needed for non-raw mode
rlol = new DtReflectedLinearObjectList( exConn, regionSet );
}
#if DtHLA_1516_EVOLVED
if( !raw )
{
// Ensures that each hlaObject will be given an aerosr.
// needed for non-raw mode
raerol = new DtReflectedAerodromeList( exConn, regionSet );
}
if (!raw)
{
// Ensures that each hlaObject will be given an tadsr.
// needed for non-raw mode
rtadl = new DtReflectedTimeAndDateList( exConn, regionSet );
}
if (!raw)
{
// Ensures that each hlaObject will be given an lsr.
// needed for non-raw mode
rlsl = new DtReflectedLandSurfaceList(exConn, regionSet);
}
if (!raw)
{
// Ensures that each hlaObject will be given an sssr.
// needed for non-raw mode
rssll = new DtReflectedSubsurfaceLayerList( exConn, regionSet );
}
if (!raw)
{
// Ensures that each hlaObject will be given an tsr.
// needed for non-raw mode
rtll = new DtReflectedTroposphereLayerList( exConn, regionSet );
}
if (!raw)
{
// Ensures that each hlaObject will be given an wsr.
// needed for non-raw mode
rwsl = new DtReflectedWaterSurfaceList(exConn, regionSet);
}
if (!raw)
{
// Ensures that each hlaObject will be given an wcsr.
// needed for non-raw mode
rwcl = new DtReflectedWindCorridorList( exConn, regionSet );
}
#endif
#if DtHLA_1516
exConn->addDiscoverObjectCallback( RTI::ObjectClassHandle(), discoverObjectCb, 0 );
exConn->addInteractionCallback( RTI::InteractionClassHandle(), receiveInterCb, 0,
region );
#else
exConn->addDiscoverObjectCallback( 0, discoverObjectCb, 0 );
exConn->addInteractionCallback( 0, receiveInterCb, 0, region );
#endif
// Main application loop
while( forever )
{
if ( input.keybrdTick() == -1 )
{
break;
}
exConn->drainInput();
DtSleep( 0.001 );
}
if (forever)
{
// Unsubscribe in normal root -> leaf order so that objects are not rediscovered as parent class
std::list<DtObjClassDesc*>::const_iterator objIter = fom->objClassList().begin();
std::list<DtObjClassDesc*>::const_iterator objEnd = fom->objClassList().end();
for (; objIter != objEnd; ++objIter)
{
DtObjClassDesc* objClassDesc = const_cast<DtObjClassDesc*>(*objIter);
if (objClassDesc->handle() != rootObjectClass->handle()
&& (includeMom || !rootMomObjectClass || !objClassDesc->isOfClass(rootMomObjectClass->handle())))
{
objClassDesc->unsubscribe();
}
}
std::list<DtInterClassDesc*>::const_iterator interItr = fom->interClassList().begin();
std::list<DtInterClassDesc*>::const_iterator interEnd = fom->interClassList().end();
for (; interItr != interEnd; ++interItr)
{
DtInterClassDesc* interClassDesc = const_cast<DtInterClassDesc*>(*interItr);
if (interClassDesc->handle() != rootInterClass->handle()
&& (includeMom || !rootMomInterClass || !interClassDesc->isOfClass(rootMomInterClass->handle())))
{
interClassDesc->subscribe();
}
}
}
DtDELETE ( rel );
DtDELETE ( ral );
DtDELETE ( rdl );
DtDELETE ( rsl );
DtDELETE ( rrl );
DtDELETE ( rtl );
DtDELETE ( ril );
DtDELETE ( repl );
DtDELETE ( rgdl );
DtDELETE ( rasl );
DtDELETE ( rpnl );
DtDELETE ( rapal );
#if DtHLA_1516_EVOLVED
DtDELETE ( raerol );
DtDELETE ( rtadl );
DtDELETE ( rlsl );
DtDELETE ( rssll );
DtDELETE ( rtll );
DtDELETE ( rwsl );
DtDELETE ( rwcl );
#endif
if (subWithDdm)
{
delete regionSet;
region.reset();
}
DtDELETE ( exConn );
return 0;
}
void reflectCb( const DtStateMsg& msg, DtHlaObject* obj, void* usr )
{
DtExerciseConn* exConn = obj->exerciseConn();
DtClock* clock = obj->exerciseConn()->clock();
DtString lastProducingFederateName = "Unknown";
#if DtHLA_1516_EVOLVED
lastProducingFederateName = obj->lastProducingFederate();
#endif
if (ddmDump)
{
DtDdmFederateAmbassador* ddmFedAmb = dynamic_cast<DtDdmFederateAmbassador*>(
obj->exerciseConn()->fedAmb());
ddmFedAmb->regionInfoForObject(obj->objectId());
bool printProducingFederate = false;
if (regionInfo.infoSet)
{
std::map<RTI::ObjectHandle, DtDdmFederateAmbassador::DtRegionInfo>::iterator iter =
myRegionInfo.find(obj->objectId());
if (iter == myRegionInfo.end())
{
myRegionInfo[obj->objectId()] = regionInfo;
std::cout
<< clearScreen
<< theSeperator
<< "*************** Update at "
<< clock->elapsedRealTime() << "secs ***************\n" << theSeperator
<< "Object: " << obj->objectId() << "\n"
<< "Name: " << obj->name() << "\n";
#if DtHLA_1516_EVOLVED
if (!lastProducingFederateName.isEmpty())
{
std::cout
<< "Updated by Federate: "
<< lastProducingFederateName
<< "\n";
}
#endif
std::cout
<< "DDM Info: " << "\n"
<< " -- Lower X Bound: " << regionInfo.lowerXBound << "\n"
<< " -- Upper X Bound: " << regionInfo.upperXBound << "\n"
<< " -- Lower Y Bound: " << regionInfo.lowerYBound << "\n"
<< " -- Upper Y Bound: " << regionInfo.upperYBound << "\n";
}
else
{
// See if it's changed. If so, update it and print it out
const DtDdmFederateAmbassador::DtRegionInfo& lastRegion = iter->second;
if (regionInfo.lowerXBound != lastRegion.lowerXBound ||
regionInfo.upperXBound != lastRegion.upperXBound ||
regionInfo.lowerYBound != lastRegion.lowerYBound ||
regionInfo.upperYBound != lastRegion.upperYBound)
{
myRegionInfo[obj->objectId()] = regionInfo;
std::cout
<< clearScreen
<< theSeperator
<< "*************** Update at "
<< clock->elapsedRealTime() << "secs ***************\n" << theSeperator
<< "Object: " << obj->objectId() << "\n"
<< "Name: " << obj->name() << "\n";
#if DtHLA_1516_EVOLVED
if (!lastProducingFederateName.isEmpty())
{
std::cout
<< "Updated by Federate: "
<< lastProducingFederateName << "\n";
}
#endif
std::cout
<< "DDM Info: " << "\n"
<< " -- Lower X Bound: " << regionInfo.lowerXBound << "\n"
<< " -- Upper X Bound: " << regionInfo.upperXBound << "\n"
<< " -- Lower Y Bound: " << regionInfo.lowerYBound << "\n"
<< " -- Upper Y Bound: " << regionInfo.upperYBound << "\n";
}
}
}
else
{
std::cout
<< clearScreen
<< theSeperator
<< "*************** Update at "
<< clock->elapsedRealTime() << "secs ***************\n"
<< theSeperator
<< "Object: " << obj->objectId() << "\n"
<< "Name: " << obj->name() << "\n";
#if DtHLA_1516_EVOLVED
if (!lastProducingFederateName.isEmpty())
{
std::cout
<< "Updated by Federate: "
<< lastProducingFederateName
<< "\n";
}
#endif
std::cout
<< "DDM Info: " << "\n"
<< " -- No DDM Region information set." << "\n";
}
}
else
{
std::cout
<< clearScreen
<< theSeperator
<< "*************** Update at "
<< clock->elapsedRealTime() << "secs ***************\n"
<< theSeperator;
#if DtHLA_1516_EVOLVED
if (!lastProducingFederateName.isEmpty())
{
std::cout
<< "Updated by Federate: "
<< lastProducingFederateName;
std::cout
<< "\n";
}
#endif
if ( raw )
{
msg.print( obj->exerciseConn(), obj->objectClassHandle() );
}
else
{
msg.print( obj, fullReport );
}
if (showRegionData)
{
DtDdmFederateAmbassador* ddmFedAmb = dynamic_cast<DtDdmFederateAmbassador*>(
obj->exerciseConn()->fedAmb());
ddmFedAmb->regionInfoForObject(obj->objectId());
std::cout << "DDM Region Data: ";
if (regionInfo.infoSet)
{
std::cout
<< "\n"
<< " -- Lower X Bound: " << regionInfo.lowerXBound << "\n"
<< " -- Upper X Bound: " << regionInfo.upperXBound << "\n"
<< " -- Lower Y Bound: " << regionInfo.lowerYBound << "\n"
<< " -- Upper Y Bound: " << regionInfo.upperYBound << "\n";
}
else
{
std::cout << "None" << "\n";
}
}
std::cout << std::endl;
}
}
void removeObjectCb( DtHlaObject* obj, void* usr )
{
obj->removeRemoveObjectCb( removeObjectCb, 0 );
obj->removePostReflectCb( reflectCb, 0 );
}
void discoverObjectCb( DtHlaObject* obj, void* usr )
{
obj->addPostReflectCb( reflectCb, 0 );
obj->addRemoveObjectCb( removeObjectCb, 0 );
}
void receiveInterCb( DtInteraction* inter, void* usr )
{
DtClock* clock = inter->exerciseConn()->clock();
std::cout << clearScreen << theSeperator << "*************** Interaction at "
<< clock->elapsedRealTime() << "secs ***************\n" << theSeperator;
if (!ddmDump)
{
if ( raw )
{
inter->printParams( true );
}
else
{
inter->print();
}
if (showRegionData)
{
DtDdmFederateAmbassador* ddmFedAmb = dynamic_cast<DtDdmFederateAmbassador*>(
inter->exerciseConn()->fedAmb());
std::cout << "DDM Region Data: ";
if (regionInfo.infoSet)
{
std::cout << std::endl;
std::cout << " -- Lower X Bound: " << regionInfo.lowerXBound << std::endl;
std::cout << " -- Upper X Bound: " << regionInfo.upperXBound << std::endl;
std::cout << " -- Lower Y Bound: " << regionInfo.lowerYBound << std::endl;
std::cout << " -- Upper Y Bound: " << regionInfo.upperYBound << std::endl;
}
else
{
std::cout << "None" << std::endl;
}
}
std::cout << std::endl;
}
else
{
std::cout << "Interaction Class: " << inter->interactionClassName() << std::endl;
DtDdmFederateAmbassador* ddmFedAmb = dynamic_cast<DtDdmFederateAmbassador*>(
inter->exerciseConn()->fedAmb());
if (regionInfo.infoSet)
{
std::cout << " -- Lower X Bound: " << regionInfo.lowerXBound << std::endl;
std::cout << " -- Upper X Bound: " << regionInfo.upperXBound << std::endl;
std::cout << " -- Lower Y Bound: " << regionInfo.lowerYBound << std::endl;
std::cout << " -- Upper Y Bound: " << regionInfo.upperYBound << std::endl;
}
else
{
std::cout << "-- No Interaction Region" << std::endl;
}
}
}
#endif // DtHLA

Document ID: Generated on Wed Mar 27 02:04:30 EDT 2024 from SVN revision 264570
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)