This example shows how to create a very simple plug-in that creates a Hla13 driver and automatically connects to a Hla13 exercise.
It shows how to create a new Hla13 Driver object, add it to the driver manager and set it up to start automatically.
Building the Example
VR-Vantage includes pre-built versions of the example plug-in. To build it yourself, follow the instructions at Building VR-Vantage Examples, Applications, and Plug-ins.
Running the Example
This example is an application. You can run it by running ./bin64/exampleHla13Connection_stealth.bat (on Windows) or ./bin64/exampleHla13Connection_stealth.sh (on Linux). For more information about running examples, please see Running Applications and Examples.
Example Source Files
exampleHla13ConnectionInit.cxx
#include <vl/exerciseConnInitializer.h>
#include <boost/bind.hpp>
{
return true;
}
namespace makVrv
{
namespace vrvExampleHla13Connection
{
static const std::string exampleDriverName =
"myHla13Driver";
void createDriver(DtDe* de)
{
&createDriver, de));
DtHla13Driver* hla13Driver = dynamic_cast<DtHla13Driver*>(
createDriver(
std::string(
"DtHla13Driver"), exampleDriverName));
exConnInitializer.setExecName("VR-Link");
exConnInitializer.setFederateType("VR-Vantage HLA 1.3 Driver");
exConnInitializer.setFedFileName("VR-Link.fed");
exConnInitializer.setRprFomVersion(1);
exConnInitializer.setUseAdvisories(true);
exConnInitializer.setUseGeographicDdm(false);
hla13Driver->setExerciseSettings(exConnInitializer);
de->driverManager().addDriver(hla13Driver);
}
{
try
{
&createDriver, &de));
DtDeInitializer initializer = de.deInitializer();
std::vector< std::string > autoStartList = initializer.autoStartDrivers();
autoStartList.push_back(exampleDriverName);
initializer.setAutoStartDrivers(autoStartList);
de.setDeInitializer(initializer);
}
DtCATCH_AND_PROPAGATE(DtCorruptedState)
}
}
}
exampleHla13ConnectionInit.h
#pragma once
#define DT_DE_PLUGIN_EXPORT_MACRO DT_DLL_EXAMPLEHLA13CONNECTION
namespace makVrv
{
class DtDe;
namespace vrvExampleHla13Connection
{
}
}
exampleHla13Connection.h
#ifndef exampleHla13Connection_H_
#define exampleHla13Connection_H_
#ifdef _WIN32
#ifdef EXAMPLEHLA13CONNECTION_EXPORTS
#define DT_DLL_EXAMPLEHLA13CONNECTION __declspec ( dllexport )
#else
#define DT_DLL_EXAMPLEHLA13CONNECTION __declspec ( dllimport )
#endif
#else
#define DT_DLL_EXAMPLEHLA13CONNECTION
#endif
#endif