From df057ce754bed879302845998c5b557bf8859313 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 26 Jun 2011 17:32:20 -0700 Subject: usrp: created cores for the rx and tx dsp --- host/include/uhd/property.hpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'host/include') diff --git a/host/include/uhd/property.hpp b/host/include/uhd/property.hpp index e3b917334..6f337cb52 100644 --- a/host/include/uhd/property.hpp +++ b/host/include/uhd/property.hpp @@ -32,6 +32,7 @@ namespace uhd{ template class UHD_API property{ public: typedef boost::function subscriber_type; + typedef boost::function publisher_type; typedef boost::function master_type; /*! @@ -44,6 +45,17 @@ public: _master = master; } + /*! + * Register a publisher into the property. + * A publisher is a special callback the provides the value. + * Publishers are useful for creating read-only properties. + * Only one publisher may be registered per property. + * Registering a publisher replaces the previous publisher. + */ + void publish(const publisher_type &publisher){ + _publisher = publisher; + } + /*! * Register a subscriber into the property. * All subscribers are called when the value changes. @@ -71,11 +83,12 @@ public: //! Get the current value of this property T get(void) const{ - return _value; + return _publisher.empty()? _value : _publisher(); } private: std::list _subscribers; + publisher_type _publisher; master_type _master; T _value; }; -- cgit v1.2.3