🛰️航天仿真算法库 SpaceAST
0.0.1
载入中...
搜索中...
未找到
UnitConverter.hpp
浏览该文件的文档.
1
20
21
#pragma once
22
23
#include "AstGlobal.h"
24
#include "AstUtil/Unit.hpp"
25
26
AST_NAMESPACE_BEGIN
27
28
31
class
UnitConverter
32
{
33
public
:
34
UnitConverter
()
35
:fromUnit_(
Unit
())
36
, toUnit_(
Unit
())
37
{}
38
39
UnitConverter
(
Unit
fromUnit,
Unit
toUnit)
40
: fromUnit_(fromUnit)
41
, toUnit_(toUnit)
42
{}
43
47
double
convert
(
double
value)
const
{
return
fromUnit_.convertTo(value, toUnit_);}
48
51
Unit
getFromUnit
()
const
{
return
fromUnit_;}
52
55
Unit
getToUnit
()
const
{
return
toUnit_;}
56
58
void
setFromUnit
(
Unit
fromUnit){fromUnit_ = fromUnit;}
59
61
void
setToUnit
(
Unit
toUnit){toUnit_ = toUnit;}
62
63
protected
:
64
Unit
fromUnit_
;
65
Unit
toUnit_
;
66
};
67
68
AST_NAMESPACE_END
ast::UnitConverter
单位转换器
定义
UnitConverter.hpp:32
ast::UnitConverter::getToUnit
Unit getToUnit() const
获取转换后的单位
定义
UnitConverter.hpp:55
ast::UnitConverter::convert
double convert(double value) const
转换单位
定义
UnitConverter.hpp:47
ast::UnitConverter::setToUnit
void setToUnit(Unit toUnit)
设置转换后的单位
定义
UnitConverter.hpp:61
ast::UnitConverter::fromUnit_
Unit fromUnit_
转换前的单位
定义
UnitConverter.hpp:64
ast::UnitConverter::setFromUnit
void setFromUnit(Unit fromUnit)
设置转换前的单位
定义
UnitConverter.hpp:58
ast::UnitConverter::getFromUnit
Unit getFromUnit() const
获取转换前的单位
定义
UnitConverter.hpp:51
ast::UnitConverter::toUnit_
Unit toUnit_
转换后的单位
定义
UnitConverter.hpp:65
ast::Unit
单位
定义
Unit.hpp:155
src
AstUtil
Quantity
UnitConverter.hpp
制作者
1.12.0