OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
json_writer_detail.hpp
1#pragma once
2#include <ossia/detail/json.hpp>
4
5namespace ossia::oscquery::detail
6{
9{
10 using writer_t = ossia::json_writer;
11 writer_t& writer;
12
13 void writeKey(std::string_view k) const;
14
15 void writeValue(const ossia::value& val, const ossia::unit_t& unit) const;
16 void writeValue(ossia::bounding_mode b) const;
17 void writeValue(ossia::access_mode b) const;
18 void writeValue(const ossia::domain& d) const;
19 void writeValue(const ossia::unit_t& d) const;
20 void writeValue(const ossia::net::tags& tags) const;
21 void writeValue(int32_t i) const;
22 void writeValue(float i) const;
23 void writeValue(double i) const;
24 void writeValue(bool i) const;
25 void writeValue(std::string_view i) const;
26 void writeValue(const ossia::repetition_filter& i) const;
27 void writeValue(const ossia::net::instance_bounds& i) const;
28
29 template <typename T, typename... Args>
30 void writeValue(const std::optional<T>& t, Args&&... args) const
31 {
32 if(t)
33 {
34 writeValue(*t, std::forward<Args>(args)...);
35 }
36 else
37 {
38 writer.Null();
39 }
40 }
41
43 void writeAttribute(const ossia::net::node_base& n, std::string_view method) const;
44
46 void writeNodeAttributes(const ossia::net::node_base& n) const;
47
49 void writeNode(const ossia::net::node_base& n);
50};
51}
The node_base class.
Definition node.hpp:48
The value class.
Definition value.hpp:173
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
access_mode
Address behaviors at crossing domain boundaries time.
Definition parameter_properties.hpp:46
std::vector< std::string > tags
Tags applied to a node: {"model", "interesting", ...}.
Definition node_attributes.hpp:71
domain A domain of values
Definition domain_base.hpp:23
How many instances a node can have.
Definition node_attributes.hpp:36
Implementation of the JSON serialisation mechanism for oscquery.
Definition json_writer_detail.hpp:9
void writeAttribute(const ossia::net::node_base &n, std::string_view method) const
Writes a single attribute.
Definition json_writer_detail.cpp:206
void writeNode(const ossia::net::node_base &n)
Writes a node recursively. Creates a new object.
Definition json_writer_detail.cpp:327
void writeNodeAttributes(const ossia::net::node_base &n) const
Writes only the attributes.
Definition json_writer_detail.cpp:296
Definition dataspace.hpp:24