BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
RODFragment.h
Go to the documentation of this file.
1//Dear emacs, this is -*- c++ -*-
2
3/**
4 * @file eformat/old/RODFragment.h
5 * @author <a href="mailto:[email protected]">Andre DOS ANJOS</a>
6 * $Author: zhangy $
7 * $Revision: 1.1.1.1 $
8 * $Date: 2009/06/19 07:35:41 $
9 *
10 * @brief Definition of the ROD header entity, following the description of
11 * the Event Format note, version 2.4
12 */
13
14#ifndef EFORMAT_OLD_RODFRAGMENT_H
15#define EFORMAT_OLD_RODFRAGMENT_H
16
17#include <stdint.h>
18#include <cstdlib>
19
20namespace eformat {
21
22 namespace old {
23
24 /**
25 * Implements the access methods and checking for the ROD header object,
26 * present in the event format stream. Manipulating ROD's is a bit
27 * different than the other fragments, as one can't know its ending
28 * position. There are two ways to solve that: the first being to give a
29 * pointer and a size, but the second, a bit more elegant, to indicate the
30 * end of the ROD instead of its begin.
31 */
33
34 public: //interface
35
36 /**
37 * To build a header given the containing buffer. I need to know where
38 * the header starts in order to do that.
39 *
40 * @param it The position pointing the first word of this fragment
41 * @param size_word The size of this fragment, in words
42 */
43 RODFragment (const uint32_t* it, size_t size_word);
44
45 /**
46 * Destructor virtualisation
47 */
48 virtual ~RODFragment() {}
49
50 /**
51 * Says if the the header is valid. This may throw exceptions.
52 */
53 virtual bool check () const;
54
55 /**
56 * Returns the fragment type.
57 */
58 inline uint32_t marker() const { return m_start[0]; }
59
60 /**
61 * Returns the total fragment size
62 */
63 uint32_t fragment_size_word() const;
64
65 /**
66 * Returns the size, in words, of the current header. That does @b
67 * not include the trailer.
68 */
69 inline uint32_t header_size_word() const { return m_start[1]; }
70
71 /**
72 * Returns the size, in words, of the trailer
73 */
74 inline uint32_t trailer_size_word() const { return 3; }
75
76 /**
77 * Returns the formatting version.
78 */
79 inline uint32_t version() const { return m_start[2]; }
80
81 /**
82 * Returns the full source identifier.
83 */
84 inline uint32_t source_id() const { return m_start[3]; }
85
86 /**
87 * Returns the current run number.
88 */
89 inline uint32_t run_no() const { return m_start[4]; }
90
91 /**
92 * Returns the lvl1 identifier
93 */
94 inline uint32_t lvl1_id() const { return m_start[5]; }
95
96 /**
97 * Returns the bunch crossing identifier
98 */
99 inline uint32_t bc_id() const { return m_start[6]; }
100
101 /**
102 * Returns the lvl1 trigger type
103 */
104 inline uint32_t lvl1_trigger_type() const { return m_start[7]; }
105
106 /**
107 * Returns the detector event type
108 */
109 inline uint32_t detev_type() const { return m_start[8]; }
110
111 /**
112 * Returns the number of status words available
113 */
114 inline uint32_t nstatus () const { return m_start[m_size-3]; }
115
116 /**
117 * Returns the status words, as an iterator to the status words
118 * available.
119 */
120 const uint32_t* status (void) const;
121
122 /**
123 * Returns the number of data words available
124 */
125 inline uint32_t ndata () const { return m_start[m_size-2]; }
126
127 /**
128 * Returns a pointer to the first data word
129 */
130 const uint32_t* data (void) const;
131
132 /**
133 * Returns the status block position. A value of <tt>zero</tt> indicates
134 * that the status block preceeds the data block. A value of <tt>one</tt>
135 * means the contrary.
136 */
137 inline uint32_t status_position () const { return m_start[m_size-1]; }
138
139 private: //representation
140
141 const uint32_t* m_start; ///< my end word
142 size_t m_size; ///< my total size, in number of words
143
144 };
145
146 }
147
148}
149
150#endif /* EFORMAT_OLD_RODFRAGMENT_H */
uint32_t source_id() const
Definition: RODFragment.h:84
uint32_t marker() const
Definition: RODFragment.h:58
uint32_t status_position() const
Definition: RODFragment.h:137
uint32_t run_no() const
Definition: RODFragment.h:89
const uint32_t * status(void) const
uint32_t bc_id() const
Definition: RODFragment.h:99
uint32_t nstatus() const
Definition: RODFragment.h:114
virtual bool check() const
uint32_t lvl1_id() const
Definition: RODFragment.h:94
uint32_t detev_type() const
Definition: RODFragment.h:109
uint32_t version() const
Definition: RODFragment.h:79
uint32_t trailer_size_word() const
Definition: RODFragment.h:74
uint32_t ndata() const
Definition: RODFragment.h:125
const uint32_t * data(void) const
uint32_t lvl1_trigger_type() const
Definition: RODFragment.h:104
uint32_t fragment_size_word() const
uint32_t header_size_word() const
Definition: RODFragment.h:69