Belle II Software  release-08-01-10
EvtSocket.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #ifndef EVTSOCKET_H
9 #define EVTSOCKET_H
10 
11 #include <string>
12 
13 #include <daq/dataflow/SocketLib.h>
14 #include <framework/pcore/EvtMessage.h>
15 
16 #define MAXEVTSIZE 80000000
17 
18 namespace Belle2 {
24  typedef unsigned short u_short;
25 
26  class EvtSocketSend {
27  public:
28  EvtSocketSend(std::string hostname, int port);
29  ~EvtSocketSend();
30 
31  int status();
32 
33  int send(EvtMessage* msg);
34  EvtMessage* recv(void);
35 
36  int send_buffer(int size, char* buf);
37  int recv_buffer(char* buf);
38  int recv_pxd_buffer(char* buf);
39 
40  SocketSend* sock(void);
41 
42  private:
43  SocketSend* m_sock;
44  char* m_recbuf;
45  };
46 
47  class EvtSocketRecv {
48  public:
49  EvtSocketRecv(int port, bool accept_at_init = true);
50  ~EvtSocketRecv();
51 
52  int status();
53 
54  int send(EvtMessage* msg);
55  EvtMessage* recv(void);
56 
57  int send_buffer(int size, char* buf);
58  int recv_buffer(char* buf);
59 
60  SocketRecv* sock(void);
61 
62  private:
63  SocketRecv* m_sock;
64  char* m_recbuf;
65  };
66 
68 }
69 
70 #endif
71 
72 
Class to manage streamed object.
Definition: EvtMessage.h:59
Abstract base class for different kinds of events.