OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
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
13namespace ossia
14{
15struct unit_t;
16class value;
17struct domain;
18struct value_with_unit;
19
25[[nodiscard]]
26OSSIA_EXPORT bool check_units_convertible(const ossia::unit_t&, const ossia::unit_t&);
27
32[[nodiscard]]
33OSSIA_EXPORT std::string_view get_dataspace_text(const ossia::unit_t&);
34
39[[nodiscard]]
40OSSIA_EXPORT std::string_view get_unit_text(const ossia::unit_t&);
41
47[[nodiscard]]
48OSSIA_EXPORT std::string_view get_unit_accessors(const ossia::unit_t&);
49
50[[nodiscard]]
51OSSIA_EXPORT ossia::domain get_unit_default_domain(const ossia::unit_t&);
52
58[[nodiscard]]
59OSSIA_EXPORT std::string_view get_pretty_unit_text(const ossia::unit_t&);
60
67[[nodiscard]]
68OSSIA_EXPORT char get_unit_accessor(const ossia::unit_t&, uint8_t n);
69
76[[nodiscard]]
77OSSIA_EXPORT ossia::unit_t parse_dataspace(std::string_view text);
78
87[[nodiscard]]
88OSSIA_EXPORT ossia::unit_t
89parse_unit(std::string_view text, const ossia::unit_t& dataspace);
90
95[[nodiscard]]
96OSSIA_EXPORT ossia::unit_t parse_pretty_unit(std::string_view text);
97
103template <typename T>
104[[nodiscard]]
105OSSIA_EXPORT ossia::unit_t parse_unit(std::string_view text, T dataspace);
106
114[[nodiscard]]
115OSSIA_EXPORT value_with_unit make_value(const ossia::value& v, const ossia::unit_t& u);
116
127[[nodiscard]]
128OSSIA_EXPORT ossia::unit_t make_unit(uint64_t dataspace, uint64_t unit);
129
138[[nodiscard]]
139OSSIA_EXPORT ossia::val_type matching_type(const ossia::unit_t& u);
140
142{
143 return matching_type(static_cast<const ossia::unit_t&>(u));
144}
145
156[[nodiscard]]
157OSSIA_EXPORT ossia::value_with_unit
158convert(const ossia::value_with_unit& v, const ossia::unit_t& t);
159
170[[nodiscard]]
171OSSIA_EXPORT ossia::value convert(
172 const ossia::value& v, const ossia::unit_t& source_unit,
173 const ossia::unit_t& destination_unit);
174
180[[nodiscard]]
181OSSIA_EXPORT ossia::value to_value(const ossia::value_with_unit& v);
182
186[[nodiscard]]
187OSSIA_EXPORT ossia::unit_t to_unit(const ossia::value_with_unit& v);
188
194[[nodiscard]]
195OSSIA_EXPORT std::string to_pretty_string(const ossia::value_with_unit& v);
196
209[[nodiscard]]
210OSSIA_EXPORT ossia::value_with_unit
212
213[[nodiscard]]
214OSSIA_EXPORT ossia::value_with_unit
215merge(const ossia::value_with_unit&, const ossia::vec2f&, std::bitset<2>);
216
217[[nodiscard]]
218OSSIA_EXPORT ossia::value_with_unit
219merge(const ossia::value_with_unit&, const ossia::vec3f&, std::bitset<3>);
220
221[[nodiscard]]
222OSSIA_EXPORT ossia::value_with_unit
223merge(const ossia::value_with_unit&, const ossia::vec4f&, std::bitset<4>);
224}
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
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