VR-Forces 4.1.1 Class Documentation
textIf.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2002 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: textIf.h,v $ $Revision: 1.13 $ $State: Exp $
7 *******************************************************************************/
8 
9 #ifndef DtTextInterface_H_
10 #define DtTextInterface_H_
11 
12 #include <vlutil/vlUtil.h>
14 
15 //This class provides a text interface for controlling VR-Forces over the network.
16 //This interface currently supports the following actions:
17 //
18 //1. load <filename>
19 // load a scenario file
20 
21 //2. save <filename>
22 // save the current scenario
23 
24 //3. new <db filename>
25 // create a new scenario
26 
27 //4. close
28 // close the current scenario
29 
30 //5. rewind
31 // rewind the current scenario to its start state
32 
33 //6. run
34 // sends a message interface request to run the current scenario
35 
36 //6a. simrun
37 // sends a sim mgmt start PDU to run the current scenario
38 
39 //7. simpause
40 // sends a sim mgmt stop PDU to pause the current scenario
41 
42 //7a. pause
43 // sends a sim mgmt pause request to pause the current scenario
44 
45 //8. list
46 // list all the backends that are currently running
47 
48 //9. create [ waypoint | route | tank | aggregate]
49 // create a VR-Forces waypoint, route, tank, or tank aggregate
50 
51 //10. delete [ <object_name> | <object_id> ]
52 // delete a VR-Forces object by name or by object ID
53 
54 //11. set [ plan | label | location | fuel | target | restore ]
55 // set a VR-Forces object attribute
56 
57 //12. task [ patrolRoute | moveToPoint | follow | wait ]
58 // task a VR-Forces entity
59 
60 //13. aggregate "name1" "name2" "name3"
61 // aggregate 3 VR-Forces entities together
62 
63 //14. quit
64 // quit the application
65 
66 
67 class DtTextInterface
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 "quit" or "q"
168  static void quitCmd(char* s, DtTextInterface* a);
169 
170  //Called in response to "help" or "?" or "h"
171  static void helpCmd(char* s, DtTextInterface* a);
172 
173  //Called in response to "help" or "?" or "h"
174  static void bigRouteCmd(char* s, DtTextInterface* a);
175 
176 
177  //-------------------------------------------------------
178  //DtVrfRemoteController callback functions
179  //-------------------------------------------------------
180 
181  //Backend arrival/departure callbacks
182  static void backendAddedCb(const DtSimulationAddress& addr, void* usr);
183  static void backendRemovedCb(const DtSimulationAddress& addr, void* usr);
184 
185  //Backend loaded/saved callbacks
186  static void backendLoadedCb(const DtSimulationAddress& addr, void* usr);
187  static void backendSavedCb(const DtSimulationAddress& addr,
188  DtSaveResult result, void* usr);
189 
190  //Scenario loaded/saved callbacks
191  static void ScenarioLoadedCb(void* usr);
192  static void ScenarioSavedCb(void* usr);
193 
194  //VR-Forces object created callback
195  static void vrfObjectCreatedCb(
196  const DtString& name, const DtEntityIdentifier& id, void* usr);
197 
198  //Plan callbacks
199  static void planCb(const DtString& name,
200  const DtList& stmts, bool append, void* usr);
201  static void planStmtCb(const DtString& id, DtPlanStatus status, void* usr);
202  static void planCompleteCb(const DtString& id, void* usr);
203 
204  //Callback used to process monitor resource responses
205  static void resourcesProcessedCb(DtSimMessage* msg, void* usr);
206 
207  //Callback used to receive object console messages from the remote control
208  //API.
209  static void objectConsoleMessageCb(const DtEntityIdentifier& id,
210  int notifyLevel, const DtString& message, void* usr);
211 
212 protected:
213 
214  //Present commmand line interface.
215  void prompt();
216 
217  //Parse user input, call corresponding function
218  void processCmd(char *buff);
219 
220 protected:
221 
222  bool myTimeToQuit;
224  DtSelectParam sparam;
225  static unsigned int theNextAggregateId;
226  static unsigned int theNextSubordinateId;
227 
228 private:
230 };
231 
232 
233 #endif
234 

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)