OSSIA
Open Scenario System for Interactive Application
ossia::net::parameter_base Class Referenceabstract

The parameter_base class. More...

Inheritance diagram for ossia::net::parameter_base:
ossia::callback_container< value_callback > ossia::net::generic_parameter

Detailed Description

The parameter_base class.

A parameter holds attributes and values. One can subscribe to modification of the value.

See also
generic_parameter
node_attributes.hpp for description of the attributes.

Public Types

using callback_index = callback_container< value_callback >::iterator
 
- Public Types inherited from ossia::callback_container< value_callback >
using impl = std::list< value_callback >
 impl How the callbackas are stored. A list is used since iterators to other callbacks must not be invalidated upon removal.
 
using iterator = typename impl::iterator
 

Public Member Functions

 parameter_base (ossia::net::node_base &n)
 
 parameter_base (const parameter_base &)=delete
 
 parameter_base (parameter_base &&)=delete
 
parameter_baseoperator= (const parameter_base &)=delete
 
parameter_baseoperator= (parameter_base &&)=delete
 
ossia::net::node_baseget_node () const noexcept
 
virtual ossia::net::protocol_baseget_protocol () const noexcept
 
virtual void pull_value ()=0
 Value getters ///. More...
 
virtual std::future< void > pull_value_async ()
 pull_value_async More...
 
virtual void request_value ()
 request_value More...
 
virtual ossia::value value () const =0
 Clone the current value without any network request.
 
ossia::value fetch_value ()
 Pulls and clone the value.
 
virtual parameter_basepush_value (const ossia::value &)=0
 Sets the value locally, and sends it to the network.
 
virtual parameter_basepush_value (ossia::value &&)=0
 
void push_value_quiet (const ossia::value &v)
 
void push_value_quiet (ossia::value &&v)
 
virtual parameter_basepush_value ()=0
 
ossia::value value (ossia::destination_index) const
 Returns the sub-value at the index given by destination_index.
 
std::vector< ossia::valuevalue (const std::vector< ossia::destination_index > &) const
 Returns a list of sub-values matching the indexes.
 
virtual ossia::value set_value (const ossia::value &)=0
 
virtual ossia::value set_value (ossia::value &&)=0
 
virtual ossia::value set_value_quiet (const ossia::value &v)
 Reimplement to provide a way that does not call the observers.
 
virtual ossia::value set_value_quiet (ossia::value &&v)
 
std::optional< ossia::valueget_default_value () const noexcept
 
void set_default_value (const ossia::value &v)
 
virtual val_type get_value_type () const noexcept=0
 
virtual parameter_baseset_value_type (val_type)=0
 
virtual access_mode get_access () const noexcept=0
 
virtual parameter_baseset_access (access_mode)=0
 
virtual const domainget_domain () const noexcept=0
 
virtual parameter_baseset_domain (const domain &)=0
 
virtual bounding_mode get_bounding () const noexcept=0
 
virtual parameter_baseset_bounding (bounding_mode)=0
 
repetition_filter get_repetition_filter () const noexcept
 
parameter_baseset_repetition_filter (repetition_filter=repetition_filter::ON)
 
virtual bool filter_value (const ossia::value &val) const noexcept
 
const ossia::unit_tget_unit () const noexcept
 by default there is no filter
 
virtual parameter_baseset_unit (const ossia::unit_t &v)
 
bool get_disabled () const noexcept
 
parameter_baseset_disabled (bool)
 
bool get_muted () const noexcept
 
parameter_baseset_muted (bool)
 
bool get_critical () const noexcept
 
parameter_baseset_critical (bool v)
 
parameter_type get_type () const noexcept
 
- Public Member Functions inherited from ossia::callback_container< value_callback >
 callback_container (const callback_container &other)
 
 callback_container (callback_container &&other) noexcept
 
callback_containeroperator= (const callback_container &other)
 
callback_containeroperator= (callback_container &&other) noexcept
 
iterator add_callback (value_callback &&callback)
 add_callback Add a new callback. More...
 
void remove_callback (iterator it)
 remove_callback Removes a callback identified by an iterator. More...
 
void replace_callback (iterator it, value_callback &&cb)
 Replaces an existing callback with another function.
 
void replace_callbacks (impl &&cbs)
 
disabled_callback disable_callback (iterator it)
 
std::size_t callback_count () const
 callback_count More...
 
bool callbacks_empty () const
 callbacks_empty More...
 
void send (Args &&... args)
 send Trigger all callbacks More...
 
void callbacks_clear ()
 clear Clears callbacks.
 
impl m_callbacks TS_GUARDED_BY (m_mutx)
 

Protected Attributes

ossia::net::node_basem_node
 
unit_t m_unit
 
bool m_critical {}
 
bool m_disabled {}
 
bool m_muted {}
 
ossia::repetition_filter m_repetitionFilter {ossia::repetition_filter::OFF}
 
parameter_type m_type {}
 

Additional Inherited Members

- Public Attributes inherited from ossia::callback_container< value_callback >
mutex m_mutx
 
- Protected Member Functions inherited from ossia::callback_container< value_callback >
virtual void on_first_callback_added ()
 on_first_callback_added More...
 
virtual void on_removing_last_callback ()
 on_removing_last_callback More...
 

Member Function Documentation

◆ pull_value()

virtual void ossia::net::parameter_base::pull_value ( )
pure virtual

Value getters ///.

pull_value

Retrieve the current value over the network. Not all protocols may provide this capability.

This may be a blocking call.

Implemented in ossia::net::generic_parameter.

◆ pull_value_async()

std::future< void > ossia::net::parameter_base::pull_value_async ( )
virtual

pull_value_async

Requests the current value over the network. Not all protocols may provide this capability.

This function returns a future that can be waited upon by client code.

Reimplemented in ossia::net::generic_parameter.

◆ request_value()

void ossia::net::parameter_base::request_value ( )
virtual

request_value

Requests the current value over the network. Not all protocols may provide this capability.

This call may not block but there is no guarantee that the value has been pulled when the call returns.

However, the callback will be called when the value is received.

Reimplemented in ossia::net::generic_parameter.

◆ push_value()

virtual parameter_base& ossia::net::parameter_base::push_value ( )
pure virtual

Value setters /// Sends the local value to the network

Implemented in ossia::net::generic_parameter.