MAK Data Logger API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
lgrInterface.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 lgrInterface_H_
10 #define lgrInterface_H_
11 
12 #include <lgrCore/lgrCore.h>
14 #include <lgrCmds/lgrCommand.h>
18 
19 #include <lgrCore/logger.h>
20 #include <lgrCore/lgrDriver.h>
21 
22 #include <map>
23 #include <list>
24 
25 namespace MAKLogger
26 {
27  class DtLogger;
28  class DtLgrCommandHandler;
29 
34  {
35  public:
38 
39 
40  virtual ~DtCommandInterface();
41 
47  virtual bool update();
48 
51  void disconnectFromDispatcher();
52 
54  void reconnectToDispatcher();
55 
56  void addResponseHandler(const DtCommand& command,DtResponseFunctorSP);
57 
59  virtual void sendCommand(const DtCommand&) const;
60 
63  bool executeResponse(DtResponse command);
64 
65  private:
68  DtCommandInterface& operator=( const DtCommandInterface& src );
69 
70  protected:
71 
73  typedef std::map<DtCommand,DtResponseFunctorSP,std::less<DtCommand> > DtResponseMap;
75 
78 
81 
82  };
83 
85  template <typename CommandHandlerType>
86  static typename CommandHandlerType::Interface* createInterface(DtLogger& logger)
87  {
88  DtBoost::shared_ptr<DtLgrCommandHandler> commandHandler = \
89  logger.getCommandHandler(CommandHandlerType::Factory::theCommandType);
90 
91  if(commandHandler)
92  {
93  commandHandler->lock();
94  DtBoost::shared_ptr<CommandHandlerType> subCommandHandler = \
95  DtBoost::dynamic_pointer_cast<CommandHandlerType>(commandHandler);
96  if(subCommandHandler)
97  {
98  typename CommandHandlerType::Interface* commandInterface = \
99  CommandHandlerType::Interface::createNonThreadsafe(logger,
100  *subCommandHandler);
101 
102  commandHandler->unlock();
103  return commandInterface;
104  }
105  commandHandler->unlock();
106  }
107  return 0;
108  }
109 
110 }
111 
112 #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)