VR-Forces 4.1.1 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 
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  // When parsing command line, is variables are set, copy them to "real" variables
148  virtual void parseCmdLine();
149 
150  virtual short simMgmtPduProcessLevel() const;
151 
152  virtual int cgfDispatcherReceivePort() const;
153  virtual void setCgfDispatcherReceivePort(int port);
154 
155  // Returns plugins to load
156  const std::vector<std::string>& pluginsToLoad() const;
157 
158  virtual void setLoadPluginIfVersionMismatch(bool);
159  virtual bool loadPluginIfVersionMismatch() const;
160 
161  virtual void setPluginsDirectory(const DtFilename&);
162  virtual const DtFilename& pluginsDirectory() const;
163 
165  virtual void setAdditionalSystemScriptsDirectory(const DtString&);
166 
168  virtual void setDoNotUsePluginsDirectory(bool b);
169  virtual bool doNotUsePluginsDirectory() const;
170 
172  virtual DtFilename outputFile() const;
173  virtual void setOutputFile(const DtFilename& s);
174 
175  // Sets the notify level for all streams managed by this console manager.
176  virtual void setNotifyLevel(DtNotifyLevelType level);
177  // \return The current notification level.
178  virtual DtNotifyLevelType notifyLevel() const;
179 
180  // If true, DtInfo, DtWarn, etc. log messages from the backend will
181  // be sent in comment interactions to the GUI. Default is true.
182  // \note This does not affect the object console logs, only the
183  // backend logs.
185  virtual void setSendBackendLogToNetwork(bool v);
186  virtual bool sendBackendLogToNetwork() const;
188 
189  // If true, terrain subpages will be fully loaded instead of on demand
191  virtual void setFullyLoadTerrain(bool v);
192  virtual bool fullyLoadTerrain() const;
194 
195  // If true, blocking terrain calls will cause an assert when a debug back-end
196  // is in run mode.
198  virtual void setAssertOnBlockingTerrainCalls(bool b);
199  virtual bool assertOnBlockingTerrainCalls() const;
201 
202  // The address of the network interface to be used for non HLA/DIS
203  // communications with the GUI.
204  // Defaults to a null string, indicating that VRF will automatically detect
205  // the network interface.
207  virtual void setHostAddress(const DtString& address);
208  virtual DtString hostAddress() const;
210 
211  // Mapping file for SIDC to Dis Enumerations
213  virtual void setMsdlSIDCMappingFile(const DtString& address);
214  virtual DtFilename msdlSIDCMappingFile() const;
216 
217  // Mapping file for Country Codes to Dis Enumerations
219  virtual void setCountryCodesMappingFile(const DtString& address);
220  virtual DtFilename countryCodesMappingFile() const;
222 
224  virtual void outputMtl();
225 
226 
227 protected:
228  // This routine will tell the myMtlEnv object what variables to expect
229  // to read from the mtl file. Modify this routine to add your new
230  // variables. This routine is called from loadMtlFile().
231  virtual void initializeMtlParams();
232 
233  // This routine will set internal member variables from those
234  // read from the mtl file
235  virtual void setVariablesFromMtl();
236  virtual void processStringList(std::vector<DtString>& v, const std::vector<DtString>& list) const;
237 
238  // Initializes variables that can be used to check which plugins to load
239  virtual void initPluginVariables();
240 
241  // Process all .mtl files found in the supplied plugin directory to see which plugins to load
242  virtual void processPluginsDirectory(const DtFilename& directory);
243 
244 private:
245  // Copy constructor; not implemented
246  DtVrfSimOptions(const DtVrfSimOptions& orig);
247 
248  // Assignment operator; not implemented
250 
251 protected:
252  // The name of an alternate parameter database file to load upon startup.
253  DtConfigVariable<DtString> mySimulationModelSetFile;
254 
255  // Filename of batch file to load at startup.
256  DtConfigVariable<DtString> myBatchFile;
257 
258  // Cgf tick performance parameters
259  DtConfigVariable<int> myTargetFrameRate;
260 
261  // Integer session Id. Applications with a common session Id must share
262  // the same terrain database, and are capable of controlling one another
263  // through interface messages.
264  DtConfigVariable<int> mySessionId;
265 
266  // The name of a scenario (.scn) file to load upon startup (optional)
267  DtConfigVariable<DtString> myScenarioFile;
268 
269  // The name of a terrain file to load upon startup (optional - new scenario)
270  DtConfigVariable<DtString> myTerrainFile;
271 
272  // Set true to use DI-Guy Characters in Vr-Forces
273  short myUseDIGuy;
274 
275  // Configuration files for setting up DI-Guy characters
276  DtConfigVariable<DtString> myDIGuyCharacterDataFile;
277  DtConfigVariable<DtString> myDIGuyAnimationsFile;
278 
279  // MTL file to load. Note this is here only for --help purposes as this
280  // variable is parsed outside of the normal parsing routine
281  DtConfigVariable<DtString> mySettingsFile;
282 
283  // Semi-colon separated list of directories to load system scripts from
284  DtConfigVariable<DtString> myAdditionalSystemScriptsDirectory;
285 
286  // Process ID of the front-end that started us (combined mode)
287  DtConfigVariable<int> myFrontEndPID;
288 #ifndef WIN32
289  // Whether to start in daemon mode or not. (UNIX only)
290  DtConfigVariable<bool> myCmdDaemonMode;
292 #endif
293 
294 #if DtHLA
295  // HLA only - flag indicating whether or not to run in HLA time
296  // management mode.
297  DtConfigVariable<bool> myCmdRunInTimeManagementMode;
299 #endif
300 
301  // Port number for incoming files in the DtCgfDispatcher
303 
307 
308  // Default threshold values
312 
313  // Should the Cgf log performance (frame rate) stats or not
315 
316  // Configure aggregate spatial model
321 
323 
326 
327  // Start in run mode
329 
330 #ifdef WIN32
331  short myDoNotUseConsole;
332 #endif
333 
334  DtFilename myPluginsDirectory;
335 
336  // Parameters for command line only
337 #ifdef WIN32
338  DtConfigVariable<bool> myCmdNotUsingConsole;
339 #endif
340  DtConfigVariable<bool> myCmdStartInRunMode;
341  DtConfigVariable<bool> myCmdDoNotUsePluginsDirectory;
342  DtConfigVariable<bool> myCmdLogFrameRateStatistics;
343  DtConfigVariable<bool> myCmdUseAbsoluteTimeStamps;
344 
345  DtMultiConfigVariable<DtString> myPluginFiles;
346 
347  std::vector<std::string> myPluginsToLoad;
349  DtConfigVariable<DtString> myOutputFile;
350 
351  // Parameter for processing sim mgmt PDUs
353 
355 
356  // Starting object console notify level. Default is 2
359 
360  DtConfigVariable<bool> myCmdFullyLoadTerrain;
362 
364 
366 
367  // Address of the network interface to use for non-DIS/HLA communication with GUI.
368  DtConfigVariable<DtString> myHostAddress;
369 
370  DtConfigVariable<DtString> myMsdlSIDCMappingFile;
371  DtConfigVariable<DtString> myCountryCodesMappingFile;
372 };
373 
374 inline const std::vector<std::string>& DtVrfSimOptions::pluginsToLoad() const
375 {
376  return myPluginsToLoad;
377 }
378 

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)