VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Add Back-End Command Line Arguments via a Plug-in

Table of Contents

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.

  1. Start vrfGui.
  2. When running the back-end from the launcher, to the additional back-end command line arguments add an argument from this example. You should see its value set, and, a message that the other is not set.

Command Line Plug-in Entry Point

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.

Plug-in Entry Points

/*******************************************************************************
** 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;
   }
}


Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)