VR-Forces Development_Version 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) 2015 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 
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  virtual bool enableDebugDrawer() const;
99  virtual void setEnableDebugDrawer(bool enable);
100 
101  virtual bool enableNavigationLabDebugging() const;
102  virtual void setEnableNavigationLabDebugging(bool enable);
103 
104  // Sets whether or not to publish zero velocity (and acceleration) when paused. Default
105  // is true
106  virtual void setPublishZeroVelocityWhenPaused(bool);
107  virtual bool publishZeroVelocityWhenPaused() const;
108 
109  // When the simulation is paused set the dead reckoning algorithm for aggregates and entities to static.
110  // This turned on in conjunction with publishZeroVelocityWhenPaused turn off will pause the objects
111  // in a VR-Forces run simulation and still show current values for velocity, speed, acceleration, etc.
113  virtual bool setDeadReckoningAlgorithmToStaticOnPause() const;
114 
115  // Aggregate spatial model tick characteristics. Times are given in seconds
116  // Indicates whether tick rates are to be specified using simulation time or
117  // real time. Default is false.
118  virtual bool aggregateSpatialModelTickPeriodUsesRealTime() const;
119  virtual void setAggregateSpatialModelTickPeriodUsesRealTime(bool yesOrNo);
120 
121  // Aggregate spatial model tick period in seconds. Default is 0.0 (tick as
122  // fast as possible).
123  virtual double aggregateSpatialModelTickPeriod() const;
124  virtual void setAggregateSpatialModelTickPeriod(double period);
125 
126  // Aggregate spatial model tick variance in seconds. Default is 0.0.
127  virtual double aggregateSpatialModelTickVariance() const;
128  virtual void setAggregateSpatialModelTickVariance(double variance);
129 
130  // Always tick as fast as possible while paused. Overrides above tick rate
131  // parameters for aggregate spatial model when simulation is paused. Default is true.
134 
135  virtual int sessionId() const;
136  virtual DtFilename batchFile() const;
137  virtual DtFilename scenarioFile() const;
138  virtual DtFilename terrainFile() const;
139 
141  virtual bool useAbsoluteTimeStamps() const;
142 
143  virtual int frontEndProcessId() const;
144 
145  virtual void setStartInRunMode(bool);
146  virtual bool startInRunMode() const;
147 
148 #ifdef WIN32
149  virtual void setDoNotUseConsole(bool);
150  virtual bool usingConsole() const;
151 
152  virtual void setStartMinimized(bool);
153  virtual bool startMinimized() const;
154 #endif
155 
156  virtual void setDaemonMode(bool);
157  virtual bool daemonMode() const;
158 
159 #if DtHLA
160  // HLA only - run back-end in HLA time management mode.
161  virtual bool runInTimeManagementMode() const;
162  virtual void setRunInTimeManagementMode(bool yesNo);
163 #endif
164 
165 #if DtDIS
166  virtual double heartbeatVariance() const;
167  virtual void setHeartbeatVariance(double variance);
168 #endif
169 
170  virtual void setReuseEntityIdentifiersOnScenarioLoad(bool);
171  virtual bool reuseEntityIdentifiersOnScenarioLoad() const;
172 
173  virtual void setTaskVisualizationPublicationMode(short state);
174  virtual short taskVisualizationPublicationMode() const;
175 
176  virtual void setUseDrawControlForTaskVisualizations(bool);
177  virtual bool useDrawControlForTaskVisualizations() const;
178 
179  // When parsing command line, is variables are set, copy them to "real" variables
180  virtual void parseCmdLine();
181 
182  virtual short simMgmtPduProcessLevel() const;
183 
184  virtual int cgfDispatcherReceivePort() const;
185  virtual void setCgfDispatcherReceivePort(int port);
186 
187  // Returns plugins to load
188  const std::vector<std::string>& pluginsToLoad() const;
189 
190  virtual void setLoadPluginIfVersionMismatch(bool);
191  virtual bool loadPluginIfVersionMismatch() const;
192 
193  virtual void setPluginsDirectory(const DtFilename&);
194  virtual const DtFilename& pluginsDirectory() const;
195 
197  virtual void setAdditionalSystemScriptsDirectory(const DtString&);
198 
200  virtual void setDoNotUsePluginsDirectory(bool b);
201  virtual bool doNotUsePluginsDirectory() const;
202 
204  virtual DtFilename outputFile() const;
205  virtual void setOutputFile(const DtFilename& s);
206 
207  // Sets the notify level for all streams managed by this console manager.
208  virtual void setNotifyLevel(DtNotifyLevelType level);
209  // \return The current notification level.
210  virtual DtNotifyLevelType notifyLevel() const;
211 
212  // If true, DtInfo, DtWarn, etc. log messages from the backend will
213  // be sent in comment interactions to the GUI. Default is true.
214  // \note This does not affect the object console logs, only the
215  // backend logs.
217  virtual void setSendBackendLogToNetwork(bool v);
218  virtual bool sendBackendLogToNetwork() const;
220 
221  // If true, terrain subpages will be fully loaded instead of on demand
223  virtual void setFullyLoadTerrain(bool v);
224  virtual bool fullyLoadTerrain() const;
226 
227  // If true, blocking terrain calls will cause an assert when a debug back-end
228  // is in run mode.
230  virtual void setAssertOnBlockingTerrainCalls(bool b);
231  virtual bool assertOnBlockingTerrainCalls() const;
233 
234  // The address of the network interface to be used for non HLA/DIS
235  // communications with the GUI.
236  // Defaults to a null string, indicating that VRF will automatically detect
237  // the network interface.
239  virtual void setHostAddress(const DtString& address);
240  virtual DtString hostAddress() const;
242 
245  virtual void setAppDataDir(const DtString&);
246  virtual DtString appDataDir() const;
248 
251  virtual void setDataDir(const DtString&);
252  virtual DtString dataDir() const;
254 
257  virtual void setUserDataDir(const DtString&);
258  virtual DtString userDataDir() const;
260 
261  // Mapping file for SIDC to Dis Enumerations
263  virtual void setMsdlSidcMappingFile(const DtString& address);
264  virtual DtFilename msdlSidcMappingFile() const;
266 
267  // Mapping file for Country Codes to Dis Enumerations
269  virtual void setCountryCodesMappingFile(const DtString& address);
270  virtual DtFilename countryCodesMappingFile() const;
272 
279  virtual void setNonVrfObjectsUUIDScheme(const DtString&);
280  virtual DtString nonVrfObjectsUUIDScheme() const;
282 
284  virtual void outputMtl();
285 #if USE_VLD_MEMORY_TRACKING && _DEBUG
286  virtual bool useVld() const;
287 #endif
288 
289  virtual void setDisableCallbackQueue(bool enable);
290  virtual void setMainThreadWaitForQueue(bool enable);
291  virtual void setNumCallbackThreads(unsigned n);
292  virtual void setDisableParallelTick(bool use);
293 
294  virtual bool disableCallbackQueue() const;
295  virtual bool mainThreadWaitForQueue() const;
296  virtual unsigned numCallbackThreads() const;
297  virtual bool disableParallelTick() const;
298 
299  virtual void setGamewareMemorySize(int sizeInMb);
300  virtual int gamewareMemorySize() const;
301 
302 #ifdef WIN32
303 
304  virtual void setMainThreadToHighPriority(bool);
305 #endif
306 
308  virtual std::vector<DtString> enabledChannels() const;
309 
310 protected:
311  // This routine will tell the myMtlEnv object what variables to expect
312  // to read from the mtl file. Modify this routine to add your new
313  // variables. This routine is called from loadMtlFile().
314  virtual void initializeMtlParams();
315 
316  // This routine will set internal member variables from those
317  // read from the mtl file
318  virtual void setVariablesFromMtl();
319  virtual void processStringList(std::vector<DtString>& v, const std::vector<DtString>& list) const;
320 
321  // Initializes variables that can be used to check which plugins to load
322  virtual void initPluginVariables();
323 
324  // Process all .mtl files found in the supplied plugin directory to see which plugins to load
325  virtual void processPluginsDirectory(const DtFilename& directory);
326 
327 private:
328  // Copy constructor; not implemented
329  DtVrfSimOptions(const DtVrfSimOptions& orig);
330 
331  // Assignment operator; not implemented
333 
334 protected:
335  // The name of an alternate parameter database file to load upon startup.
336  DtConfigVariable<DtString> mySimulationModelSetFile;
337 
338  // Filename of batch file to load at startup.
339  DtConfigVariable<DtString> myBatchFile;
340 
341  // Cgf tick performance parameters
342  DtConfigVariable<int> myTargetFrameRate;
343 
344  // Integer session Id. Applications with a common session Id must share
345  // the same terrain database, and are capable of controlling one another
346  // through interface messages.
347  DtConfigVariable<int> mySessionId;
348 
349  // The name of a scenario (.scn) file to load upon startup (optional)
350  DtConfigVariable<DtString> myScenarioFile;
351 
352  // The name of a terrain file to load upon startup (optional - new scenario)
353  DtConfigVariable<DtString> myTerrainFile;
354 
355  // Set true to use DI-Guy Characters in Vr-Forces
356  short myUseDIGuy;
357 
358  // Configuration files for setting up DI-Guy characters
359  DtConfigVariable<DtString> myDIGuyCharacterDataFile;
360  DtConfigVariable<DtString> myDIGuyAnimationsFile;
361 
362  // MTL file to load. Note this is here only for --help purposes as this
363  // variable is parsed outside of the normal parsing routine
364  DtConfigVariable<DtString> mySettingsFile;
365 
366  // Where the app data directory is located
367  DtConfigVariable<DtString> myAppDataDir;
368 
369  // Where the data directory is located
370  DtConfigVariable<DtString> myDataDir;
371 
372  // Where the user data directory is located
373  DtConfigVariable<DtString> myUserDataDir;
374 
375  // Semi-colon separated list of directories to load system scripts from
376  DtConfigVariable<DtString> myAdditionalSystemScriptsDirectory;
377 
378  // Process ID of the front-end that started us (combined mode)
379  DtConfigVariable<int> myFrontEndPID;
380 #ifndef WIN32
381  // Whether to start in daemon mode or not. (UNIX only)
382  DtConfigVariable<bool> myCmdDaemonMode;
384 #endif
385 
386 #if DtHLA
387  // HLA only - flag indicating whether or not to run in HLA time
388  // management mode.
389  DtConfigVariable<bool> myCmdRunInTimeManagementMode;
391 #endif
392 
393 #ifdef DtDIS
395 #endif
396 
398 
399  // Port number for incoming files in the DtCgfDispatcher
401 
405 
406  // Default threshold values
410 
411  // Should the Cgf log performance (frame rate) stats or not
413 
415 
417 
418  // Configure aggregate spatial model
423 
426 
427  // Start in run mode
429 
430 #ifdef WIN32
431  short myDoNotUseConsole;
432  short myStartMinimized;
433 #endif
434 
435  DtFilename myPluginsDirectory;
436 
437  // Parameters for command line only
438 #ifdef WIN32
439  DtConfigVariable<bool> myCmdNotUsingConsole;
440  DtConfigVariable<bool> myCmdStartMinimized;
441 #endif
442  DtConfigVariable<bool> myCmdStartInRunMode;
443  DtConfigVariable<bool> myCmdDoNotUsePluginsDirectory;
444  DtConfigVariable<bool> myCmdUseAbsoluteTimeStamps;
445 
446  DtConfigVariable<bool> myCmdLogFrameRateStatistics;
447 
448  DtMultiConfigVariable<DtString> myPluginFiles;
449 
450  DtMultiConfigVariable<DtString> myEnabledChannels;
451 
452  std::vector<std::string> myPluginsToLoad;
454  DtConfigVariable<DtString> myOutputFile;
455 
456  // Parameter for processing sim mgmt PDUs
458 
460 
461  // Starting object console notify level. Default is 2
464 
465  DtConfigVariable<bool> myCmdFullyLoadTerrain;
467 
471 
473 
474  // Address of the network interface to use for non-DIS/HLA communication with GUI.
475  DtConfigVariable<DtString> myHostAddress;
476 
477  DtConfigVariable<DtString> myMsdlSidcMappingFile;
478  DtConfigVariable<DtString> myCountryCodesMappingFile;
479  DtConfigVariable<DtString> myNonVrfObjectsUUIDScheme;
480 
481  DtConfigVariable<bool> myCmdDisableCallbackQueue;
482  DtConfigVariable<int> myCmdNumCallbackThreads;
483  DtConfigVariable<bool> myCmdMainThreadWaitForQueue;
484  DtConfigVariable<bool> myCmdDisableParallelTick;
485 
489 
490 #ifdef WIN32
491  DtConfigVariable<bool> myCmdSetMainThreadToHighPriority;
492  short mySetMainThreadToHighPriority;
493 #endif
494 #if USE_VLD_MEMORY_TRACKING && _DEBUG
495  DtConfigVariable<bool> myUseVld;
496 #endif
497 
500 
502 };
503 
504 inline const std::vector<std::string>& DtVrfSimOptions::pluginsToLoad() const
505 {
506  return myPluginsToLoad;
507 }
508 

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)