VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 
102  virtual void setRejectMismatchedScenarioMessages(bool);
103  virtual bool rejectMismatchedScenarioMessages() const;
104 
105  virtual bool enableNavigationLabDebugging() const;
106  virtual void setEnableNavigationLabDebugging(bool enable);
107 
108  // Sets whether or not to publish zero velocity (and acceleration) when paused. Default
109  // is true
110  virtual void setPublishZeroVelocityWhenPaused(bool);
111  virtual bool publishZeroVelocityWhenPaused() const;
112 
113  // When the simulation is paused set the dead reckoning algorithm for aggregates and entities to static.
114  // This turned on in conjunction with publishZeroVelocityWhenPaused turn off will pause the objects
115  // in a VR-Forces run simulation and still show current values for velocity, speed, acceleration, etc.
117  virtual bool setDeadReckoningAlgorithmToStaticOnPause() const;
118 
119  // Aggregate spatial model tick characteristics. Times are given in seconds
120  // Indicates whether tick rates are to be specified using simulation time or
121  // real time. Default is false.
122  virtual bool aggregateSpatialModelTickPeriodUsesRealTime() const;
123  virtual void setAggregateSpatialModelTickPeriodUsesRealTime(bool yesOrNo);
124 
125  // Aggregate spatial model tick period in seconds. Default is 0.0 (tick as
126  // fast as possible).
127  virtual double aggregateSpatialModelTickPeriod() const;
128  virtual void setAggregateSpatialModelTickPeriod(double period);
129 
130  // Aggregate spatial model tick variance in seconds. Default is 0.0.
131  virtual double aggregateSpatialModelTickVariance() const;
132  virtual void setAggregateSpatialModelTickVariance(double variance);
133 
134  // Always tick as fast as possible while paused. Overrides above tick rate
135  // parameters for aggregate spatial model when simulation is paused. Default is true.
138 
139  virtual int sessionId() const;
140  virtual DtFilename batchFile() const;
141  virtual DtFilename scenarioFile() const;
142  virtual DtFilename terrainFile() const;
143 
145  virtual bool useAbsoluteTimeStamps() const;
146 
147  virtual int frontEndProcessId() const;
148 
149  virtual void setStartInRunMode(bool);
150  virtual bool startInRunMode() const;
151 
152 #ifdef WIN32
153  virtual void setDoNotUseConsole(bool);
154  virtual bool usingConsole() const;
155 
156  virtual void setStartMinimized(bool);
157  virtual bool startMinimized() const;
158 #endif
159 
160  virtual void setDaemonMode(bool);
161  virtual bool daemonMode() const;
162 
163 #if DtHLA
164  // HLA only - run back-end in HLA time management mode.
165  virtual bool runInTimeManagementMode() const;
166  virtual void setRunInTimeManagementMode(bool yesNo);
167 #endif
168 
169 #if DtDIS
170  virtual double heartbeatVariance() const;
171  virtual void setHeartbeatVariance(double variance);
172 
173  virtual std::vector<DtString> additionalDestinationAddresses() const;
174 
176  virtual void setAdditionalDestinationAddresses(const DtString& addresses);
177 
179  virtual void setAdditionalDestinationAddresses(const std::vector<DtString>& addresses);
180 #endif
181 
182  virtual void setReuseEntityIdentifiersOnScenarioLoad(bool);
183  virtual bool reuseEntityIdentifiersOnScenarioLoad() const;
184 
185  virtual void setTaskVisualizationPublicationMode(short state);
186  virtual short taskVisualizationPublicationMode() const;
187 
188  virtual void setUseDrawControlForTaskVisualizations(bool);
189  virtual bool useDrawControlForTaskVisualizations() const;
190 
191  // When parsing command line, is variables are set, copy them to "real" variables
192  virtual void parseCmdLine();
193 
194  virtual short simMgmtPduProcessLevel() const;
195 
196  virtual int cgfDispatcherReceivePort() const;
197  virtual void setCgfDispatcherReceivePort(int port);
198 
199  // Returns plugins to load
200  const std::vector<std::string>& pluginsToLoad() const;
201 
202  virtual void setLoadPluginIfVersionMismatch(bool);
203  virtual bool loadPluginIfVersionMismatch() const;
204 
205  virtual void setPluginsDirectory(const DtFilename&);
206  virtual const DtFilename& pluginsDirectory() const;
207 
209  virtual void setAdditionalSystemScriptsDirectory(const DtString&);
210 
212  virtual void setDoNotUsePluginsDirectory(bool b);
213  virtual bool doNotUsePluginsDirectory() const;
214 
216  virtual DtFilename outputFile() const;
217  virtual void setOutputFile(const DtFilename& s);
218 
219  // Sets the notify level for all streams managed by this console manager.
220  virtual void setNotifyLevel(DtNotifyLevelType level);
221  // \return The current notification level.
222  virtual DtNotifyLevelType notifyLevel() const;
223 
224  // If true, DtInfo, DtWarn, etc. log messages from the backend will
225  // be sent in comment interactions to the GUI. Default is true.
226  // \note This does not affect the object console logs, only the
227  // backend logs.
229  virtual void setSendBackendLogToNetwork(bool v);
230  virtual bool sendBackendLogToNetwork() const;
232 
233  // If true, terrain subpages will be fully loaded instead of on demand
235  virtual void setFullyLoadTerrain(bool v);
236  virtual bool fullyLoadTerrain() const;
238 
239  // If true, blocking terrain calls will cause an assert when a debug back-end
240  // is in run mode.
242  virtual void setAssertOnBlockingTerrainCalls(bool b);
243  virtual bool assertOnBlockingTerrainCalls() const;
245 
246  // The address of the network interface to be used for non HLA/DIS
247  // communications with the GUI.
248  // Defaults to a null string, indicating that VRF will automatically detect
249  // the network interface.
251  virtual void setHostAddress(const DtString& address);
252  virtual DtString hostAddress() const;
254 
255  // The address of the network interface to be used for non HLA/DIS
256  // communications, as reported to the GUI or remote controller.
257  // Defaults to a null string, indicating that VRF will report the hostAddress.
259  virtual void setReportedHostAddress(const DtString& address);
260  virtual DtString reportedHostAddress() const;
262 
265  virtual void setAppDataDir(const DtString&);
266  virtual DtString appDataDir() const;
268 
271  virtual void setDataDir(const DtString&);
272  virtual DtString dataDir() const;
274 
277  virtual void setUserDataDir(const DtString&);
278  virtual DtString userDataDir() const;
280 
281  // Mapping file for SIDC to Dis Enumerations
283  virtual void setMsdlSidcMappingFile(const DtString& address);
284  virtual DtFilename msdlSidcMappingFile() const;
286 
287  // Mapping file for Country Codes to Dis Enumerations
289  virtual void setCountryCodesMappingFile(const DtString& address);
290  virtual DtFilename countryCodesMappingFile() const;
292 
299  virtual void setNonVrfObjectsUUIDScheme(const DtString&);
300  virtual DtString nonVrfObjectsUUIDScheme() const;
302 
304  virtual void outputMtl();
305 #if USE_VLD_MEMORY_TRACKING && _DEBUG
306  virtual bool useVld() const;
307 #endif
308 
309  virtual void setMainThreadWaitForQueue(bool enable);
310  virtual void setNumCallbackThreads(unsigned n);
311  virtual void setDisableParallelTick(bool use);
312 
313  virtual bool mainThreadWaitForQueue() const;
314  virtual unsigned numCallbackThreads() const;
315  virtual bool disableParallelTick() const;
316 
317  virtual void setGamewareMemorySize(int sizeInMb);
318  virtual int gamewareMemorySize() const;
319 
320  virtual void setRegenerateNavigationDataAtRuntime(bool v);
321  virtual bool regenerateNavigationDataAtRuntime() const;
322 
323  virtual void setMaxNavigationRegenerationThreads(int threads);
324  virtual int maxNavigationRegenerationThreads() const;
325 
326  virtual void setNavigationRegenerationDelay(double delay);
327  virtual double navigationRegenerationDelay() const;
328 
329  virtual void setEnableLogFileTimestamps(bool v);
330  virtual bool enableLogFileTimestamps() const;
331 
332 #ifdef WIN32
333 
334  virtual void setMainThreadToHighPriority(bool);
335 #endif
336 
338  virtual std::vector<DtString> enabledChannels() const;
339 
340 protected:
341  // This routine will tell the myMtlEnv object what variables to expect
342  // to read from the mtl file. Modify this routine to add your new
343  // variables. This routine is called from loadMtlFile().
344  virtual void initializeMtlParams();
345 
346  // This routine will set internal member variables from those
347  // read from the mtl file
348  virtual void setVariablesFromMtl();
349  virtual void processStringList(std::vector<DtString>& v, const std::vector<DtString>& list) const;
350 
351  // Initializes variables that can be used to check which plugins to load
352  virtual void initPluginVariables();
353 
354  // Process all .mtl files found in the supplied plugin directory to see which plugins to load
355  virtual void processPluginsDirectory(const DtFilename& directory);
356 
357 private:
358  // Copy constructor; not implemented
359  DtVrfSimOptions(const DtVrfSimOptions& orig);
360 
361  // Assignment operator; not implemented
363 
364 protected:
365  // The name of an alternate parameter database file to load upon startup.
366  DtConfigVariable<DtString> mySimulationModelSetFile;
367 
368  // Filename of batch file to load at startup.
369  DtConfigVariable<DtString> myBatchFile;
370 
371  // Cgf tick performance parameters
372  DtConfigVariable<int> myTargetFrameRate;
373 
374  // Integer session Id. Applications with a common session Id must share
375  // the same terrain database, and are capable of controlling one another
376  // through interface messages.
377  DtConfigVariable<int> mySessionId;
378 
379  // The name of a scenario (.scn) file to load upon startup (optional)
380  DtConfigVariable<DtString> myScenarioFile;
381 
382  // The name of a terrain file to load upon startup (optional - new scenario)
383  DtConfigVariable<DtString> myTerrainFile;
384 
385  // Set true to use DI-Guy Characters in Vr-Forces
386  short myUseDIGuy;
387 
388  // Configuration files for setting up DI-Guy characters
389  DtConfigVariable<DtString> myDIGuyCharacterDataFile;
390  DtConfigVariable<DtString> myDIGuyAnimationsFile;
391 
392  // MTL file to load. Note this is here only for --help purposes as this
393  // variable is parsed outside of the normal parsing routine
394  DtConfigVariable<DtString> mySettingsFile;
395 
396  // Where the app data directory is located
397  DtConfigVariable<DtString> myAppDataDir;
398 
399  // Where the data directory is located
400  DtConfigVariable<DtString> myDataDir;
401 
402  // Where the user data directory is located
403  DtConfigVariable<DtString> myUserDataDir;
404 
405  // Semi-colon separated list of directories to load system scripts from
406  DtConfigVariable<DtString> myAdditionalSystemScriptsDirectory;
407 
408  // Process ID of the front-end that started us (combined mode)
409  DtConfigVariable<int> myFrontEndPID;
410 #ifndef WIN32
411  // Whether to start in daemon mode or not. (UNIX only)
412  DtConfigVariable<bool> myCmdDaemonMode;
414 #endif
415 
416 #if DtHLA
417  // HLA only - flag indicating whether or not to run in HLA time
418  // management mode.
419  DtConfigVariable<bool> myCmdRunInTimeManagementMode;
421 #endif
422 
423 #ifdef DtDIS
425 
427 #endif
428 
430 
431  // Port number for incoming files in the DtCgfDispatcher
433 
435 
439 
440  // Default threshold values
444 
445  // Should the Cgf log performance (frame rate) stats or not
447 
449 
451 
452  // Configure aggregate spatial model
457 
460 
461  // Start in run mode
463 
464 #ifdef WIN32
465  short myDoNotUseConsole;
466  short myStartMinimized;
467 #endif
468 
469  DtFilename myPluginsDirectory;
470 
471  // Parameters for command line only
472 #ifdef WIN32
473  DtConfigVariable<bool> myCmdNotUsingConsole;
474  DtConfigVariable<bool> myCmdStartMinimized;
475 #endif
476  DtConfigVariable<bool> myCmdStartInRunMode;
477  DtConfigVariable<bool> myCmdDoNotUsePluginsDirectory;
478  DtConfigVariable<bool> myCmdUseAbsoluteTimeStamps;
479 
480  DtConfigVariable<bool> myCmdLogFrameRateStatistics;
481 
482  DtMultiConfigVariable<DtString> myPluginFiles;
483 
484  DtMultiConfigVariable<DtString> myEnabledChannels;
485 
486  std::vector<std::string> myPluginsToLoad;
488  DtConfigVariable<DtString> myOutputFile;
489 
490  // Parameter for processing sim mgmt PDUs
492 
494 
495  // Starting object console notify level. Default is 2
498 
499  DtConfigVariable<bool> myCmdFullyLoadTerrain;
501 
505 
507 
508  // Address of the network interface to use for non-DIS/HLA communication with GUI.
509  DtConfigVariable<DtString> myHostAddress;
510 
511  DtConfigVariable<DtString> myMsdlSidcMappingFile;
512  DtConfigVariable<DtString> myCountryCodesMappingFile;
513  DtConfigVariable<DtString> myNonVrfObjectsUUIDScheme;
514 
515  DtConfigVariable<int> myCmdNumCallbackThreads;
516  DtConfigVariable<bool> myCmdMainThreadWaitForQueue;
517  DtConfigVariable<bool> myCmdDisableParallelTick;
518 
521 
522 #ifdef WIN32
523  DtConfigVariable<bool> myCmdSetMainThreadToHighPriority;
524  short mySetMainThreadToHighPriority;
525 #endif
526 #if USE_VLD_MEMORY_TRACKING && _DEBUG
527  DtConfigVariable<bool> myUseVld;
528 #endif
529 
532 
537 
539 
541 };
542 
543 inline const std::vector<std::string>& DtVrfSimOptions::pluginsToLoad() const
544 {
545  return myPluginsToLoad;
546 }
547 

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)