BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
old/Header.h
Go to the documentation of this file.
1//Dear emacs, this is -*- c++ -*-
2
3/**
4 * @file eformat/old/Header.h
5 * @author <a href="mailto:[email protected]>Andr� Rabello dos
6 * ANJOS</a>
7 * $Author: zhangy $
8 * $Revision: 1.1.1.1 $
9 * $Date: 2009/06/19 07:35:41 $
10 *
11 * @brief Defines the Header entity. The definition is based on the
12 * update of ATL-DAQ-98-129, version 2.4, by D.Francis et al.
13 */
14
15#ifndef EFORMAT_OLD_HEADER_H
16#define EFORMAT_OLD_HEADER_H
17
18#include <stdint.h>
19#include <cstdlib>
20
21namespace eformat {
22
23 /**
24 * Includes classes and non-member methods that allows provisional reading
25 * from event format v2.4. The main purpose of this functionality is
26 * conversion from the old to the new event format.
27 */
28 namespace old {
29
30 /**
31 * Contains the information on the Header of a fragment as described
32 * by the original note. The header is a composite entity, build from
33 * two parts:
34 *
35 * -# The generic part, containing the header type, size and version
36 * information;
37 * -# The specific part, containing data that is specific for a
38 * particular fragment.
39 */
40 class Header {
41
42 public:
43
44 /**
45 * To build a header given the containing buffer. I need to know
46 * where the header starts in order to do that.
47 *
48 * @param it The exact position where this header should start.
49 * @param match The word that this header should match.
50 */
51 Header (const uint32_t* it, uint32_t match);
52
53 /**
54 * Destructor virtualisation
55 */
56 virtual ~Header() {}
57
58 /**
59 * Says if the generic part of the header is valid. This may throw
60 * exceptions.
61 */
62 virtual bool check () const;
63
64 /**
65 * Returns the fragment type.
66 */
67 inline uint32_t marker() const { return m_start[0]; }
68
69 /**
70 * Returns the size, in words, of the current fragment.
71 */
72 inline uint32_t fragment_size_word() const { return m_start[1]; }
73
74 /**
75 * Returns the size, in words, of the current header. That does include
76 * the specific part of the header.
77 */
78 inline uint32_t header_size_word() const { return m_start[2]; }
79
80 /**
81 * Returns the formatting version.
82 */
83 inline uint32_t version() const { return m_start[3]; }
84
85 /**
86 * Returns the full source identifier.
87 */
88 inline uint32_t source_id() const { return m_start[4]; }
89
90 /**
91 * Returns the current run number.
92 */
93 inline uint32_t run_no() const { return m_start[5]; }
94
95 /**
96 * Returns the number of status words available
97 */
98 inline uint32_t nstatus () const { return m_start[6]; }
99
100 /**
101 * Returns the status words, as an iterator to the status words
102 * available.
103 */
104 inline const uint32_t* status () const { return &m_start[7]; }
105
106 /**
107 * Returns the number of offset words available. This will also determine
108 * the number of child fragments available to this super-fragment.
109 */
110 inline uint32_t noffset () const { return m_start[7 + nstatus()]; }
111
112 /**
113 * Returns the offset words, as an iterator to the offset words
114 * available.
115 */
116 inline const uint32_t* offset (void) const
117 { return &m_start[8 + nstatus()]; }
118
119 /**
120 * Returns the number of specific words available in the specific header
121 * part
122 */
123 inline uint32_t nspecific () const
124 { return m_start[8 + nstatus() + noffset()]; }
125
126 /**
127 * Returns an iterator to the start of the specific header part (this
128 * includes the number of specific header fragments)
129 */
130 inline const uint32_t* specific_header (void) const
131 { return &m_start[9 + nstatus() + noffset()]; }
132
133 /**
134 * Returns the nth child fragment. If the nth fragment doesn't exist, an
135 * exception is thrown.
136 *
137 * @param n The fragment position, starting at zero, of the child
138 * fragment you would like to get.
139 */
140 const uint32_t* child (size_t n) const;
141
142 private: ///< representation
143
144 const uint32_t* m_start; ///< my start word
145
146 };
147
148 }
149
150}
151
152#endif //EFORMAT_OLD_HEADER_H
const Int_t n
uint32_t version() const
Definition: old/Header.h:83
virtual bool check() const
Definition: Header24.cxx:29
const uint32_t * offset(void) const
Definition: old/Header.h:116
uint32_t fragment_size_word() const
Definition: old/Header.h:72
const uint32_t * status() const
Definition: old/Header.h:104
uint32_t nstatus() const
Definition: old/Header.h:98
uint32_t run_no() const
Definition: old/Header.h:93
uint32_t source_id() const
Definition: old/Header.h:88
const uint32_t * child(size_t n) const
Definition: Header24.cxx:39
uint32_t noffset() const
Definition: old/Header.h:110
uint32_t nspecific() const
Definition: old/Header.h:123
const uint32_t * specific_header(void) const
Definition: old/Header.h:130
uint32_t marker() const
Definition: old/Header.h:67
uint32_t header_size_word() const
Definition: old/Header.h:78