VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
textIf.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #ifndef DtTextInterface_H_
7 #define DtTextInterface_H_
8 
9 #include <vlutil/vlUtil.h>
11 
12 //This class provides a text interface for controlling VR-Forces over the network.
13 //This interface currently supports the following actions:
14 //
15 //1. load <filename>
16 // load a scenario file
17 
18 //2. save <filename>
19 // save the current scenario
20 
21 //3. new <db filename>
22 // create a new scenario
23 
24 //4. close
25 // close the current scenario
26 
27 //5. rewind
28 // rewind the current scenario to its start state
29 
30 //6. run
31 // sends a message interface request to run the current scenario
32 
33 //6a. simrun
34 // sends a sim mgmt start PDU to run the current scenario
35 
36 //7. simpause
37 // sends a sim mgmt stop PDU to pause the current scenario
38 
39 //7a. pause
40 // sends a sim mgmt pause request to pause the current scenario
41 
42 //8. list
43 // list all the backends that are currently running
44 
45 //9. create [ waypoint | route | tank | aggregate]
46 // create a VR-Forces waypoint, route, tank, or tank aggregate
47 
48 //10. delete [ <object_name> | <object_id> ]
49 // delete a VR-Forces object by name or by object ID
50 
51 //11. set [ plan | label | location | fuel | target | restore ]
52 // set a VR-Forces object attribute
53 
54 //12. task [ patrolRoute | moveToPoint | follow | wait ]
55 // task a VR-Forces entity
56 
57 //13. aggregate "name1" "name2" "name3"
58 // aggregate 3 VR-Forces entities together
59 
60 //14. timemultiplier
61 // sets the time multiplier on the exercise clock
62 
63 //15. quit
64 // quit the application
65 
66 
68 {
69 public:
70 
71  //constructor
73 
74  //destructor
75  virtual ~DtTextInterface();
76 
77  //Process entered text
78  void readStdin();
79 
80  //Set/Get time to quit
81  virtual void setTimeToQuit(bool yesNo);
82  virtual bool timeToQuit() const;
83 
84  //Get remote vrf controller pointer
85  virtual DtVrfRemoteController* controller() const;
86 
87 public:
88 
89  //Functions for parsing command strings and calling
90  //the corresponding methods on DtVrfRemoteController.
91 
92  virtual void createWaypoint(char* str);
93  virtual void createRoute(char* str);
94  virtual void createTank(char* str);
95  virtual void createAggregate(char* str);
96  virtual void setPlan(char* str);
97  virtual void setLabel(char* str);
98  virtual void setLocation(char* str);
99  virtual void setFuel(char* str);
100  virtual void setTarget(char* str);
101  virtual void setRestore(char* str);
102  virtual void patrolRoute(char* str);
103  virtual void moveToPoint(char* str);
104  virtual void follow(char* str);
105  virtual void wait(char* str);
106  virtual void bigRoute(int iPoints);
107 
108 public:
109 
110  //-------------------------------------------------------
111  //Text callback functions
112  //-------------------------------------------------------
113 
114  //Called in response to "list"
115  static void listCmd(char* s, DtTextInterface* a);
116 
117  //Called in response to "load"
118  static void loadCmd(char* s, DtTextInterface* a);
119  //Called by DtVrfRemoteController::loadScenario when back-ends are missing
120  static bool missingBackends(DtBackendMap* map, void* usr);
121 
122  //Called in response to "new"
123  static void newCmd(char* s, DtTextInterface* a);
124 
125  //Called in response to "save"
126  static void saveCmd(char* s, DtTextInterface* a);
127 
128  //Called in response to "create"
129  static void createCmd(char* s, DtTextInterface* a);
130 
131  //Called in response to "set"
132  static void setCmd(char* s, DtTextInterface* a);
133 
134  //Called in response to "task"
135  static void taskCmd(char* s, DtTextInterface* a);
136 
137  //Called in response to "aggregate"
138  static void aggregateCmd(char* s, DtTextInterface* a);
139 
140  //Called in response to "delete"
141  static void deleteCmd(char* s, DtTextInterface* a);
142 
143  //Called in response to "close"
144  static void closeCmd(char* s, DtTextInterface* a);
145 
146  //Called in response to "monitor"
147  static void monitorResourcesCmd(char* s, DtTextInterface* a);
148 
149  //Called in response to "unmonitor"
150  static void removeMonitorResourcesCmd(char* s, DtTextInterface* a);
151 
152  //Called in response to "rewind"
153  static void rewindCmd(char* s, DtTextInterface* a);
154 
155  //Called in response to "run"
156  static void runCmd(char* s, DtTextInterface* a);
157 
158  //Called in response to "pause"
159  static void pauseCmd(char* s, DtTextInterface* a);
160 
161  //Called in response to "simrun"
162  static void simrunCmd(char* s, DtTextInterface* a);
163 
164  //Called in response to "simpause"
165  static void simpauseCmd(char* s, DtTextInterface* a);
166 
167  //Called in response to "timemultipler"
168  static void timemultiplierCmd(char* s, DtTextInterface* a);
169 
170  //Called in response to "quit" or "q"
171  static void quitCmd(char* s, DtTextInterface* a);
172 
173  //Called in response to "help" or "?" or "h"
174  static void helpCmd(char* s, DtTextInterface* a);
175 
176  //Called in response to "help" or "?" or "h"
177  static void bigRouteCmd(char* s, DtTextInterface* a);
178 
179 
180  //-------------------------------------------------------
181  //DtVrfRemoteController callback functions
182  //-------------------------------------------------------
183 
184  //Backend arrival/departure callbacks
185  static void backendAddedCb(const DtSimulationAddress& addr, void* usr);
186  static void backendRemovedCb(const DtSimulationAddress& addr, void* usr);
187 
188  //Backend loaded/saved callbacks
189  static void backendLoadedCb(const DtSimulationAddress& addr, void* usr);
190  static void backendSavedCb(const DtSimulationAddress& addr,
191  DtSaveResult result, void* usr);
192 
193  //Scenario loaded/saved callbacks
194  static void ScenarioLoadedCb(void* usr);
195  static void ScenarioSavedCb(void* usr);
196 
197  //VR-Forces object created callback
198  static void vrfObjectCreatedCb(
199  const DtString& name, const DtEntityIdentifier& id, const DtUUID& uuid, void* usr);
200 
201  //Plan callbacks
202  static void planCb(const DtUUID& name,
203  const std::vector<DtSimStatement*>& statements, bool append, void* usr);
204  static void planStmtCb(const DtUUID& id, DtPlanStatus status, void* usr);
205  static void planCompleteCb(const DtUUID& id, void* usr);
206 
207  //Callback used to process monitor resource responses
208  static void resourcesProcessedCb(DtSimMessage* msg, void* usr);
209 
210  //Callback used to receive object console messages from the remote control
211  //API.
212  static void objectConsoleMessageCb(const DtEntityIdentifier& id,
213  int notifyLevel, const DtString& message, void* usr);
214 
215 protected:
216 
217  //Present commmand line interface.
218  void prompt();
219 
220  //Parse user input, call corresponding function
221  void processCmd(char *buff);
222 
223 protected:
224 
227  DtSelectParam sparam;
228  static unsigned int theNextAggregateId;
229  static unsigned int theNextSubordinateId;
230 
231 private:
233 };
234 
235 
236 #endif
237 

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)