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