otsdaq  v2_05_02_indev
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 open(void);
26  void close(void);
27  void sendClose(void);
28 
29  protected:
30  static constexpr int invalidSocketId = -1;
31 
32  private:
33  int fSocketId;
34 };
35 }
36 #endif