OSSIA
Open Scenario System for Interactive Application
dataspace_visitors.hpp
Go to the documentation of this file.
1 #pragma once
3 #include <ossia/detail/string_view.hpp>
4 #include <ossia/network/common/parameter_properties.hpp>
5 #include <ossia/network/value/vec.hpp>
6 
7 #include <bitset>
8 #include <type_traits>
9 
13 namespace ossia
14 {
15 struct unit_t;
16 class value;
17 struct domain;
18 struct value_with_unit;
19 
25 OSSIA_EXPORT
27 
32 OSSIA_EXPORT
33 std::string_view get_dataspace_text(const ossia::unit_t&);
34 
39 OSSIA_EXPORT
40 std::string_view get_unit_text(const ossia::unit_t&);
41 
47 OSSIA_EXPORT
48 std::string_view get_unit_accessors(const ossia::unit_t&);
49 
50 OSSIA_EXPORT
51 ossia::domain get_unit_default_domain(const ossia::unit_t&);
52 
58 OSSIA_EXPORT
59 std::string_view get_pretty_unit_text(const ossia::unit_t&);
60 
67 OSSIA_EXPORT
68 char get_unit_accessor(const ossia::unit_t&, uint8_t n);
69 
76 OSSIA_EXPORT
77 ossia::unit_t parse_dataspace(std::string_view text);
78 
87 OSSIA_EXPORT
88 ossia::unit_t parse_unit(std::string_view text, const ossia::unit_t& dataspace);
89 
94 OSSIA_EXPORT
95 ossia::unit_t parse_pretty_unit(std::string_view text);
96 
102 template <typename T>
103 OSSIA_EXPORT ossia::unit_t parse_unit(std::string_view text, T dataspace);
104 
112 OSSIA_EXPORT
113 value_with_unit make_value(const ossia::value& v, const ossia::unit_t& u);
114 
125 OSSIA_EXPORT
126 ossia::unit_t make_unit(uint64_t dataspace, uint64_t unit);
127 
136 OSSIA_EXPORT
138 
140 {
141  return matching_type(static_cast<const ossia::unit_t&>(u));
142 }
143 
154 OSSIA_EXPORT
156 
167 OSSIA_EXPORT
169  const ossia::value& v, const ossia::unit_t& source_unit,
170  const ossia::unit_t& destination_unit);
171 
177 OSSIA_EXPORT
179 
183 OSSIA_EXPORT
185 
191 OSSIA_EXPORT
192 std::string to_pretty_string(const ossia::value_with_unit& v);
193 
206 OSSIA_EXPORT
209 
210 OSSIA_EXPORT
212 merge(const ossia::value_with_unit&, const ossia::vec2f&, std::bitset<2>);
213 
214 OSSIA_EXPORT
216 merge(const ossia::value_with_unit&, const ossia::vec3f&, std::bitset<3>);
217 
218 OSSIA_EXPORT
220 merge(const ossia::value_with_unit&, const ossia::vec4f&, std::bitset<4>);
221 }
The value class.
Definition: value.hpp:173
Definition: git_info.h:7
val_type
Enum to represent the types that a value can take.
Definition: parameter_properties.hpp:16
char get_unit_accessor(const ossia::unit_t &unit, uint8_t n)
get_unit_accessor Return the character corresponding to the accessor
Definition: dataspace_visitors.cpp:153
value to_value(const value_with_unit &v)
convert Convert a value + unit to a simple value
Definition: dataspace_visitors.cpp:232
bool check_units_convertible(const ossia::unit_t &lhs, const ossia::unit_t &rhs)
Checks ///.
Definition: dataspace_visitors.cpp:22
unit_t parse_pretty_unit(std::string_view text)
parse_pretty_unit Create a unit from a valid unit in the format of get_pretty_unit_text
Definition: dataspace_visitors.cpp:70
std::string_view get_unit_accessors(const unit_t &u)
get_unit_accessors
Definition: dataspace_visitors.cpp:38
std::string_view get_dataspace_text(const unit_t &u)
Parse ///.
Definition: dataspace_visitors.cpp:28
OSSIA_EXPORT T convert(const ossia::value &val)
convert Convert a value to the given type.
Definition: value_conversion_impl.hpp:411
unit_t parse_unit(std::string_view text, const unit_t &dataspace)
parse_unit Takes a text and a dataspace and gives a corresponding unit.
Definition: dataspace_visitors.cpp:57
unit_t parse_dataspace(std::string_view text)
parse_dataspace
Definition: dataspace_visitors.cpp:89
std::string_view get_pretty_unit_text(const unit_t &u)
get_pretty_unit_text Unit for human readability and debugging
Definition: dataspace_visitors.cpp:43
std::string_view get_unit_text(const unit_t &u)
get_unit_text
Definition: dataspace_visitors.cpp:33
val_type matching_type(const unit_t &u)
underlying_type Get the implementation type of an unit
Definition: dataspace_visitors.cpp:198
ossia::value_with_unit merge(const value_with_unit &vu, const ossia::value &val, ossia::destination_index idx)
merge Merge a computed value in a unit-aware value
Definition: dataspace_visitors.cpp:311
value_with_unit make_value(const ossia::value &v, const ossia::unit_t &u)
Convert ///.
Definition: dataspace_visitors.cpp:178
unit_t make_unit(uint64_t dataspace, uint64_t unit)
get_unit Create an unit from indexes in the variant
Definition: dataspace_visitors.cpp:193
ossia::small_vector< int32_t, 2 > destination_index
Definition: destination_index.hpp:40
unit_t to_unit(const value_with_unit &v)
to_unit Get the unit part of a value_with_unit
Definition: dataspace_visitors.cpp:237
std::string to_pretty_string(const value_with_unit &v)
to_pretty_string Pretty string of unit & value
Definition: dataspace_visitors.cpp:242
domain A domain of values
Definition: domain_base.hpp:23
Definition: dataspace.hpp:24
Definition: value_with_unit.hpp:13