VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vrfSimOptions.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 /*******************************************************************************
7 ** Modify this class to add options that you can use to set up
8 ** initial simulation state. This object is used exclusively by the
9 ** DtVrfApp class.
10 *******************************************************************************/
11 
12 #pragma once
13 
16 
17 #include <vlutil/vlMachineTypes.h>
18 #include <vlutil/vlFilename.h>
19 #include <mtl/configVariable.h>
20 #include <mtl/multiConfigVariable.h>
21 #include <mtl/mtlEnvironment.h>
22 
23 #include <vrfExtObjects/vrfExtApplicationInitializer.h>
24 
28 {
29 public:
30  // Default constructor
31  DtVrfSimOptions(int argc, char** argv, const char* appName, const char* appVersion);
32 
33  // Destructor
34  virtual ~DtVrfSimOptions();
35 
36  // This function will read a configuration file and set all
37  // of the appropriate values in the options object.
38  virtual bool readConfigurationFile(const DtFilename& mtlFile);
39 
40 public:
41  // Returns the frequency of vrfObject update messages for entities
42  virtual DtFloat64 entVrfDataTimeThreshold() const;
43 
44  // Returns the frequency of heartbeat messages
45  virtual int statusUpdateHeartbeat() const;
46 
47  // Returns the default simulation model set to use to load
48  // parameter database, communication model, physical world
49  // parameters
50  virtual DtFilename simulationModelSetFilename() const;
51 
52  // Forces DtCgf::loadScenario to reload the parameter database
53  virtual bool forceParameterDbReload() const;
54 
55  // The frame rate above which the back-end will sleep in order to yield CPU
56  // time to other processes. Once the frame rate drops below this level, the
57  // back-end will no longer sleep. This parameter only takes effect when the
58  // simulation is running in variable frame mode.
59  // @{
60  virtual void setTargetFrameRate(int rate);
61  virtual int targetFrameRate() const;
62  // @}
63 
64  // Returns the default rotation threshold
65  virtual double rotationThreshold() const;
66 
67  // Returns the default translation threshold
68  virtual double translationThreshold() const;
69 
70  // Returns the default aggregate dimension threshold
71  virtual double aggDimensionThreshold() const;
72 
73  // Default path to search for parameter database files, when no path is
74  // specified in a given scenario file.
75  virtual void setDefaultParameterDatabasePath(const DtFilename& path);
76  virtual const DtFilename& defaultParameterDatabasePath() const;
77 
78  // Default path to search for terrain database files, when no path is
79  // specified in a given scenario file.
80  virtual void setDefaultTerrainDatabasePath(const DtFilename& path);
81  virtual const DtFilename& defaultTerrainDatabasePath() const;
82 
83  // DI-Guy configuration files
84  // Returns whether to use DI-Characters inside Vr-Forces
85  virtual bool useDIGuy() const;
86 
87  // Character data file generated from DI0Guy
88  virtual DtFilename diGuyCharacterDataFile() const;
89 
90  // Animations configuration file used to augment character data file
91  virtual DtFilename diGuyAnimationsFile() const;
92 
93  // Whether or not the frame rate statistics of the backend should be logged,
94  // presumably (but not definitely) to file.
95  virtual bool logFrameRateStats() const;
96  virtual void setLogFrameRateStats(bool yesOrNo);
97 
98  // The log file where frame rate stats should be logged.
99  virtual void setFrameRateStatsLogFileName(const DtFilename& filename);
100  virtual DtFilename frameRateStatsLogFileName() const;
101 
102  virtual bool enableDebugDrawer() const;
103  virtual void setEnableDebugDrawer(bool enable);
104 
105  // Sets whether or not to publish zero velocity (and acceleration) when paused. Default
106  // is true
107  virtual void setPublishZeroVelocityWhenPaused(bool);
108  virtual bool publishZeroVelocityWhenPaused() const;
109 
110  // When the simulation is paused set the dead reckoning algorithm for aggregates and entities to static.
111  // This turned on in conjunction with publishZeroVelocityWhenPaused turn off will pause the objects
112  // in a VR-Forces run simulation and still show current values for velocity, speed, acceleration, etc.
114  virtual bool setDeadReckoningAlgorithmToStaticOnPause() const;
115 
116  // Aggregate spatial model tick characteristics. Times are given in seconds
117  // Indicates whether tick rates are to be specified using simulation time or
118  // real time. Default is false.
119  virtual bool aggregateSpatialModelTickPeriodUsesRealTime() const;
120  virtual void setAggregateSpatialModelTickPeriodUsesRealTime(bool yesOrNo);
121 
122  // Aggregate spatial model tick period in seconds. Default is 0.0 (tick as
123  // fast as possible).
124  virtual double aggregateSpatialModelTickPeriod() const;
125  virtual void setAggregateSpatialModelTickPeriod(double period);
126 
127  // Aggregate spatial model tick variance in seconds. Default is 0.0.
128  virtual double aggregateSpatialModelTickVariance() const;
129  virtual void setAggregateSpatialModelTickVariance(double variance);
130 
131  // Always tick as fast as possible while paused. Overrides above tick rate
132  // parameters for aggregate spatial model when simulation is paused. Default is true.
135 
136  virtual int sessionId() const;
137  virtual DtFilename batchFile() const;
138  virtual DtFilename scenarioFile() const;
139  virtual DtFilename terrainFile() const;
140 
142  virtual bool useAbsoluteTimeStamps() const;
143 
144  virtual int frontEndProcessId() const;
145 
146  virtual void setStartInRunMode(bool);
147  virtual bool startInRunMode() const;
148 
149 #ifdef WIN32
150  virtual void setDoNotUseConsole(bool);
151  virtual bool usingConsole() const;
152 #endif
153 
154  virtual void setDaemonMode(bool);
155  virtual bool daemonMode() const;
156 
157 #if DtHLA
158  // HLA only - run back-end in HLA time management mode.
159  virtual bool runInTimeManagementMode() const;
160  virtual void setRunInTimeManagementMode(bool yesNo);
161 #endif
162 
163 #if DtDIS
164  virtual double heartbeatVariance() const;
165  virtual void setHeartbeatVariance(double variance);
166 #endif
167 
168  // When parsing command line, is variables are set, copy them to "real" variables
169  virtual void parseCmdLine();
170 
171  virtual short simMgmtPduProcessLevel() const;
172 
173  virtual int cgfDispatcherReceivePort() const;
174  virtual void setCgfDispatcherReceivePort(int port);
175 
176  // Returns plugins to load
177  const std::vector<std::string>& pluginsToLoad() const;
178 
179  virtual void setLoadPluginIfVersionMismatch(bool);
180  virtual bool loadPluginIfVersionMismatch() const;
181 
182  virtual void setPluginsDirectory(const DtFilename&);
183  virtual const DtFilename& pluginsDirectory() const;
184 
186  virtual void setAdditionalSystemScriptsDirectory(const DtString&);
187 
189  virtual void setDoNotUsePluginsDirectory(bool b);
190  virtual bool doNotUsePluginsDirectory() const;
191 
193  virtual DtFilename outputFile() const;
194  virtual void setOutputFile(const DtFilename& s);
195 
196  // Sets the notify level for all streams managed by this console manager.
197  virtual void setNotifyLevel(DtNotifyLevelType level);
198  // \return The current notification level.
199  virtual DtNotifyLevelType notifyLevel() const;
200 
201  // If true, DtInfo, DtWarn, etc. log messages from the backend will
202  // be sent in comment interactions to the GUI. Default is true.
203  // \note This does not affect the object console logs, only the
204  // backend logs.
206  virtual void setSendBackendLogToNetwork(bool v);
207  virtual bool sendBackendLogToNetwork() const;
209 
210  // If true, terrain subpages will be fully loaded instead of on demand
212  virtual void setFullyLoadTerrain(bool v);
213  virtual bool fullyLoadTerrain() const;
215 
216  // If true, blocking terrain calls will cause an assert when a debug back-end
217  // is in run mode.
219  virtual void setAssertOnBlockingTerrainCalls(bool b);
220  virtual bool assertOnBlockingTerrainCalls() const;
222 
223  // The address of the network interface to be used for non HLA/DIS
224  // communications with the GUI.
225  // Defaults to a null string, indicating that VRF will automatically detect
226  // the network interface.
228  virtual void setHostAddress(const DtString& address);
229  virtual DtString hostAddress() const;
231 
234  virtual void setAppDataDir(const DtString&);
235  virtual DtString appDataDir() const;
237 
238  // Mapping file for SIDC to Dis Enumerations
240  virtual void setMsdlSidcMappingFile(const DtString& address);
241  virtual DtFilename msdlSidcMappingFile() const;
243 
244  // Mapping file for Country Codes to Dis Enumerations
246  virtual void setCountryCodesMappingFile(const DtString& address);
247  virtual DtFilename countryCodesMappingFile() const;
249 
251  virtual void outputMtl();
252 #ifdef USE_VLD_MEMORY_TRACKING
253  virtual bool useVld() const;
254 #endif
255 
256  virtual void setDisableCallbackQueue(bool enable);
257  virtual void setMainThreadWaitForQueue(bool enable);
258  virtual void setNumCallbackThreads(unsigned n);
260  virtual void setDisableParallelPreprocess(bool usePp);
261 
262  virtual bool disableCallbackQueue() const;
263  virtual bool mainThreadWaitForQueue() const;
264  virtual unsigned numCallbackThreads() const;
265  virtual bool disableParallelPreprocess() const;
266 
267 #ifdef WIN32
268 
269  virtual void setMainThreadToHighPriority(bool);
270 #endif
271 
273  virtual void setDynamicFeaturesDisabled(bool);
274  virtual bool disableDynamicFeatures() const;
275 
276 protected:
277  // This routine will tell the myMtlEnv object what variables to expect
278  // to read from the mtl file. Modify this routine to add your new
279  // variables. This routine is called from loadMtlFile().
280  virtual void initializeMtlParams();
281 
282  // This routine will set internal member variables from those
283  // read from the mtl file
284  virtual void setVariablesFromMtl();
285  virtual void processStringList(std::vector<DtString>& v, const std::vector<DtString>& list) const;
286 
287  // Initializes variables that can be used to check which plugins to load
288  virtual void initPluginVariables();
289 
290  // Process all .mtl files found in the supplied plugin directory to see which plugins to load
291  virtual void processPluginsDirectory(const DtFilename& directory);
292 
293 private:
294  // Copy constructor; not implemented
295  DtVrfSimOptions(const DtVrfSimOptions& orig);
296 
297  // Assignment operator; not implemented
299 
300 protected:
301  // The name of an alternate parameter database file to load upon startup.
302  DtConfigVariable<DtString> mySimulationModelSetFile;
303 
304  // Filename of batch file to load at startup.
305  DtConfigVariable<DtString> myBatchFile;
306 
307  // Cgf tick performance parameters
308  DtConfigVariable<int> myTargetFrameRate;
309 
310  // Integer session Id. Applications with a common session Id must share
311  // the same terrain database, and are capable of controlling one another
312  // through interface messages.
313  DtConfigVariable<int> mySessionId;
314 
315  // The name of a scenario (.scn) file to load upon startup (optional)
316  DtConfigVariable<DtString> myScenarioFile;
317 
318  // The name of a terrain file to load upon startup (optional - new scenario)
319  DtConfigVariable<DtString> myTerrainFile;
320 
321  // Set true to use DI-Guy Characters in Vr-Forces
322  short myUseDIGuy;
323 
324  // Configuration files for setting up DI-Guy characters
325  DtConfigVariable<DtString> myDIGuyCharacterDataFile;
326  DtConfigVariable<DtString> myDIGuyAnimationsFile;
327 
328  // MTL file to load. Note this is here only for --help purposes as this
329  // variable is parsed outside of the normal parsing routine
330  DtConfigVariable<DtString> mySettingsFile;
331 
332  // Where the app data directory is located
333  DtConfigVariable<DtString> myAppDataDir;
334 
335  // Semi-colon separated list of directories to load system scripts from
336  DtConfigVariable<DtString> myAdditionalSystemScriptsDirectory;
337 
338  // Process ID of the front-end that started us (combined mode)
339  DtConfigVariable<int> myFrontEndPID;
340 #ifndef WIN32
341  // Whether to start in daemon mode or not. (UNIX only)
342  DtConfigVariable<bool> myCmdDaemonMode;
344 #endif
345 
346 #if DtHLA
347  // HLA only - flag indicating whether or not to run in HLA time
348  // management mode.
349  DtConfigVariable<bool> myCmdRunInTimeManagementMode;
351 #endif
352 
353 #ifdef DtDIS
355 #endif
356 
357  // Port number for incoming files in the DtCgfDispatcher
359 
363 
364  // Default threshold values
368 
369  // Should the Cgf log performance (frame rate) stats or not
371 
373 
374  // Configure aggregate spatial model
379 
382 
383  // Start in run mode
385 
386 #ifdef WIN32
387  short myDoNotUseConsole;
388 #endif
389 
390  DtFilename myPluginsDirectory;
391 
392  // Parameters for command line only
393 #ifdef WIN32
394  DtConfigVariable<bool> myCmdNotUsingConsole;
395 #endif
396  DtConfigVariable<bool> myCmdStartInRunMode;
397  DtConfigVariable<bool> myCmdDoNotUsePluginsDirectory;
398  DtConfigVariable<bool> myCmdUseAbsoluteTimeStamps;
399 
400  DtConfigVariable<bool> myCmdLogFrameRateStatistics;
401  DtConfigVariable<DtString> myFrameRateStatisticsLogFile;
402 
403  DtMultiConfigVariable<DtString> myPluginFiles;
404 
405  std::vector<std::string> myPluginsToLoad;
407  DtConfigVariable<DtString> myOutputFile;
408 
409  // Parameter for processing sim mgmt PDUs
411 
413 
414  // Starting object console notify level. Default is 2
417 
418  DtConfigVariable<bool> myCmdFullyLoadTerrain;
420 
424 
426 
427  // Address of the network interface to use for non-DIS/HLA communication with GUI.
428  DtConfigVariable<DtString> myHostAddress;
429 
430  DtConfigVariable<DtString> myMsdlSidcMappingFile;
431  DtConfigVariable<DtString> myCountryCodesMappingFile;
432 
433  DtConfigVariable<bool> myCmdDisableCallbackQueue;
434  DtConfigVariable<int> myCmdNumCallbackThreads;
435  DtConfigVariable<bool> myCmdMainThreadWaitForQueue;
436  DtConfigVariable<bool> myCmdDisableParallelPreprocess;
437 
441 
442 #ifdef WIN32
443  DtConfigVariable<bool> myCmdSetMainThreadToHighPriority;
444  short mySetMainThreadToHighPriority;
445 #endif
446 #ifdef USE_VLD_MEMORY_TRACKING
447  DtConfigVariable<bool> myUseVld;
448 #endif
449 
450  DtConfigVariable<bool> myCmdDynamicFeaturesDisable;
452 };
453 
454 inline const std::vector<std::string>& DtVrfSimOptions::pluginsToLoad() const
455 {
456  return myPluginsToLoad;
457 }
458 

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)