#include <uhd/property_tree.hpp>
Public Types | |
typedef boost::function< void(const T &)> | subscriber_type |
typedef boost::function< T(void)> | publisher_type |
typedef boost::function< T(const T &)> | coercer_type |
Public Member Functions | |
virtual | ~property (void)=0 |
virtual property< T > & | coerce (const coercer_type &coercer)=0 |
virtual property< T > & | publish (const publisher_type &publisher)=0 |
virtual property< T > & | subscribe (const subscriber_type &subscriber)=0 |
virtual property< T > & | update (void)=0 |
virtual property< T > & | set (const T &value)=0 |
virtual T | get (void) const =0 |
virtual bool | empty (void) const =0 |
A templated property interface for holding a value and registering callbacks when that value changes.
typedef boost::function<T(const T &)> uhd::property< T >::coercer_type |
typedef boost::function<T(void)> uhd::property< T >::publisher_type |
typedef boost::function<void(const T &)> uhd::property< T >::subscriber_type |
|
pure virtual |
|
pure virtual |
Register a coercer into the property. A coercer is a special subscriber that coerces the value. Only one coercer may be registered per property. Registering a coercer replaces the previous coercer.
coercer | the coercer callback function |
|
pure virtual |
A property is empty if it has never been set. A property with a publisher is never empty.
|
pure virtual |
Get the current value of this property. The publisher (when provided) yields the value, otherwise an internal shadow is used for the value.
|
pure virtual |
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.
publisher | the publisher callback function |
|
pure virtual |
Set the new value and call all subscribers. The coercer (when provided) is called initially, and the coerced value is used to set the subscribers.
value | the new value to set on this property |
|
pure virtual |
Register a subscriber into the property. All subscribers are called when the value changes. Once a subscriber is registered, it cannot be unregistered.
subscriber | the subscriber callback function |
|
pure virtual |
Update calls all subscribers w/ the current value.