2 #include <ossia/detail/config.hpp>
5 #include <ossia/detail/hash_map.hpp>
6 #include <ossia/detail/optional.hpp>
8 #include <ossia/network/base/parameter.hpp>
9 #include <ossia/network/common/extended_types.hpp>
10 #include <ossia/network/common/parameter_properties.hpp>
11 #include <ossia/network/value/value.hpp>
32 struct parameter_data;
49 int32_t min_instances = 0;
54 return lhs.min_instances == rhs.min_instances
55 && lhs.max_instances == rhs.max_instances;
63 friend std::ostream& operator<<(std::ostream& os,
const instance_bounds& c)
67 friend std::istream& operator>>(std::istream& is,
instance_bounds& c) {
return is; }
71 using tags = std::vector<std::string>;
115 OSSIA_EXPORT std::string_view text_instance_bounds();
116 OSSIA_EXPORT std::optional<instance_bounds>
117 get_instance_bounds(
const extended_attributes& n);
119 set_instance_bounds(extended_attributes& n, std::optional<instance_bounds>);
123 OSSIA_EXPORT std::string_view text_tags();
124 OSSIA_EXPORT std::optional<tags> get_tags(
const extended_attributes& n);
125 OSSIA_EXPORT
void set_tags(extended_attributes& n, std::optional<tags> v);
128 OSSIA_EXPORT std::string_view text_description();
129 OSSIA_EXPORT std::optional<description> get_description(
const extended_attributes& n);
130 OSSIA_EXPORT
void set_description(extended_attributes& n, std::optional<description> v);
131 OSSIA_EXPORT
void set_description(extended_attributes& n,
const char* v);
136 OSSIA_EXPORT std::string_view text_priority();
137 OSSIA_EXPORT std::optional<priority> get_priority(
const extended_attributes& n);
138 OSSIA_EXPORT
void set_priority(extended_attributes& n, std::optional<priority> v);
141 OSSIA_EXPORT std::string_view text_refresh_rate();
142 OSSIA_EXPORT std::optional<refresh_rate> get_refresh_rate(
const extended_attributes& n);
144 set_refresh_rate(extended_attributes& n, std::optional<refresh_rate> v);
148 OSSIA_EXPORT std::string_view text_value_step_size();
149 OSSIA_EXPORT std::optional<value_step_size>
150 get_value_step_size(
const extended_attributes& n);
152 set_value_step_size(extended_attributes& n, std::optional<value_step_size> v);
156 OSSIA_EXPORT std::string_view text_zombie();
157 OSSIA_EXPORT
zombie get_zombie(
const extended_attributes& n);
158 OSSIA_EXPORT
void set_zombie(extended_attributes& n,
zombie v);
161 OSSIA_EXPORT std::string_view text_hidden();
162 OSSIA_EXPORT
hidden get_hidden(
const extended_attributes& n);
163 OSSIA_EXPORT
void set_hidden(extended_attributes& n,
hidden v);
166 OSSIA_EXPORT std::string_view text_recall_safe();
167 OSSIA_EXPORT
recall_safe get_recall_safe(
const extended_attributes& n);
168 OSSIA_EXPORT
void set_recall_safe(extended_attributes& n,
recall_safe v);
171 OSSIA_EXPORT std::string_view text_extended_type();
172 OSSIA_EXPORT std::optional<extended_type>
174 OSSIA_EXPORT std::optional<extended_type>
176 OSSIA_EXPORT std::optional<extended_type>
177 get_extended_type(
const extended_attributes& n);
179 set_extended_type(extended_attributes& n, std::optional<extended_type> v);
183 OSSIA_EXPORT std::string_view text_app_name();
184 OSSIA_EXPORT std::optional<app_name> get_app_name(
const extended_attributes& n);
185 OSSIA_EXPORT
void set_app_name(extended_attributes& n, std::optional<app_name> v);
187 OSSIA_EXPORT
void set_app_name(extended_attributes& n,
const char* v);
190 OSSIA_EXPORT std::string_view text_app_version();
191 OSSIA_EXPORT std::optional<app_version> get_app_version(
const extended_attributes& n);
192 OSSIA_EXPORT
void set_app_version(extended_attributes& n, std::optional<app_version> v);
196 set_app_version(extended_attributes& n,
const char* v);
199 OSSIA_EXPORT std::string_view text_app_creator();
200 OSSIA_EXPORT std::optional<app_creator> get_app_creator(
const extended_attributes& n);
201 OSSIA_EXPORT
void set_app_creator(extended_attributes& n, std::optional<app_creator> v);
205 set_app_creator(extended_attributes& n,
const char* v);
208 OSSIA_EXPORT std::string_view text_default_value();
209 OSSIA_EXPORT std::optional<ossia::value> get_default_value(
const extended_attributes& n);
210 OSSIA_EXPORT
void set_default_value(extended_attributes& n,
const ossia::value& v);
211 OSSIA_EXPORT
void set_default_value(extended_attributes& n,
ossia::value&& v);
212 OSSIA_EXPORT
void set_default_value(extended_attributes& n,
int v);
213 OSSIA_EXPORT
void set_default_value(extended_attributes& n,
long v);
214 OSSIA_EXPORT
void set_default_value(extended_attributes& n,
bool v);
215 OSSIA_EXPORT
void set_default_value(extended_attributes& n,
char v);
216 OSSIA_EXPORT
void set_default_value(extended_attributes& n,
float v);
217 OSSIA_EXPORT
void set_default_value(extended_attributes& n,
double v);
218 OSSIA_EXPORT
void set_default_value(extended_attributes& n,
const char* v);
219 OSSIA_EXPORT
void set_default_value(extended_attributes& n, std::nullopt_t v);
232 OSSIA_EXPORT std::string_view text_value();
237 OSSIA_EXPORT std::string_view text_value_type();
241 OSSIA_EXPORT std::string_view text_domain();
246 OSSIA_EXPORT std::string_view text_access_mode();
251 OSSIA_EXPORT std::string_view text_bounding_mode();
252 OSSIA_EXPORT std::optional<bounding_mode>
257 OSSIA_EXPORT std::string_view text_repetition_filter();
263 OSSIA_EXPORT std::string_view text_unit();
268 OSSIA_EXPORT std::string_view text_muted();
273 OSSIA_EXPORT std::string_view text_disabled();
278 OSSIA_EXPORT std::string_view text_critical();
283 template <
typename T>
284 struct is_parameter_attribute :
public std::false_type
288 #define OSSIA_ATTRIBUTE(Type, Name) \
289 struct OSSIA_EXPORT Name##_attribute \
294 return ossia::net::text_##Name(); \
296 template <typename... Args> \
297 static auto getter(Args&&... args) \
299 return ossia::net::get_##Name(std::forward<Args>(args)...); \
301 template <typename... Args> \
302 static auto setter(Args&&... args) \
304 return ossia::net::set_##Name(std::forward<Args>(args)...); \
308 #define OSSIA_PARAM_ATTRIBUTE(Type, Name) \
309 OSSIA_ATTRIBUTE(Type, Name) \
311 struct is_parameter_attribute<Name##_attribute> : public std::true_type \
315 #define OSSIA_ATTRIBUTE_2(Type, Name, Text, Get, Set) \
316 struct OSSIA_EXPORT Name##_attribute \
323 template <typename... Args> \
324 static auto getter(Args&&... args) \
326 return Get(std::forward<Args>(args)...); \
328 template <typename... Args> \
329 static auto setter(Args&&... args) \
331 return Set(std::forward<Args>(args)...); \
338 ossia::net::push_value)
341 struct is_parameter_attribute<value_attribute> :
public std::true_type
369 template <
typename T,
typename U>
370 bool compare_optional(
const T& t,
const U& u)
372 return !t || (t && *t != u);
378 template <
typename U>
379 inline bool compare_optional(
const ossia::domain& t,
const U& u)
383 template <
typename U>
384 inline bool compare_optional(
const ossia::unit_t& t,
const U& u)
388 inline bool compare_optional(
bool t,
bool u)
401 template <
typename T>
402 inline bool valid(
const T& v)
The node_base class.
Definition: node.hpp:48
The parameter_base class.
Definition: ossia/network/base/parameter.hpp:48
The value class.
Definition: value.hpp:173
val_type
Enum to represent the types that a value can take.
Definition: parameter_properties.hpp:16
repetition_filter
If enabled, sending twice the same value will only send it once by network.
Definition: parameter_properties.hpp:70
bounding_mode
Address behaviors at crossing domain boundaries.
Definition: parameter_properties.hpp:56
constexpr OSSIA_INLINE auto min(const T a, const U b) noexcept -> typename std::conditional<(sizeof(T) > sizeof(U)), T, U >::type
min function tailored for values
Definition: math.hpp:125
std::string extended_type
How a low-level type should be interpreted.
Definition: complex_type.hpp:9
access_mode
Address behaviors at crossing domain boundaries time.
Definition: parameter_properties.hpp:46
constexpr OSSIA_INLINE auto max(const T a, const U b) noexcept -> typename std::conditional<(sizeof(T) > sizeof(U)), T, U >::type
max function tailored for values
Definition: math.hpp:96
std::string description
Human-readable description of a node.
Definition: node_attributes.hpp:74
std::string app_creator
Device attribute : the creator of the software managed by this device.
Definition: node_attributes.hpp:113
bool disabled
A disabled node.
Definition: node_attributes.hpp:95
bool recall_safe
Should the value be untouched on preset loading.
Definition: node_attributes.hpp:83
int32_t refresh_rate
How often a node is refreshed.
Definition: node_attributes.hpp:80
bool critical
Means that the node is very important, e.g. a "play" message.
Definition: node_attributes.hpp:92
bool hidden
Means that the node should not be advertised by default.
Definition: node_attributes.hpp:101
std::string app_name
Device attribute : the name of the software managed by this device.
Definition: node_attributes.hpp:107
double value_step_size
Granularity of the space.
Definition: node_attributes.hpp:86
std::vector< std::string > tags
Tags applied to a node: {"model", "interesting", ...}.
Definition: node_attributes.hpp:71
float priority
When a node must be sent before other.
Definition: node_attributes.hpp:77
bool zombie
Means that the node is not present on the "host" device.
Definition: node_attributes.hpp:98
std::string app_version
Device attribute : the version of the software managed by this device.
Definition: node_attributes.hpp:110
bool muted
Means that the node should not send / receives network messages.
Definition: node_attributes.hpp:104
domain A domain of values
Definition: domain_base.hpp:23
How many instances a node can have.
Definition: node_attributes.hpp:36
The data that can be found inside a parameter.
Definition: parameter_data.hpp:21
Definition: dataspace.hpp:24