template<typename T>
property_change_event struct
Contents
- Reference
This class can be used to define property change events. This is useful when value changes are triggered not via AES70 but instead from within the device code.
This class is used by defining a public property with the appropriate name. It will then be automatically detected by the introspection classes and hooked up. A property change can then be signalled to all subscribed clients by calling value(). Changes to the minimum or maximum value of the property can be signalled using min() or max(), respectively.
The function call operator can be used as a shorthand for value().
The template parameter may be chosen freely, however the type needs to be compatible with the encoder for the corresponding AES70 type of the property. Choosing an incompatible type will lead to a compile time error.
Note that using this class to signal a property change will directly send data over the network. In implementations which use several threads you may need to make sure to do this from the IO thread.
For example, property_
class MyLevel { aes70::property_change_event<float> OnReadingChanged; float reading; // This method is called when the level value changes. void update_level(float _reading) { reading = _reading; OnReadingChanged(_reading); } } aes70::static_device::OcaLevelSensor<MyLevel> my_level;
Public functions
- void operator()(const T& val) const
- void value(const T& val) const
- void min(const T& val) const
- void max(const T& val) const
Function documentation
template<typenameT>
void aes70:: property_change_event<T>:: operator()(const T& val) const
Notifies a value change.
template<typenameT>
void aes70:: property_change_event<T>:: value(const T& val) const
Notifies a value change.
template<typenameT>
void aes70:: property_change_event<T>:: min(const T& val) const
Notifies a change of the minimum value.
template<typenameT>
void aes70:: property_change_event<T>:: max(const T& val) const
Notifies a change of the maximum value.