示例#1
0
void Trode::set_thresh_uv_one_thresh_n_chans(int16_t uv_thresh, int *chan_array, int n_chans_to_set){

  double thresh_at_daq_V;
  int target_chans[MAX_FILTERED_BUFFER_N_CHANS];
  int n_target;
  int i;
 
  if(n_chans_to_set == -1){
    n_target = n_chans;
    for(i = 0; i < n_target; i++){
      target_chans[i] = i;
    }
  } else {
    n_target = n_chans_to_set;
    for(i = 0; i < n_target; i++){
      if( chan_array[i] < n_chans ){
	target_chans[i] = chan_array[i];
      } else {
	printf("Error: tried to set chan %d of trode %d which has %d chans\n", 
	       chan_array[i], name, n_chans);
	target_chans[i] = i;
      }
    }
  }

  for(i = 0; i < n_target; i++){
    thresh_at_daq_V = (double)uv_thresh / 1000000.0 * (double)gains[i];
    thresholds[i] = ftor(&thresh_at_daq_V);
  }
}
示例#2
0
void G2Builder::setupAdapter()
{
	G2 ftor(dC, dx0);
	if(!ftorAdapter)
	{
		adapter<G2>(ftorAdapter);
	}
	adapterSetFunctor(ftorAdapter, ftor);
}
示例#3
0
void QP1Builder::setupAdapter()
{
	QP1 ftor(c());
	if(!ftorAdapter)
	{
		adapter<QP1>(ftorAdapter);
	}
	adapterSetFunctor(ftorAdapter, ftor);
}
示例#4
0
int
main()
{
    //////////////////////////////////
    // compile time check wether as_parser<> works for if_p

    ::boost::spirit::rule<> r;

    r = ::boost::spirit::if_p('-')['-'];
    r = ::boost::spirit::if_p("-")["-"];
    r = ::boost::spirit::if_p('-')['-'].else_p['-'];
    r = ::boost::spirit::if_p("-")["-"].else_p["-"];
    
    r = ::boost::spirit::if_p(&fun)["foo"];
    r = ::boost::spirit::if_p(ftor())["foo"];
    r = ::boost::spirit::if_p(&fun)["foo"].else_p["bar"];
    r = ::boost::spirit::if_p(ftor())["foo"].else_p["bar"];

    r = ::boost::spirit::if_p(r)[r];
    r = ::boost::spirit::if_p(r)[r].else_p[r];
}
示例#5
0
void	AtomicIntOp::exec_both (AtomicInt <T> &atom, F &ftor, T &val_old, T &val_new)
{
	assert (&atom != 0);
	assert (&ftor != 0);

	T					val_cur;
	do
	{
		val_cur = atom;
		val_new = ftor (val_cur);
		val_old = atom.cas (val_new, val_cur);
	}
	while (val_old != val_cur);
}
示例#6
0
template <typename F> void Method(char* data, size_t size, F ftor)
{
    ftor(data);
}
void ftor_a(double *f_val, rdata_t *r_value, int n_elem){
  for(int i = 0; i < n_elem; i++){
    r_value[i] = ftor(f_val+i);
  }
}