VR-Forces 4.0.4 Class Documentation
include/vrfGuiCore/DtVrfGuiCommandLineParser.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2009 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: DtVrfGuiCommandLineParser.h,v $ $Revision: 111909 $ $State: Exp $
00007 *******************************************************************************/
00008 
00011 
00013 
00014 #pragma once
00015 
00016 #include <vrfGuiCore/DtVrfGuiApplication.h>
00017 #include <vrfGuiCore/DtVrfGuiPluginManager.h>
00018 
00019 #include <vrvCore/DtStealthCommandLineProcessor.h>
00020 
00021 #include <cmdLine/cmdArg.h>
00022 #include <cmdLine/cmdLine.h>
00023 
00024 #include <boost/function.hpp>
00025 
00026 namespace makVrf
00027 {
00029    class DtVrfGuiCommandLineParser : public makVrv::DtStealthCommandLineProcessor
00030    {
00031    protected:
00032       typedef boost::function<void (std::vector<DtCmdLine::Arg*>&,
00033          makVrv::DtStealthCommandLineProcessor::StealthArgs&)> DtAdditionalCommandsFcn;
00034 
00035    public:
00036       DtVrfGuiCommandLineParser();
00037 
00038       virtual ~DtVrfGuiCommandLineParser();
00039 
00041       virtual void processCommandLine(makVrv::DtVrvApplicationConfiguration& appConfig, int argc, char** argv);
00042 
00044       virtual void removeAutoStartDriver();
00045 
00046       void setAllowObserverModeFlags(bool);
00047 
00048    protected:
00049       struct BaseArgs
00050       {
00051          virtual void processArgs(makVrv::DtVrvApplicationConfiguration& appConfig, StealthArgs& args, std::string& autoStartDriver) = 0;
00052          virtual std::string driverName() const = 0;
00053          virtual std::string driverClass() const = 0;
00054 
00055          DtVrfGuiCommandLineParser* myParser;
00056          DtCmdLine::ValueArg<int>*     siteId;
00057          DtCmdLine::ValueArg<int>*     appId;
00058       };
00059 
00060       struct DisArgs : public BaseArgs
00061       {
00062          virtual void processArgs(makVrv::DtVrvApplicationConfiguration& appConfig, StealthArgs& args, std::string& autoStartDriver);
00063          virtual std::string driverName() const;
00064          virtual std::string driverClass() const;
00065 
00066          DtCmdLine::ValueArg<int>*     port;
00067          DtCmdLine::ValueArg<int>*     exerciseId;
00068          DtCmdLine::ValueArg<int>*     disVersion;
00069          DtCmdLine::ValueArg<std::string>*   destinationAddress;
00070          DtCmdLine::ValueArg<std::string>*   deviceAddress;
00071          DtCmdLine::ValueArg<std::string>*   hostAddress;
00072          DtCmdLine::ValueArg<int>*        sessionId;
00073          DtCmdLine::ValueArg<int>*     receiveBufferSize;
00074          DtCmdLine::ValueArg<int>*     sendBufferSize;
00075          DtCmdLine::SwitchArg*         useAsynchIO;
00076          DtCmdLine::SwitchArg*         useIpv6;
00077          DtCmdLine::ValueArg<int>*     multicastTTL;
00078          DtCmdLine::MultiArg<std::string>* multicastAddresses;
00079       };
00080 
00081       struct Hla13Args : public BaseArgs
00082       {
00083          virtual void processArgs(makVrv::DtVrvApplicationConfiguration& appConfig, StealthArgs& args, std::string& autoStartDriver);
00084          virtual void setupHlaConfiguration(makVrv::DtConfiguration& config);
00085          virtual std::string driverName() const;
00086          virtual std::string driverClass() const;
00087 
00088          DtCmdLine::ValueArg<std::string>*     execName;
00089          DtCmdLine::ValueArg<std::string>*     fedFileName;
00090          DtCmdLine::ValueArg<std::string>*     fomMapperLibName;
00091          DtCmdLine::ValueArg<std::string>*     fomMapperInitData;
00092          DtCmdLine::ValueArg<std::string>*   hostAddress;
00093          DtCmdLine::ValueArg<int>*             sessionId;
00094          DtCmdLine::ValueArg<double>*          rprFomVersion;
00095          DtCmdLine::ValueArg<int>*             rprFomRevision;
00096          DtCmdLine::SwitchArg*                 useAdvisories;
00097          DtCmdLine::SwitchArg*                 useGeographicDdm;
00098          DtCmdLine::ValueArg<std::string>*     federateType;
00099       };
00100 
00101       struct Hla1516Args : public Hla13Args
00102       {
00103          virtual std::string driverName() const;
00104          virtual std::string driverClass() const;
00105       };
00106 
00107       struct Hla1516eArgs : public Hla13Args
00108       {
00109          virtual void setupHlaConfiguration(makVrv::DtConfiguration& config);
00110 
00111          virtual std::string driverName() const;
00112          virtual std::string driverClass() const;
00113 
00114          DtCmdLine::MultiArg<std::string>*   fomModule;
00115          DtCmdLine::ValueArg<std::string>*   federateName;
00116       };
00117 
00118       struct VrfGuiArgs : public makVrv::DtStealthCommandLineProcessor::StealthArgs
00119       {
00120          DtCmdLine::SwitchArg* disMode;
00121          DtCmdLine::SwitchArg* hla13Mode;
00122          DtCmdLine::SwitchArg* hla1516Mode;
00123          DtCmdLine::SwitchArg* hla1516eMode;
00124 
00125          DtCmdLine::MultiArg<std::string>*   observerModeArg;
00126          DtCmdLine::MultiArg<std::string>*   pluginsToLoadArg;
00127          DtCmdLine::ValueArg<std::string>*   loadScenario;
00128          DtCmdLine::SwitchArg*               doNotLoadDefaultPluginsArg;
00129          DtCmdLine::SwitchArg*               doNotCheckPluginVersions;
00130 
00132          DtCmdLine::SwitchArg*             pvdModeOnly;
00133          DtCmdLine::SwitchArg*             stealthModeOnly;
00134 
00135          std::vector<BaseArgs*>            additionalArguments;
00136       };
00137 
00139       virtual void processArgs(makVrv::DtVrvApplicationConfiguration& appConfig, StealthArgs& args);
00140       virtual std::vector<Arg*> createDefaultArguments(VrfGuiArgs& args);
00141 
00142       virtual void addArgumentParserAddition(const std::string&, DtAdditionalCommandsFcn fcn);
00143 
00145       virtual void createDriver(makVrv::DtVrvApplicationConfiguration&, const makVrv::DtConfiguration&,
00146          BaseArgs*, std::string& autoStarted);
00147 
00148       virtual std::string createDriver(const makVrv::DtConfiguration& c, const std::string& driverName,
00149          const std::string& driverClass, std::string& fullName);
00150       virtual std::string createDriverFileName(const std::string& driverClass,const std::string& driverName);
00151       virtual void addHlaCommandArguments(std::vector<DtCmdLine::Arg*>& a,
00152          makVrv::DtStealthCommandLineProcessor::StealthArgs& args, Hla13Args* hlaArgs);
00153 
00155       virtual void bindObserverModes(const std::vector<std::string>&, makVrf::DtVrfGuiApplication::ObserverModeBindings&) const;
00156 
00157    protected:
00158       virtual void addDisCommandArguments(std::vector<DtCmdLine::Arg*>&,
00159          makVrv::DtStealthCommandLineProcessor::StealthArgs&);
00160       virtual void addHla13CommandArguments(std::vector<DtCmdLine::Arg*>&,
00161          makVrv::DtStealthCommandLineProcessor::StealthArgs&);
00162       virtual void addHla1516CommandArguments(std::vector<DtCmdLine::Arg*>&,
00163          makVrv::DtStealthCommandLineProcessor::StealthArgs&);
00164       virtual void addHla1516eCommandArguments(std::vector<DtCmdLine::Arg*>&,
00165          makVrv::DtStealthCommandLineProcessor::StealthArgs&);
00166 
00167       virtual void setupDefaultProtocolArguments(BaseArgs&);
00168 
00170       virtual std::vector<std::string> defaultObserverMode() const;
00171 
00172    protected:
00173       std::map<std::string, DtAdditionalCommandsFcn>  myAdditionalCommands;
00174       std::string myAutoStartDriver;
00175       bool myAllowObserverModeFlags;
00176    };
00177 }
00178 
00179 #ifndef DtVrfGuiCommandLineParser_INL
00180 #include <vrfGuiCore/DtVrfGuiCommandLineParser.inl>
00181 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)