VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vrfApp.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2001 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: vrfApp.h,v $ $Revision: 1.24 $ $State: Exp $
7 *******************************************************************************/
8 #ifndef vrfApp_H_
9 #define vrfApp_H_
10 
11 #include <vlutil/vlString.h>
12 #include <vlutil/vlList.h>
13 #include <vlutil/vlUtil.h>
14 #include <vl/hostStructs.h>
15 #include <vlutil/vlFilename.h>
16 #include <vl/rprFomMapper.h>
17 #include <vlutil/vlTime.h>
18 #include <vl/exerciseConn.h>
19 
20 class DtCgf;
21 class DtCgfDispatcher;
22 class DtExerciseConn;
23 class DtFomMapper;
24 class DtBatchManager;
25 class DtVrfCreator;
26 class DtVrfSimOptions;
27 #ifdef WIN32
28 class DtFilePrinter;
29 class DtWindowsConsolePrinter;
30 #endif
32 
33 // class DtVrfApp:
34 //
35 // Instances of DtVrfApp are the main class for the VR-Forces simulation
36 // back-end application.
37 
38 class DtVrfApp
39 {
40 public:
41 
42  // constructor
43  DtVrfApp(int argc, char** argv);
44 
45  // destructor
46  virtual ~DtVrfApp();
47 
48  // Initialization. Must be called before any other member functions
49  // are called.
50  virtual bool init(DtVrfCreator* creator = 0);
51 
52  // Main execution loop. Calls our DtCgf's tick(). Calls DtSleep() for a
53  // given time interval (the main loop sleep interval). Polls the keyboard
54  // for input. If a 'q' key press is received, exits the application.
55  virtual void mainLoop();
56 
57  // Accessor for the DtCgf
58  virtual DtCgf* cgf();
59 
60  // Accessor for the DtExerciseConn
61  virtual DtExerciseConn* exerciseConn();
62 
63 #ifdef WIN32
64  virtual void setConsoleWindow(HWND consoleWindow);
65 #endif
66 
67 protected:
68 
69  // Process mtl file. Also reads off mtl file (optionally) added to
70  // command line by -d command
71  virtual bool processMtlFile(int argc, char** argv);
72 
73  // Creates our cgf (called from init())
74  virtual DtCgf* createCgf(const DtSimulationAddress& addr, DtU32 sessionId);
75 
76  // Creates our simOptions (called from init())
78 
79  // This routine will read in the simulation options from the vrfSim.mtl
80  // file by default of the supplied filename
81  virtual bool readSimOptions(const DtFilename& mtlFile);
82 
83  // This routine will process the options read from the mtl file and set
84  // them in the appropriate places in the cgf. This method is called
85  // after the cgf has been initialized
86  virtual void processCgfOptions();
87 
88  // This routine will process app level options (parameter database, port,
89  // etc). This is called before processCgfOptions and before
90  // processCommandLine such that the command line options will take
91  // precedence over the .mtl options
92  virtual void processAppOptions();
93 
94  // Calls down to myCgf to schedule to load up all plugins from command line and vrfSim.mtl
95  virtual void addPluginsToLoad();
96 
97  // Print out collected frame rate stats to file
98  virtual void logFrameRateStats();
99 
100  // Gets keyboard input and sends it to console command manager.
101  // Returns false if mainloop should exit.
102  // Called during mainloop.
103  virtual bool processKeyboardInput();
104 
105  // Ticks subcomponents. Returns false is mainloop should exit.
106  // Called during mainloop.
107  virtual bool tick();
108 
109 private:
110  // copy constructor - not implemented
111  DtVrfApp(const DtVrfApp& orig);
112 
113  // assignment operator - not implemented
114  DtVrfApp& operator=(const DtVrfApp& orig);
115 
116 protected:
117 
118  // Our DIS/RPR (site id, application id) simulation address that
119  // uniquely identifies our application in an exercise.
120  DtSimulationAddress mySimAddress;
121 
122  // VR-Link exercise connection. Provides means by which all network
123  // interactions (PDUs/HLA objects and interactions) are sent/recieved.
124  DtExerciseConn* myExerciseConn;
125 
126  // Command line arguments are cached in our constructor so we can process
127  // them later in init().
128  int myArgc;
129  char** myArgv;
130 
131  // Driver for our CGF object that responds to network messages
133 
134  // Driver for CGF Object that handles execution of scenario batches.
136 
137  // Options that are read in from the vrfSim.mtl file
139 
141 
142 #ifdef WIN32
143  HWND myConsoleWindow;
144 
145  // Writes diagnostics to vrfSim.log
146  DtFilePrinter* myFilePrinter;
147 #endif
148 
149  // Publishes all diagnostics to network in comment interactions.
151 
153 };
154 
155 #endif
156 
157 

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)