2#include <ossia/network/osc/detail/osc_common_policy.hpp>
3#include <ossia/network/osc/detail/osc_utils.hpp>
4#include <ossia/network/value/value.hpp>
6#include <boost/endian/conversion.hpp>
8#include <oscpack/osc/OscOutboundPacketStream.h>
9#include <oscpack/osc/OscTypes.h>
14struct osc_extended_outbound_dynamic_policy : osc_common_outbound_dynamic_policy
16 using osc_common_outbound_dynamic_policy::operator();
17 mutable int m_depth = 0;
18 void operator()(impulse)
const { p << oscpack::Infinitum(); }
20 void operator()(
bool b)
const { p << b; }
22 void operator()(
char c)
const { p << c; }
24 void operator()(vec2f vec)
const
28 p << oscpack::BeginArray();
31 p << vec[0] << vec[1];
35 p << oscpack::EndArray();
39 void operator()(vec3f vec)
const
43 p << oscpack::BeginArray();
46 p << vec[0] << vec[1] << vec[2];
50 p << oscpack::EndArray();
54 void operator()(vec4f vec)
const
56 if(unit == ossia::rgba8_u{})
58 p << to_osc_rgba({vec});
64 p << oscpack::BeginArray();
67 p << vec[0] << vec[1] << vec[2] << vec[3];
71 p << oscpack::EndArray();
77 void operator()(
const std::vector<value>& t)
const
81 p << oscpack::BeginArray();
85 for(
const auto& val : t)
93 p << oscpack::EndArray();
97 void operator()(
const value_map_type& t)
const { }
100struct osc_extended_outbound_static_policy : osc_common_outbound_static_policy
102 using osc_common_outbound_static_policy::operator();
103 std::size_t operator()(
109 buffer[1] = oscpack::INFINITUM_TYPE_TAG;
111 buffer[1] = oscpack::NIL_TYPE_TAG;
112 else if(t ==
"empty")
120 std::size_t operator()(
char* buffer, ossia::impulse v)
const noexcept
131 std::size_t operator()(
char* buffer,
bool v)
const noexcept
134 buffer[1] = v ? oscpack::TRUE_TYPE_TAG : oscpack::FALSE_TYPE_TAG;
141 std::size_t operator()(
char* buffer,
char v)
const noexcept
144 buffer[1] = oscpack::CHAR_TYPE_TAG;
148 boost::endian::endian_store<int32_t, 4, boost::endian::order::big>(
149 (
unsigned char*)buffer + 4, (int32_t)v);
154 std::size_t operator()(
char* buffer, oscpack::RgbaColor v)
const noexcept
157 buffer[1] = oscpack::RGBA_COLOR_TYPE_TAG;
161 boost::endian::endian_store<uint32_t, 4, boost::endian::order::big>(
162 (
unsigned char*)buffer + 4, v.value);
166 std::size_t operator()(
char* buffer, vec4f t)
const noexcept
168 if(unit == ossia::rgba8_u{})
170 return (*
this)(buffer, to_osc_rgba({t}));
174 return osc_common_outbound_static_policy::operator()(buffer, t);
179struct osc_extended_policy
181 using static_policy = osc_extended_outbound_static_policy;
182 using dynamic_policy = osc_extended_outbound_dynamic_policy;
std::string extended_type
How a low-level type should be interpreted.
Definition complex_type.hpp:9