diff options
| author | Josh Blum <josh@joshknows.com> | 2010-02-13 09:22:12 -0800 | 
|---|---|---|
| committer | Josh Blum <josh@joshknows.com> | 2010-02-13 09:22:12 -0800 | 
| commit | 97785c838e088f978c8dd2c4c796cdcbeafebffc (patch) | |
| tree | 30b6dbbcd145f507cc353df220bf3b80425fdea5 /lib | |
| parent | 51e5396079d8af7cf8287b586ff2351a19ae8381 (diff) | |
| download | uhd-97785c838e088f978c8dd2c4c796cdcbeafebffc.tar.gz uhd-97785c838e088f978c8dd2c4c796cdcbeafebffc.tar.bz2 uhd-97785c838e088f978c8dd2c4c796cdcbeafebffc.zip | |
Compiling under old fedora8 with boost 1.37.
Fixed somethings that caused errors and warnings.
Cannot get rid of all warnings on this system.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gain_handler.cpp | 31 | ||||
| -rw-r--r-- | lib/usrp/mboard/test.cpp | 1 | 
2 files changed, 18 insertions, 14 deletions
| diff --git a/lib/gain_handler.cpp b/lib/gain_handler.cpp index 85cacd2a5..b03d5bda2 100644 --- a/lib/gain_handler.cpp +++ b/lib/gain_handler.cpp @@ -72,35 +72,40 @@ void gain_handler::_check_key(const wax::obj &key_){      catch(const std::assert_error &){}  } +static gain_t gain_max(gain_t a, gain_t b){ +    return std::max(a, b); +} +static gain_t gain_sum(gain_t a, gain_t b){ +    return std::sum(a, b); +} +  bool gain_handler::intercept_get(const wax::obj &key, wax::obj &val){      _check_key(key); //verify the key -    // use a vector of tuples to map properties to a reducer function -    // we cant use a map because the wax::obj cant be sorted -    typedef boost::function<gain_t(gain_t, gain_t)> reducer_t; -    typedef boost::tuple<wax::obj, reducer_t> tuple_t; -    reducer_t reducer_sum = boost::bind(std::sum<gain_t>, _1, _2); -    reducer_t reducer_max = boost::bind(std::max<gain_t>, _1, _2); -    std::vector<tuple_t> prop_to_reducer = boost::assign::tuple_list_of -        (_gain_prop,      reducer_sum)(_gain_min_prop,  reducer_sum) -        (_gain_max_prop,  reducer_sum)(_gain_step_prop, reducer_max); +    std::vector<wax::obj> gain_props = boost::assign::list_of +        (_gain_prop)(_gain_min_prop)(_gain_max_prop)(_gain_step_prop);      /*!       * Handle getting overall gains when a name is not specified.       * For the gain props below, set the overall value and return true.        */ -    BOOST_FOREACH(tuple_t p2r, prop_to_reducer){ -        if (_is_equal(key, p2r.get<0>())){ +    BOOST_FOREACH(wax::obj prop_key, gain_props){ +        if (_is_equal(key, prop_key)){              //form the gains vector from the props vector              prop_names_t prop_names = GET_PROP_NAMES();              std::vector<gain_t> gains(prop_names.size());              std::transform(                  prop_names.begin(), prop_names.end(), gains.begin(), -                boost::bind(get_named_gain, _wax_obj_ptr, p2r.get<0>(), _1) +                boost::bind(get_named_gain, _wax_obj_ptr, key, _1)              );              //reduce across the gain vector -            val = std::reduce<gain_t>(gains.begin(), gains.end(), p2r.get<1>()); +            if (_is_equal(key, _gain_step_prop)){ +                val = std::reduce<gain_t>(gains.begin(), gains.end(), gain_max); +            } +            else{ +                val = std::reduce<gain_t>(gains.begin(), gains.end(), gain_sum); +            }              return true;          }      } diff --git a/lib/usrp/mboard/test.cpp b/lib/usrp/mboard/test.cpp index c533c97b4..67d3c70fa 100644 --- a/lib/usrp/mboard/test.cpp +++ b/lib/usrp/mboard/test.cpp @@ -91,7 +91,6 @@ private:              }          case DBOARD_PROP_CODEC: -            val = NULL; //TODO              return;          }      } | 
