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  virtual void listSnapshots();
108 
109 public:
110 
111  //-------------------------------------------------------
112  //Text callback functions
113  //-------------------------------------------------------
114 
115  //Called in response to "list"
116  static void listCmd(char* s, DtTextInterface* a);
117 
118  //Called in response to "load"
119  static void loadCmd(char* s, DtTextInterface* a);
120  //Called by DtVrfRemoteController::loadScenario when back-ends are missing
121  static bool missingBackends(DtBackendMap* map, void* usr);
122 
123  //Called in response to "new"
124  static void newCmd(char* s, DtTextInterface* a);
125 
126  //Called in response to "save"
127  static void saveCmd(char* s, DtTextInterface* a);
128 
129  //Called in response to "create"
130  static void createCmd(char* s, DtTextInterface* a);
131 
132  //Called in response to "set"
133  static void setCmd(char* s, DtTextInterface* a);
134 
135  //Called in response to "task"
136  static void taskCmd(char* s, DtTextInterface* a);
137 
138  //Called in response to "aggregate"
139  static void aggregateCmd(char* s, DtTextInterface* a);
140 
141  //Called in response to "delete"
142  static void deleteCmd(char* s, DtTextInterface* a);
143 
144  //Called in response to "close"
145  static void closeCmd(char* s, DtTextInterface* a);
146 
147  //Called in response to "monitor"
148  static void monitorResourcesCmd(char* s, DtTextInterface* a);
149 
150  //Called in response to "unmonitor"
151  static void removeMonitorResourcesCmd(char* s, DtTextInterface* a);
152 
153  //Called in response to "rewind"
154  static void rewindCmd(char* s, DtTextInterface* a);
155 
156  //Called in response to "run"
157  static void runCmd(char* s, DtTextInterface* a);
158 
159  //Called in response to "pause"
160  static void pauseCmd(char* s, DtTextInterface* a);
161 
162  //Called in response to "simrun"
163  static void simrunCmd(char* s, DtTextInterface* a);
164 
165  //Called in response to "simpause"
166  static void simpauseCmd(char* s, DtTextInterface* a);
167 
168  //Called in response to "timemultipler"
169  static void timemultiplierCmd(char* s, DtTextInterface* a);
170 
171  //Called in response to "quit" or "q"
172  static void quitCmd(char* s, DtTextInterface* a);
173 
174  //Called in response to "help" or "?" or "h"
175  static void helpCmd(char* s, DtTextInterface* a);
176 
177  //Called in response to "help" or "?" or "h"
178  static void bigRouteCmd(char* s, DtTextInterface* a);
179 
180  //Called in response to "listsnapshots"
181  static void listSnapshotsCmd(char* s, DtTextInterface* a);
182 
183  //Called in response to "takesnapshot"
184  static void takeSnapshotCmd(char* s, DtTextInterface* a);
185 
186  //Called in response to "turnonsnapshots"
187  static void turnOnSnapshotsCmd(char* s, DtTextInterface* a);
188 
189  //Called in response to "turnoffsnapshots"
190  static void turnOffSnapshotsCmd(char* s, DtTextInterface* a);
191 
192  //Called in response to "rollback"
193  static void rollbackToSnapshotCmd(char* s, DtTextInterface* a);
194 
195  //-------------------------------------------------------
196  //DtVrfRemoteController callback functions
197  //-------------------------------------------------------
198 
199  //Backend arrival/departure callbacks
200  static void backendAddedCb(const DtSimulationAddress& addr, void* usr);
201  static void backendRemovedCb(const DtSimulationAddress& addr, void* usr);
202 
203  //Backend loaded/saved callbacks
204  static void backendLoadedCb(const DtSimulationAddress& addr, void* usr);
205  static void backendSavedCb(const DtSimulationAddress& addr,
206  DtSaveResult result, void* usr);
207 
208  //Scenario loaded/saved callbacks
209  static void ScenarioLoadedCb(void* usr);
210  static void ScenarioSavedCb(void* usr);
211 
212  //VR-Forces object created callback
213  static void vrfObjectCreatedCb(
214  const DtString& name, const DtEntityIdentifier& id, const DtUUID& uuid, void* usr);
215 
216  //Plan callbacks
217  static void planCb(const DtUUID& name,
218  const std::vector<DtSimStatement*>& statements, bool append, void* usr);
219  static void planStmtCb(const DtUUID& id, DtPlanStatus status, void* usr);
220  static void planCompleteCb(const DtUUID& id, void* usr);
221 
222  //Callback used to process monitor resource responses
223  static void resourcesProcessedCb(DtSimMessage* msg, void* usr);
224 
225  //Callback for list of current snapshots
226  static void scenarioSnapshotResponseCb(DtSimMessage* msg, void* usr);
227 
228  //Callback used to receive object console messages from the remote control
229  //API.
230  static void objectConsoleMessageCb(const DtEntityIdentifier& id,
231  int notifyLevel, const DtString& message, void* usr);
232 
233 protected:
234 
235  //Present commmand line interface.
236  void prompt();
237 
238  //Parse user input, call corresponding function
239  void processCmd(char *buff);
240 
241 protected:
242 
245  DtSelectParam sparam;
246  static unsigned int theNextAggregateId;
247  static unsigned int theNextSubordinateId;
248 
249 private:
251 };
252 
253 
254 #endif
255 

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)