Orion
high-rate readout
outcallback.hpp
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <cstdint>
8 
9 namespace itk::itkpix::endec {
10 
15 struct OutputError {
16 
18  enum error_t {
19  UNDEFINED = 0,
24  TOT_NOHIT_ERROR = 5
25  };
26 
28  uint8_t qcol;
29  uint8_t qrow;
30 
31 };
32 
33 namespace intf {
34 
40 public:
42  virtual ~OutputCallback() = default;
43 
45  virtual void out_init() = 0;
46 
49  virtual void out_next(uint8_t nbits) = 0;
50 
54  virtual void out_done(uint8_t nbits) = 0;
55 
58  virtual void out_data(uint64_t data) = 0;
59 
60 
64  virtual uint8_t on_error(OutputError error) = 0;
65 };
66 
67 } // intf
68 
69 namespace concepts {
70 
71 template<typename T>
72 concept OutputCallback =
73  std::destructible<T> and
74  requires(T self, uint8_t tag) {
75  { self.out_init(tag) } -> std::same_as<void>;
76  { self.out_next(tag) } -> std::same_as<void>;
77  { self.out_done() } -> std::same_as<void>;
78  } and
79  requires(T self, uint64_t data) {
80  { self.out_data(data) } -> std::same_as<void>;
81  } and
82  requires(T self, OutputError error) {
83  { self.on_error(error) } -> std::same_as<uint8_t>;
84  };
85 
86 } // concepts
87 
88 } // itk::itkpix::encoder
Callback interface for output.
Definition: outcallback.hpp:39
virtual void out_data(uint64_t data)=0
Output 64-bit data word for current event.
virtual void out_next(uint8_t nbits)=0
Complete the event and start the next one.
virtual void out_init()=0
Create a new stream and start a new event.
virtual void out_done(uint8_t nbits)=0
Complete the event and finalize the stream.
virtual ~OutputCallback()=default
Destructor.
virtual uint8_t on_error(OutputError error)=0
Callback on encoding error.
Callback on event decoding error.
Definition: outcallback.hpp:15
error_t
Encoding errors.
Definition: outcallback.hpp:18
@ UNDEFINED
undefined
Definition: outcallback.hpp:19
@ TOT_NOHIT_ERROR
appeared "no hit" ToT = 0xF, which should never appear
Definition: outcallback.hpp:24
@ QCOL_RANGE_ERROR
qcol out of range
Definition: outcallback.hpp:20
@ WRONG_STATE_ERROR
wrong state
Definition: outcallback.hpp:23
@ QROW_ORDER_ERROR
incorrect order of qrow
Definition: outcallback.hpp:22
@ QROW_RANGE_ERROR
qrow out of range
Definition: outcallback.hpp:21
error_t code
error code
Definition: outcallback.hpp:27
uint8_t qcol
error qcol
Definition: outcallback.hpp:28
uint8_t qrow
error qrow
Definition: outcallback.hpp:29