🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
Unit.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "Dimension.hpp"
25#include "UnitRep.hpp"
26#include "AstUtil/Object.hpp"
27#include "AstUtil/SharedPtr.hpp"
28#include "AstUtil/StringView.hpp"
29#include "AstUtil/Constants.h"
30#include <cmath>
31#include <string>
32#include <vector>
33#include <memory>
34
35AST_NAMESPACE_BEGIN
36
37
45class Unit;
46class Quantity;
47class UnitRep;
48
49
50
51namespace units
52{
53 extern AST_UTIL_API Unit none;
54
55 extern AST_UTIL_API Unit mm;
56 extern AST_UTIL_API Unit cm;
57 extern AST_UTIL_API Unit dm;
58 extern AST_UTIL_API Unit m;
59 extern AST_UTIL_API Unit km;
60
61 extern AST_UTIL_API Unit in;
62 extern AST_UTIL_API Unit ft;
63 extern AST_UTIL_API Unit yd;
64 extern AST_UTIL_API Unit mi;
65
66
67
68 extern AST_UTIL_API Unit sec;
69 extern AST_UTIL_API Unit s;
70 extern AST_UTIL_API Unit ms;
71 extern AST_UTIL_API Unit minute;
72 extern AST_UTIL_API Unit hour;
73 extern AST_UTIL_API Unit h;
74 extern AST_UTIL_API Unit day;
75
76 extern AST_UTIL_API Unit kg;
77 extern AST_UTIL_API Unit g;
78 extern AST_UTIL_API Unit mg;
79 extern AST_UTIL_API Unit lb;
80
81 extern AST_UTIL_API Unit N;
82
83 extern AST_UTIL_API Unit deg;
84 extern AST_UTIL_API Unit rad;
85 extern AST_UTIL_API Unit arcsec;
86
87 extern AST_UTIL_API Unit A;
88
89 extern AST_UTIL_API Unit m2;
90
91 extern AST_UTIL_API Unit m3;
92 extern AST_UTIL_API Unit L;
93
94 extern AST_UTIL_API Unit Pa;
95
96 extern AST_UTIL_API Unit T;
97 extern AST_UTIL_API Unit nT;
98 extern AST_UTIL_API Unit Gs;
99
100 extern AST_UTIL_API Unit K;
101
102 extern AST_UTIL_API Unit degC;
103 extern AST_UTIL_API Unit degF;
104 extern AST_UTIL_API Unit degR;
105
106 extern AST_UTIL_API Unit dB;
107 extern AST_UTIL_API Unit dBm;
108 extern AST_UTIL_API Unit dBW;
109
110 extern AST_UTIL_API Unit B;
111};
112
113
114
116AST_UTIL_API Unit aUnitMultiply(const Unit& unit1, const Unit& unit2);
117
119AST_UTIL_API Unit aUnitMultiply(const Unit& unit1, const Unit& unit2, StringView newname);
120
122AST_UTIL_API Unit aUnitDivide(const Unit& unit1, const Unit& unit2);
123
125AST_UTIL_API Unit aUnitDivide(const Unit& unit1, const Unit& unit2, StringView newname);
126
128AST_UTIL_API Unit aUnitPower(const Unit& unit, int exponent);
129
131AST_UTIL_API Unit aUnitPower(const Unit& unit, int exponent, StringView newname);
132
134AST_UTIL_API Unit aUnitInvert(const Unit& unit);
135
137AST_UTIL_API Unit aUnitInvert(const Unit& unit, StringView newname);
138
143AST_UTIL_API void aUnitFactorize(const Unit& unit, Unit& newUnit, double& scale);
144
148AST_UTIL_API void aUnitFactorize(Unit& unit, double& scale);
149
150
151
152
154class Unit
155{
156public:
157 #ifdef AST_BUILD_LIB_UTIL
158 friend Unit unit_multiply(const Unit& unit1, const Unit& unit2);
159 friend Unit unit_divide(const Unit& unit1, const Unit& unit2);
160 friend Unit unit_power(const Unit& unit, int exponent);
161 friend void unit_setname(Unit& unit, StringView name);
162 #endif
163public: // 便捷工厂(只能用于创建基本单位,不建议用于直接创建复合单位,否则所创建复合单位会缺少子单位信息)
164
169 AST_UTIL_API
170 static Unit MakeScale(StringView name, Dimension dim, double scale);
171
177 AST_UTIL_API
178 static Unit MakeAffine(StringView name, Dimension dim, double scale, double offset);
179
185 AST_UTIL_API
186 static Unit MakeLogarithmic(StringView name, Dimension dim, double reference, double factor);
187
188public:
190 static Unit NaN()
191 {
192 return Unit("", 0.0, EDimension::eUnit);
193 }
194
196 static Unit None()
197 {
198 return Unit("", 1.0, EDimension::eUnit);
199 }
200
202 static Unit One()
203 {
204 // return Unit(aText("×1"), 1.0, EDimension::eUnit);
205 return Unit(aText("\u00D71"), 1.0, EDimension::eUnit);
206 }
207
211 AST_UTIL_API
212 static Unit Scale(double scale);
213
215 static Unit Percent()
216 {
217 return Unit("%", kPercentToUnit, EDimension::eUnit);
218 }
219
220
222 static Unit Second()
223 {
224 return Unit("s", 1.0, EDimension::eTime);
225 }
227 static Unit Minute()
228 {
229 return Unit("min", kSecondsPerMinute, EDimension::eTime);
230 }
232 static Unit Hour()
233 {
234 return Unit("h", kSecondsPerHour, EDimension::eTime);
235 }
237 static Unit Day()
238 {
239 return Unit("day", kSecondsPerDay, EDimension::eTime);
240 }
243 {
244 return Unit("ms", kMilliSecToSec, EDimension::eTime);
245 }
246
247
248
250 static Unit Meter()
251 {
252 return Unit("m", 1.0, EDimension::eLength);
253 }
256 {
257 return Unit("km", kKilometerToMeter, EDimension::eLength);
258 }
261 {
262 return Unit("cm", kCentimeterToMeter, EDimension::eLength);
263 }
266 {
267 return Unit("dm", kDecimeterToMeter, EDimension::eLength);
268 }
269
272 {
273 return Unit("mm", kMillimeterToMeter, EDimension::eLength);
274 }
275
276
278 static Unit Inch()
279 {
280 return Unit("in", kInchToMeter, EDimension::eLength);
281 }
282
284 static Unit Foot()
285 {
286 return Unit("ft", kFootToMeter, EDimension::eLength);
287 }
288
290 static Unit Yard()
291 {
292 return Unit("yd", kYardToMeter, EDimension::eLength);
293 }
294
296 static Unit Mile()
297 {
298 return Unit("mi", kMileToMeter, EDimension::eLength);
299 }
300
302 static Unit Kilogram()
303 {
304 return Unit("kg", 1.0, EDimension::eMass);
305 }
307 static Unit Gram()
308 {
309 return Unit("g", kGramToKilogram, EDimension::eMass);
310 }
311
314 {
315 return Unit("mg", kMilligramToKilogram, EDimension::eMass);
316 }
317
319 static Unit Pound()
320 {
321 return Unit("lb", kPoundToKilogram, EDimension::eMass);
322 }
323
325 static Unit Radian()
326 {
327 return Unit("rad", 1.0, EDimension::eAngle);
328 }
329
331 static Unit Degree()
332 {
333 // return Unit("°", 0.017453292519943295, EDimension::eAngle);
334 return Unit(aText("\u00B0"), kDegToRad, EDimension::eAngle);
335 }
336
339 {
340 return Unit(aText("\u2033"), kArcSecToRad, EDimension::eAngle);
341 }
342
344 static Unit Newton()
345 {
346 return Unit("N", 1.0, EDimension::eForce);
347 }
348
350 static Unit Ampere()
351 {
352 return Unit("A", 1.0, EDimension::eCurrent);
353 }
355 static Unit Kelvin()
356 {
357 return Unit("K", 1.0, EDimension::eTemperature);
358 }
359
361 static Unit Celsius()
362 {
363 return MakeAffine(aText("°C"), EDimension::eTemperature, 1.0, kCelsiusToKelvinOffset);
364 }
367 {
368 return MakeAffine(aText("°F"), EDimension::eTemperature, kFahrenheitToKelvinScale, kFahrenheitToKelvinOffset);
369 }
371 static Unit Rankine()
372 {
373 return MakeScale(aText("°R"), EDimension::eTemperature, kRankineToKelvin);
374 }
375
377 static Unit Decibel()
378 {
379 return MakeLogarithmic(aText("dB"), EDimension::eUnit, 1.0, kDecibelPowerFactor);
380 }
383 {
384 // @todo 修复构造单位后缺少子单位信息
385 // dBm 为导出量纲(功率),MakeLogarithmic 的断言不满足,直接构造对数单位表示
386 return Unit(std::make_shared<LogarithmicUnitRep>(aText("dBm"), EDimension::ePower, kMilliwattToWatt, kDecibelPowerFactor));
387 }
390 {
391 // @todo 修复构造单位后缺少子单位信息
392 // dBW 为导出量纲(功率),直接构造对数单位表示
393 return Unit(std::make_shared<LogarithmicUnitRep>(aText("dBW"), EDimension::ePower, 1.0, kDecibelPowerFactor));
394 }
395
397 static Unit Bel()
398 {
399 return MakeLogarithmic(aText("B"), EDimension::eUnit, 1.0, kBelFactor);
400 }
401
403 // static Unit Mole()
404 // {
405 // return Unit("mol", 1.0, EDimension::eAmount);
406 // }
407
408 // 下面是组合单位
409
412 return Centimeter() / Second();
413 }
416 {
417 return Kilometer() / Hour();
418 }
421 {
422 return Meter() / Minute();
423 }
426 {
427 return Meter() * Meter();
428 }
431 {
432 return Kilometer() * Kilometer();
433 }
436 {
437 return Foot() * Foot();
438 }
439
442 {
443 return Yard() * Yard();
444 }
445
448 {
449 return Meter() * Meter() * Meter();
450 }
452 static Unit Liter()
453 {
454 return Unit("L", kLiterToCubicMeter, EDimension::eVolume);
455 }
456
458 static Unit Pascal()
459 {
460 return Unit("Pa", 1.0, EDimension::ePressure);
461 }
462
464 static Unit Tesla()
465 {
466 return Unit("T", 1.0, EDimension::eMagneticFluxDensity);
467 }
470 {
471 return Unit("nT", kNanoteslaToTesla, EDimension::eMagneticFluxDensity);
472 }
474 static Unit Gauss()
475 {
476 return Unit("Gs", kGaussToTesla, EDimension::eMagneticFluxDensity);
477 }
478
479public:
481 Unit(): Unit{Unit::None()}{}
482
484 AST_UTIL_API
485 Unit(StringView name);
486
488 Unit(StringView name, double scale, Dimension dimension)
489 : rep_{std::make_shared<ScaleUnitRep>(name, dimension, scale)}
490 {}
491
492protected:
493 Unit(double scale, Dimension dimension, const SubUnitListConst& subunits)
494 : rep_{std::make_shared<ScaleUnitRep>("", dimension, (subunits), scale)}
495 {}
496
498 Unit(UnitRepHandle rep) : rep_(rep) {}
499
500public:
504 double fromSI(double value) const { return rep_->fromSI(value); }
505
509 double toSI(double value) const { return rep_->toSI(value); }
510
515 double convertTo(double value, const Unit& unit) const { return unit.fromSI(toSI(value)); }
516
521 double convertFrom(double value, const Unit& unit) const { return fromSI(unit.toSI(value)); }
522
525 double getScale() const { return rep_->scale(); }
526
529 Dimension dimension() const { return rep_->dimension_; }
530
533 const std::string& name() const { return rep_->name_; }
534
537 EUnitKind kind() const { return rep_->kind_; }
538
541 bool isValid() const { return rep_->valid(); }
542
543public: // operators
544
547 Unit clone() const { return Unit(rep_->clone()); }
548
550 Unit invert() const { return aUnitInvert(*this); }
551
556 Unit multiply(StringView newname, const Unit& other) const
557 {
558 return aUnitMultiply(*this, other, newname);
559 }
560
565 Unit divide(StringView newname, const Unit& other) const
566 {
567 return aUnitDivide(*this, other, newname);
568 }
569
574 Unit pow(StringView newname, int exponent) const
575 {
576 return aUnitPower(*this, exponent, newname);
577 }
578
582 Unit pow(int exponent) const
583 {
584 return aUnitPower(*this, exponent);
585 }
586
590 bool operator==(const Unit& other) const
591 {
592 if(rep_ == other.rep_)
593 return true;
594 return rep_->operator==(*other.rep_);
595 }
596
600 bool operator!=(const Unit& other) const
601 {
602 return !(*this == other);
603 }
604
608 // @todo 应禁止 affine(如 °C)与 logarithmic(如 dBm)单位的复合算术(乘/除/幂),这些单位不能按线性比例运算。
609 Unit operator*(const Unit& other) const
610 {
611 return aUnitMultiply(*this, other);
612 }
613
617 Unit operator/(const Unit& other) const
618 {
619 return aUnitDivide(*this, other);
620 }
624 Unit& operator*=(const Unit& other)
625 {
626 *this = *this * other;
627 return *this;
628 }
632 Unit& operator/=(const Unit& other)
633 {
634 *this = *this / other;
635 return *this;
636 }
637
638
639public:
640 UnitRepHandle rep_{};
641};
642
643
647AST_NAMESPACE_END
单位表示抽象基类
量纲
定义 Dimension.hpp:362
乘法型单位表示: SI = v * scale
定义 UnitRep.hpp:91
单位
定义 Unit.hpp:155
static Unit Newton()
牛顿单位
定义 Unit.hpp:344
Unit(StringView name, double scale, Dimension dimension)
新建单位
定义 Unit.hpp:488
static Unit Day()
天单位
定义 Unit.hpp:237
static Unit Fahrenheit()
华氏度单位(仿射: SI = (v+459.67)*5/9)
定义 Unit.hpp:366
Unit multiply(StringView newname, const Unit &other) const
单位乘法
定义 Unit.hpp:556
static Unit Rankine()
兰氏度单位(仿射: SI = v*5/9)
定义 Unit.hpp:371
static Unit Meter()
米单位
定义 Unit.hpp:250
static Unit DecibelWatt()
分贝瓦单位(对数: 参考1W,功率量纲)
定义 Unit.hpp:389
double getScale() const
获取单位缩放因子
定义 Unit.hpp:525
static Unit Percent()
百分比单位
定义 Unit.hpp:215
static Unit Minute()
分钟单位
定义 Unit.hpp:227
bool operator!=(const Unit &other) const
单位不相等运算符
定义 Unit.hpp:600
Unit pow(StringView newname, int exponent) const
单位幂运算
定义 Unit.hpp:574
Unit divide(StringView newname, const Unit &other) const
单位除法
定义 Unit.hpp:565
Unit pow(int exponent) const
单位幂运算
定义 Unit.hpp:582
double toSI(double value) const
从此单位对应的值转换为国际单位制下的值
定义 Unit.hpp:509
Unit operator*(const Unit &other) const
单位乘法运算符
定义 Unit.hpp:609
static Unit Pascal()
帕斯卡单位(压力量纲)
定义 Unit.hpp:458
static Unit Milligram()
毫克单位
定义 Unit.hpp:313
static Unit Tesla()
特斯拉单位(磁感应强度/磁通密度量纲)
定义 Unit.hpp:464
bool operator==(const Unit &other) const
单位相等运算符
定义 Unit.hpp:590
static Unit Gauss()
高斯单位(1 Gs = 1e-4 T)
定义 Unit.hpp:474
static Unit Second()
秒单位
定义 Unit.hpp:222
static Unit DecibelMilliwatt()
分贝毫瓦单位(对数: 参考1mW,功率量纲)
定义 Unit.hpp:382
EUnitKind kind() const
获取单位类型
定义 Unit.hpp:537
static Unit None()
无单位
定义 Unit.hpp:196
static Unit CubicMeter()
立方米单位
定义 Unit.hpp:447
static Unit NaN()
无效单位
定义 Unit.hpp:190
static Unit SquareMeter()
平方米单位
定义 Unit.hpp:425
static Unit Yard()
码单位
定义 Unit.hpp:290
static Unit NanoTesla()
纳特斯拉单位
定义 Unit.hpp:469
Dimension dimension() const
获取单位量纲
定义 Unit.hpp:529
static Unit Gram()
克单位
定义 Unit.hpp:307
static Unit Decibel()
分贝单位(对数: SI = 10^(v/10),无量纲)
定义 Unit.hpp:377
Unit & operator*=(const Unit &other)
单位乘法赋值运算符
定义 Unit.hpp:624
static Unit Kilometer()
米单位
定义 Unit.hpp:255
Unit invert() const
单位倒数
定义 Unit.hpp:550
static Unit SquareYard()
平方码单位
定义 Unit.hpp:441
static Unit Centimeter()
厘米单位
定义 Unit.hpp:260
static Unit Liter()
升单位
定义 Unit.hpp:452
const std::string & name() const
获取单位名称
定义 Unit.hpp:533
static Unit Bel()
贝尔单位(对数: SI = 10^v,无量纲;1B = 10dB)
定义 Unit.hpp:397
double convertFrom(double value, const Unit &unit) const
从指定单位下的值转换为此单位对应的值
定义 Unit.hpp:521
static Unit Ampere()
安培单位
定义 Unit.hpp:350
Unit clone() const
单位克隆
定义 Unit.hpp:547
static Unit Kelvin()
开尔文单位
定义 Unit.hpp:355
static Unit Foot()
英尺单位
定义 Unit.hpp:284
static Unit Hour()
小时单位
定义 Unit.hpp:232
static Unit SquareFoot()
平方英尺单位
定义 Unit.hpp:435
Unit & operator/=(const Unit &other)
单位除法赋值运算符
定义 Unit.hpp:632
bool isValid() const
是否有效单位
定义 Unit.hpp:541
static Unit CentimeterPerSecond()
mole单位
定义 Unit.hpp:411
static Unit Millimeter()
毫米单位
定义 Unit.hpp:271
double fromSI(double value) const
从国际单位制转换为此单位对应的值
定义 Unit.hpp:504
static Unit Decimeter()
分米单位
定义 Unit.hpp:265
static Unit Celsius()
摄氏度单位(仿射: SI = v*1 + 273.15)
定义 Unit.hpp:361
double convertTo(double value, const Unit &unit) const
转换为指定单位下的值
定义 Unit.hpp:515
static Unit Radian()
弧度单位
定义 Unit.hpp:325
static Unit ArcSecond()
弧秒单位
定义 Unit.hpp:338
static Unit Mile()
英里单位
定义 Unit.hpp:296
Unit(UnitRepHandle rep)
定义 Unit.hpp:498
Unit()
默认无单位
定义 Unit.hpp:481
static Unit Inch()
英寸单位
定义 Unit.hpp:278
static Unit Degree()
度单位
定义 Unit.hpp:331
Unit operator/(const Unit &other) const
单位除法运算符
定义 Unit.hpp:617
static Unit One()
无量纲单位
定义 Unit.hpp:202
static Unit Pound()
磅单位
定义 Unit.hpp:319
static Unit MeterPerMinute()
米每分钟单位
定义 Unit.hpp:420
static Unit Kilogram()
千克单位
定义 Unit.hpp:302
static Unit MilliSecond()
毫秒单位
定义 Unit.hpp:242
static Unit KilometerPerHour()
千米每秒单位
定义 Unit.hpp:415
static Unit SquareKilometer()
平方公里单位
定义 Unit.hpp:430
Unit aUnitMultiply(const Unit &unit1, const Unit &unit2)
单位乘法
定义 Unit.cpp:333
Unit aUnitPower(const Unit &unit, int exponent)
单位幂
定义 Unit.cpp:361
Unit aUnitInvert(const Unit &unit)
单位倒数
定义 Unit.cpp:376
void aUnitFactorize(const Unit &unit, Unit &newUnit, double &scale)
单位分解
定义 Unit.cpp:390
Unit aUnitDivide(const Unit &unit1, const Unit &unit2)
单位除法
定义 Unit.cpp:347
constexpr double kSecondsPerMinute
一分钟的秒数
定义 Constants.h:229
constexpr double kCentimeterToMeter
厘米到米
定义 Constants.h:184
constexpr double kInchToMeter
英寸到米
定义 Constants.h:190
constexpr double kArcSecToRad
弧秒到弧度 kDegToRad/3600.0 度分秒的秒
定义 Constants.h:249
constexpr double kGaussToTesla
高斯到特斯拉
定义 Constants.h:262
constexpr double kSecondsPerHour
一小时的秒数
定义 Constants.h:228
constexpr double kKilometerToMeter
千米到米
定义 Constants.h:183
constexpr double kYardToMeter
码到米
定义 Constants.h:192
constexpr double kFahrenheitToKelvinScale
华氏度到开尔文缩放(乘子)
定义 Constants.h:268
constexpr double kDegToRad
角度到弧度 kPI/180.0
定义 Constants.h:248
constexpr double kSecondsPerDay
一天的秒数
定义 Constants.h:227
constexpr double kMileToMeter
英里到米
定义 Constants.h:193
constexpr double kPercentToUnit
百分比到单位
定义 Constants.h:244
constexpr double kRankineToKelvin
兰氏度到开尔文缩放(乘子)
定义 Constants.h:270
constexpr double kDecibelPowerFactor
功率型分贝系数(10·log10)
定义 Constants.h:274
constexpr double kMilligramToKilogram
毫克到千克
定义 Constants.h:235
constexpr double kLiterToCubicMeter
升到立方米
定义 Constants.h:240
constexpr double kMilliSecToSec
毫秒到秒
定义 Constants.h:213
constexpr double kMilliwattToWatt
毫瓦到瓦(dBm参考值)
定义 Constants.h:276
constexpr double kDecimeterToMeter
分米到米
定义 Constants.h:185
constexpr double kGramToKilogram
克到千克
定义 Constants.h:234
constexpr double kNanoteslaToTesla
纳特斯拉到特斯拉
定义 Constants.h:261
constexpr double kMillimeterToMeter
毫米到米
定义 Constants.h:186
constexpr double kFahrenheitToKelvinOffset
华氏度到开尔文偏移[K]
定义 Constants.h:269
constexpr double kCelsiusToKelvinOffset
摄氏度到开尔文偏移K
定义 Constants.h:267
constexpr double kFootToMeter
英尺到米
定义 Constants.h:191
constexpr double kPoundToKilogram
磅到千克
定义 Constants.h:236
constexpr double kBelFactor
贝尔对数系数(1B = 10dB,即 log10 直接表示)
定义 Constants.h:275
Unit m3
立方米
定义 Unit.cpp:487
Unit mg
毫克
定义 Unit.cpp:474
Unit s
定义 Unit.cpp:465
Unit Gs
高斯
定义 Unit.cpp:494
Unit A
安培
定义 Unit.cpp:483
Unit minute
分钟,不要命名为min,容易与std::min冲突
定义 Unit.cpp:467
Unit cm
厘米
定义 Unit.cpp:454
Unit degF
华氏度
定义 Unit.cpp:499
Unit kg
千克
定义 Unit.cpp:472
Unit T
特斯拉
定义 Unit.cpp:492
Unit nT
纳特斯拉
定义 Unit.cpp:493
Unit h
小时
定义 Unit.cpp:469
Unit arcsec
弧秒
定义 Unit.cpp:481
Unit mi
英里
定义 Unit.cpp:462
Unit day
定义 Unit.cpp:470
Unit lb
定义 Unit.cpp:475
Unit dm
分米
定义 Unit.cpp:455
Unit hour
小时
定义 Unit.cpp:468
Unit ms
毫秒
定义 Unit.cpp:466
Unit L
定义 Unit.cpp:488
Unit yd
定义 Unit.cpp:460
Unit m
定义 Unit.cpp:456
Unit deg
定义 Unit.cpp:479
Unit mm
毫米
定义 Unit.cpp:453
Unit sec
定义 Unit.cpp:464
Unit ft
英尺
定义 Unit.cpp:461
Unit none
无单位
定义 Unit.cpp:451
Unit Pa
帕斯卡
定义 Unit.cpp:490
Unit km
千米
定义 Unit.cpp:457
Unit dBW
分贝瓦
定义 Unit.cpp:504
Unit rad
弧度
定义 Unit.cpp:480
Unit B
贝尔(无量纲)
定义 Unit.cpp:506
Unit N
牛顿
定义 Unit.cpp:477
Unit dBm
分贝毫瓦
定义 Unit.cpp:503
Unit degC
摄氏度
定义 Unit.cpp:498
Unit degR
兰氏度
定义 Unit.cpp:500
Unit m2
平方米
定义 Unit.cpp:485
Unit dB
分贝(无量纲)
定义 Unit.cpp:502
Unit in
英寸
定义 Unit.cpp:459
Unit g
定义 Unit.cpp:473
Unit K
开氏温度
定义 Unit.cpp:496
Unit unit_divide(const Unit &unit1, const Unit &unit2)
单位除法
定义 Unit.cpp:267
Unit unit_power(const Unit &unit, int exponent)
单位幂
定义 Unit.cpp:300
void unit_setname(Unit &unit, StringView name)
设置单位名称
定义 Unit.cpp:327
std::shared_ptr< UnitRep > UnitRepHandle
单位表示句柄
定义 UnitRep.hpp:46
Unit unit_multiply(const Unit &unit1, const Unit &unit2)
单位乘法
定义 Unit.cpp:236
std::vector< UnitRepPairConst > SubUnitListConst
单位表示子项列表(常量)
定义 UnitRep.hpp:51