OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
local.hpp
1#pragma once
2
4#include <ossia/detail/audio_spin_mutex.hpp>
5#include <ossia/detail/mutex.hpp>
6#include <ossia/network/base/protocol.hpp>
7
8#include <vector>
9
10namespace ossia::net
11{
12class generic_device;
21class OSSIA_EXPORT multiplex_protocol final : public ossia::net::protocol_base
22{
23public:
24 multiplex_protocol();
25 multiplex_protocol(const multiplex_protocol&) = delete;
26 multiplex_protocol(multiplex_protocol&&) = delete;
27 multiplex_protocol& operator=(const multiplex_protocol&) = delete;
28 multiplex_protocol& operator=(multiplex_protocol&&) = delete;
29 virtual ~multiplex_protocol();
30
31 bool pull(ossia::net::parameter_base&) override;
32 bool push(const ossia::net::parameter_base& addr, const ossia::value& v) override;
33 bool push_raw(const full_parameter_data&) override;
34 bool observe(ossia::net::parameter_base&, bool) override;
36
38 const message_origin_identifier&, const parameter_base&,
39 const ossia::value& v) override;
40
41 void stop() override;
42 void set_device(ossia::net::device_base& dev) override;
43
46 void expose_to(std::unique_ptr<ossia::net::protocol_base> p);
47
50
51 void clear();
52
54 const auto& get_protocols() const { return m_protocols; }
55
56private:
57 std::vector<std::unique_ptr<ossia::net::protocol_base>>
58 m_protocols TS_GUARDED_BY(m_protocols_mutex);
59 std::vector<std::unique_ptr<ossia::net::protocol_base>>
60 m_protocols_to_register TS_GUARDED_BY(m_protocols_mutex);
61 ossia::audio_spin_mutex m_protocols_mutex;
62 ossia::net::device_base* m_device{};
63};
64
65using local_protocol = multiplex_protocol;
66}
Root of a device tree.
Definition ossia/network/base/device.hpp:58
bool observe(ossia::net::parameter_base &, bool) override
Notify the network that a parameter should be listened to.
Definition local.cpp:63
bool push(const ossia::net::parameter_base &addr, const ossia::value &v) override
Send a value to the network.
Definition local.cpp:42
bool echo_incoming_message(const message_origin_identifier &, const parameter_base &, const ossia::value &v) override
called when some protocol on the same device received a message.
Definition local.cpp:78
bool pull(ossia::net::parameter_base &) override
Pulls a value from the server synchronously.
Definition local.cpp:37
const auto & get_protocols() const
The protocols we are currently exposing this device through.
Definition local.hpp:54
bool push_raw(const full_parameter_data &) override
Send a value to the network.
Definition local.cpp:53
void set_device(ossia::net::device_base &dev) override
It is mandatory to call this function from device implementations, when the protocol is set.
Definition local.cpp:95
void stop_expose_to(const ossia::net::protocol_base &p)
Stop exposition to a protocol. It will be deleted.
Definition local.cpp:142
bool update(ossia::net::node_base &node_base) override
If the protocol supports it, request the namespace corresponding to this node. If the update takes to...
Definition local.cpp:73
void expose_to(std::unique_ptr< ossia::net::protocol_base > p)
Use this to add protocols through which you will expose the device.
Definition local.cpp:111
The node_base class.
Definition node.hpp:48
The parameter_base class.
Definition ossia/network/base/parameter.hpp:48
The protocol_base class.
Definition protocol.hpp:40
The value class.
Definition value.hpp:173
Full information about a parameter.
Definition parameter_data.hpp:61