2#include <ossia/detail/config.hpp>
4#include <ossia/detail/for_each.hpp>
5#include <ossia/detail/size.hpp>
6#include <ossia/network/dataspace/dataspace.hpp>
7#include <ossia/network/dataspace/detail/dataspace_parse.hpp>
15 : indices(make_dataspace_index_array())
16 , units(make_unit_array())
20 ossia::unit_t get_unit(uint64_t dataspace, uint64_t unit)
const
25 if(dataspace < indices.size())
27 auto idx = indices[dataspace];
29 if(idx + unit < units.size())
30 return units[idx + unit];
45 using indices_array = std::array<uint64_t, ossia::dataspace_count>;
46 using units_array = std::array<ossia::unit_t, ossia::unit_count>;
48 const indices_array indices;
49 const units_array units;
51 static indices_array make_dataspace_index_array()
57 ossia::for_each_tagged(ossia::dataspace_u_list{}, [&](
auto t) {
58 using dataspace_type =
typename decltype(t)::type;
60 sum += ossia::size<dataspace_type>::value;
68 static units_array make_unit_array()
73 ossia::for_each_tagged(ossia::dataspace_u_list{}, [&](
auto t) {
74 using dataspace_type =
typename decltype(t)::type;
75 ossia::for_each_tagged(dataspace_type{}, [&](
auto u) {
76 using unit_type =
typename decltype(u)::type;
Definition dataspace.hpp:24