Orion
high-rate readout
cmddecoder.hpp
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <cstdint>
8 #include <span>
9 #include <functional>
10 
11 #include "cmdcallback.hpp"
12 
13 namespace itk::itkpix::cmd {
14 
15 namespace intf {
21 public:
22  // using CommandCallback = intf::CommandCallback;
23 
24  virtual ~CommandDecoder() = default;
25 
27  virtual void reset() = 0;
28 
31  virtual void decode(uint16_t cmd) = 0;
32 
35  virtual void decode(const std::span<const uint16_t> cmds) = 0;
36 
40  inline void decode(const uint16_t* cmds, size_t size) { decode({ cmds, size }); }
41 
42 }; // CommandDecoder
43 
44 } // intf
45 
46 
47 namespace concepts {
48 
53 template<typename T>
54 concept CommandDecoder =
55 
57  std::constructible_from<T, typename T::CommandCallback&> and
58 
61  std::constructible_from<T, uint8_t, typename T::CommandCallback&> and
62 
63  // /// @brief Destructor
64  std::destructible<T> and
65 
66  requires () {
68  } and
69 
71  requires(T self) {
72  { self.reset() } -> std::same_as<void>;
73  } and
74 
77  requires(T self, uint16_t cmd) {
78  { self.decode(cmd) } -> std::same_as<void>;
79  } and
80 
84  requires(T self, uint16_t* cmds, size_t size) {
85  { self.decode(cmds, size) } -> std::same_as<void>;
86  } and
87 
90  requires(T self, const std::span<const uint16_t> cmds) {
91  { self.decode(cmds) } -> std::same_as<void>;
92  };
93 
94 }; // concepts
95 
96 } // emu::itkpix
Command callback interface for ITkPix.
Definition: cmdcallback.hpp:20
Command stream decoder interface.
Definition: cmddecoder.hpp:20
virtual void decode(const std::span< const uint16_t > cmds)=0
Decode 16-bit commands.
void decode(const uint16_t *cmds, size_t size)
Decode 16-bit commands.
Definition: cmddecoder.hpp:40
virtual void decode(uint16_t cmd)=0
Decode 16-bit command.
virtual void reset()=0
Reset command decoder.
Dummy CommandCallback implementation.
uint16_t size
Definition: fragheader.hpp:5