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

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)