Flecs: include/flecs/addons/cpp/mixins/units/impl.hpp Source File
Description: A fast entity component system (ECS) for C & C++

| 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
5
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}
FlecsUnitsImport
FLECS_API void FlecsUnitsImport(ecs_world_t *world)
Units module import function.
flecs::world::module
flecs::entity module(const char *name=nullptr) const
Define a module.
Definition impl.hpp:80
flecs::world::entity
flecs::entity entity(Args &&... args) const
Create an entity.
Definition impl.hpp:190
flecs::units::Amount
Definition decl.hpp:74
flecs::units::Angle
Definition decl.hpp:81
flecs::units::Atto
Definition decl.hpp:31
flecs::units::Bel
Definition decl.hpp:354
flecs::units::Centi
Definition decl.hpp:37
flecs::units::Color
Definition decl.hpp:84
flecs::units::DataRate
Definition decl.hpp:80
flecs::units::Data
Definition decl.hpp:79
flecs::units::Deca
Definition decl.hpp:39
flecs::units::DeciBel
Definition decl.hpp:355
flecs::units::Deci
Definition decl.hpp:38
flecs::units::Duration
Definition decl.hpp:68
flecs::units::ElectricCurrent
Definition decl.hpp:71
flecs::units::Exa
Definition decl.hpp:46
flecs::units::Exbi
Definition decl.hpp:54
flecs::units::Femto
Definition decl.hpp:32
flecs::units::Force
Definition decl.hpp:73
flecs::units::Frequency
Definition decl.hpp:82
flecs::units::Gibi
Definition decl.hpp:51
flecs::units::Giga
Definition decl.hpp:43
flecs::units::Hecto
Definition decl.hpp:40
flecs::units::Kibi
Definition decl.hpp:49
flecs::units::Kilo
Definition decl.hpp:41
flecs::units::Length
Definition decl.hpp:75
flecs::units::LuminousIntensity
Definition decl.hpp:72
flecs::units::Mass
Definition decl.hpp:70
flecs::units::Mebi
Definition decl.hpp:50
flecs::units::Mega
Definition decl.hpp:42
flecs::units::Micro
Definition decl.hpp:35
flecs::units::Milli
Definition decl.hpp:36
flecs::units::Nano
Definition decl.hpp:34
flecs::units::Pebi
Definition decl.hpp:53
flecs::units::Percentage
Definition decl.hpp:353
flecs::units::Peta
Definition decl.hpp:45
flecs::units::Pico
Definition decl.hpp:33
flecs::units::Prefixes
Definition decl.hpp:19
flecs::units::Pressure
Definition decl.hpp:76
flecs::units::Speed
Definition decl.hpp:77
flecs::units::Tebi
Definition decl.hpp:52
flecs::units::Temperature
Definition decl.hpp:78
flecs::units::Tera
Definition decl.hpp:44
flecs::units::Time
Definition decl.hpp:69
flecs::units::Uri
Definition decl.hpp:83
flecs::units::Yobi
Definition decl.hpp:56
flecs::units::Yocto
Definition decl.hpp:29
flecs::units::Yotta
Definition decl.hpp:48
flecs::units::Zebi
Definition decl.hpp:55
flecs::units::Zepto
Definition decl.hpp:30
flecs::units::Zetta
Definition decl.hpp:47
flecs::units::amount::Mole
Definition decl.hpp:168
flecs::units::angle::Degrees
Definition decl.hpp:115
flecs::units::angle::Radians
Definition decl.hpp:114
flecs::units::color::Css
Definition decl.hpp:348
flecs::units::color::Hsl
Definition decl.hpp:347
flecs::units::color::Rgb
Definition decl.hpp:346
flecs::units::data::Bits
Definition decl.hpp:273
flecs::units::data::Bytes
Definition decl.hpp:277
flecs::units::data::GibiBytes
Definition decl.hpp:283
flecs::units::data::GigaBits
Definition decl.hpp:276
flecs::units::data::GigaBytes
Definition decl.hpp:280
flecs::units::data::KibiBytes
Definition decl.hpp:281
flecs::units::data::KiloBits
Definition decl.hpp:274
flecs::units::data::KiloBytes
Definition decl.hpp:278
flecs::units::data::MebiBytes
Definition decl.hpp:282
flecs::units::data::MegaBits
Definition decl.hpp:275
flecs::units::data::MegaBytes
Definition decl.hpp:279
flecs::units::datarate::BitsPerSecond
Definition decl.hpp:295
flecs::units::datarate::BytesPerSecond
Definition decl.hpp:299
flecs::units::datarate::GigaBitsPerSecond
Definition decl.hpp:298
flecs::units::datarate::GigaBytesPerSecond
Definition decl.hpp:302
flecs::units::datarate::KiloBitsPerSecond
Definition decl.hpp:296
flecs::units::datarate::KiloBytesPerSecond
Definition decl.hpp:300
flecs::units::datarate::MegaBitsPerSecond
Definition decl.hpp:297
flecs::units::datarate::MegaBytesPerSecond
Definition decl.hpp:301
flecs::units::duration::Days
Definition decl.hpp:102
flecs::units::duration::Hours
Definition decl.hpp:101
flecs::units::duration::MicroSeconds
Definition decl.hpp:97
flecs::units::duration::MilliSeconds
Definition decl.hpp:98
flecs::units::duration::Minutes
Definition decl.hpp:100
flecs::units::duration::NanoSeconds
Definition decl.hpp:96
flecs::units::duration::PicoSeconds
Definition decl.hpp:95
flecs::units::duration::Seconds
Definition decl.hpp:99
flecs::units::electric_current::Ampere
Definition decl.hpp:155
flecs::units::force::Newton
Definition decl.hpp:194
flecs::units::frequency::GigaHertz
Definition decl.hpp:318
flecs::units::frequency::Hertz
Definition decl.hpp:315
flecs::units::frequency::KiloHertz
Definition decl.hpp:316
flecs::units::frequency::MegaHertz
Definition decl.hpp:317
flecs::units::length::CentiMeters
Definition decl.hpp:212
flecs::units::length::KiloMeters
Definition decl.hpp:213
flecs::units::length::Meters
Definition decl.hpp:207
flecs::units::length::MicroMeters
Definition decl.hpp:210
flecs::units::length::Miles
Definition decl.hpp:214
flecs::units::length::MilliMeters
Definition decl.hpp:211
flecs::units::length::NanoMeters
Definition decl.hpp:209
flecs::units::length::PicoMeters
Definition decl.hpp:208
flecs::units::length::Pixels
Definition decl.hpp:215
flecs::units::luminous_intensity::Candela
Definition decl.hpp:181
flecs::units::mass::Grams
Definition decl.hpp:141
flecs::units::mass::KiloGrams
Definition decl.hpp:142
flecs::units::pressure::Bar
Definition decl.hpp:229
flecs::units::pressure::Pascal
Definition decl.hpp:228
flecs::units::speed::KiloMetersPerHour
Definition decl.hpp:244
flecs::units::speed::KiloMetersPerSecond
Definition decl.hpp:243
flecs::units::speed::MetersPerSecond
Definition decl.hpp:242
flecs::units::speed::MilesPerHour
Definition decl.hpp:245
flecs::units::temperature::Celsius
Definition decl.hpp:259
flecs::units::temperature::Fahrenheit
Definition decl.hpp:260
flecs::units::temperature::Kelvin
Definition decl.hpp:258
flecs::units::time::Date
Definition decl.hpp:128
flecs::units::uri::File
Definition decl.hpp:333
flecs::units::uri::Hyperlink
Definition decl.hpp:331
flecs::units::uri::Image
Definition decl.hpp:332
flecs::world
The world.
Definition world.hpp:172