Belle II Software development
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
18namespace Belle2 {
23
24 typedef unsigned short u_short;
25
26 class EvtSocketSend {
27 public:
28 EvtSocketSend(const std::string& hostname, int port);
29 ~EvtSocketSend();
31 EvtSocketSend(const EvtSocketSend&) = delete;
32
34 EvtSocketSend& operator=(const EvtSocketSend&) = delete;
35
36 int status();
37
38 int send(EvtMessage* msg);
39 EvtMessage* recv(void);
40
41 int send_buffer(int size, char* buf);
42 int recv_buffer(char* buf);
43 int recv_pxd_buffer(char* buf);
44
45 SocketSend* sock(void);
46
47 private:
48 SocketSend* m_sock;
49 char* m_recbuf;
50 };
51
52 class EvtSocketRecv {
53 public:
54 explicit EvtSocketRecv(int port, bool accept_at_init = true);
55 ~EvtSocketRecv();
57 EvtSocketRecv(const EvtSocketRecv&) = delete;
58
60 EvtSocketRecv& operator=(const EvtSocketRecv&) = delete;
61
62 int status();
63
64 int send(EvtMessage* msg);
65 EvtMessage* recv(void);
66
67 int send_buffer(int size, char* buf);
68 int recv_buffer(char* buf);
69
70 SocketRecv* sock(void);
71
72 private:
73 SocketRecv* m_sock;
74 char* m_recbuf;
75 };
76
78}
79
80#endif
81
82
Class to manage streamed object.
Definition EvtMessage.h:59
EvtSocketRecv(const EvtSocketRecv &)=delete
Copy constructor (disabled).
EvtSocketRecv & operator=(const EvtSocketRecv &)=delete
Operator = (disabled).
EvtSocketSend & operator=(const EvtSocketSend &)=delete
Operator = (disabled).
EvtSocketSend(const EvtSocketSend &)=delete
Copy constructor (disabled).
Abstract base class for different kinds of events.