2#include <ossia/network/dataspace/color.hpp>
3#include <ossia/network/value/value.hpp>
5#include <oscpack/osc/OscOutboundPacketStream.h>
8class OutboundPacketStream;
10namespace ossia::oscquery
12struct osc_outbound_visitor
15 explicit osc_outbound_visitor(oscpack::OutboundPacketStream& stream)
20 oscpack::OutboundPacketStream& p;
21 void operator()(impulse)
const
24 p << oscpack::Infinitum();
27 void operator()(int32_t i)
const { p << i; }
29 void operator()(
float f)
const { p << f; }
31 void operator()(
bool b)
const { p << b; }
33 void operator()(
char c)
const { p << c; }
35 void operator()(
const std::string& str)
const { p << std::string_view{str}; }
37 void operator()(vec2f vec)
const
41 p << oscpack::BeginArray();
44 p << vec[0] << vec[1];
48 p << oscpack::EndArray();
52 void operator()(vec3f vec)
const
56 p << oscpack::BeginArray();
59 p << vec[0] << vec[1] << vec[2];
63 p << oscpack::EndArray();
67 void operator()(vec4f vec)
const
71 p << oscpack::BeginArray();
74 p << vec[0] << vec[1] << vec[2] << vec[3];
78 p << oscpack::EndArray();
82 void operator()(
const std::vector<value>& t)
const
86 p << oscpack::BeginArray();
90 for(
const auto& val : t)
98 p << oscpack::EndArray();
102 void operator()(
const value_map_type& t)
const { }
104 template <
typename T,
typename U>
105 void operator()(
const T& t,
const U& u)
const
110 void operator()(
const vec4f& t,
const ossia::rgba8_u& u)
const
112 uint32_t r = (uint32_t)t[0] << 24;
113 uint32_t g = (uint32_t)t[1] << 16;
114 uint32_t b = (uint32_t)t[2] << 8;
115 uint32_t a = (uint32_t)t[3];
116 p << oscpack::RgbaColor(r + g + b + a);
119 void operator()()
const { }
122 mutable int m_depth = 0;