Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
impl.hpp
Go to the documentation of this file.
1
6#pragma once
7
8namespace flecs {
9
10inline units::units(flecs::world& world) {
11 /* Import C module */
12 FlecsUnitsImport(world);
13
14 /* Bridge between C++ types and flecs.units entities */
15 world.module<units>();
16
17 // Initialize world.entity(prefixes) scope
18 world.entity<Prefixes>("::flecs::units::prefixes");
19
20 // Initialize prefixes
21 world.entity<Yocto>("::flecs::units::prefixes::Yocto");
22 world.entity<Zepto>("::flecs::units::prefixes::Zepto");
23 world.entity<Atto>("::flecs::units::prefixes::Atto");
24 world.entity<Femto>("::flecs::units::prefixes::Femto");
25 world.entity<Pico>("::flecs::units::prefixes::Pico");
26 world.entity<Nano>("::flecs::units::prefixes::Nano");
27 world.entity<Micro>("::flecs::units::prefixes::Micro");
28 world.entity<Milli>("::flecs::units::prefixes::Milli");
29 world.entity<Centi>("::flecs::units::prefixes::Centi");
30 world.entity<Deci>("::flecs::units::prefixes::Deci");
31 world.entity<Deca>("::flecs::units::prefixes::Deca");
32 world.entity<Hecto>("::flecs::units::prefixes::Hecto");
33 world.entity<Kilo>("::flecs::units::prefixes::Kilo");
34 world.entity<Mega>("::flecs::units::prefixes::Mega");
35 world.entity<Giga>("::flecs::units::prefixes::Giga");
36 world.entity<Tera>("::flecs::units::prefixes::Tera");
37 world.entity<Peta>("::flecs::units::prefixes::Peta");
38 world.entity<Exa>("::flecs::units::prefixes::Exa");
39 world.entity<Zetta>("::flecs::units::prefixes::Zetta");
40 world.entity<Yotta>("::flecs::units::prefixes::Yotta");
41 world.entity<Kibi>("::flecs::units::prefixes::Kibi");
42 world.entity<Mebi>("::flecs::units::prefixes::Mebi");
43 world.entity<Gibi>("::flecs::units::prefixes::Gibi");
44 world.entity<Tebi>("::flecs::units::prefixes::Tebi");
45 world.entity<Pebi>("::flecs::units::prefixes::Pebi");
46 world.entity<Exbi>("::flecs::units::prefixes::Exbi");
47 world.entity<Zebi>("::flecs::units::prefixes::Zebi");
48 world.entity<Yobi>("::flecs::units::prefixes::Yobi");
49
50 // Initialize quantities
51 world.entity<Duration>("::flecs::units::Duration");
52 world.entity<Time>("::flecs::units::Time");
53 world.entity<Mass>("::flecs::units::Mass");
54 world.entity<Force>("::flecs::units::Force");
55 world.entity<ElectricCurrent>("::flecs::units::ElectricCurrent");
56 world.entity<Amount>("::flecs::units::Amount");
57 world.entity<LuminousIntensity>("::flecs::units::LuminousIntensity");
58 world.entity<Length>("::flecs::units::Length");
59 world.entity<Pressure>("::flecs::units::Pressure");
60 world.entity<Speed>("::flecs::units::Speed");
61 world.entity<Temperature>("::flecs::units::Temperature");
62 world.entity<Data>("::flecs::units::Data");
63 world.entity<DataRate>("::flecs::units::DataRate");
64 world.entity<Angle>("::flecs::units::Angle");
65 world.entity<Frequency>("::flecs::units::Frequency");
66 world.entity<Uri>("::flecs::units::Uri");
67 world.entity<Color>("::flecs::units::Color");
68
69 // Initialize duration units
70 world.entity<duration::PicoSeconds>(
71 "::flecs::units::Duration::PicoSeconds");
72 world.entity<duration::NanoSeconds>(
73 "::flecs::units::Duration::NanoSeconds");
74 world.entity<duration::MicroSeconds>(
75 "::flecs::units::Duration::MicroSeconds");
76 world.entity<duration::MilliSeconds>(
77 "::flecs::units::Duration::MilliSeconds");
78 world.entity<duration::Seconds>(
79 "::flecs::units::Duration::Seconds");
80 world.entity<duration::Minutes>(
81 "::flecs::units::Duration::Minutes");
82 world.entity<duration::Hours>(
83 "::flecs::units::Duration::Hours");
84 world.entity<duration::Days>(
85 "::flecs::units::Duration::Days");
86
87 // Initialize time units
88 world.entity<time::Date>("::flecs::units::Time::Date");
89
90 // Initialize mass units
91 world.entity<mass::Grams>("::flecs::units::Mass::Grams");
92 world.entity<mass::KiloGrams>("::flecs::units::Mass::KiloGrams");
93
94 // Initialize current units
95 world.entity<electric_current::Ampere>
96 ("::flecs::units::ElectricCurrent::Ampere");
97
98 // Initialize amount units
99 world.entity<amount::Mole>("::flecs::units::Amount::Mole");
100
101 // Initialize luminous intensity units
102 world.entity<luminous_intensity::Candela>(
103 "::flecs::units::LuminousIntensity::Candela");
104
105 // Initialize force units
106 world.entity<force::Newton>("::flecs::units::Force::Newton");
107
108 // Initialize length units
109 world.entity<length::Meters>("::flecs::units::Length::Meters");
110 world.entity<length::PicoMeters>("::flecs::units::Length::PicoMeters");
111 world.entity<length::NanoMeters>("::flecs::units::Length::NanoMeters");
112 world.entity<length::MicroMeters>("::flecs::units::Length::MicroMeters");
113 world.entity<length::MilliMeters>("::flecs::units::Length::MilliMeters");
114 world.entity<length::CentiMeters>("::flecs::units::Length::CentiMeters");
115 world.entity<length::KiloMeters>("::flecs::units::Length::KiloMeters");
116 world.entity<length::Miles>("::flecs::units::Length::Miles");
117 world.entity<length::Pixels>("::flecs::units::Length::Pixels");
118
119 // Initialize pressure units
120 world.entity<pressure::Pascal>("::flecs::units::Pressure::Pascal");
121 world.entity<pressure::Bar>("::flecs::units::Pressure::Bar");
122
123 // Initialize speed units
124 world.entity<speed::MetersPerSecond>(
125 "::flecs::units::Speed::MetersPerSecond");
126 world.entity<speed::KiloMetersPerSecond>(
127 "::flecs::units::Speed::KiloMetersPerSecond");
128 world.entity<speed::KiloMetersPerHour>(
129 "::flecs::units::Speed::KiloMetersPerHour");
130 world.entity<speed::MilesPerHour>(
131 "::flecs::units::Speed::MilesPerHour");
132
133 // Initialize temperature units
134 world.entity<temperature::Kelvin>(
135 "::flecs::units::Temperature::Kelvin");
136 world.entity<temperature::Celsius>(
137 "::flecs::units::Temperature::Celsius");
138 world.entity<temperature::Fahrenheit>(
139 "::flecs::units::Temperature::Fahrenheit");
140
141 // Initialize data units
142 world.entity<data::Bits>(
143 "::flecs::units::Data::Bits");
144 world.entity<data::KiloBits>(
145 "::flecs::units::Data::KiloBits");
146 world.entity<data::MegaBits>(
147 "::flecs::units::Data::MegaBits");
148 world.entity<data::GigaBits>(
149 "::flecs::units::Data::GigaBits");
150 world.entity<data::Bytes>(
151 "::flecs::units::Data::Bytes");
152 world.entity<data::KiloBytes>(
153 "::flecs::units::Data::KiloBytes");
154 world.entity<data::MegaBytes>(
155 "::flecs::units::Data::MegaBytes");
156 world.entity<data::GigaBytes>(
157 "::flecs::units::Data::GigaBytes");
158 world.entity<data::KibiBytes>(
159 "::flecs::units::Data::KibiBytes");
160 world.entity<data::MebiBytes>(
161 "::flecs::units::Data::MebiBytes");
162 world.entity<data::GibiBytes>(
163 "::flecs::units::Data::GibiBytes");
164
165 // Initialize datarate units
166 world.entity<datarate::BitsPerSecond>(
167 "::flecs::units::DataRate::BitsPerSecond");
168 world.entity<datarate::KiloBitsPerSecond>(
169 "::flecs::units::DataRate::KiloBitsPerSecond");
170 world.entity<datarate::MegaBitsPerSecond>(
171 "::flecs::units::DataRate::MegaBitsPerSecond");
172 world.entity<datarate::GigaBitsPerSecond>(
173 "::flecs::units::DataRate::GigaBitsPerSecond");
174 world.entity<datarate::BytesPerSecond>(
175 "::flecs::units::DataRate::BytesPerSecond");
176 world.entity<datarate::KiloBytesPerSecond>(
177 "::flecs::units::DataRate::KiloBytesPerSecond");
178 world.entity<datarate::MegaBytesPerSecond>(
179 "::flecs::units::DataRate::MegaBytesPerSecond");
180 world.entity<datarate::GigaBytesPerSecond>(
181 "::flecs::units::DataRate::GigaBytesPerSecond");
182
183 // Initialize hertz units
184 world.entity<frequency::Hertz>(
185 "::flecs::units::Frequency::Hertz");
186 world.entity<frequency::KiloHertz>(
187 "::flecs::units::Frequency::KiloHertz");
188 world.entity<frequency::MegaHertz>(
189 "::flecs::units::Frequency::MegaHertz");
190 world.entity<frequency::GigaHertz>(
191 "::flecs::units::Frequency::GigaHertz");
192
193 // Initialize uri units
194 world.entity<uri::Hyperlink>(
195 "::flecs::units::Uri::Hyperlink");
196 world.entity<uri::Image>(
197 "::flecs::units::Uri::Image");
198 world.entity<uri::File>(
199 "::flecs::units::Uri::File");
200
201 // Initialize angles
202 world.entity<angle::Radians>(
203 "::flecs::units::Angle::Radians");
204 world.entity<angle::Degrees>(
205 "::flecs::units::Angle::Degrees");
206
207 // Initialize color
208 world.entity<color::Rgb>("::flecs::units::Color::Rgb");
209 world.entity<color::Hsl>("::flecs::units::Color::Hsl");
210 world.entity<color::Css>("::flecs::units::Color::Css");
211
212 // Initialize percentage
213 world.entity<Percentage>("::flecs::units::Percentage");
214
215 // Initialize Bel
216 world.entity<Bel>("::flecs::units::Bel");
217 world.entity<DeciBel>("::flecs::units::DeciBel");
218}
219
220}
FLECS_API void FlecsUnitsImport(ecs_world_t *world)
Units module import function.
flecs::entity module(const char *name=nullptr) const
Define a module.
flecs::entity entity(Args &&... args) const
Create an entity.
The world.
Definition world.hpp:137