VR-Forces 4.1 Class Documentation
Remote Control Command Line Options

This subclass of DtVrlApplicationInitializer adds command line options for the HLA version of the example.


Header file:

/*******************************************************************************
** Copyright (c) 2005 MaK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
/*******************************************************************************
** $RCSfile: remoteControlInit.h,v $ $Revision: 1.4 $ $State: Exp $
*******************************************************************************/
#ifndef _f18Init_H_
#define _f18Init_H_
#include <vl/exConnInit.h>
#include <vlutil/vlString.h>
#include <mtl/lispEnv.h>
#include <matrix/vlVector.h>
class DtMtlEnvironment;
//DtRemoteControlInitializer derives from DtVrlApplicationInitializer and
//configures command line arguments for the remoteControl application.
//DtVrlApplicationInitializer contains
//default behavior for protocol specific parameters, while
//DtRemoteControlInitializer contains behavior particular to the remoteControl
//application.
//
//parseCmdLine() parses the command line arguments specified in
//this class and DtVrlApplicationInitializer. loadMtlFile() can be
//called (defined in DtVrlApplicationInitializer) with an MTL file name.
//This will parse the MTL file specified and set those variables registered
{
public:
DtRemoteControlInitializer(int argc, char* argv[]);
//These are parameters used by the remoteControl app that are defined in the
//DIS DtVrlApplicationInitializer, but not the HLA version, so define them
//for HLA here
#if DtHLA
virtual void setApplicationNumber(int num);
virtual int applicationNumber() const;
virtual void setSiteId(int id);
virtual int siteId() const;
#endif
protected:
//Register the MTL/Command Line parameters. Non-virtual
//since they are called from the constructor
void initMtl();
void initCmdLine();
protected:
#if DtHLA
//This is already in the DIS base-class... For the remoteControl app,
//make one for HLA
DtConfigVariable<int> myApplicationNumber;
DtConfigVariable<int> mySiteId;
#endif
};
#endif

Implementation:

/*******************************************************************************
** Copyright (c) 2005 MaK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
/*******************************************************************************
** $RCSfile: remoteControlInit.cxx,v $ $Revision: 1.4 $ $State: Exp $
*******************************************************************************/
#include <matrix/vlVector.h>
#include <matrix/geodCoord.h>
//Constructor -- Initialize the base class (will initialize protocol-specific
//parameters), command line arguments and mtl parameters
DtVrlApplicationInitializer(argc, argv, "remoteControl")
#if DtHLA
, mySiteId(myHlaConnection, "backendSiteId", 1, "Site ID of the back-end", DtBaseConfigVariable::DtScopeBoth, false, "s")
, myApplicationNumber(myHlaConnection, "b&ackendAppNum", 2, "Application number of the back-end")
#endif
{
initMtl();
initCmdLine();
}
{
}
//Registers the MTL parameters
{
#if DtHLA
myMtlEnv->registerConfigVar(myApplicationNumber);
myMtlEnv->registerConfigVar(mySiteId);
#endif
}
//Initializes the command line parameters
{
}
//--------------------------------------------------------------
// ACCESSORS/MODIFIERS
// Provide a way to inspect/modify the data
//--------------------------------------------------------------
#if DtHLA
{
myApplicationNumber.setValue(num);
}
{
return myApplicationNumber.value();
}
{
mySiteId.setValue(id);
}
{
return mySiteId.value();
}
#endif

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)