Belle II Software  release-08-01-10
RawHeader_v0.cc
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 
9 #include <rawdata/dataobjects/RawHeader_v0.h>
10 
11 
12 
13 using namespace Belle2;
14 
15 //ClassImp(RawHeader_v0);
16 
18 {
19  m_buffer = NULL;
20  // initialize();
21  // cout << "RawHeader_v0 NULL constructor" << endl;
22 }
23 
25 {
26  m_buffer = buffer;
27 }
28 
30 {
31 }
32 
33 
34 int RawHeader_v0::AddNodeInfo(int node_id)
35 {
37  // When the number of total nodes exceeds NUM_MAX_NODES
38  if (GetNumNodes() >= NUM_MAX_NODES) {
39  m_buffer[ POS_NUM_NODES ]++;
40  return -1;
41  }
42 
43  m_buffer[ POS_NODES_1 + m_buffer[ POS_NUM_NODES ] ] = node_id;
44  m_buffer[ POS_NUM_NODES ]++;
45  return 0;
46 }
47 
48 int RawHeader_v0::GetNodeInfo(int node_no, int* node_id)
49 {
51  if (node_no >= GetNumNodes()) {
52  return -1;
53  }
54  *node_id = m_buffer[ POS_NODES_1 + node_no ];
55 
56  return 0;
57 }
RawHeader_v0()
Default constructor.
Definition: RawHeader_v0.cc:17
int AddNodeInfo(int node_id)
set magic words;
Definition: RawHeader_v0.cc:34
int * m_buffer
do not record buffer ( RawCOPPER includes buffer of RawHeader_v0 and RawTrailer )
Definition: RawHeader_v0.h:222
~RawHeader_v0()
Destructor.
Definition: RawHeader_v0.cc:29
int GetNodeInfo(int node_no, int *node_id)
get contents of header
Definition: RawHeader_v0.cc:48
void CheckSetBuffer()
initialize header
Definition: RawHeader_v0.h:230
void CheckGetBuffer()
check if m_buffer exists
Definition: RawHeader_v0.h:237
int GetNumNodes()
get contents of header
Definition: RawHeader_v0.h:463
Abstract base class for different kinds of events.