Advertisement
Nuke29

mer_detector.h

Oct 3rd, 2022
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.42 KB | Source Code | 0 0
  1. #ifndef INC_TECH_CHANNEL_MER_DETECTOR_H_
  2. #define INC_TECH_CHANNEL_MER_DETECTOR_H_
  3.  
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7.  
  8. #include "tech_channel.h"
  9.  
  10. class MER_Detector : public Tech_Channel {
  11. public:
  12.     MER_Detector(const MER_Detector& rhs) = delete;
  13.     MER_Detector(MER_Detector&& rhs) = delete;
  14.     MER_Detector& operator =(const MER_Detector& rhs) = delete;
  15.     MER_Detector& operator =(MER_Detector&& rhs) = delete;
  16.  
  17.     MER_Detector(int adc_freq, int adc_ch_mask);
  18.  
  19.     virtual void push_to_calc(int64_t data1_, int64_t data2_, int64_t data3_) override;
  20.     virtual const int get_triggered() const override;
  21.     virtual const int get_trigglvl() const override;
  22.  
  23. #if DEBUG
  24.     void show_triggered();
  25. #endif
  26.  
  27. private:
  28.     void calc_trigger();
  29.  
  30.     static constexpr int mer_factor = 4;
  31.     static constexpr int trigg_lvl = 40;
  32.     const int top_freq = 5;
  33.     const int estimate_denominator = 100;
  34.  
  35.     bool is_filled = false;
  36.  
  37.     size_t position = 0;
  38.     int num_of_adcs = 0;
  39.     size_t mer_length;
  40.     size_t arr_length;
  41.     size_t step;
  42.  
  43.     int64_t left_mer_accum = 0;
  44.     int64_t right_mer_accum = 0;
  45.     int trigg_fraction = 0;
  46.     int trigg_to_show = 0;
  47.  
  48.     int mer_ratio[2];
  49.     int cur_pos = 1;
  50.     int prev_pos = 0;
  51. };
  52.  
  53. inline
  54. const int MER_Detector::get_triggered() const {
  55.     return trigg_to_show;
  56. }
  57.  
  58. inline
  59. const int MER_Detector::get_trigglvl() const {
  60.     return trigg_lvl;
  61. }
  62.  
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66.  
  67. #endif /* INC_TECH_CHANNEL_MER_DETECTOR_H_ */
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement