dimval 0.2.0
Modern C++23 header-only library of dimensional values (units, measures, ranges)
Loading...
Searching...
No Matches
dimensionless.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <dimval/define.hpp>
8
9// NOLINTNEXTLINE(readability-redundant-string-init)
11 "count",
12 "",
13 "",
14 "count",
15 "count",
16 1.0,
17 ::comms::Icons::mdi::counter,
18 ::comms::Colors::mui::grey[400],
19 static constexpr int default_precision = 0;
20 static constexpr bool no_space_before_symbol = true;)
21
22// NOLINTNEXTLINE(readability-redundant-string-init)
24 "ratio",
25 "",
26 "",
27 "ratio",
28 "ratio",
29 1.0,
30 ::comms::Icons::mdi::percent_outline,
31 ::comms::Colors::mui::grey[400])
32
33// NOLINTNEXTLINE(readability-redundant-string-init)
34DIMVAL_DEFINE_UNIT(Dimensionless,
35 "dimensionless",
36 "",
37 "",
38 "dimensionless",
39 "dimensionless",
40 1.0,
41 ::comms::Icons::mdi::variable,
42 ::comms::Colors::mui::grey[400],
43 static constexpr bool no_space_before_symbol = true;)
44
45DIMVAL_DEFINE_UNIT(Percent,
46 "percent",
47 "%",
48 "%",
49 "percent",
50 "ratio",
51 0.01,
52 ::comms::Icons::mdi::percent,
53 ::comms::Colors::mui::grey[400],
54 static constexpr ::std::string_view formatter = "percent";
55 static constexpr int default_precision = 2;
56 static constexpr bool no_space_before_symbol = true;)
57
58DIMVAL_DEFINE_UNIT(PartsPerMillion,
59 "ppm",
60 "ppm",
61 "ppm",
62 "parts per million",
63 "ratio",
64 1e-6,
65 ::comms::Icons::mdi::tune_variant,
66 ::comms::Colors::mui::cyan[400],
67 static constexpr int default_precision = 2;)
68
69DIMVAL_DEFINE_UNIT(PartsPerBillion,
70 "ppb",
71 "ppb",
72 "ppb",
73 "parts per billion",
74 "ratio",
75 1e-9,
76 ::comms::Icons::mdi::tune,
77 ::comms::Colors::mui::cyan[500],
78 static constexpr int default_precision = 2;)
Macros that expand into a CRTP unit/measure struct and a runtime auto-registration for it.
#define DIMVAL_DEFINE_UNIT(Tag, Id, Symbol, ShortName, LongName, Kind, Factor, Icon, Color,...)
Define a unit struct in ::dimval and auto-register its descriptor at static-init time.
Definition define.hpp:72