![]() |
VR-Forces 4.10 Class Documentation
|
This example shows how to add command-line arguments that can be used in a plug-in to the back-end list of command line arguments.
The Add Back-End Command Line
In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the addBackendCommandLine plug-in for this example to work.
In order to add command-line arguments, you must implement the new plug-in entry point:
DT_VRF_DLL_PLUGIN void DtInitializeVrfSettings(DtApplicationSettings& settings)
You can add your command-line arguments to these settings:
myBooleanFlag = new DtConfigVariable<bool>(settings, "exampleBoolean", false, "Example boolean flag."); myStringCommand = new DtConfigVariable<DtString>(settings, "exampleString", false, "Example string flag.");
These arguments will be available on the command line and, if specfied, will be set before DtInitializeVrfPlugin is called.
To make use of the new functionality, you must implement the void DtInitializeVrfSettings(DtApplicationSettings& settings) function. The settings passed in can have arguments added to them that are of type DtConfigVariable.
/*******************************************************************************
** Copyright (c) 2019 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
#include "vrfcgf/vrfPluginExtension.h"
#include <mtl/applicationSettings.h>
#include "vrfcgf/cgf.h"
extern "C" {
DtConfigVariable<bool>* myBooleanFlag = 0;
DtConfigVariable<DtString>* myStringCommand = 0;
DT_VRF_DLL_PLUGIN void DtPluginInformation(DtVrfPluginInformation& info)
{
info.pluginName = "Add Back-End Command Line";
info.pluginVersion = "1.00";
info.pluginDescription = "Adds a string and boolean command line argument to the back-end command line processor and then prints out the values when the plugin is initialized.";
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
info.pluginContactWebPage = "www.mak.com";
info.pluginContactMailingAddress = "10 Fawcett Street, Suite 204, Cambridge, MA 02138 USA";
info.pluginContactPhone = "(617) 876 8085";
}
//! This function is implemented in order to add new command line arguments to the command line
DT_VRF_DLL_PLUGIN void DtInitializeVrfSettings(DtApplicationSettings& settings)
{
myBooleanFlag = new DtConfigVariable<bool>(settings, "exampleBoolean", false, "Example boolean flag.");
myStringCommand = new DtConfigVariable<DtString>(settings, "exampleString", false, "Example string flag.");
}
DT_VRF_DLL_PLUGIN bool DtInitializeVrfPlugin(DtCgf* cgf)
{
if (myBooleanFlag && myBooleanFlag->isSet())
{
DtWarn << "User DID set boolean flag on command line.\n";
}
else
{
DtWarn << "User DID NOT set boolean flag on command line.\n";
}
if (myStringCommand && myStringCommand->isSet())
{
DtWarn << "User DID set string flag to " << myStringCommand->value() << std::endl;
}
else
{
DtWarn << "User DID NOT set string flag on command line.\n";
}
return true;
}
}