![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 00006 /******************************************************************************* 00007 ** Modify this class to add options that you can use to set up 00008 ** initial simulation state. This object is used exclusively by the 00009 ** DtVrfApp class. 00010 *******************************************************************************/ 00011 00012 #pragma once 00013 00014 #include "vrfutil/vrfPluginRecordManager.h" 00015 00016 #include <vlutil/vlMachineTypes.h> 00017 #include <vlutil/vlFilename.h> 00018 #include <mtl/configVar.h> 00019 #include <mtl/multiVar.h> 00020 #include <mtl/lispEnv.h> 00021 00022 #include <vrfExtObjects/vrfExtAppInit.h> 00023 00024 class DtVrfSimOptions : public DtVrfExtApplicationInitializer 00025 { 00026 public: 00027 // Default constructor 00028 DtVrfSimOptions(int argc, char** argv, const char* appName, const char* appVersion); 00029 00030 // Destructor 00031 virtual ~DtVrfSimOptions(); 00032 00033 // This function will read a configuration file and set all 00034 // of the appropriate values in the options object. 00035 virtual bool readConfigurationFile(const DtFilename& mtlFile); 00036 00037 public: 00038 // Returns the frequency of vrfObject update messages for entities 00039 virtual DtFloat64 entVrfDataTimeThreshold() const; 00040 00041 // Returns the frequency of heartbeat messages 00042 virtual int statusUpdateHeartbeat() const; 00043 00044 // Returns the default simulation model set to use to load 00045 // parameter database, communication model, physical world 00046 // parameters 00047 virtual DtFilename simulationModelSetFilename() const; 00048 00049 // Forces DtCgf::loadScenario to reload the parameter database 00050 virtual bool forceParameterDbReload() const; 00051 00052 // The frame rate above which the back-end will sleep in order to yield CPU 00053 // time to other processes. Once the frame rate drops below this level, the 00054 // back-end will no longer sleep. This parameter only takes effect when the 00055 // simulation is running in variable frame mode. 00056 // @{ 00057 virtual void setTargetFrameRate(int rate); 00058 virtual int targetFrameRate() const; 00059 // @} 00060 00061 // Returns the default rotation threshold 00062 virtual double rotationThreshold() const; 00063 00064 // Returns the default translation threshold 00065 virtual double translationThreshold() const; 00066 00067 // Returns the default aggregate dimension threshold 00068 virtual double aggDimensionThreshold() const; 00069 00070 // Return true/false as to whether or not publish simulation time 00071 // for stealth 00072 virtual bool publishSimulationTimeForStealth() const; 00073 00074 // Default path to search for parameter database files, when no path is 00075 // specified in a given scenario file. 00076 virtual void setDefaultParameterDatabasePath(const DtFilename& path); 00077 virtual const DtFilename& defaultParameterDatabasePath() const; 00078 00079 // Default path to search for terrain database files, when no path is 00080 // specified in a given scenario file. 00081 virtual void setDefaultTerrainDatabasePath(const DtFilename& path); 00082 virtual const DtFilename& defaultTerrainDatabasePath() const; 00083 00084 // DI-Guy configuration files 00085 // Returns whether to use DI-Characters inside Vr-Forces 00086 virtual bool useDIGuy() const; 00087 00088 // Character data file generated from DI0Guy 00089 virtual DtFilename diGuyCharacterDataFile() const; 00090 00091 // Animations configuration file used to augment character data file 00092 virtual DtFilename diGuyAnimationsFile() const; 00093 00094 // Whether or not the frame rate statistics of the backend should be logged, 00095 // presumably (but not definitely) to file. 00096 virtual bool logFrameRateStats() const; 00097 virtual void setLogFrameRateStats(bool yesOrNo); 00098 00099 // Aggregate spatial model tick characteristis. Times are given in seconds 00100 00101 // Indicates whether tick rates are to be specified using simulation time or 00102 // real time. Default is false. 00103 virtual bool aggregateSpatialModelTickPeriodUsesRealTime() const; 00104 virtual void setAggregateSpatialModelTickPeriodUsesRealTime(bool yesOrNo); 00105 00106 // Aggregate spatial model tick period in seconds. Default is 0.0 (tick as 00107 // fast as possible). 00108 virtual double aggregateSpatialModelTickPeriod() const; 00109 virtual void setAggregateSpatialModelTickPeriod(double period); 00110 00111 // Aggregate spatial model tick variance in seconds. Default is 0.0. 00112 virtual double aggregateSpatialModelTickVariance() const; 00113 virtual void setAggregateSpatialModelTickVariance(double variance); 00114 00115 // Always tick as fast as possible while paused. Overrides above tick rate 00116 // parameters for aggregate spatial model when simulation is paused. Default is true. 00117 virtual bool tickAggregateSpatialModelAsFastAsPossibleWhilePaused() const; 00118 virtual void setTickAggregateSpatialModelAsFastAsPossibleWhilePaused(bool yesOrNo); 00119 00120 virtual int sessionId() const; 00121 virtual DtFilename batchFile() const; 00122 virtual DtFilename scenarioFile() const; 00123 virtual DtFilename terrainFile() const; 00124 00125 virtual int frontEndProcessId() const; 00126 00127 virtual void setStartInRunMode(bool); 00128 virtual bool startInRunMode() const; 00129 00130 #ifdef WIN32 00131 virtual void setDoNotUseConsole(bool); 00132 virtual bool usingConsole() const; 00133 #endif 00134 00135 virtual void setDaemonMode(bool); 00136 virtual bool daemonMode() const; 00137 00138 #if DtHLA 00139 // HLA only - run back-end in HLA time management mode. 00140 virtual bool runInTimeManagementMode() const; 00141 virtual void setRunInTimeManagementMode(bool yesNo); 00142 #endif 00143 00144 // When parsing command line, is variables are set, copy them to "real" variables 00145 virtual void parseCmdLine(); 00146 00147 virtual short simMgmtPduProcessLevel() const; 00148 00149 virtual int cgfDispatcherReceivePort() const; 00150 virtual void setCgfDispatcherReceivePort(int port); 00151 00152 // Returns plugins to load 00153 const std::vector<std::string>& pluginsToLoad() const; 00154 00155 virtual void setLoadPluginIfVersionMismatch(bool); 00156 virtual bool loadPluginIfVersionMismatch() const; 00157 00158 virtual void setPluginsDirectory(const DtFilename&); 00159 virtual const DtFilename& pluginsDirectory() const; 00160 00162 virtual void setDoNotUsePluginsDirectory(bool b); 00163 virtual bool doNotUsePluginsDirectory() const; 00164 00166 virtual DtFilename outputFile() const; 00167 virtual void setOutputFile(const DtFilename& s); 00168 00169 // Sets the notify level for all streams managed by this console manager. 00170 virtual void setNotifyLevel(DtNotifyLevelType level); 00171 // \return The current notification level. 00172 virtual DtNotifyLevelType notifyLevel() const; 00173 00174 // If true, DtInfo, DtWarn, etc. log messages from the backend will 00175 // be sent in comment interactions to the GUI. Default is true. 00176 // \note This does not affect the object console logs, only the 00177 // backend logs. 00179 virtual void setSendBackendLogToNetwork(bool v); 00180 virtual bool sendBackendLogToNetwork() const; 00182 00183 // If true, terrain subpages will be fully loaded instead of on demand 00185 virtual void setFullyLoadTerrain(bool v); 00186 virtual bool fullyLoadTerrain() const; 00188 00189 // If true, blocking terrain calls will cause an assert when a debug back-end 00190 // is in run mode. 00192 virtual void setAssertOnBlockingTerrainCalls(bool b); 00193 virtual bool assertOnBlockingTerrainCalls() const; 00195 00196 // The address of the network interface to be used for non HLA/DIS 00197 // communications with the GUI. 00198 // Defaults to a null string, indicating that VRF will automatically detect 00199 // the network interface. 00201 virtual void setHostAddress(const DtString& address); 00202 virtual DtString hostAddress() const; 00204 00206 virtual void outputMtl(); 00207 00208 protected: 00209 // This routine will tell the myMtlEnv object what variables to expect 00210 // to read from the mtl file. Modify this routine to add your new 00211 // variables. This routine is called from loadMtlFile(). 00212 virtual void initializeMtlParams(); 00213 00214 // This routine will set internal member variables from those 00215 // read from the mtl file 00216 virtual void setVariablesFromMtl(); 00217 virtual void processStringList(std::vector<DtString>& v, const std::vector<DtString>& list) const; 00218 00219 // Initializes variables that can be used to check which plugins to load 00220 virtual void initPluginVariables(); 00221 00222 // Process all .mtl files found in the supplied plugin directory to see which plugins to load 00223 virtual void processPluginsDirectory(const DtFilename& directory); 00224 00225 private: 00226 // Copy constructor; not implemented 00227 DtVrfSimOptions(const DtVrfSimOptions& orig); 00228 00229 // Assignment operator; not implemented 00230 DtVrfSimOptions& operator=(const DtVrfSimOptions& rhs); 00231 00232 protected: 00233 // The name of an alternate parameter database file to load upon startup. 00234 DtConfigVariable<DtString> mySimulationModelSetFile; 00235 00236 // Filename of batch file to load at startup. 00237 DtConfigVariable<DtString> myBatchFile; 00238 00239 // Cgf tick performance parameters 00240 DtConfigVariable<int> myTargetFrameRate; 00241 00242 // Integer session Id. Applications with a common session Id must share 00243 // the same terrain database, and are capable of controlling one another 00244 // through interface messages. 00245 DtConfigVariable<int> mySessionId; 00246 00247 // The name of a scenario (.scn) file to load upon startup (optional) 00248 DtConfigVariable<DtString> myScenarioFile; 00249 00250 // The name of a terrain file to load upon startup (optional - new scenario) 00251 DtConfigVariable<DtString> myTerrainFile; 00252 00253 // Set true to use DI-Guy Characters in Vr-Forces 00254 short myUseDIGuy; 00255 00256 // Configuration files for setting up DI-Guy characters 00257 DtConfigVariable<DtString> myDIGuyCharacterDataFile; 00258 DtConfigVariable<DtString> myDIGuyAnimationsFile; 00259 00260 // MTL file to load. Note this is here only for --help purposes as this 00261 // variable is parsed outside of the normal parsing routine 00262 DtConfigVariable<DtString> mySettingsFile; 00263 00264 // Process ID of the front-end that started us (combined mode) 00265 DtConfigVariable<int> myFrontEndPID; 00266 #ifndef WIN32 00267 // Whether to start in daemon mode or not. (UNIX only) 00268 DtConfigVariable<bool> myCmdDaemonMode; 00269 short myDaemonMode; 00270 #endif 00271 00272 #if DtHLA 00273 // HLA only - flag indicating whether or not to run in HLA time 00274 // management mode. 00275 DtConfigVariable<bool> myCmdRunInTimeManagementMode; 00276 int myRunInTimeManagementMode; 00277 #endif 00278 00279 // Port number for incoming files in the DtCgfDispatcher 00280 int myCgfDispatcherReceivePort; 00281 00282 DtFloat64 myEntVrfDataTimeThreshold; 00283 int myStatusUpdateHeartbeat; 00284 short myForceParameterDbReload; 00285 00286 // Default threshold values 00287 DtFloat64 myDefaultTranslationThreshold; 00288 DtFloat64 myDefaultRotationThreshold; 00289 DtFloat64 myDefaultAggDimensionThreshold; 00290 00291 // Should the Cgf log performance (frame rate) stats or not 00292 short myLogFrameRateStatistics; 00293 00294 // Configure aggregate spatial model 00295 short myASM_tickPeriodUsesRealTime; 00296 double myASM_minTickPeriod; 00297 double myASM_minTickPeriodVariance; 00298 short myASM_tickFastAsPossibleWhilePaused; 00299 00300 short myPublishSimulationTimeForStealth; 00301 00302 DtFilename myDefaultParameterDatabasePath; 00303 DtFilename myDefaultTerrainDatabasePath; 00304 00305 // Start in run mode 00306 short myStartInRunMode; 00307 00308 #ifdef WIN32 00309 short myDoNotUseConsole; 00310 #endif 00311 00312 DtFilename myPluginsDirectory; 00313 00314 // Parameters for command line only 00315 #ifdef WIN32 00316 DtConfigVariable<bool> myCmdNotUsingConsole; 00317 #endif 00318 DtConfigVariable<bool> myCmdStartInRunMode; 00319 DtConfigVariable<bool> myCmdDoNotUsePluginsDirectory; 00320 DtConfigVariable<bool> myCmdLogFrameRateStatistics; 00321 00322 DtMultiConfigVariable<DtString> myPluginFiles; 00323 00324 std::vector<std::string> myPluginsToLoad; 00325 bool myDoNotUsePluginsDirectory; 00326 DtConfigVariable<DtString> myOutputFile; 00327 00328 // Parameter for processing sim mgmt PDUs 00329 short mySimMgmtPduProcessLevel; 00330 00331 short myLoadPluginIfVersionMismatch; 00332 00333 // Starting object console notify level. Default is 2 00334 int myObjectConsoleNotifyLevel; 00335 short mySendBackendLogToNetwork; 00336 00337 DtConfigVariable<bool> myCmdFullyLoadTerrain; 00338 short myFullyLoadTerrain; 00339 00340 short myAssertOnBlockingTerrainCalls; 00341 00342 DtVrfPluginRecordManager myPluginRecordManager; 00343 00344 // Address of the network interface to use for non-DIS/HLA communication with GUI. 00345 DtConfigVariable<DtString> myHostAddress; 00346 }; 00347 00348 inline const std::vector<std::string>& DtVrfSimOptions::pluginsToLoad() const 00349 { 00350 return myPluginsToLoad; 00351 } 00352