otsdaq  v2_04_02
TCPSocket.h
1 #ifndef _TCPSocket_h_
2 #define _TCPSocket_h_
3 
4 namespace ots
5 {
6 class TCPSocket
7 {
8  public:
9  virtual ~TCPSocket();
10 
11  // Designed to be a base class not used used directly.
12  TCPSocket(int socketId = invalidSocketId);
13 
14  // Moveable but not Copyable
15  TCPSocket(TCPSocket&& move);
16 
17  TCPSocket& operator=(TCPSocket&& move);
18  void swap(TCPSocket& other);
19 
20  // Explicitly deleting copy constructor
21  TCPSocket(TCPSocket const&) = delete;
22  TCPSocket& operator=(TCPSocket const&) = delete;
23 
24  int getSocketId(void) const { return fSocketId; }
25  void close(void);
26  void sendClose(void);
27 
28  protected:
29  static constexpr int invalidSocketId = -1;
30 
31  private:
32  int fSocketId;
33 };
34 }
35 #endif