OpenDaVINCI  4.16.0
ConnectionAcceptor.h
Go to the documentation of this file.
1 
20 #ifndef OPENDAVINCI_CORE_IO_CONNECTIONACCEPTOR_H_
21 #define OPENDAVINCI_CORE_IO_CONNECTIONACCEPTOR_H_
22 
24 #include <memory>
28 
29 namespace odcore {
30  namespace io {
31 
32 class ConnectionAcceptorListener;
33 namespace tcp { class TCPConnection; }
34 
35  using namespace std;
36 
45  private:
50 
54  ConnectionAcceptor& operator=(const ConnectionAcceptor&);
55 
56  public:
57  ConnectionAcceptor(const uint32_t &port);
58  virtual ~ConnectionAcceptor();
59 
60  void setConnectionAcceptorListener(ConnectionAcceptorListener* listener);
61 
62  void start();
63  void stop();
64 
65  protected:
68 
69  std::shared_ptr<odcore::io::tcp::TCPAcceptor> m_acceptor;
70 
71  void onNewConnection(std::shared_ptr<odcore::io::tcp::TCPConnection> connection);
72  };
73  }
74 }
75 
76 #endif /* OPENDAVINCI_CORE_IO_CONNECTIONACCEPTOR_H_ */
Definition: TCPAcceptorListener.h:33
Definition: ConnectionAcceptorListener.h:33
Definition: base/Mutex.h:49
Definition: ConnectionAcceptor.h:44
ConnectionAcceptorListener * m_listener
Definition: ConnectionAcceptor.h:67
#define OPENDAVINCI_API
Definition: opendavinci.h:67
base::Mutex m_listenerMutex
Definition: ConnectionAcceptor.h:66
std::shared_ptr< odcore::io::tcp::TCPAcceptor > m_acceptor
Definition: ConnectionAcceptor.h:69
Definition: TCPConnection.h:40