Psyllid  v1.12.4
Project 8 Data Acquisisition Software
terminator.cc
Go to the documentation of this file.
1 /*
2  * terminator.cc
3  *
4  * Created on: May 31, 2016
5  * Author: nsoblath
6  */
7 
8 #include "terminator.hh"
9 
10 #include "freq_data.hh"
11 
12 #include "logger.hh"
13 
14 
15 
16 namespace psyllid
17 {
18  REGISTER_NODE_AND_BUILDER( terminator_time_data, "term-time-data", terminator_time_data_binding );
19  REGISTER_NODE_AND_BUILDER( terminator_freq_data, "term-freq-data", terminator_freq_data_binding );
20  REGISTER_NODE_AND_BUILDER( terminator_trigger_flag, "term-trig-flag", terminator_trigger_flag_binding );
21 
22  LOGGER( plog, "terminator" );
23 
24 
25  //************************
26  // terminator_time_data
27  //************************
28 
30  {
31  }
32 
34  {
35  }
36 
38  {
39  return;
40  }
41 
42  void terminator_time_data::execute( midge::diptera* a_midge )
43  {
44  try
45  {
46  midge::enum_t t_command = midge::stream::s_none;
47 
48  while( ! is_canceled() )
49  {
50  t_command = in_stream< 0 >().get();
51  if( t_command == midge::stream::s_none ) continue;
52  if( t_command == midge::stream::s_error ) break;
53 
54  if( t_command == midge::stream::s_exit )
55  {
56  LDEBUG( plog, "Terminator is exiting" );
57  break;
58  }
59 
60  if( t_command == midge::stream::s_stop )
61  {
62  LDEBUG( plog, "Terminator is stopping" );
63  continue;
64  }
65 
66  if( t_command == midge::stream::s_start )
67  {
68  LDEBUG( plog, "Terminator is starting" );
69  continue;
70  }
71 
72  if( t_command == midge::stream::s_run )
73  {
74  continue;
75  }
76 
77  }
78 
79  return;
80  }
81  catch(...)
82  {
83  if( a_midge ) a_midge->throw_ex( std::current_exception() );
84  else throw;
85  }
86  }
87 
89  {
90  return;
91  }
92 
93 
96  {}
97 
99  {}
100 
101  void terminator_time_data_binding::do_apply_config( terminator_time_data*, const scarab::param_node& ) const
102  {}
103 
104  void terminator_time_data_binding::do_dump_config( const terminator_time_data*, scarab::param_node& ) const
105  {}
106 
107 
108  //************************
109  // terminator_freq_data
110  //************************
111 
113  {
114  }
115 
117  {
118  }
119 
121  {
122  return;
123  }
124 
125  void terminator_freq_data::execute( midge::diptera* a_midge )
126  {
127  try
128  {
129  midge::enum_t t_command = midge::stream::s_none;
130 
131  while( ! is_canceled() )
132  {
133  t_command = in_stream< 0 >().get();
134  if( t_command == midge::stream::s_none ) continue;
135  if( t_command == midge::stream::s_error ) break;
136 
137  if( t_command == midge::stream::s_exit )
138  {
139  LDEBUG( plog, "Terminator is exiting" );
140  break;
141  }
142 
143  if( t_command == midge::stream::s_stop )
144  {
145  LDEBUG( plog, "Terminator is stopping" );
146  continue;
147  }
148 
149  if( t_command == midge::stream::s_start )
150  {
151  LDEBUG( plog, "Terminator is starting" );
152  continue;
153  }
154 
155  if( t_command == midge::stream::s_run )
156  {
157  continue;
158  }
159 
160  }
161 
162  return;
163  }
164  catch(...)
165  {
166  if( a_midge ) a_midge->throw_ex( std::current_exception() );
167  else throw;
168  }
169  }
170 
172  {
173  return;
174  }
175 
176 
179  {}
180 
182  {}
183 
184  void terminator_freq_data_binding::do_apply_config( terminator_freq_data*, const scarab::param_node& ) const
185  {}
186 
187  void terminator_freq_data_binding::do_dump_config( const terminator_freq_data*, scarab::param_node& ) const
188  {}
189 
190 
192  /*
193  terminator_trigger_flag::terminator_trigger_flag()
194  {
195  }
196 
197  terminator_trigger_flag::~terminator_trigger_flag()
198  {
199  }
200 
201  void terminator_trigger_flag::execute( midge::diptera* a_midge )
202  {
203  try
204  {
205  midge::enum_t t_command = midge::stream::s_none;
206 
207  while( ! is_canceled() )
208  {
209  t_command = in_stream< 0 >().get();
210  if( t_command == midge::stream::s_none )
211  {
212  LTRACE( plog, "Terminator s_none" );
213  continue;
214  }
215  if( t_command == midge::stream::s_error )
216  {
217  LTRACE( plog, "Terminator s_error" );
218  break;
219 
220  if( t_command == midge::stream::s_exit )
221  {
222  LDEBUG( plog, "Terminator is exiting" );
223  break;
224  }
225 
226  if( t_command == midge::stream::s_stop )
227  {
228  LDEBUG( plog, "Terminator is stopping" );
229  continue;
230  }
231 
232  if( t_command == midge::stream::s_start )
233  {
234  LDEBUG( plog, "Terminator is starting" );
235  continue;
236  }
237 
238  if( t_command == midge::stream::s_run )
239  {
240  LTRACE( plog, "Terminator run" );
241  continue;
242  }
243 
244  }
245 
246  return;
247  }
248  catch(...)
249  {
250  if( a_midge ) a_midge->throw_ex( std::current_exception() );
251  else throw;
252  }
253  }
254 
255  terminator_trigger_flag_binding::terminator_trigger_flag_binding() :
256  _node_binding< terminator_trigger_flag, terminator_trigger_flag_binding >()
257  {}
258 
259  terminator_trigger_flag_binding::~terminator_trigger_flag_binding()
260  {}
261  */
262 
263 } /* namespace psyllid */
virtual void do_apply_config(terminator_freq_data *a_node, const scarab::param_node &a_config) const
Definition: terminator.cc:184
virtual void execute(midge::diptera *a_midge=nullptr)
Definition: terminator.cc:125
virtual void do_dump_config(const terminator_time_data *a_node, scarab::param_node &a_config) const
Definition: terminator.cc:104
virtual void execute(midge::diptera *a_midge=nullptr)
Definition: terminator.cc:42
static scarab::logger plog("batch_executor")
#define IMPLEMENT_TERMINATOR(data_class)
Definition: terminator.hh:43
virtual void do_dump_config(const terminator_freq_data *a_node, scarab::param_node &a_config) const
Definition: terminator.cc:187
REGISTER_NODE_AND_BUILDER(data_producer, "data-producer", data_producer_binding)
LOGGER(plog, "egg_writer")
virtual void do_apply_config(terminator_time_data *a_node, const scarab::param_node &a_config) const
Definition: terminator.cc:101