This example shows how to create a very simple plug-in that creates a Hla1516e driver and automatically connects to a Hla1516e exercise.
It shows how to create a new Hla1516e Driver object, add it to the driver manager and set it up to start automatically.
This example is an application. You can run it by running ./bin64/exampleHla1516eConnection_stealth.bat (on Windows) or ./bin64/exampleHla1516eConnection_stealth.sh (on Linux). When Vantage start it will ask you to select an RTI connection (select the loopback connection). From the menu "Settings->Connections..." you can see the new HLA connection that was added by the plugin. For more information about running examples, please see Running Applications and Examples.
#include <vl/exerciseConnInitializer.h>
#include <boost/filesystem.hpp>
#include <boost/bind/bind.hpp>
{
return true;
}
{
namespace vrvExampleHla1516eConnection
{
static vrvSignalsLib::connection postInitializeConnection;
static const std::string exampleDriverName = "myHla1516eDriver";
void createDriver(DtDe* de)
{
postInitializeConnection.disconnect();
DtHla1516eDriver* hla1516eDriver = dynamic_cast<DtHla1516eDriver*>(
createDriver(std::string("DtHla1516eDriver"), exampleDriverName));
boost::filesystem::path loadPath = boost::filesystem::system_complete(
de->dePathConfiguration().driverPath());
loadPath += "/HLA 1516 Evolved.DtHla1516eDriver";
{
DtConfiguration settings;
settings.setName("HLA 1516 Evolved.DtHla1516eDriver");
std::string federateName = "VR-Vantage HLA 1516 Evolved Example Driver";
settings.setOptionalParameters(record.
settings());
settings.setOptionalParameter("federateName", "VR-Vantage 3.1 Example");
settings.setOptionalParameter("federateType", "VR-Vantage HLA 1516 Evolved Example Driver");
settings.setOptionalParameter("fedFileName", "RPR_FOM_v2.0_1516-2010.xml");
settings.setOptionalParameter("rprFomVersion", "2");
settings.setOptionalParameter("useAdvisories", "1");
settings.setOptionalParameter("useGeographicDdm", "0");
hla1516eDriver->realizeConfiguration(settings);
}
else
{
error << loadPath.string();
de->emitDeError(error, true);
return;
}
de->driverManager().addDriver(hla1516eDriver);
}
{
try
{
postInitializeConnection = de.signal_postInitialize.connect(boost::bind(
&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)
}
}
}
Contains makVrv::DtDe class.
#define DT_DE_INIT_ONCE(de)
This macro is called by modules in their init() function. This macro ensures that the module is only ...
Definition DtDe.h:30
Contains makVrv::DtDeError class.
Contains vrvUtil::DtDePathConfiguration class.
Contains makVrv:DtMasterScene class.
Contains makArchives::DtDriverRecord class.
Contains the makVrv::DtHla1516eDriver class declaration.
Contains makVrv::DtXmlFileIo class.
A record for saving out a driver instance.
Definition DtDriverRecord.h:20
std::map< std::string, std::string > & settings()
Get the settings map of the driver.
static bool read(const std::string &filePath, T &t, const std::string &tagName="Record")
Definition DtXmlFileIo.h:81
@ Error_UnableToLoadDriverFile
Definition DtDeError.h:40
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer,...
Definition DtDe.h:77
static DtDriverFactory & instance(DtDe &de)
Get the instance of the factory.
Contains DLL export macros.
DT_DE_PLUGIN_EXPORT_MACRO bool initDeModule(makVrv::DtDe *de)
DT_DLL_EXAMPLEHLA1516ECONNECTION void init(DtDe &anIG)
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16