summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-26 17:32:20 -0700
committerJosh Blum <josh@joshknows.com>2011-06-26 17:32:20 -0700
commitdf057ce754bed879302845998c5b557bf8859313 (patch)
treeff92ee7b688380e036570f67a1555c6e8b1eaace /host/include
parent52f9a39c2dfceb3cae1f0e9f4a62d908b9231e35 (diff)
downloaduhd-df057ce754bed879302845998c5b557bf8859313.tar.gz
uhd-df057ce754bed879302845998c5b557bf8859313.tar.bz2
uhd-df057ce754bed879302845998c5b557bf8859313.zip
usrp: created cores for the rx and tx dsp
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/property.hpp15
1 files changed, 14 insertions, 1 deletions
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 <typename T> class UHD_API property{
public:
typedef boost::function<void(const T &)> subscriber_type;
+ typedef boost::function<T(void)> publisher_type;
typedef boost::function<T(const T &)> master_type;
/*!
@@ -45,6 +46,17 @@ public:
}
/*!
+ * 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.
* Once a subscriber is registered, it cannot be unregistered.
@@ -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<subscriber_type> _subscribers;
+ publisher_type _publisher;
master_type _master;
T _value;
};