VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDeCommunicator.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
12 #include <vrvCore/DtDeRecord.h>
13 #include <boost/signal.hpp>
14 #include <list>
15 #include <string>
16 
17 namespace makVrv
18 {
19  class DtDe;
20  class DtTcpServer;
21  class DtUdpServer;
22  class DtTcpMessageClient;
23  class DtMessageDispatcher;
24  class DtDriverConfiguration;
25  class DtIgCommunicatorSignaler;
26  class DtDeRemoteDisplayReconnector;
27 
32  {
33  public:
34 
38 
39  typedef std::list<DtDeRecord> IgRecords;
40 
42  virtual ~DtDeCommunicator();
43 
45  virtual bool initialize();
46 
49  virtual void listenForMasterIg();
50 
52  virtual bool hasMasterIg() const;
53 
55  virtual void disconnectMasterIg(const std::string& masterName);
56 
60  bool connectToSlaveIg(const std::string& slaveAddr,int port, std::string& igNameOut);
61 
66  void disconnectSlaveIg(const std::string& name, bool lostConnection=false);
67 
69  virtual void tick();
70 
72  /*virtual const DtDriverConfiguration& configuration() const;*/
73 
75  virtual void addIgRecord(const DtDeRecord& record);
76 
80  virtual void removeIgRecord(const DtDeRecord& record, bool lostConnection=false );
81 
84  DtDeRecord& hostIgRecord();
85 
87  DtDeRecord* findRecordByIgName(const std::string& igName);
88 
90  DtDeRecord* findRecordByDisplayName(const std::string& displayName);
91 
93  bool masterIgOnly() const;
94 
96  const IgRecords& connectedIgs() const;
97 
100  virtual const std::string& name() const;
101 
104  static const char* className();
105 
106  protected:
107 
110 
112  bool validateSlaveConnection( const std::string& ipAddr );
113 
115  void invalidateSlaveConnection( const std::string& ipAddr );
116 
119  virtual void addSlave(DtTcpMessageClient* client, std::string& igNameOut );
120 
121  protected:
122 
123  static const char* myClassName;
124 
128  std::string myName;
134  };
135 
139  {
140 
141  public:
142 
144  static DtIgCommunicatorSignaler& instance(DtDe& de);
145 
147  virtual ~DtIgCommunicatorSignaler();
148 
150 
151 
153  boost::signal<void (const std::string&)> signal_masterIgConnected;
154 
156  boost::signal<void (const std::string&)> signal_masterIgLost;
157 
159  boost::signal<void (const DtDeRecord&)> signal_clientAdded;
160 
164  boost::signal<void (const std::string& clientName, bool lostConnection)> signal_clientToByDeleted;
165 
167  boost::signal<void (const std::string&)> signal_clientModified;
168 
170 
171  protected:
172 
174 
175  };
176 
177 
181  {
182  public:
183 
185  static DtDeCommunicatorCreator& instance(DtDe&);
186 
188  static void registerInstance(DtDe& de,DtDeCommunicatorCreator*);
189 
191  virtual DtDeCommunicator* create(DtDe& de, DtDriverConfiguration& config);
192  };
193 
194 }
195 

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)