USRP Hardware Driver and USRP Manual  Version: 003.009.000-0-gcd88f80f
UHD and USRP Manual
uhd::property< T > Class Template Referenceabstract

#include <uhd/property_tree.hpp>

Inheritance diagram for uhd::property< T >:

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
 

Detailed Description

template<typename T>
class uhd::property< T >

A templated property interface for holding a value and registering callbacks when that value changes.

Member Typedef Documentation

◆ coercer_type

template<typename T>
typedef boost::function<T(const T &)> uhd::property< T >::coercer_type

◆ publisher_type

template<typename T>
typedef boost::function<T(void)> uhd::property< T >::publisher_type

◆ subscriber_type

template<typename T>
typedef boost::function<void(const T &)> uhd::property< T >::subscriber_type

Constructor & Destructor Documentation

◆ ~property()

template<typename T >
uhd::property< T >::~property ( void  )
pure virtual

Member Function Documentation

◆ coerce()

template<typename T>
virtual property<T>& uhd::property< T >::coerce ( const coercer_type coercer)
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.

Parameters
coercerthe coercer callback function
Returns
a reference to this property for chaining

◆ empty()

template<typename T>
virtual bool uhd::property< T >::empty ( void  ) const
pure virtual

A property is empty if it has never been set. A property with a publisher is never empty.

Returns
true if the property is empty

◆ get()

template<typename T>
virtual T uhd::property< T >::get ( void  ) const
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.

Returns
the current value in the property

◆ publish()

template<typename T>
virtual property<T>& uhd::property< T >::publish ( const publisher_type publisher)
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.

Parameters
publisherthe publisher callback function
Returns
a reference to this property for chaining

◆ set()

template<typename T>
virtual property<T>& uhd::property< T >::set ( const T &  value)
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.

Parameters
valuethe new value to set on this property
Returns
a reference to this property for chaining

◆ subscribe()

template<typename T>
virtual property<T>& uhd::property< T >::subscribe ( const subscriber_type subscriber)
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.

Parameters
subscriberthe subscriber callback function
Returns
a reference to this property for chaining

◆ update()

template<typename T>
virtual property<T>& uhd::property< T >::update ( void  )
pure virtual

Update calls all subscribers w/ the current value.

Returns
a reference to this property for chaining

The documentation for this class was generated from the following file: