Belle II Software  release-08-01-10
EventBuffer.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 Belle2_EventBuffer_h
9 #define Belle2_EventBuffer_h
10 
11 namespace Belle2 {
17  class EventBuffer {
18 
19  public:
20  struct Header {
21  unsigned int expno;
22  unsigned int runno;
23  unsigned int subno;
24  unsigned int count_in;
25  unsigned int count_out;
26  unsigned long long nword_in;
27  unsigned long long nword_out;
28  unsigned short nwriter;
29  unsigned short nreader;
30  };
31 
32  public:
33  EventBuffer()
34  {
35  m_buf = 0;
36  m_nword = 0;
37  }
38  EventBuffer(unsigned int nword);
39  ~EventBuffer();
40 
41  public:
42  unsigned int size() throw();
43  bool init();
44  void clear();
45 
46  public:
47  Header& getHeader() throw() { return m_header; }
48  int* getBuffer() throw() { return m_buf; }
49  bool isWritable(int nword) throw();
50  bool isReadable() throw();
51  unsigned int write(const int* buf, unsigned int nword,
52  unsigned int serial = 0);
53  unsigned int read(int* buf, Header* hdr = 0);
54 
55  private:
56  Header m_header;
57  int* m_buf;
58  unsigned int m_nword;
59 
60  };
61 
63 }
64 
65 #endif
Abstract base class for different kinds of events.