2#include <ossia/network/osc/detail/osc_utils.hpp>
3#include <ossia/network/value/value.hpp>
5#include <boost/endian/conversion.hpp>
7#include <oscpack/osc/OscOutboundPacketStream.h>
8#include <oscpack/osc/OscTypes.h>
14struct osc_always_bundled_policy : T
16 using bundled = std::true_type;
19using osc_never_bundled_policy = T;
25struct osc_common_outbound_dynamic_policy
27 oscpack::OutboundPacketStream& p;
30 void operator()(int32_t i)
const { p << i; }
32 void operator()(
float f)
const { p << f; }
34 void operator()(
const std::string& str)
const { p << (std::string_view)str; }
36 void operator()(oscpack::Blob str)
const { p << str; }
38 void operator()(vec2f vec)
const { p << vec[0] << vec[1]; }
40 void operator()(vec3f vec)
const { p << vec[0] << vec[1] << vec[2]; }
42 void operator()(vec4f vec)
const { p << vec[0] << vec[1] << vec[2] << vec[3]; }
44 void operator()()
const { }
50struct osc_common_outbound_static_policy
53 std::size_t operator()(
char* buffer,
float v)
const noexcept
56 buffer[1] = oscpack::FLOAT_TYPE_TAG;
60 boost::endian::endian_store<float, 4, boost::endian::order::big>(
61 (
unsigned char*)buffer + 4, v);
65 std::size_t operator()(
char* buffer, int32_t v)
const noexcept
68 buffer[1] = oscpack::INT32_TYPE_TAG;
72 boost::endian::endian_store<int32_t, 4, boost::endian::order::big>(
73 (
unsigned char*)buffer + 4, v);
77 std::size_t operator()(
char* buffer,
const std::string& v)
const noexcept
80 buffer[1] = oscpack::STRING_TYPE_TAG;
84 std::size_t written = write_string(v, buffer + 4);
88 std::size_t operator()(
char* buffer,
const oscpack::Blob& v)
const noexcept
91 buffer[1] = oscpack::BLOB_TYPE_TAG;
96 = write_string(std::string_view((
const char*)v.data, v.size), buffer + 4);
100 std::size_t operator()(
char* buffer, vec2f v)
const noexcept
103 buffer[1] = oscpack::FLOAT_TYPE_TAG;
104 buffer[2] = oscpack::FLOAT_TYPE_TAG;
107 boost::endian::endian_store<float, 4, boost::endian::order::big>(
108 (
unsigned char*)buffer + 4, v[0]);
109 boost::endian::endian_store<float, 4, boost::endian::order::big>(
110 (
unsigned char*)buffer + 8, v[1]);
115 std::size_t operator()(
char* buffer, vec3f v)
const noexcept
118 buffer[1] = oscpack::FLOAT_TYPE_TAG;
119 buffer[2] = oscpack::FLOAT_TYPE_TAG;
120 buffer[3] = oscpack::FLOAT_TYPE_TAG;
126 boost::endian::endian_store<float, 4, boost::endian::order::big>(
127 (
unsigned char*)buffer + 8, v[0]);
128 boost::endian::endian_store<float, 4, boost::endian::order::big>(
129 (
unsigned char*)buffer + 12, v[1]);
130 boost::endian::endian_store<float, 4, boost::endian::order::big>(
131 (
unsigned char*)buffer + 16, v[2]);
136 std::size_t operator()(
char* buffer, vec4f v)
const noexcept
139 buffer[1] = oscpack::FLOAT_TYPE_TAG;
140 buffer[2] = oscpack::FLOAT_TYPE_TAG;
141 buffer[3] = oscpack::FLOAT_TYPE_TAG;
142 buffer[4] = oscpack::FLOAT_TYPE_TAG;
147 boost::endian::endian_store<float, 4, boost::endian::order::big>(
148 (
unsigned char*)buffer + 8, v[0]);
149 boost::endian::endian_store<float, 4, boost::endian::order::big>(
150 (
unsigned char*)buffer + 12, v[1]);
151 boost::endian::endian_store<float, 4, boost::endian::order::big>(
152 (
unsigned char*)buffer + 16, v[2]);
153 boost::endian::endian_store<float, 4, boost::endian::order::big>(
154 (
unsigned char*)buffer + 20, v[3]);
Definition dataspace.hpp:24