MAK Data Logger API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
lgrSystemDriver.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
9 #ifndef lgrSystemDriver_H_
10 #define lgrSystemDriver_H_
11 
12 #include <lgrCore/lgrCore.h>
13 #include <lgrCmds/lgrCommand.h>
15 #include <lgrCore/lgrDriver.h>
16 #include <lgrUtil/lgrExceptions.h>
19 #include <lgrUtil/threadSafe.h>
20 
21 #include <map>
22 #include <set>
23 #include <list>
24 
25 namespace MAKLogger
26 {
27 
28  class DtLgrDynamicLibrary;
29  class DtLgrSystemCommandFactory;
30  class DtLogger;
31  class DtMessagePipeline;
32  class DtRuntimeCommandFactory;
33  class DtLgrProtocolRegistration;
35 
36  typedef std::list<DtBoost::shared_ptr<DtLgrDynamicLibrary> > DtLibraryList;
37 
42  {
43  public:
45 
46  enum NasmpMode
47  {
49  NasmpMode_Snnf
50  };
51 
52  enum NasmpFlag
53  {
54  NasmpFlag_Fast
55  };
56 
57  public:
59 
60 
61  virtual ~DtLgrSystemDriver();
62 
64  virtual void tick();
65 
69  void init(DtLgrProtocolRegistration*);
70 
72  virtual bool timeToShutdown() const;
73 
75  virtual void submitCommand(const DtCommand& command);
76 
78  DtCommandDispatcherSP dispatcher();
79 
84  DtMessagePipeline* requestPipeline(DtLgrCommandHandler*);
85 
91  bool releasePipeline();
92 
94  const DtLgrCommandHandler* pipelineOwner() const;
95 
97  const DtMessagePipeline* pipeline() const;
98 
100  DtMessagePipeline* pipeline();
101 
103  void setPipelineDriver(DtLgrDomainId domain);
104 
106  virtual bool wasListeningOnIdle() const;
107 
109  virtual bool isListeningOnIdle() const;
110 
114  void addDriver(DtLgrCommandType, DtLgrCommandHandlerSP driver);
115 
118  DtLgrCommandHandlerSP getCommandHandler(const DtLgrCommandType& type);
119 
122  bool removeDriver(DtLgrCommandType type);
123 
125  void setSimManager(DtLgrSimManager*);
126 
128  const DtLgrSimManager* simManager() const;
129 
130  DtLgrSimManager* simManager();
131 
133  virtual void loadPluginLibrary(const DtString& filename);
134 
136  void setNotifyLevel(int vlLevel,int lgrLevel);
137 
139  void setBasicGuiFlag(bool basic);
140 
142  void issueTextCommand(const DtString& textCommand);
143 
145  void setEntityTracking(bool enableEntityTracking);
146 
148  bool entityTracking() const;
149 
151  void setFastJumpsWithoutDiff(bool enableFastJumpsWithoutDiff);
152 
154  bool fastJumpsWithoutDiff() const;
155 
157  void setPlaybackReadTimeLimit(double readTimeLimit);
158 
160  double playbackReadTimeLimit() const;
161 
163  void setNasmpMode (const DtString& nasmpMode);
164 
166  int notifyLevel() const;
167 
169  bool basicGuiFlag()const;
170 
172  DtString nasmpModeString() const;
173 
175  NasmpMode nasmpMode() const;
176 
178  bool nasmpFlag(NasmpFlag flag);
179 
181  void sendMessage(const DtString& message);
182 
184  DtRuntimeCommandFactory* runtimeCommandFactory();
185 
187  const DtLibraryList& libraries() const;
188 
190 
191  DtLogger* logger();
192  const DtLogger* logger() const;
194 
196  DtThreadSafe<bool>* cancelLongOperationFlag();
197 
199  void startLongOperation(const DtString& name,bool interruptible);
200 
202  void updateLongOperation(const DtString& message,int progress);
203 
205  void finishLongOperation();
206 
208  void cancelLongOperation();
209 
211  bool isLongOperationCanceled() const;
212 
215  protected:
216  DtResponse shutdownCommand(const DtCommand& command);
217  DtResponse cancelShutdown(const DtCommand& command);
218  DtResponse createDriver(const DtCommand& command);
219  DtResponse loadPlugin(const DtCommand& command);
220  DtResponse setNotifyLevel(const DtCommand& command);
221  DtResponse setBasicGuiFlag(const DtCommand& command);
222  DtResponse setPlaybackReadTimeLimit(const DtCommand& command);
223  DtResponse setEntityTracking(const DtCommand& command);
224  DtResponse setFastJumpsWithoutDiff(const DtCommand& command);
225  DtResponse setNasmpMode(const DtCommand& command);
226  DtResponse deleteFile(const DtCommand& command);
227  DtResponse installOutputListener(const DtCommand& command);
229  DtResponse issueTextCommand(const DtCommand& command);
230  DtResponse helpCommand(const DtCommand& command);
231  DtResponse infoCommand(const DtCommand& command);
232  DtResponse setTempDir(const DtCommand& command);
233  DtResponse setDefaultTapeDirectory(const DtCommand& command);
234 
235 
236  protected:
237  //Type definitions
238  typedef DtU32 NasmpFlags;
239 
240  static const int NasmpModeMask = 0x0f;
241  static const int NasmpModeNone = 0x00;
242  static const int NasmpModeSnnf = 0x01;
243 
244  static const int NasmpFlagMask = 0xf0;
245  static const int NasmpFlagFast = 0x10;
246 
247  typedef DtResponse (DtLgrSystemDriver::*CommandHandler)(const DtCommand&);
248  typedef std::map<DtLgrCommandId,CommandHandler> DtCommandMap;
249  typedef std::map<DtLgrCommandType,DtLgrCommandHandlerSP> DtDriverMap;
251 
252  virtual void unloadLibraries();
253 
255  void registerCommandHandler(const DtCommandDefinition&,CommandHandler);
256 
258  virtual void tickDrivers();
259 
261  virtual void lockDrivers();
262 
264  virtual void unlockDrivers();
265 
267  virtual void processCommands();
268 
270  virtual DtString commandDescription( const DtString& commandName) const;
271 
274  void lookupCommandId(DtCommand& command);
275 
277  virtual void processCommand(const DtCommand& command);
278 
279  protected:
281  DtLogger* myParentLogger;
282 
283  DtCommandMap myCommandMap;
286  DtDriverList myDriverList;
287  DtDriverMap myDriverMap;
288  DtCommandDispatcherSP myDispatcher;
289  DtMessagePipeline* myPipeline;
290  DtLgrCommandHandler* myPipelineOwner;
291 
292  DtLgrSimManager* mySimManager;
293 
294  DtRuntimeCommandFactory* myRuntimeCommandFactory;
295 
296  DtLibraryList myLibraries;
297 
299  bool myShutdownFlag;
300 
302  bool myBasicGuiFlag;
303 
305  DtString myNasmpMode;
306 
308  bool myEntityTracking;
309 
311  bool myFastJumpsWithoutDiff;
312 
313  DtMutex myCommandHandlerMutex;
314 
315  DtThreadSafe<bool> myCancelLongOperationFlag;
316 
317  NasmpFlags myNasmpFlags;
318  };
319 
320 }
321 
322 #endif

Document ID: Generated on Tue Aug 1 09:00:26 EDT 2017 from SVN revision 179128
Copyright © 2017 VT MÄK. All Rights Reserved (www.mak.com)