MAK Data Logger API Documentation for HLA
 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-2025 MAK Technologies, Inc
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  std::shared_ptr<DtLgrCommandHandler> commandHandler = \
89  logger.getCommandHandler(CommandHandlerType::Factory::theCommandType);
90 
91  if(commandHandler)
92  {
93  commandHandler->lock();
94  std::shared_ptr<CommandHandlerType> subCommandHandler = \
95  std::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
The logger command which contains the command type and its parameters.
Definition: lgrCommand.h:110
The base class for command interface which allows an interface to send and receive commands...
Definition: lgrInterface.h:33
#define DT_VIRTUAL_CTR(CLASS_NAME, ARG_TYPES_LIST)
Declare a Virtual Constructor Create using DT_VIRTUAL_CTR(CLASS_NAME,ARG_TYPES_LIST) Where CLASS_NAME...
Definition: virtualConstructor.h:34
static CommandHandlerType::Interface * createInterface(DtLogger &logger)
Create interface templated function.
Definition: lgrInterface.h:86
Contains DT_VIRTUAL_CTR DT_VIRTUAL_CTR_DEFAULTS DT_VIRTUAL_COPY_ASSIGN DT_VIRTUAL_BASE_CTR DT_PURE_VI...
Contains MAKLogger::DtLgrCommandQueue and MAKLogger::DtResponseQueue and MAKLogger::DtResponseQueueSP...
std::map< DtCommand, DtResponseFunctorSP, std::less< DtCommand > > DtResponseMap
Callback types.
Definition: lgrInterface.h:73
DtCommandDispatcherSP myDispatcher
A shared pointer to the interface&#39;s dispatcher.
Definition: lgrInterface.h:80
std::shared_ptr< DtResponseFunctor > DtResponseFunctorSP
Definition: lgrCommandFunctor.h:50
std::shared_ptr< DtCommandDispatcher > DtCommandDispatcherSP
Definition: lgrCommandDispatcher.h:101
Contains MAKLogger::DtLgrCommandType and MAKLogger::DtCommand classes.
#define DT_DLL_LGRCORE
Definition: lgrCore.h:19
Contains MAKLogger::DtCommandFunctor, MAKLogger::DtResponseFunctor, MAKLogger::DtLgrCommandHandlerFun...
std::shared_ptr< DtSharedQueue< DtResponse > > DtResponseQueueSP
Definition: lgrCommandQueue.h:27
DtResponseMap myResponseMap
Definition: lgrInterface.h:74
Contains MAKLogger::DtLogger class.
std::shared_ptr< const DtCommand > DtResponse
Definition: lgrCommand.h:175
DtLogger provides the core system structure and controls the execution model for the underlying objec...
Definition: logger.h:35
DtResponseQueueSP myResponseQueue
The queue which stores commands sent to the interface from the dispatcher.
Definition: lgrInterface.h:77
Contains MAKLogger::DtCommandDispatcher class.
Contains MAKLogger::DtLgrCommandHandler class.
Contains lgrCore library definitions.

Document ID: Generated on Thu Dec 18 15:35:09 EST 2025 from SVN revision 282494
Copyright © 2024 MAK Technologies. All Rights Reserved (www.mak.com)