MAK Data Logger API Documentation for HLA
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.h"
13 #include "virtualConstructor.h"
14 #include "lgrCommand.h"
15 #include "lgrCommandDispatcher.h"
16 #include "lgrCommandQueue.h"
17 #include "lgrCommandFunctor.h"
18 
19 #include "logger.h"
20 #include "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 Sun Dec 15 18:04:30 EST 2013 from SVN revision 134418
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)