otsdaq  v2_01_00
TransmitterSocket.h
1 #ifndef _ots_TransmitterSocket_h_
2 #define _ots_TransmitterSocket_h_
3 
4 #include "otsdaq-core/NetworkUtilities/Socket.h"
5 
6 #include <string>
7 #include <vector>
8 #include <mutex> //for std::mutex
9 
10 namespace ots
11 {
12 
13 class TransmitterSocket : public virtual Socket
14 {
15  //TransceiverSocket is a "Friend" class of TransmitterSocket so has access to private members.
16  friend class TransceiverSocket;
17 public:
18  TransmitterSocket(const std::string &IPAddress, unsigned int port=0);
19  virtual ~TransmitterSocket(void);
20 
21  int send(Socket& toSocket, const std::string& buffer, bool verbose=false);
22  int send(Socket& toSocket, const std::vector<uint32_t>& buffer, bool verbose=false);
23  int send(Socket& toSocket, const std::vector<uint16_t>& buffer, bool verbose=false);
24 
25 protected:
26  TransmitterSocket(void);
27 
28 private:
29  std::mutex sendMutex_; //to make transmitter socket thread safe
30  // i.e. multiple threads can share a socket and call send()
31 
32 };
33 
34 }
35 
36 #endif