MAK Data Logger API Documentation for HLA
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.h"
13 #include "lgrCommand.h"
14 #include "lgrCommandDispatcher.h"
15 #include "lgrDriver.h"
16 #include "lgrExceptions.h"
18 #include "virtualConstructor.h"
19 #include "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  typedef std::list<DtBoost::shared_ptr<DtLgrDynamicLibrary> > DtLibraryList;
36 
41  {
42  public:
44 
45  enum NasmpMode
46  {
48  NasmpMode_Snnf
49  };
50 
51  enum NasmpFlag
52  {
53  NasmpFlag_Fast
54  };
55 
56  public:
58 
59 
60  virtual ~DtLgrSystemDriver();
61 
63  virtual void tick();
64 
68  void init(DtLgrProtocolRegistration*);
69 
71  virtual bool timeToShutdown() const;
72 
74  virtual void submitCommand(const DtCommand& command);
75 
77  DtCommandDispatcherSP dispatcher();
78 
83  DtMessagePipeline* requestPipeline(DtLgrCommandHandler*);
84 
90  bool releasePipeline();
91 
93  const DtLgrCommandHandler* pipelineOwner() const;
94 
96  const DtMessagePipeline* pipeline() const;
97 
99  void setPipelineDriver(DtLgrDomainId domain);
100 
104  void addDriver(DtLgrCommandType, DtLgrCommandHandlerSP driver);
105 
108  DtLgrCommandHandlerSP getCommandHandler(const DtLgrCommandType& type);
109 
112  bool removeDriver(DtLgrCommandType type);
113 
115  void setSimManager(DtLgrSimManager*);
116 
118  const DtLgrSimManager* simManager() const;
119 
120  DtLgrSimManager* simManager();
121 
123  virtual void loadPluginLibrary(const DtString& filename);
124 
126  void setNotifyLevel(int vlLevel,int lgrLevel);
127 
129  void setBasicGuiFlag(bool basic);
130 
132  void issueTextCommand(const DtString& textCommand);
133 
135  void setEntityTracking(bool enableEntityTracking);
136 
138  bool entityTracking() const;
139 
141  void setFastJumpsWithoutDiff(bool enableFastJumpsWithoutDiff);
142 
144  bool fastJumpsWithoutDiff() const;
145 
147  void setPlaybackReadTimeLimit(double readTimeLimit);
148 
150  double playbackReadTimeLimit() const;
151 
153  void setNasmpMode (const DtString& nasmpMode);
154 
156  int notifyLevel() const;
157 
159  bool basicGuiFlag()const;
160 
162  DtString nasmpModeString() const;
163 
165  NasmpMode nasmpMode() const;
166 
168  bool nasmpFlag(NasmpFlag flag);
169 
171  void sendMessage(const DtString& message);
172 
174  DtRuntimeCommandFactory* runtimeCommandFactory();
175 
177  const DtLibraryList& libraries() const;
178 
180 
181  DtLogger* logger();
182  const DtLogger* logger() const;
184 
186  DtThreadSafe<bool>* cancelLongOperationFlag();
187 
189  void startLongOperation(const DtString& name,bool interruptible);
190 
192  void updateLongOperation(const DtString& message,int progress);
193 
195  void finishLongOperation();
196 
198  void cancelLongOperation();
199 
201  bool isLongOperationCanceled() const;
202 
205  protected:
206  DtResponse shutdownCommand(const DtCommand& command);
207  DtResponse cancelShutdown(const DtCommand& command);
208  DtResponse createDriver(const DtCommand& command);
209  DtResponse loadPlugin(const DtCommand& command);
210  DtResponse setNotifyLevel(const DtCommand& command);
211  DtResponse setBasicGuiFlag(const DtCommand& command);
212  DtResponse setPlaybackReadTimeLimit(const DtCommand& command);
213  DtResponse setEntityTracking(const DtCommand& command);
214  DtResponse setFastJumpsWithoutDiff(const DtCommand& command);
215  DtResponse setNasmpMode(const DtCommand& command);
216  DtResponse deleteFile(const DtCommand& command);
217  DtResponse installOutputListener(const DtCommand& command);
219  DtResponse issueTextCommand(const DtCommand& command);
220  DtResponse helpCommand(const DtCommand& command);
221  DtResponse infoCommand(const DtCommand& command);
222  DtResponse setTempDir(const DtCommand& command);
223  DtResponse setDefaultTapeDirectory(const DtCommand& command);
224 
225 
226  protected:
227  //Type definitions
228  typedef DtU32 NasmpFlags;
229 
230  static const int NasmpModeMask = 0x0f;
231  static const int NasmpModeNone = 0x00;
232  static const int NasmpModeSnnf = 0x01;
233 
234  static const int NasmpFlagMask = 0xf0;
235  static const int NasmpFlagFast = 0x10;
236 
237  typedef DtResponse (DtLgrSystemDriver::*CommandHandler)(const DtCommand&);
238  typedef std::map<DtLgrCommandId,CommandHandler> DtCommandMap;
239  typedef std::map<DtLgrCommandType,DtLgrCommandHandlerSP> DtDriverMap;
241 
242  virtual void unloadLibraries();
243 
245  void registerCommandHandler(const DtCommandDefinition&,CommandHandler);
246 
248  virtual void tickDrivers();
249 
251  virtual void lockDrivers();
252 
254  virtual void unlockDrivers();
255 
257  virtual void processCommands();
258 
260  virtual DtString commandDescription( const DtString& commandName) const;
261 
264  void lookupCommandId(DtCommand& command);
265 
267  virtual void processCommand(const DtCommand& command);
268 
269  protected:
271  DtLogger* myParentLogger;
272 
273  DtCommandMap myCommandMap;
276  DtDriverList myDriverList;
277  DtDriverMap myDriverMap;
278  DtCommandDispatcherSP myDispatcher;
279  DtMessagePipeline* myPipeline;
280  DtLgrCommandHandler* myPipelineOwner;
281 
282  DtLgrSimManager* mySimManager;
283 
284  DtRuntimeCommandFactory* myRuntimeCommandFactory;
285 
286  DtLibraryList myLibraries;
287 
289  bool myShutdownFlag;
290 
292  bool myBasicGuiFlag;
293 
295  DtString myNasmpMode;
296 
298  bool myEntityTracking;
299 
301  bool myFastJumpsWithoutDiff;
302 
303  DtMutex myCommandHandlerMutex;
304 
305  DtThreadSafe<bool> myCancelLongOperationFlag;
306 
307  NasmpFlags myNasmpFlags;
308  };
309 
310 }
311 
312 #endif

Document ID: Generated on Thu Apr 11 12:13:00 EDT 2013 from SVN revision 126011
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)