Belle II Software development
HLTSocket.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#pragma once
9
10#include <daq/rfarm/event/hltsocket/HLTMainLoop.h>
11#include <string>
12
13#define D2_SOCKBUF_SIZE 8000000
14
15namespace Belle2 {
20 class HLTSocket {
21 public:
22 virtual ~HLTSocket();
23
24 int put(char* data, int len);
25 int put_wordbuf(int* data, int len);
26 int get(char* data, int len);
27 int get_wordbuf(int* data, int len);
28
29 bool accept(unsigned int port);
30 bool connect(const std::string& hostName, unsigned int port, const HLTMainLoop& mainLoop);
31 bool initialized() const;
32 void deinitialize();
33
34 private:
35 int read_data(char* data, int len);
36 int write_data(char* data, int len);
37
38 void close(int socket);
39
40 int m_socket = -1;
41 int m_listener = -1;
42 bool m_initialized = false;
43 };
45}
46
47
48
49
50
51
Abstract base class for different kinds of events.