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

Root of a device tree. More...

Inherited by ossia::net::generic_device, ossia::net::midi::midi_device, ossia::net::wrapped_device< Node_T, Protocol_T >, and ossia::qt::qt_device.

Detailed Description

Root of a device tree.

A device models a real hardware or software with which communication should be established.

It handles transformations of the node tree and allows to add callbacks to be called :

  • after a node has been created : device_base::on_node_created
  • after a node has been renamed : device_base::on_node_renamed
  • before a node is removed : device_base::on_node_removing
  • after a parameter has been created : device_base::on_parameter_created
  • before a parameter is being removed : device_base::on_parameter_removing

The root node of a device maps to the "/" address.

A device is necessarily constructed with a protocol. If the device is meant to mirror a remote application, it should be constructed directly with the remote protocol (e.g. minuit_protocol, osc_protocol).

if the device is meant to expose the current application to the network, it should be constructed with the local_protocol.

See also
generic_device
node_base
protocol_base

Public Member Functions

 device_base (std::unique_ptr< ossia::net::protocol_base > proto)
 
 device_base (const device_base &)=delete
 
 device_base (device_base &&)=delete
 
device_baseoperator= (const device_base &)=delete
 
device_baseoperator= (device_base &&)=delete
 
ossia::net::protocol_baseget_protocol () const
 
virtual const ossia::net::node_baseget_root_node () const =0
 
virtual ossia::net::node_baseget_root_node ()=0
 
device_capabilities get_capabilities () const
 
void set_name (const std::string &str)
 
std::string get_name () const
 
bool has_echo ()
 
void set_echo (bool echo)
 
void apply_incoming_message (const message_origin_identifier &id, ossia::net::parameter_base &param, ossia::value &&value)
 
void apply_incoming_message_quiet (const message_origin_identifier &id, ossia::net::parameter_base &param, ossia::value &&value)
 

Public Attributes

Nano::Signal< void(node_base &)> on_node_created
 
Nano::Signal< void(node_base &)> on_node_removing
 
Nano::Signal< void(node_base &, std::string)> on_node_renamed
 
Nano::Signal< void(node_base &, const std::string &)> on_attribute_modified
 
Nano::Signal< void(const parameter_base &)> on_parameter_created
 
Nano::Signal< void(const parameter_base &)> on_parameter_removing
 
Nano::Signal< void(const parameter_base &)> on_message
 
Nano::Signal< void(const std::string, const ossia::value &val)> on_unhandled_message
 
Nano::Signal< void(std::string, const parameter_data &)> on_add_node_requested
 
Nano::Signal< void(std::string, std::string)> on_remove_node_requested
 
Nano::Signal< void(std::string, std::string)> on_rename_node_requested
 

Protected Attributes

std::unique_ptr< ossia::net::protocol_basem_protocol
 
device_capabilities m_capabilities {}
 
bool m_echo {false}
 

Member Data Documentation

◆ on_add_node_requested

Nano::Signal<void(std::string, const parameter_data&)> ossia::net::device_base::on_add_node_requested

Called when a network client requests the creation of an instance. First argument is the path to the parent.

◆ on_remove_node_requested

Nano::Signal<void(std::string, std::string)> ossia::net::device_base::on_remove_node_requested

Called when a network client requests the removal of an instance. Argument is the path of the parent and the node to remove.

◆ on_rename_node_requested

Nano::Signal<void(std::string, std::string)> ossia::net::device_base::on_rename_node_requested

Called when a network client requests the renaming of a node Argument is the node to rename and the new name