Jpp 21.0.0-rc.1-88-g0130508c4
the software that should make you happy
Loading...
Searching...
No Matches
JDAQSuperFrame.hh
Go to the documentation of this file.
1#ifndef __JDAQSUPERFRAME__
2#define __JDAQSUPERFRAME__
3
11
12
13/**
14 * \author mdejong
15 */
16
17namespace KM3NETDAQ {
18
19 /**
20 * Data frame of one optical module.
21 */
23 public JDAQPreamble,
25 public JDAQFrame
26 {
27 public:
28
29 using JDAQFrame::add;
30
35
36 friend size_t getSizeof(const JDAQSuperFrame&);
38 friend JWriter& operator<<(JWriter&, const JDAQSuperFrame&);
39
40 /**
41 * Default constructor.
42 */
48
49
50 /**
51 * Constructor.
52 *
53 * \param header JDAQ super frame header
54 */
60
61
62 /**
63 * Copy constructor.
64 *
65 * \param super_frame JDAQ super frame
66 */
67 JDAQSuperFrame(const JDAQSuperFrame& super_frame) :
70 JDAQFrame(super_frame)
71 {}
72
73
74 /**
75 * Add data from same optical module.
76 *
77 * \param super_frame JDAQ super frame
78 * \return this JDAQ super frame
79 */
80 JDAQSuperFrame& add(const JDAQSuperFrame& super_frame)
81 {
82 if (this->getModuleID() != super_frame.getModuleID()) {
83 throw JDAQException("JDAQSuperFrame::add(): Different module identifiers.");
84 }
85
86 add(static_cast<const JDAQFrame&>(super_frame));
87
88 return *this;
89 }
90
92 };
93
94
95 /**
96 * Equal operator for DAQ super frames.
97 *
98 * \param first super frame
99 * \param second super frame
100 * \result true if first super frame equal to second; else false
101 */
102 inline bool operator==(const JDAQSuperFrame& first,
103 const JDAQSuperFrame& second)
104 {
105 if (first.getDAQSuperFrameHeader() == second.getDAQSuperFrameHeader() &&
106 first.size() == second.size()) {
107
108 for (JDAQSuperFrame::const_iterator p = first.begin(), q = second.begin(); p != first.end(); ++p, ++q) {
109 if (*p != *q) {
110 return false;
111 }
112 }
113
114 return true;
115
116 } else {
117
118 return false;
119 }
120 }
121
122
123 /**
124 * Not-equal operator for DAQ super frames.
125 *
126 * \param first super frame
127 * \param second super frame
128 * \result true if first super frame not equal to second; else false
129 */
130 inline bool operator!=(const JDAQSuperFrame& first,
131 const JDAQSuperFrame& second)
132 {
133 return !(first == second);
134 }
135}
136
137#endif
KM3NeT DAQ constants, bit handling, etc.
Interface for binary input.
Interface for binary output.
General exception.
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition JDAQFrame.hh:71
const_iterator end() const
Definition JDAQFrame.hh:166
JDAQFrame & add(const int number_of_hits, const JDAQHit *data)
Add data.
Definition JDAQFrame.hh:220
std::reverse_iterator< iterator > reverse_iterator
Definition JDAQFrame.hh:72
const_iterator begin() const
Definition JDAQFrame.hh:165
Hit data structure.
Definition JDAQHit.hh:35
int getModuleID() const
Get module identifier.
const JDAQSuperFrameHeader & getDAQSuperFrameHeader() const
Get DAQ super frame header.
Data frame of one optical module.
JDAQSuperFrame & add(const JDAQSuperFrame &super_frame)
Add data from same optical module.
friend JReader & operator>>(JReader &, JDAQSuperFrame &)
Read JDAQ super frame from input.
friend size_t getSizeof(const JDAQSuperFrame &)
Get size of object.
JDAQSuperFrame(const JDAQSuperFrame &super_frame)
Copy constructor.
ClassDef(JDAQSuperFrame, 4)
JDAQFrame::const_iterator const_iterator
friend JWriter & operator<<(JWriter &, const JDAQSuperFrame &)
Write JDAQSuperFrame to output.
JDAQFrame::iterator iterator
JDAQSuperFrame(const JDAQSuperFrameHeader &header)
Constructor.
JDAQSuperFrame()
Default constructor.
JDAQFrame::reverse_iterator reverse_iterator
JDAQFrame::const_reverse_iterator const_reverse_iterator
bool operator==(const Head &first, const Head &second)
Equal operator.
Definition JHead.hh:1819
bool operator!=(const JTag &first, const JTag &second)
Not equal operator for JTag.
Definition JTag.hh:291
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
Auxiliary class for a DAQ type holder.