From daed43a8a873ad5cc16ac8a3eb6db5a8fe126fa5 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 11 Mar 2010 18:37:34 -0800 Subject: Cleaned up the gain handler (thing that gets and sets wildcard gains) and made use of it in the dboard manager so it intercepts the sets and gets. While doing this, fixed something with nested links in wax obj. Added some useful macros and templates to the utils. --- host/test/gain_handler_test.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'host/test') diff --git a/host/test/gain_handler_test.cpp b/host/test/gain_handler_test.cpp index c81221aac..9a6a50dab 100644 --- a/host/test/gain_handler_test.cpp +++ b/host/test/gain_handler_test.cpp @@ -17,7 +17,9 @@ #include #include +#include #include +#include #include using namespace uhd; @@ -33,9 +35,17 @@ enum prop_t{ class gainful_obj : public wax::obj{ public: gainful_obj(void){ - _gain_handler = gain_handler::sptr(new gain_handler( - this, PROP_GAIN, PROP_GAIN_MIN, PROP_GAIN_MAX, PROP_GAIN_STEP, PROP_GAIN_NAMES - )); + //initialize gain props struct + gain_handler::gain_props_t gain_props; + gain_props.gain_val_prop = PROP_GAIN; + gain_props.gain_min_prop = PROP_GAIN_MIN; + gain_props.gain_max_prop = PROP_GAIN_MAX; + gain_props.gain_step_prop = PROP_GAIN_STEP; + gain_props.gain_names_prop = PROP_GAIN_NAMES; + //make a new gain handler + _gain_handler = gain_handler::make( + this->get_link(), gain_props, boost::bind(&gain_handler::is_equal, _1, _2) + ); _gains["g0"] = 0; _gains["g1"] = 0; _gains_min["g0"] = -10; @@ -113,7 +123,7 @@ BOOST_AUTO_TEST_CASE(test_gain_handler){ BOOST_CHECK_THROW( wax::cast(go0[named_prop_t(PROP_GAIN, "fail")]), - std::invalid_argument + std::exception ); std::cout << "verifying the overall min, max, step" << std::endl; -- cgit v1.2.3