2#include <ossia/detail/config.hpp>
4#include <ossia/detail/flat_map.hpp>
5#include <ossia/detail/fmt.hpp>
6#include <ossia/network/base/node.hpp>
7#include <ossia/network/base/parameter.hpp>
8#include <ossia/network/base/protocol.hpp>
10#include <ossia/network/value/value.hpp>
12#include <ossia-c/log/ossia_log.h>
31 std::shared_ptr<ossia::net::device_base> device;
39struct ossia_value_callback_index
41 ossia::net::parameter_base::iterator it;
86 return static_cast<void*
>(v);
100 return v->device.get();
109 return static_cast<void*
>(v);
114 return new ossia_value{std::move(v)};
119 return new ossia_value{v};
124 return new ossia_domain{v};
128 return new ossia_domain{std::move(v)};
131template <
typename Fun>
132auto safe_function(
const char name[], Fun f) ->
decltype(f())
138catch(
const std::exception& e)
140 auto str = fmt::format(
"{}: {}", name, e.what());
141 ossia_log_error(str.c_str());
142 return decltype(f())();
146 auto str = fmt::format(
"{}: Exception caught", name);
147 ossia_log_error(str.c_str());
148 return decltype(f())();
151inline char* copy_string(
const std::string& str)
153 const auto n = str.size();
154 auto mbuffer =
new char[n + 1];
155 std::memcpy(mbuffer, str.data(), n);
160inline void copy_bytes(
const std::string& str,
char** ptr,
size_t* sz)
162 const auto n = str.size();
164 *ptr = (
char*)std::malloc(
sizeof(
char) * (n + 1));
165 std::memcpy(*ptr, str.data(), n);
171 ossia_node_callback_t m_cb{};
177 ossia_parameter_callback_t m_cb{};
181 m_cb(m_ctx, convert(&addr));
187 ossia::flat_map<std::string, ossia_device_t> devices;
189 global_devices() =
default;
190 global_devices(
const global_devices&) =
delete;
191 global_devices(global_devices&&) =
delete;
192 global_devices& operator=(
const global_devices&) =
delete;
193 global_devices& operator=(global_devices&&) =
delete;
196global_devices& static_devices();
Root of a device tree.
Definition ossia/network/base/device.hpp:58
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
ossia_bounding_mode
Definition ossia-c.h:403
ossia_type
Definition ossia-c.h:376
ossia_access_mode
Definition ossia-c.h:393
val_type
Enum to represent the types that a value can take.
Definition parameter_properties.hpp:16
bounding_mode
Address behaviors at crossing domain boundaries.
Definition parameter_properties.hpp:56
access_mode
Address behaviors at crossing domain boundaries time.
Definition parameter_properties.hpp:46
domain A domain of values
Definition domain_base.hpp:23