OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
list_units.hpp
1#pragma once
2#include <ossia/network/base/parameter_data.hpp>
3#include <ossia/network/dataspace/dataspace.hpp>
4#include <ossia/network/dataspace/dataspace_base_fwd.hpp>
6#include <ossia/network/dataspace/detail/dataspace_parse.hpp>
7
8#include <boost/algorithm/string/case_conv.hpp>
9namespace ossia::detail
10{
11
12template <typename InsertFun>
13void list_units(InsertFun fun)
14{
15 // TODO frozen hash-map
16 ossia::for_each_tagged(dataspace_u_list{}, [&](auto t) {
18 using dataspace_type = typename decltype(t)::type;
19 using d_traits = dataspace_traits<dataspace_type>;
20 for(auto dn : d_traits::text())
21 {
22 std::string dataspace_name(dn);
23 boost::algorithm::to_lower(dataspace_name);
24 using neutral_u = typename d_traits::neutral_unit;
25
26 fun(dataspace_name, neutral_u{});
27
28 ossia::for_each_tagged(dataspace_type{}, [&](auto u) {
29 using unit_type = typename decltype(u)::type;
30
31 for(auto un : unit_traits<unit_type>::text())
32 {
33 // Add the unit in short form and long
34 std::string s = boost::algorithm::to_lower_copy(std::string(un));
35 fun(dataspace_name + "." + s, unit_type{});
36 fun(std::move(s), unit_type{});
37 }
38 });
39 }
40 });
41
42 fun("complex", ossia::cartesian_2d_u{});
43 fun("point2d", ossia::cartesian_2d_u{});
44 fun("2d", ossia::cartesian_2d_u{});
45 fun("cartesian2d", ossia::cartesian_2d_u{});
46
47 fun("pos", ossia::cartesian_3d_u{});
48 fun("point", ossia::cartesian_3d_u{});
49 fun("point3d", ossia::cartesian_3d_u{});
50 fun("3d", ossia::cartesian_3d_u{});
51 fun("cartesian3d", ossia::cartesian_3d_u{});
52 fun("coord", ossia::cartesian_3d_u{});
53 fun("coordinate", ossia::cartesian_3d_u{});
54 fun("coordinates", ossia::cartesian_3d_u{});
55 fun("pvector", ossia::cartesian_3d_u{});
56 fun("vertex", ossia::cartesian_3d_u{});
57
58 fun("gl", ossia::opengl_u{});
59 fun("opengl", ossia::opengl_u{});
60 fun("position.gl", ossia::opengl_u{});
61 fun("position.opengl", ossia::opengl_u{});
62
63 fun("freq", ossia::frequency_u{});
64 fun("frequence", ossia::frequency_u{});
65 fun("frequency", ossia::frequency_u{});
66
67 fun("col", ossia::rgba8_u{});
68 fun("color", ossia::rgba8_u{});
69 // note !! we don't use the neutral (normalized argb) unit for color
70
71 fun("rot", ossia::dataspace_traits<angle_u>::neutral_unit{});
72 fun("rotation", ossia::dataspace_traits<angle_u>::neutral_unit{});
73
74 fun("meter", ossia::meter_u{});
75 fun("decimeter", ossia::decimeter_u{});
76 fun("centimeter", ossia::centimeter_u{});
77 fun("millimeter", ossia::millimeter_u{});
78 fun("micrometer", ossia::micrometer_u{});
79 fun("nanometer", ossia::nanometer_u{});
80 fun("picometer", ossia::picometer_u{});
81}
82}
Definition transitive_closure.hpp:27
The data that can be found inside a parameter.
Definition parameter_data.hpp:21