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  DtMessagePipeline* pipeline();
100 
102  void setPipelineDriver(DtLgrDomainId domain);
103 
107  void addDriver(DtLgrCommandType, DtLgrCommandHandlerSP driver);
108 
111  DtLgrCommandHandlerSP getCommandHandler(const DtLgrCommandType& type);
112 
115  bool removeDriver(DtLgrCommandType type);
116 
118  void setSimManager(DtLgrSimManager*);
119 
121  const DtLgrSimManager* simManager() const;
122 
123  DtLgrSimManager* simManager();
124 
126  virtual void loadPluginLibrary(const DtString& filename);
127 
129  void setNotifyLevel(int vlLevel,int lgrLevel);
130 
132  void setBasicGuiFlag(bool basic);
133 
135  void issueTextCommand(const DtString& textCommand);
136 
138  void setEntityTracking(bool enableEntityTracking);
139 
141  bool entityTracking() const;
142 
144  void setFastJumpsWithoutDiff(bool enableFastJumpsWithoutDiff);
145 
147  bool fastJumpsWithoutDiff() const;
148 
150  void setPlaybackReadTimeLimit(double readTimeLimit);
151 
153  double playbackReadTimeLimit() const;
154 
156  void setNasmpMode (const DtString& nasmpMode);
157 
159  int notifyLevel() const;
160 
162  bool basicGuiFlag()const;
163 
165  DtString nasmpModeString() const;
166 
168  NasmpMode nasmpMode() const;
169 
171  bool nasmpFlag(NasmpFlag flag);
172 
174  void sendMessage(const DtString& message);
175 
177  DtRuntimeCommandFactory* runtimeCommandFactory();
178 
180  const DtLibraryList& libraries() const;
181 
183 
184  DtLogger* logger();
185  const DtLogger* logger() const;
187 
189  DtThreadSafe<bool>* cancelLongOperationFlag();
190 
192  void startLongOperation(const DtString& name,bool interruptible);
193 
195  void updateLongOperation(const DtString& message,int progress);
196 
198  void finishLongOperation();
199 
201  void cancelLongOperation();
202 
204  bool isLongOperationCanceled() const;
205 
208  protected:
209  DtResponse shutdownCommand(const DtCommand& command);
210  DtResponse cancelShutdown(const DtCommand& command);
211  DtResponse createDriver(const DtCommand& command);
212  DtResponse loadPlugin(const DtCommand& command);
213  DtResponse setNotifyLevel(const DtCommand& command);
214  DtResponse setBasicGuiFlag(const DtCommand& command);
215  DtResponse setPlaybackReadTimeLimit(const DtCommand& command);
216  DtResponse setEntityTracking(const DtCommand& command);
217  DtResponse setFastJumpsWithoutDiff(const DtCommand& command);
218  DtResponse setNasmpMode(const DtCommand& command);
219  DtResponse deleteFile(const DtCommand& command);
220  DtResponse installOutputListener(const DtCommand& command);
222  DtResponse issueTextCommand(const DtCommand& command);
223  DtResponse helpCommand(const DtCommand& command);
224  DtResponse infoCommand(const DtCommand& command);
225  DtResponse setTempDir(const DtCommand& command);
226  DtResponse setDefaultTapeDirectory(const DtCommand& command);
227 
228 
229  protected:
230  //Type definitions
231  typedef DtU32 NasmpFlags;
232 
233  static const int NasmpModeMask = 0x0f;
234  static const int NasmpModeNone = 0x00;
235  static const int NasmpModeSnnf = 0x01;
236 
237  static const int NasmpFlagMask = 0xf0;
238  static const int NasmpFlagFast = 0x10;
239 
240  typedef DtResponse (DtLgrSystemDriver::*CommandHandler)(const DtCommand&);
241  typedef std::map<DtLgrCommandId,CommandHandler> DtCommandMap;
242  typedef std::map<DtLgrCommandType,DtLgrCommandHandlerSP> DtDriverMap;
244 
245  virtual void unloadLibraries();
246 
248  void registerCommandHandler(const DtCommandDefinition&,CommandHandler);
249 
251  virtual void tickDrivers();
252 
254  virtual void lockDrivers();
255 
257  virtual void unlockDrivers();
258 
260  virtual void processCommands();
261 
263  virtual DtString commandDescription( const DtString& commandName) const;
264 
267  void lookupCommandId(DtCommand& command);
268 
270  virtual void processCommand(const DtCommand& command);
271 
272  protected:
274  DtLogger* myParentLogger;
275 
276  DtCommandMap myCommandMap;
279  DtDriverList myDriverList;
280  DtDriverMap myDriverMap;
281  DtCommandDispatcherSP myDispatcher;
282  DtMessagePipeline* myPipeline;
283  DtLgrCommandHandler* myPipelineOwner;
284 
285  DtLgrSimManager* mySimManager;
286 
287  DtRuntimeCommandFactory* myRuntimeCommandFactory;
288 
289  DtLibraryList myLibraries;
290 
292  bool myShutdownFlag;
293 
295  bool myBasicGuiFlag;
296 
298  DtString myNasmpMode;
299 
301  bool myEntityTracking;
302 
304  bool myFastJumpsWithoutDiff;
305 
306  DtMutex myCommandHandlerMutex;
307 
308  DtThreadSafe<bool> myCancelLongOperationFlag;
309 
310  NasmpFlags myNasmpFlags;
311  };
312 
313 }
314 
315 #endif

Document ID: Generated on Mon Jan 19 08:20:14 EST 2015 from SVN revision 149581
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)