lgrDriver.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 lgrDriver_H_
00010 #define lgrDriver_H_
00011 
00012 #include "lgrCore.h"
00013 #include "lgrCommand.h"
00014 #include "lgrCommandFunctor.h"
00015 #include "lgrCommandDispatcher.h"
00016 #include "lgrRuntimeCommandFactory.h"
00017 #include <vlutil/vlSmartPointers.h>
00018 #include <vlutil/vlMutex.h>
00019 
00020 #include <map>
00021 
00022 namespace MAKLogger
00023 {
00024 
00025    class DtLgrSystemDriver;
00026    class DtCommandInterface;
00027    class DtRuntimeCommandFactory;
00028 
00031    class DT_DLL_LGRCORE DtLgrCommandHandler
00032    {
00033    public:
00034 
00037       DtLgrCommandHandler(const DtString& name,DtRuntimeCommandFactory*
00038          ,DtCommandDispatcherSP);
00039 
00041       virtual ~DtLgrCommandHandler();
00042 
00044       void lock();
00045 
00047       void unlock();
00048 
00050       virtual void tick() = 0;
00051 
00053       DtCommandDispatcherSP dispatcher();
00054 
00056       virtual const DtString& driverName() const;
00057 
00059       virtual const DtString& driverInfo();
00060 
00062       virtual void processCommand(const DtCommand& command);
00063 
00072       virtual bool releasePipeline() = 0;
00073 
00074 
00078       virtual bool getPipeline() = 0;
00079 
00083       virtual bool hasPipeline() const = 0;
00084 
00085    protected:
00086 
00087       typedef DtLgrCommandHandler* (*DriverCreator)(DtCommandDispatcherSP);
00088 
00091       void addCommandHandler(const DtCommandDefinition& commandDef,
00092          DtCommandFunctorSP commandFunctor);
00093 
00096       void removeCommandHandler(const DtCommandDefinition& commandDef);
00097 
00099       virtual void sendResponse(DtResponse response);
00100 
00102       virtual void queueResponse(DtResponse response);
00103 
00105       virtual void sendQueuedResponses();
00106 
00108       virtual void emptyResponseQueue();
00109 
00110       typedef std::map<DtLgrCommandId,DtCommandFunctorSP> DtLgrCommandHandlerMap;
00111       typedef std::map<DtString,DtLgrCommandId> DtLgrCommandNameMap;
00112 
00113       typedef std::list<DtResponse> DtResponseQueue;
00114 
00115       DtRuntimeCommandFactory* myRuntimeCommandFactory;
00116 
00117       DtLgrCommandHandlerMap myCommandMap;
00118       DtCommandDispatcherSP  myDispatcher;
00119       DtResponseQueue myResponseQueue;
00120       DtString myName;
00121       DtString myInfo;
00122 
00123       DtMutex myMutex;
00124    };
00125 
00126    typedef DtBoost::shared_ptr<DtLgrCommandHandler> DtLgrCommandHandlerSP;
00127 
00128 }
00129 
00130 #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)