VR-Forces 4.5 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 #pragma once
7 
8 #include <vlutil/vlUtil.h>
10 
11 //This class provides a text interface for controlling VR-Forces over the network.
12 //This interface currently supports the following actions:
13 //
14 //1. load <filename>
15 // load a scenario file
16 
17 //2. save <filename>
18 // save the current scenario
19 
20 //3. new <db filename>
21 // create a new scenario
22 
23 //4. close
24 // close the current scenario
25 
26 //5. rewind
27 // rewind the current scenario to its start state
28 
29 //6. run
30 // sends a message interface request to run the current scenario
31 
32 //6a. simrun
33 // sends a sim mgmt start PDU to run the current scenario
34 
35 //7. simpause
36 // sends a sim mgmt stop PDU to pause the current scenario
37 
38 //7a. pause
39 // sends a sim mgmt pause request to pause the current scenario
40 
41 //8. list
42 // list all the backends that are currently running
43 
44 //9. create [ waypoint | route | tank | aggregate]
45 // create a VR-Forces waypoint, route, tank, or tank aggregate
46 
47 //10. delete [ <object_name> | <object_id> ]
48 // delete a VR-Forces object by name or by object ID
49 
50 //11. set [ plan | label | location | fuel | target | restore ]
51 // set a VR-Forces object attribute
52 
53 //12. task [ patrolRoute | moveToPoint | follow | wait ]
54 // task a VR-Forces entity
55 
56 //13. aggregate "name1" "name2" "name3"
57 // aggregate 3 VR-Forces entities together
58 
59 //14. timemultiplier
60 // sets the time multiplier on the exercise clock
61 
62 //15. quit
63 // quit the application
64 
65 
67 {
68 public:
69 
70  //constructor
72 
73  //destructor
74  virtual ~DtTextInterface();
75 
76  //Process entered text
77  void readStdin();
78 
79  //Set/Get time to quit
80  virtual void setTimeToQuit(bool yesNo);
81  virtual bool timeToQuit() const;
82 
83  //Get remote vrf controller pointer
84  virtual DtVrfRemoteController* controller() const;
85 
86 public:
87 
88  //Functions for parsing command strings and calling
89  //the corresponding methods on DtVrfRemoteController.
90 
91  virtual void createWaypoint(char* str);
92  virtual void createRoute(char* str);
93  virtual void createTank(char* str);
94  virtual void createAggregate(char* str);
95  virtual void setPlan(char* str);
96  virtual void setLabel(char* str);
97  virtual void setLocation(char* str);
98  virtual void setFuel(char* str);
99  virtual void setTarget(char* str);
100  virtual void setRestore(char* str);
101  virtual void patrolRoute(char* str);
102  virtual void moveToPoint(char* str);
103  virtual void follow(char* str);
104  virtual void wait(char* str);
105  virtual void bigRoute(int iPoints);
106  virtual void listSnapshots();
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  //Called in response to "listsnapshots"
180  static void listSnapshotsCmd(char* s, DtTextInterface* a);
181 
182  //Called in response to "takesnapshot"
183  static void takeSnapshotCmd(char* s, DtTextInterface* a);
184 
185  //Called in response to "turnonsnapshots"
186  static void turnOnSnapshotsCmd(char* s, DtTextInterface* a);
187 
188  //Called in response to "turnoffsnapshots"
189  static void turnOffSnapshotsCmd(char* s, DtTextInterface* a);
190 
191  //Called in response to "rollback"
192  static void rollbackToSnapshotCmd(char* s, DtTextInterface* a);
193 
194  //-------------------------------------------------------
195  //DtVrfRemoteController callback functions
196  //-------------------------------------------------------
197 
198  //Backend arrival/departure callbacks
199  static void backendAddedCb(const DtSimulationAddress& addr, void* usr);
200  static void backendRemovedCb(const DtSimulationAddress& addr, void* usr);
201 
202  //Backend loaded/saved callbacks
203  static void backendLoadedCb(const DtSimulationAddress& addr, void* usr);
204  static void backendSavedCb(const DtSimulationAddress& addr,
205  DtSaveResult result, void* usr);
206 
207  //Scenario loaded/saved callbacks
208  static void ScenarioLoadedCb(void* usr);
209  static void ScenarioSavedCb(void* usr);
210 
211  //VR-Forces object created callback
212  static void vrfObjectCreatedCb(
213  const DtString& name, const DtEntityIdentifier& id, const DtUUID& uuid, void* usr);
214 
215  //Plan callbacks
216  static void planCb(const DtUUID& name,
217  const std::vector<DtSimStatement*>& statements, bool append, void* usr);
218  static void planStmtCb(const DtUUID& id, DtPlanStatus status, void* usr);
219  static void planCompleteCb(const DtUUID& id, void* usr);
220 
221  //Callback used to process monitor resource responses
222  static void resourcesProcessedCb(DtSimMessage* msg, void* usr);
223 
224  //Callback for list of current snapshots
225  static void scenarioSnapshotResponseCb(DtSimMessage* msg, void* usr);
226 
227  //Callback used to receive object console messages from the remote control
228  //API.
229  static void objectConsoleMessageCb(const DtEntityIdentifier& id,
230  int notifyLevel, const DtString& message, void* usr);
231 
233 
234 protected:
235 
236  //Present commmand line interface.
237  void prompt();
238 
239  //Parse user input, call corresponding function
240  void processCmd(char *buff);
241 
242 protected:
243 
246  DtSelectParam sparam;
247  static unsigned int theNextAggregateId;
248  static unsigned int theNextSubordinateId;
250 
251 private:
253 };

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)