VR-Forces 4.3 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  // Aggregate spatial model tick characteristics. Times are given in seconds
111  // Indicates whether tick rates are to be specified using simulation time or
112  // real time. Default is false.
113  virtual bool aggregateSpatialModelTickPeriodUsesRealTime() const;
114  virtual void setAggregateSpatialModelTickPeriodUsesRealTime(bool yesOrNo);
115 
116  // Aggregate spatial model tick period in seconds. Default is 0.0 (tick as
117  // fast as possible).
118  virtual double aggregateSpatialModelTickPeriod() const;
119  virtual void setAggregateSpatialModelTickPeriod(double period);
120 
121  // Aggregate spatial model tick variance in seconds. Default is 0.0.
122  virtual double aggregateSpatialModelTickVariance() const;
123  virtual void setAggregateSpatialModelTickVariance(double variance);
124 
125  // Always tick as fast as possible while paused. Overrides above tick rate
126  // parameters for aggregate spatial model when simulation is paused. Default is true.
129 
130  virtual int sessionId() const;
131  virtual DtFilename batchFile() const;
132  virtual DtFilename scenarioFile() const;
133  virtual DtFilename terrainFile() const;
134 
136  virtual bool useAbsoluteTimeStamps() const;
137 
138  virtual int frontEndProcessId() const;
139 
140  virtual void setStartInRunMode(bool);
141  virtual bool startInRunMode() const;
142 
143 #ifdef WIN32
144  virtual void setDoNotUseConsole(bool);
145  virtual bool usingConsole() const;
146 #endif
147 
148  virtual void setDaemonMode(bool);
149  virtual bool daemonMode() const;
150 
151 #if DtHLA
152  // HLA only - run back-end in HLA time management mode.
153  virtual bool runInTimeManagementMode() const;
154  virtual void setRunInTimeManagementMode(bool yesNo);
155 #endif
156 
157 #if DtDIS
158  virtual double heartbeatVariance() const;
159  virtual void setHeartbeatVariance(double variance);
160 #endif
161 
162  // When parsing command line, is variables are set, copy them to "real" variables
163  virtual void parseCmdLine();
164 
165  virtual short simMgmtPduProcessLevel() const;
166 
167  virtual int cgfDispatcherReceivePort() const;
168  virtual void setCgfDispatcherReceivePort(int port);
169 
170  // Returns plugins to load
171  const std::vector<std::string>& pluginsToLoad() const;
172 
173  virtual void setLoadPluginIfVersionMismatch(bool);
174  virtual bool loadPluginIfVersionMismatch() const;
175 
176  virtual void setPluginsDirectory(const DtFilename&);
177  virtual const DtFilename& pluginsDirectory() const;
178 
180  virtual void setAdditionalSystemScriptsDirectory(const DtString&);
181 
183  virtual void setDoNotUsePluginsDirectory(bool b);
184  virtual bool doNotUsePluginsDirectory() const;
185 
187  virtual DtFilename outputFile() const;
188  virtual void setOutputFile(const DtFilename& s);
189 
190  // Sets the notify level for all streams managed by this console manager.
191  virtual void setNotifyLevel(DtNotifyLevelType level);
192  // \return The current notification level.
193  virtual DtNotifyLevelType notifyLevel() const;
194 
195  // If true, DtInfo, DtWarn, etc. log messages from the backend will
196  // be sent in comment interactions to the GUI. Default is true.
197  // \note This does not affect the object console logs, only the
198  // backend logs.
200  virtual void setSendBackendLogToNetwork(bool v);
201  virtual bool sendBackendLogToNetwork() const;
203 
204  // If true, terrain subpages will be fully loaded instead of on demand
206  virtual void setFullyLoadTerrain(bool v);
207  virtual bool fullyLoadTerrain() const;
209 
210  // If true, blocking terrain calls will cause an assert when a debug back-end
211  // is in run mode.
213  virtual void setAssertOnBlockingTerrainCalls(bool b);
214  virtual bool assertOnBlockingTerrainCalls() const;
216 
217  // The address of the network interface to be used for non HLA/DIS
218  // communications with the GUI.
219  // Defaults to a null string, indicating that VRF will automatically detect
220  // the network interface.
222  virtual void setHostAddress(const DtString& address);
223  virtual DtString hostAddress() const;
225 
228  virtual void setAppDataDir(const DtString&);
229  virtual DtString appDataDir() const;
231 
232  // Mapping file for SIDC to Dis Enumerations
234  virtual void setMsdlSidcMappingFile(const DtString& address);
235  virtual DtFilename msdlSidcMappingFile() const;
237 
238  // Mapping file for Country Codes to Dis Enumerations
240  virtual void setCountryCodesMappingFile(const DtString& address);
241  virtual DtFilename countryCodesMappingFile() const;
243 
245  virtual void outputMtl();
246 #ifdef USE_VLD_MEMORY_TRACKING
247  virtual bool useVld() const;
248 #endif
249 
250  virtual void setDisableCallbackQueue(bool enable);
251  virtual void setMainThreadWaitForQueue(bool enable);
252  virtual void setNumCallbackThreads(unsigned n);
254  virtual void setDisableParallelPreprocess(bool usePp);
255 
256  virtual bool disableCallbackQueue() const;
257  virtual bool mainThreadWaitForQueue() const;
258  virtual unsigned numCallbackThreads() const;
259  virtual bool disableParallelPreprocess() const;
260 
261 #ifdef WIN32
262 
263  virtual void setMainThreadToHighPriority(bool);
264 #endif
265 
267  virtual void setDynamicFeaturesDisabled(bool);
268  virtual bool disableDynamicFeatures() const;
269 
270 protected:
271  // This routine will tell the myMtlEnv object what variables to expect
272  // to read from the mtl file. Modify this routine to add your new
273  // variables. This routine is called from loadMtlFile().
274  virtual void initializeMtlParams();
275 
276  // This routine will set internal member variables from those
277  // read from the mtl file
278  virtual void setVariablesFromMtl();
279  virtual void processStringList(std::vector<DtString>& v, const std::vector<DtString>& list) const;
280 
281  // Initializes variables that can be used to check which plugins to load
282  virtual void initPluginVariables();
283 
284  // Process all .mtl files found in the supplied plugin directory to see which plugins to load
285  virtual void processPluginsDirectory(const DtFilename& directory);
286 
287 private:
288  // Copy constructor; not implemented
289  DtVrfSimOptions(const DtVrfSimOptions& orig);
290 
291  // Assignment operator; not implemented
293 
294 protected:
295  // The name of an alternate parameter database file to load upon startup.
296  DtConfigVariable<DtString> mySimulationModelSetFile;
297 
298  // Filename of batch file to load at startup.
299  DtConfigVariable<DtString> myBatchFile;
300 
301  // Cgf tick performance parameters
302  DtConfigVariable<int> myTargetFrameRate;
303 
304  // Integer session Id. Applications with a common session Id must share
305  // the same terrain database, and are capable of controlling one another
306  // through interface messages.
307  DtConfigVariable<int> mySessionId;
308 
309  // The name of a scenario (.scn) file to load upon startup (optional)
310  DtConfigVariable<DtString> myScenarioFile;
311 
312  // The name of a terrain file to load upon startup (optional - new scenario)
313  DtConfigVariable<DtString> myTerrainFile;
314 
315  // Set true to use DI-Guy Characters in Vr-Forces
316  short myUseDIGuy;
317 
318  // Configuration files for setting up DI-Guy characters
319  DtConfigVariable<DtString> myDIGuyCharacterDataFile;
320  DtConfigVariable<DtString> myDIGuyAnimationsFile;
321 
322  // MTL file to load. Note this is here only for --help purposes as this
323  // variable is parsed outside of the normal parsing routine
324  DtConfigVariable<DtString> mySettingsFile;
325 
326  // Where the app data directory is located
327  DtConfigVariable<DtString> myAppDataDir;
328 
329  // Semi-colon separated list of directories to load system scripts from
330  DtConfigVariable<DtString> myAdditionalSystemScriptsDirectory;
331 
332  // Process ID of the front-end that started us (combined mode)
333  DtConfigVariable<int> myFrontEndPID;
334 #ifndef WIN32
335  // Whether to start in daemon mode or not. (UNIX only)
336  DtConfigVariable<bool> myCmdDaemonMode;
338 #endif
339 
340 #if DtHLA
341  // HLA only - flag indicating whether or not to run in HLA time
342  // management mode.
343  DtConfigVariable<bool> myCmdRunInTimeManagementMode;
345 #endif
346 
347 #ifdef DtDIS
349 #endif
350 
351  // Port number for incoming files in the DtCgfDispatcher
353 
357 
358  // Default threshold values
362 
363  // Should the Cgf log performance (frame rate) stats or not
365 
367 
368  // Configure aggregate spatial model
373 
376 
377  // Start in run mode
379 
380 #ifdef WIN32
381  short myDoNotUseConsole;
382 #endif
383 
384  DtFilename myPluginsDirectory;
385 
386  // Parameters for command line only
387 #ifdef WIN32
388  DtConfigVariable<bool> myCmdNotUsingConsole;
389 #endif
390  DtConfigVariable<bool> myCmdStartInRunMode;
391  DtConfigVariable<bool> myCmdDoNotUsePluginsDirectory;
392  DtConfigVariable<bool> myCmdUseAbsoluteTimeStamps;
393 
394  DtConfigVariable<bool> myCmdLogFrameRateStatistics;
395  DtConfigVariable<DtString> myFrameRateStatisticsLogFile;
396 
397  DtMultiConfigVariable<DtString> myPluginFiles;
398 
399  std::vector<std::string> myPluginsToLoad;
401  DtConfigVariable<DtString> myOutputFile;
402 
403  // Parameter for processing sim mgmt PDUs
405 
407 
408  // Starting object console notify level. Default is 2
411 
412  DtConfigVariable<bool> myCmdFullyLoadTerrain;
414 
417 
419 
420  // Address of the network interface to use for non-DIS/HLA communication with GUI.
421  DtConfigVariable<DtString> myHostAddress;
422 
423  DtConfigVariable<DtString> myMsdlSidcMappingFile;
424  DtConfigVariable<DtString> myCountryCodesMappingFile;
425 
426  DtConfigVariable<bool> myCmdDisableCallbackQueue;
427  DtConfigVariable<int> myCmdNumCallbackThreads;
428  DtConfigVariable<bool> myCmdMainThreadWaitForQueue;
429  DtConfigVariable<bool> myCmdDisableParallelPreprocess;
430 
434 
435 #ifdef WIN32
436  DtConfigVariable<bool> myCmdSetMainThreadToHighPriority;
437  short mySetMainThreadToHighPriority;
438 #endif
439 #ifdef USE_VLD_MEMORY_TRACKING
440  DtConfigVariable<bool> myUseVld;
441 #endif
442 
443  DtConfigVariable<bool> myCmdDynamicFeaturesDisable;
445 };
446 
447 inline const std::vector<std::string>& DtVrfSimOptions::pluginsToLoad() const
448 {
449  return myPluginsToLoad;
450 }
451 

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)