OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
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
 impl How the callbackas are stored. A list is used since iterators to other callbacks must not be invalidated upon removal.
using iterator

Public Member Functions

 parameter_base (ossia::net::node_base &n)
 parameter_base (const parameter_base &)=delete
 parameter_base (parameter_base &&)=delete
parameter_base & operator= (const parameter_base &)=delete
parameter_base & operator= (parameter_base &&)=delete
ossia::net::node_base & get_node () const noexcept
virtual ossia::net::protocol_base & get_protocol () const noexcept
virtual void pull_value ()=0
 Value getters ///.
virtual std::future< void > pull_value_async ()
 pull_value_async
virtual void request_value ()
 request_value
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_base & push_value (const ossia::value &)=0
 Sets the value locally, and sends it to the network.
virtual parameter_base & push_value (ossia::value &&)=0
void push_value_quiet (const ossia::value &v)
void push_value_quiet (ossia::value &&v)
virtual parameter_base & push_value ()=0
ossia::value value (ossia::destination_index) const
 Returns the sub-value at the index given by destination_index.
std::vector< ossia::value > value (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::value > get_default_value () const noexcept
void set_default_value (const ossia::value &v)
virtual val_type get_value_type () const noexcept=0
virtual parameter_base & set_value_type (val_type)=0
virtual access_mode get_access () const noexcept=0
virtual parameter_base & set_access (access_mode)=0
virtual const domain & get_domain () const noexcept=0
virtual parameter_base & set_domain (const domain &)=0
virtual bounding_mode get_bounding () const noexcept=0
virtual parameter_base & set_bounding (bounding_mode)=0
repetition_filter get_repetition_filter () const noexcept
parameter_base & set_repetition_filter (repetition_filter=repetition_filter::ON)
virtual bool filter_value (const ossia::value &val) const noexcept
const ossia::unit_t & get_unit () const noexcept
 by default there is no filter
virtual parameter_base & set_unit (const ossia::unit_t &v)
bool get_disabled () const noexcept
parameter_base & set_disabled (bool)
bool get_muted () const noexcept
parameter_base & set_muted (bool)
bool get_critical () const noexcept
parameter_base & set_critical (bool v)
parameter_type get_type () const noexcept
Public Member Functions inherited from ossia::callback_container< value_callback >
callback_container & operator= (const callback_container &other)
iterator add_callback (value_callback &&callback)
 add_callback Add a new callback.
void remove_callback (iterator it)
 remove_callback Removes a callback identified by an iterator.
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
bool callbacks_empty () const
 callbacks_empty
void send (Args &&... args)
 send Trigger all callbacks
void callbacks_clear ()
 clear Clears callbacks.
impl m_callbacks TS_GUARDED_BY (m_mutx)

Protected Attributes

ossia::net::node_base & m_node
unit_t m_unit
std::atomic_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
virtual void on_removing_last_callback ()
 on_removing_last_callback

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.

◆ value()

virtual ossia::value ossia::net::parameter_base::value ( ) const
pure virtual

Clone the current value without any network request.

Implemented in ossia::net::generic_parameter.

◆ push_value() [1/2]

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

Sets the value locally, and sends it to the network.

Implemented in ossia::net::generic_parameter.

◆ push_value() [2/2]

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.

◆ set_value_quiet()

virtual ossia::value ossia::net::parameter_base::set_value_quiet ( const ossia::value & v)
inlinevirtual

Reimplement to provide a way that does not call the observers.

Reimplemented in ossia::net::generic_parameter.