Belle II Software  release-05-01-25
HLTSocket.h
1 #pragma once
2 
3 #include <daq/rfarm/event/hltsocket/HLTMainLoop.h>
4 #include <string>
5 
6 #define D2_SOCKBUF_SIZE 8000000
7 
8 namespace Belle2 {
13  class HLTSocket {
14  public:
15  virtual ~HLTSocket();
16 
17  int put(char* data, int len);
18  int put_wordbuf(int* data, int len);
19  int get(char* data, int len);
20  int get_wordbuf(int* data, int len);
21 
22  bool accept(unsigned int port);
23  bool connect(const std::string& hostName, unsigned int port, const HLTMainLoop& mainLoop);
24  bool initialized() const;
25  void deinitialize();
26 
27  private:
28  int read_data(char* data, int len);
29  int write_data(char* data, int len);
30 
31  void close(int socket);
32 
33  int m_socket = -1;
34  int m_listener = -1;
35  bool m_initialized = false;
36  };
38 }
39 
40 
41 
42 
43 
44 
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::HLTMainLoop
Definition: HLTMainLoop.h:28
Belle2::HLTSocket
Definition: HLTSocket.h:13