diff options
author | Ashish Chaudhari <ashish@ettus.com> | 2015-08-25 21:09:06 -0700 |
---|---|---|
committer | Ashish Chaudhari <ashish@ettus.com> | 2016-02-11 14:36:20 -0800 |
commit | 27a08ccddc94c4945d48445b14c23fe6d186f9ef (patch) | |
tree | aa0675904822e6dba9358cddc4ca1d66a3df3b7b /host/tests | |
parent | 0d74d16093c9350205eb704b1aa6a4bcefa5667d (diff) | |
download | uhd-27a08ccddc94c4945d48445b14c23fe6d186f9ef.tar.gz uhd-27a08ccddc94c4945d48445b14c23fe6d186f9ef.tar.bz2 uhd-27a08ccddc94c4945d48445b14c23fe6d186f9ef.zip |
prop_tree: Multiple API enhancements to uhd::property
- Added desired and coerced values and accessors to property
- Added support to register desired subscribers
- set APIs don't reallocate storage for a property value
- Renamed callback method registration APIs
- Registering 2 coercers or publishers for a property will throw
- Registering a coercer and a publisher for the same property will throw
Diffstat (limited to 'host/tests')
-rw-r--r-- | host/tests/property_test.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/host/tests/property_test.cpp b/host/tests/property_test.cpp index 00bb3c022..b7aa29e4b 100644 --- a/host/tests/property_test.cpp +++ b/host/tests/property_test.cpp @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(test_prop_with_subscriber){ uhd::property<int> &prop = tree->create<int>("/"); setter_type setter; - prop.subscribe(boost::bind(&setter_type::doit, &setter, _1)); + prop.add_coerced_subscriber(boost::bind(&setter_type::doit, &setter, _1)); prop.set(42); BOOST_CHECK_EQUAL(prop.get(), 42); @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(test_prop_with_publisher){ BOOST_CHECK(prop.empty()); getter_type getter; - prop.publish(boost::bind(&getter_type::doit, &getter)); + prop.set_publisher(boost::bind(&getter_type::doit, &getter)); BOOST_CHECK(not prop.empty()); getter._x = 42; @@ -96,10 +96,10 @@ BOOST_AUTO_TEST_CASE(test_prop_with_publisher_and_subscriber){ uhd::property<int> &prop = tree->create<int>("/"); getter_type getter; - prop.publish(boost::bind(&getter_type::doit, &getter)); + prop.set_publisher(boost::bind(&getter_type::doit, &getter)); setter_type setter; - prop.subscribe(boost::bind(&setter_type::doit, &setter, _1)); + prop.add_coerced_subscriber(boost::bind(&setter_type::doit, &setter, _1)); getter._x = 42; prop.set(0); @@ -117,10 +117,10 @@ BOOST_AUTO_TEST_CASE(test_prop_with_coercion){ uhd::property<int> &prop = tree->create<int>("/"); setter_type setter; - prop.subscribe(boost::bind(&setter_type::doit, &setter, _1)); + prop.add_coerced_subscriber(boost::bind(&setter_type::doit, &setter, _1)); coercer_type coercer; - prop.coerce(boost::bind(&coercer_type::doit, &coercer, _1)); + prop.set_coercer(boost::bind(&coercer_type::doit, &coercer, _1)); prop.set(42); BOOST_CHECK_EQUAL(prop.get(), 40); |