Psyllid  v1.12.4
Project 8 Data Acquisisition Software
tf_roach_receiver.hh
Go to the documentation of this file.
1 /*
2  * udp_receiver.hh
3  *
4  * Created on: Dec 25, 2015
5  * Author: nsoblath
6  */
7 
8 #ifndef PSYLLID_TF_ROACH_RECEIVER_HH_
9 #define PSYLLID_TF_ROACH_RECEIVER_HH_
10 
11 #include "freq_data.hh"
12 #include "memory_block.hh"
13 #include "node_builder.hh"
14 #include "time_data.hh"
15 
16 #include "transformer.hh"
17 #include "shared_cancel.hh"
18 
19 #include <memory>
20 
21 namespace scarab
22 {
23  class param_node;
24 }
25 
26 namespace psyllid
27 {
60  class tf_roach_receiver : public midge::_transformer< midge::type_list< memory_block >, midge::type_list< time_data, freq_data > >
61  {
62  public:
64  virtual ~tf_roach_receiver();
65 
66  public:
67  mv_accessible( uint64_t, time_length );
68  mv_accessible( uint64_t, freq_length );
69  mv_accessible( uint64_t, udp_buffer_size );
70  mv_accessible( unsigned, time_sync_tol );
71  mv_accessible( bool, start_paused );
72  mv_accessible( bool, force_time_first );
73  mv_accessible( unsigned, skip_after_stop );
74 
75  public:
76  void switch_to_freq_only();
77  void switch_to_time_and_freq();
78 
79  virtual void initialize();
80  virtual void execute( midge::diptera* a_midge = nullptr );
81  virtual void finalize();
82 
83  private:
85  {
86  midge::diptera* f_midge;
87  midge::enum_t f_in_command;
91  std::unique_ptr< char[] > f_buffer_ptr;
92  size_t f_pkt_size;
93  };
94 
95  bool exe_time_and_freq( exe_func_context& a_ctx );
96  bool exe_freq_only( exe_func_context& a_ctx );
97 
98  bool (tf_roach_receiver::*f_exe_func)( exe_func_context& a_ctx );
99  std::mutex f_exe_func_mutex;
100  std::atomic< bool > f_break_exe_func;
101 
102  bool f_paused;
103 
106 
107  };
108 
109  class tf_roach_receiver_binding : public _node_binding< tf_roach_receiver, tf_roach_receiver_binding >
110  {
111  public:
113  virtual ~tf_roach_receiver_binding();
114 
115  private:
116  virtual void do_apply_config( tf_roach_receiver* a_node, const scarab::param_node& a_config ) const;
117  virtual void do_dump_config( const tf_roach_receiver* a_node, scarab::param_node& a_config ) const;
118 
119  virtual bool do_run_command( tf_roach_receiver* a_node, const std::string& a_cmd, const scarab::param_node& ) const;
120  };
121 
122 } /* namespace psyllid */
123 
124 #endif /* PSYLLID_TF_ROACH_RECEIVER_HH_ */
std::atomic< bool > f_break_exe_func
A transformer to receive raw blocks of memory, parse them, and distribute them as time and frequency ...