Orion
high-rate readout
decoder.hpp
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <span>
8 #include <functional>
9 
10 #include "deccore.hpp"
11 
12 namespace itk::itkpix::endec {
13 
14 namespace intf {
15 
16 template<typename T>
17 class Decoder {
18 public:
19  using EventCallback = T;
20 
21  virtual ~Decoder() = default;
22 
23  virtual void reset() = 0;
24 
25  virtual void decode(EventCallback& cb, std::span<const uint8_t> buff, uint8_t pos = 0) = 0;
26 
27  virtual void decode(EventCallback& cb, std::span<const uint64_t> buff, uint8_t pos = 0) = 0;
28 
29  // properties
30  virtual void set_options(const Options& opt) = 0;
31  virtual uint64_t get_status() = 0;
32  virtual void set_status(uint64_t status) = 0;
33 };
34 
35 } // intf
36 
37 namespace factory {
38 
41 struct Decoder {
42 
45  inline auto operator()() { return func(); }
46 
50  inline auto operator()(Options opt) { return func_opt(opt); }
51 
54  template<typename T>
55  static inline Decoder make() {
56  Decoder maker;
57  maker.func = []() -> auto { return new T(); };
58  maker.func_opt = [](Options opt) -> auto { return new T(opt); };
59  return maker;
60  }
61 
62  std::function<intf::Decoder<intf::EventCallback>* ()> func;
63  std::function<intf::Decoder<intf::EventCallback>* (Options opt)> func_opt;
64 };
65 
66 } // factory
67 
68 
69 } // itk::itkpix::decoder
70 
Definition: test_enc_dec.cpp:117
Definition: decoder.hpp:17
uint32_t status[n]
number of status elements
Definition: fragheader.hpp:9
Implementation for ITkPix Decoder.
Common encoder/decoder options.
Definition: options.hpp:10
Constructor for Decoder.
Definition: decoder.hpp:41
auto operator()()
Constructor.
Definition: decoder.hpp:45
auto operator()(Options opt)
Constructor.
Definition: decoder.hpp:50
static Decoder make()
Create Decoder maker.
Definition: decoder.hpp:55