All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
uhd::property< T > Class Template Referenceabstract

`#include <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< 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

template<typename T>

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

template<typename T>

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

template<typename T>

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

## Member Function Documentation

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 subscribes that coerces the value. Only one coercer may be registered per property. Registering a coercer replaces the previous coercer.

Parameters

  coercer | the coercer callback function

Returns
  a reference to this property for chaining

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

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

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

  publisher | the publisher callback function

Returns
  a reference to this property for chaining

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

  value | the new value to set on this property

Returns
  a reference to this property for chaining

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

  subscriber | the subscriber callback function

Returns
  a reference to this property for chaining

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:

- include/uhd/property_tree.hpp