VR-Forces 4.2 Class Documentation
vrfSimOptions.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2010 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 
15 
16 #include <vlutil/vlMachineTypes.h>
17 #include <vlutil/vlFilename.h>
18 #include <mtl/configVar.h>
19 #include <mtl/multiVar.h>
20 #include <mtl/lispEnv.h>
21 
22 #include <vrfExtObjects/vrfExtAppInit.h>
23 
25 {
26 public:
27  // Default constructor
28  DtVrfSimOptions(int argc, char** argv, const char* appName, const char* appVersion);
29 
30  // Destructor
31  virtual ~DtVrfSimOptions();
32 
33  // This function will read a configuration file and set all
34  // of the appropriate values in the options object.
35  virtual bool readConfigurationFile(const DtFilename& mtlFile);
36 
37 public:
38  // Returns the frequency of vrfObject update messages for entities
39  virtual DtFloat64 entVrfDataTimeThreshold() const;
40 
41  // Returns the frequency of heartbeat messages
42  virtual int statusUpdateHeartbeat() const;
43 
44  // Returns the default simulation model set to use to load
45  // parameter database, communication model, physical world
46  // parameters
47  virtual DtFilename simulationModelSetFilename() const;
48 
49  // Forces DtCgf::loadScenario to reload the parameter database
50  virtual bool forceParameterDbReload() const;
51 
52  // The frame rate above which the back-end will sleep in order to yield CPU
53  // time to other processes. Once the frame rate drops below this level, the
54  // back-end will no longer sleep. This parameter only takes effect when the
55  // simulation is running in variable frame mode.
56  // @{
57  virtual void setTargetFrameRate(int rate);
58  virtual int targetFrameRate() const;
59  // @}
60 
61  // Returns the default rotation threshold
62  virtual double rotationThreshold() const;
63 
64  // Returns the default translation threshold
65  virtual double translationThreshold() const;
66 
67  // Returns the default aggregate dimension threshold
68  virtual double aggDimensionThreshold() const;
69 
70  // Return true/false as to whether or not publish simulation time
71  // for stealth
72  virtual bool publishSimulationTimeForStealth() const;
73 
74  // Default path to search for parameter database files, when no path is
75  // specified in a given scenario file.
76  virtual void setDefaultParameterDatabasePath(const DtFilename& path);
77  virtual const DtFilename& defaultParameterDatabasePath() const;
78 
79  // Default path to search for terrain database files, when no path is
80  // specified in a given scenario file.
81  virtual void setDefaultTerrainDatabasePath(const DtFilename& path);
82  virtual const DtFilename& defaultTerrainDatabasePath() const;
83 
84  // DI-Guy configuration files
85  // Returns whether to use DI-Characters inside Vr-Forces
86  virtual bool useDIGuy() const;
87 
88  // Character data file generated from DI0Guy
89  virtual DtFilename diGuyCharacterDataFile() const;
90 
91  // Animations configuration file used to augment character data file
92  virtual DtFilename diGuyAnimationsFile() const;
93 
94  // Whether or not the frame rate statistics of the backend should be logged,
95  // presumably (but not definitely) to file.
96  virtual bool logFrameRateStats() const;
97  virtual void setLogFrameRateStats(bool yesOrNo);
98 
99  // Aggregate spatial model tick characteristis. Times are given in seconds
100 
101  // Indicates whether tick rates are to be specified using simulation time or
102  // real time. Default is false.
103  virtual bool aggregateSpatialModelTickPeriodUsesRealTime() const;
104  virtual void setAggregateSpatialModelTickPeriodUsesRealTime(bool yesOrNo);
105 
106  // Aggregate spatial model tick period in seconds. Default is 0.0 (tick as
107  // fast as possible).
108  virtual double aggregateSpatialModelTickPeriod() const;
109  virtual void setAggregateSpatialModelTickPeriod(double period);
110 
111  // Aggregate spatial model tick variance in seconds. Default is 0.0.
112  virtual double aggregateSpatialModelTickVariance() const;
113  virtual void setAggregateSpatialModelTickVariance(double variance);
114 
115  // Always tick as fast as possible while paused. Overrides above tick rate
116  // parameters for aggregate spatial model when simulation is paused. Default is true.
119 
120  virtual int sessionId() const;
121  virtual DtFilename batchFile() const;
122  virtual DtFilename scenarioFile() const;
123  virtual DtFilename terrainFile() const;
124 
126  virtual bool useAbsoluteTimeStamps() const;
127 
128  virtual int frontEndProcessId() const;
129 
130  virtual void setStartInRunMode(bool);
131  virtual bool startInRunMode() const;
132 
133 #ifdef WIN32
134  virtual void setDoNotUseConsole(bool);
135  virtual bool usingConsole() const;
136 #endif
137 
138  virtual void setDaemonMode(bool);
139  virtual bool daemonMode() const;
140 
141 #if DtHLA
142  // HLA only - run back-end in HLA time management mode.
143  virtual bool runInTimeManagementMode() const;
144  virtual void setRunInTimeManagementMode(bool yesNo);
145 #endif
146 
147 #if DtDIS
148  virtual double heartbeatVariance() const;
149  virtual void setHeartbeatVariance(double variance);
150 #endif
151 
152  // When parsing command line, is variables are set, copy them to "real" variables
153  virtual void parseCmdLine();
154 
155  virtual short simMgmtPduProcessLevel() const;
156 
157  virtual int cgfDispatcherReceivePort() const;
158  virtual void setCgfDispatcherReceivePort(int port);
159 
160  // Returns plugins to load
161  const std::vector<std::string>& pluginsToLoad() const;
162 
163  virtual void setLoadPluginIfVersionMismatch(bool);
164  virtual bool loadPluginIfVersionMismatch() const;
165 
166  virtual void setPluginsDirectory(const DtFilename&);
167  virtual const DtFilename& pluginsDirectory() const;
168 
170  virtual void setAdditionalSystemScriptsDirectory(const DtString&);
171 
173  virtual void setDoNotUsePluginsDirectory(bool b);
174  virtual bool doNotUsePluginsDirectory() const;
175 
177  virtual DtFilename outputFile() const;
178  virtual void setOutputFile(const DtFilename& s);
179 
180  // Sets the notify level for all streams managed by this console manager.
181  virtual void setNotifyLevel(DtNotifyLevelType level);
182  // \return The current notification level.
183  virtual DtNotifyLevelType notifyLevel() const;
184 
185  // If true, DtInfo, DtWarn, etc. log messages from the backend will
186  // be sent in comment interactions to the GUI. Default is true.
187  // \note This does not affect the object console logs, only the
188  // backend logs.
190  virtual void setSendBackendLogToNetwork(bool v);
191  virtual bool sendBackendLogToNetwork() const;
193 
194  // If true, terrain subpages will be fully loaded instead of on demand
196  virtual void setFullyLoadTerrain(bool v);
197  virtual bool fullyLoadTerrain() const;
199 
200  // If true, blocking terrain calls will cause an assert when a debug back-end
201  // is in run mode.
203  virtual void setAssertOnBlockingTerrainCalls(bool b);
204  virtual bool assertOnBlockingTerrainCalls() const;
206 
207  // The address of the network interface to be used for non HLA/DIS
208  // communications with the GUI.
209  // Defaults to a null string, indicating that VRF will automatically detect
210  // the network interface.
212  virtual void setHostAddress(const DtString& address);
213  virtual DtString hostAddress() const;
215 
216  // Mapping file for SIDC to Dis Enumerations
218  virtual void setMsdlSIDCMappingFile(const DtString& address);
219  virtual DtFilename msdlSIDCMappingFile() const;
221 
222  // Mapping file for Country Codes to Dis Enumerations
224  virtual void setCountryCodesMappingFile(const DtString& address);
225  virtual DtFilename countryCodesMappingFile() const;
227 
229  virtual void outputMtl();
230 
231 
232 protected:
233  // This routine will tell the myMtlEnv object what variables to expect
234  // to read from the mtl file. Modify this routine to add your new
235  // variables. This routine is called from loadMtlFile().
236  virtual void initializeMtlParams();
237 
238  // This routine will set internal member variables from those
239  // read from the mtl file
240  virtual void setVariablesFromMtl();
241  virtual void processStringList(std::vector<DtString>& v, const std::vector<DtString>& list) const;
242 
243  // Initializes variables that can be used to check which plugins to load
244  virtual void initPluginVariables();
245 
246  // Process all .mtl files found in the supplied plugin directory to see which plugins to load
247  virtual void processPluginsDirectory(const DtFilename& directory);
248 
249 private:
250  // Copy constructor; not implemented
251  DtVrfSimOptions(const DtVrfSimOptions& orig);
252 
253  // Assignment operator; not implemented
255 
256 protected:
257  // The name of an alternate parameter database file to load upon startup.
258  DtConfigVariable<DtString> mySimulationModelSetFile;
259 
260  // Filename of batch file to load at startup.
261  DtConfigVariable<DtString> myBatchFile;
262 
263  // Cgf tick performance parameters
264  DtConfigVariable<int> myTargetFrameRate;
265 
266  // Integer session Id. Applications with a common session Id must share
267  // the same terrain database, and are capable of controlling one another
268  // through interface messages.
269  DtConfigVariable<int> mySessionId;
270 
271  // The name of a scenario (.scn) file to load upon startup (optional)
272  DtConfigVariable<DtString> myScenarioFile;
273 
274  // The name of a terrain file to load upon startup (optional - new scenario)
275  DtConfigVariable<DtString> myTerrainFile;
276 
277  // Set true to use DI-Guy Characters in Vr-Forces
278  short myUseDIGuy;
279 
280  // Configuration files for setting up DI-Guy characters
281  DtConfigVariable<DtString> myDIGuyCharacterDataFile;
282  DtConfigVariable<DtString> myDIGuyAnimationsFile;
283 
284  // MTL file to load. Note this is here only for --help purposes as this
285  // variable is parsed outside of the normal parsing routine
286  DtConfigVariable<DtString> mySettingsFile;
287 
288  // Semi-colon separated list of directories to load system scripts from
289  DtConfigVariable<DtString> myAdditionalSystemScriptsDirectory;
290 
291  // Process ID of the front-end that started us (combined mode)
292  DtConfigVariable<int> myFrontEndPID;
293 #ifndef WIN32
294  // Whether to start in daemon mode or not. (UNIX only)
295  DtConfigVariable<bool> myCmdDaemonMode;
297 #endif
298 
299 #if DtHLA
300  // HLA only - flag indicating whether or not to run in HLA time
301  // management mode.
302  DtConfigVariable<bool> myCmdRunInTimeManagementMode;
304 #endif
305 
306 #ifdef DtDIS
308 #endif
309 
310  // Port number for incoming files in the DtCgfDispatcher
312 
316 
317  // Default threshold values
321 
322  // Should the Cgf log performance (frame rate) stats or not
324 
325  // Configure aggregate spatial model
330 
332 
335 
336  // Start in run mode
338 
339 #ifdef WIN32
340  short myDoNotUseConsole;
341 #endif
342 
343  DtFilename myPluginsDirectory;
344 
345  // Parameters for command line only
346 #ifdef WIN32
347  DtConfigVariable<bool> myCmdNotUsingConsole;
348 #endif
349  DtConfigVariable<bool> myCmdStartInRunMode;
350  DtConfigVariable<bool> myCmdDoNotUsePluginsDirectory;
351  DtConfigVariable<bool> myCmdLogFrameRateStatistics;
352  DtConfigVariable<bool> myCmdUseAbsoluteTimeStamps;
353 
354  DtMultiConfigVariable<DtString> myPluginFiles;
355 
356  std::vector<std::string> myPluginsToLoad;
358  DtConfigVariable<DtString> myOutputFile;
359 
360  // Parameter for processing sim mgmt PDUs
362 
364 
365  // Starting object console notify level. Default is 2
368 
369  DtConfigVariable<bool> myCmdFullyLoadTerrain;
371 
373 
375 
376  // Address of the network interface to use for non-DIS/HLA communication with GUI.
377  DtConfigVariable<DtString> myHostAddress;
378 
379  DtConfigVariable<DtString> myMsdlSIDCMappingFile;
380  DtConfigVariable<DtString> myCountryCodesMappingFile;
381 };
382 
383 inline const std::vector<std::string>& DtVrfSimOptions::pluginsToLoad() const
384 {
385  return myPluginsToLoad;
386 }
387 

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)