2 #include <ossia/network/base/osc_address.hpp>
3 #include <ossia/network/base/protocol.hpp>
4 #include <ossia/network/generic/generic_parameter.hpp>
9 template <
typename T,
typename Parameter_T>
14 std::unique_ptr<Parameter_T> m_parameter;
24 m_oscAddressCache = ossia::net::osc_parameter_string(*
this);
26 m_parameter.reset(
new Parameter_T(std::move(data), *
this));
33 m_oscAddressCache = ossia::net::osc_parameter_string(*
this);
35 m_parameter.reset(
new Parameter_T(std::move(data), *
this));
38 ~wrapped_node()
override { clear(); }
44 write_lock_t lock{m_mutex};
49 device_base& get_device() const final
override {
return m_device; }
51 node_base* get_parent() const final
override {
return m_parent; }
53 node_base& set_name(std::string)
final override {
return *
this; }
55 parameter_base* get_parameter() const final
override {
return m_parameter.get(); }
62 bool remove_parameter() final
override {
return false; }
64 void add_child(std::unique_ptr<ossia::net::node_base> p)
68 write_lock_t lock{m_mutex};
69 m_children.push_back(std::move(p));
74 std::unique_ptr<node_base> make_child(
const std::string& name)
final override
76 return std::make_unique<generic_node>(name, m_device, *
this);
80 void removing_child(node_base& node_base)
final override { }
87 using base_data_type =
typename T::base_data_type;
91 , m_data(std::move(data))
95 wrapped_parameter() =
delete;
96 wrapped_parameter(
const wrapped_parameter& other) =
delete;
97 wrapped_parameter(wrapped_parameter&& other) =
delete;
98 wrapped_parameter& operator=(
const wrapped_parameter& other) =
delete;
99 wrapped_parameter& operator=(wrapped_parameter&& other) =
delete;
102 const base_data_type& data()
const {
return m_data; }
104 base_data_type& data() {
return m_data; }
107 base_data_type m_data;
110 template <
typename Node_T,
typename Protocol_T>
111 class wrapped_device final
116 wrapped_device() =
delete;
117 wrapped_device(
const wrapped_device&) =
delete;
118 wrapped_device(wrapped_device&&) =
delete;
119 wrapped_device& operator=(
const wrapped_device&) =
delete;
120 wrapped_device& operator=(wrapped_device&&) =
delete;
122 wrapped_device(std::unique_ptr<Protocol_T> protocol_base, std::string name)
123 : device_base(std::move(protocol_base))
124 , Node_T{typename Node_T::data_type{name}, *this}
127 m_protocol->set_device(*
this);
133 using Node_T::get_name;
134 using Node_T::set_name;
139 this->remove_parameter();
144 write_lock_t lock{this->m_mutex};
145 this->m_children.clear();
void callbacks_clear()
clear Clears callbacks.
Definition: callback_container.hpp:203
Root of a device tree.
Definition: ossia/network/base/device.hpp:58
Definition: generic_parameter.hpp:24
generic_parameter(ossia::net::node_base &node_base)
Used for repetition filter.
Definition: generic_parameter.cpp:28
The node_base class.
Definition: network/base/node.hpp:48
Nano::Signal< void(const node_base &)> about_to_be_deleted
The node subclasses must call this in their destructor.
Definition: network/base/node.hpp:201
node_base * add_child(std::unique_ptr< node_base >)
Adds a new child if it can be added.
Definition: node.cpp:140
val_type
Enum to represent the types that a value can take.
Definition: parameter_properties.hpp:16
bool change_tree
change_tree : nodes can be added and removed externally.
Definition: ossia/network/base/device.hpp:24