lgrSystemDriver.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 
00008 
00009 #ifndef lgrSystemDriver_H_
00010 #define lgrSystemDriver_H_
00011 
00012 #include "lgrCore.h"
00013 #include "lgrCommand.h"
00014 #include "lgrCommandDispatcher.h"
00015 #include "lgrDriver.h"
00016 #include "lgrExceptions.h"
00017 #include "lgrRuntimeCommandFactory.h"
00018 #include "virtualConstructor.h"
00019 #include "threadSafe.h"
00020 
00021 #include <map>
00022 #include <set>
00023 #include <list>
00024 
00025 namespace MAKLogger
00026 {
00027 
00028    class DtLgrDynamicLibrary;
00029    class DtLgrSystemCommandFactory;
00030    class DtLogger;
00031    class DtMessagePipeline;
00032    class DtRuntimeCommandFactory;
00033    class DtLgrProtocolRegistration;
00034    class DtLgrSimManager;
00035    typedef std::list<DtBoost::shared_ptr<DtLgrDynamicLibrary> > DtLibraryList;
00036 
00040    class DT_DLL_LGRCORE DtLgrSystemDriver
00041    {
00042    public:
00043       typedef DtLgrSystemCommandFactory Factory;
00044 
00045       enum NasmpMode
00046       {
00047          NasmpMode_None,
00048          NasmpMode_Snnf
00049       };
00050 
00051       enum NasmpFlag
00052       {
00053          NasmpFlag_Fast
00054       };
00055 
00056    public:
00057       DT_VIRTUAL_CTR(DtLgrSystemDriver,(DtLogger&))
00058 
00059       
00060       virtual ~DtLgrSystemDriver();
00061 
00063       virtual void tick();
00064 
00068       void init(DtLgrProtocolRegistration*);
00069 
00071       virtual bool timeToShutdown() const;
00072 
00074       virtual void submitCommand(const DtCommand& command);
00075 
00077       DtCommandDispatcherSP dispatcher();
00078 
00083       DtMessagePipeline* requestPipeline(DtLgrCommandHandler*);
00084 
00090       bool releasePipeline();
00091 
00093       const DtLgrCommandHandler* pipelineOwner() const;
00094 
00096       const DtMessagePipeline* pipeline() const;
00097 
00099       void setPipelineDriver(DtLgrDomainId domain);
00100 
00104       void addDriver(DtLgrCommandType, DtLgrCommandHandlerSP driver);
00105 
00108       DtLgrCommandHandlerSP getCommandHandler(const DtLgrCommandType& type);
00109 
00112       bool removeDriver(DtLgrCommandType type);
00113 
00115       void setSimManager(DtLgrSimManager*);
00116 
00118       const DtLgrSimManager* simManager() const;
00119 
00120       DtLgrSimManager* simManager();
00121 
00123       virtual void loadPluginLibrary(const DtString& filename);
00124 
00126       void setNotifyLevel(int vlLevel,int lgrLevel);
00127 
00129       void setBasicGuiFlag(bool basic);
00130 
00132       void issueTextCommand(const DtString& textCommand);
00133 
00135       void setEntityTracking(bool enableEntityTracking);
00136 
00138       bool entityTracking() const;
00139 
00141       void setFastJumpsWithoutDiff(bool enableFastJumpsWithoutDiff);
00142 
00144       bool fastJumpsWithoutDiff() const;
00145 
00147       void setPlaybackReadTimeLimit(double readTimeLimit);
00148 
00150       double playbackReadTimeLimit() const;
00151 
00153       void setNasmpMode (const DtString& nasmpMode);
00154 
00156       int  notifyLevel() const;
00157 
00159       bool basicGuiFlag()const;
00160 
00162       DtString nasmpModeString() const;
00163 
00165       NasmpMode nasmpMode() const;
00166 
00168       bool nasmpFlag(NasmpFlag flag);
00169 
00171       void sendMessage(const DtString& message);
00172 
00174       DtRuntimeCommandFactory* runtimeCommandFactory();
00175 
00177       const DtLibraryList&  libraries() const;
00178 
00180 
00181       DtLogger* logger();
00182       const DtLogger* logger() const;
00184 
00186       DtThreadSafe<bool>* cancelLongOperationFlag();
00187 
00189       void startLongOperation(const DtString& name,bool interruptible);
00190 
00192       void updateLongOperation(const DtString& message,int progress);
00193 
00195       void finishLongOperation();
00196 
00198       void cancelLongOperation();
00199 
00201       bool isLongOperationCanceled() const;
00202 
00205    protected:
00206       DtResponse shutdownCommand(const DtCommand& command);
00207       DtResponse cancelShutdown(const DtCommand& command);
00208       DtResponse createDriver(const DtCommand& command);
00209       DtResponse loadPlugin(const DtCommand& command);
00210       DtResponse setNotifyLevel(const DtCommand& command);
00211       DtResponse setBasicGuiFlag(const DtCommand& command);
00212       DtResponse setPlaybackReadTimeLimit(const DtCommand& command);
00213       DtResponse setEntityTracking(const DtCommand& command);
00214       DtResponse setFastJumpsWithoutDiff(const DtCommand& command);
00215       DtResponse setNasmpMode(const DtCommand& command);
00216       DtResponse deleteFile(const DtCommand& command);
00217       DtResponse installOutputListener(const DtCommand& command);
00219       DtResponse issueTextCommand(const DtCommand& command);
00220       DtResponse helpCommand(const DtCommand& command);
00221       DtResponse infoCommand(const DtCommand& command);
00222       DtResponse setTempDir(const DtCommand& command);
00223       DtResponse setDefaultTapeDirectory(const DtCommand& command);
00224 
00225 
00226    protected:
00227       //Type definitions
00228       typedef DtU32 NasmpFlags;
00229 
00230       static const int NasmpModeMask   = 0x0f;
00231       static const int NasmpModeNone   = 0x00;
00232       static const int NasmpModeSnnf   = 0x01;
00233 
00234       static const int NasmpFlagMask   = 0xf0;
00235       static const int NasmpFlagFast   = 0x10;
00236 
00237       typedef DtResponse (DtLgrSystemDriver::*CommandHandler)(const DtCommand&);
00238       typedef std::map<DtLgrCommandId,CommandHandler>  DtCommandMap;
00239       typedef std::map<DtLgrCommandType,DtLgrCommandHandlerSP> DtDriverMap;
00240       typedef std::set<DtLgrCommandHandlerSP> DtDriverList;
00241 
00242       virtual void unloadLibraries();
00243 
00245       void registerCommandHandler(const DtCommandDefinition&,CommandHandler);
00246 
00248       virtual void tickDrivers();
00249 
00251       virtual void lockDrivers();
00252 
00254       virtual void unlockDrivers();
00255 
00257       virtual void processCommands();
00258 
00260       virtual DtString commandDescription( const DtString& commandName) const;
00261 
00264       void lookupCommandId(DtCommand& command);
00265 
00267       virtual void processCommand(const DtCommand& command);
00268 
00269    protected:
00271       DtLogger* myParentLogger;
00272 
00273       DtCommandMap         myCommandMap;
00276       DtDriverList          myDriverList;
00277       DtDriverMap           myDriverMap;
00278       DtCommandDispatcherSP myDispatcher;
00279       DtMessagePipeline*    myPipeline;
00280       DtLgrCommandHandler*  myPipelineOwner;
00281 
00282       DtLgrSimManager* mySimManager;
00283 
00284       DtRuntimeCommandFactory* myRuntimeCommandFactory;
00285 
00286       DtLibraryList myLibraries;
00287 
00289       bool myShutdownFlag;
00290 
00292       bool myBasicGuiFlag;
00293 
00295       DtString myNasmpMode;
00296 
00298       bool myEntityTracking;
00299 
00301       bool myFastJumpsWithoutDiff;
00302 
00303       DtMutex myCommandHandlerMutex;
00304 
00305       DtThreadSafe<bool> myCancelLongOperationFlag;
00306 
00307       NasmpFlags myNasmpFlags;
00308    };
00309 
00310 }
00311 
00312 #endif

Document ID: Generated on Tue Oct 11 19:41:03 EDT 2011 from SVN revision 107422
Copyright © 2005-2011 VT MÄK Inc. All Rights Reserved (www.mak.com)