🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ast::Unit类 参考

#include <Unit.hpp>

class  UnitRep
 

Public 类型

using UnitRepHandle = std::shared_ptr<UnitRep>
 
using UnitRepPair = std::pair<UnitRepHandle, int>
 
using SubUnitList = std::vector<UnitRepPair>
 
using UnitRepHandleConst = std::shared_ptr<const UnitRep>
 
using UnitRepPairConst = std::pair<UnitRepHandleConst, int>
 
using SubUnitListConst = std::vector<UnitRepPairConst>
 

Public 成员函数

 Unit ()
 
 Unit (StringView name, double scale, Dimension dimension)
 
double fromSI (double value) const
 
double toSI (double value) const
 
double convertTo (double value, const Unit &unit) const
 
double convertFrom (double value, const Unit &unit) const
 
double getScale () const
 
Dimension dimension () const
 
const std::string & name () const
 
bool isValid () const
 
Unit clone () const
 
Unit invert () const
 
Unit multiply (StringView newname, const Unit &other) const
 
Unit divide (StringView newname, const Unit &other) const
 
Unit scale (StringView newname, double factor) const
 
Unit pow (StringView newname, int exponent) const
 
Unit pow (int exponent) const
 
bool operator== (const Unit &other) const
 
bool operator!= (const Unit &other) const
 
Unit operator* (const Unit &other) const
 
Unit operator/ (const Unit &other) const
 
Unitoperator*= (const Unit &other)
 
Unitoperator/= (const Unit &other)
 

静态 Public 成员函数

static Unit NaN ()
 
static Unit None ()
 
static Unit One ()
 
static AST_UTIL_API Unit Scale (double scale)
 
static Unit Percent ()
 
static Unit Second ()
 
static Unit Minute ()
 
static Unit Hour ()
 
static Unit Day ()
 
static Unit MilliSecond ()
 
static Unit Meter ()
 
static Unit Kilometer ()
 
static Unit Centimeter ()
 
static Unit Decimeter ()
 
static Unit Millimeter ()
 
static Unit Inch ()
 
static Unit Foot ()
 
static Unit Yard ()
 
static Unit Mile ()
 
static Unit Kilogram ()
 
static Unit Gram ()
 
static Unit Milligram ()
 
static Unit Pound ()
 
static Unit Radian ()
 
static Unit Degree ()
 
static Unit ArcSecond ()
 
static Unit Newton ()
 
static Unit Ampere ()
 
static Unit Kelvin ()
 
static Unit Mole ()
 
static Unit CentimeterPerSecond ()
 
static Unit KilometerPerHour ()
 
static Unit MeterPerMinute ()
 
static Unit SquareMeter ()
 
static Unit SquareKilometer ()
 
static Unit SquareFoot ()
 
static Unit SquareYard ()
 
static Unit CubicMeter ()
 
static Unit Liter ()
 

Public 属性

UnitRepHandle rep_
 

Protected 成员函数

 Unit (double scale, Dimension dimension, const SubUnitListConst &subunits)
 
 Unit (UnitRepHandle rep)
 

友元

Unit unit_multiply (const Unit &unit1, const Unit &unit2)
 
Unit unit_divide (const Unit &unit1, const Unit &unit2)
 
Unit unit_power (const Unit &unit, int exponent)
 
void unit_setname (Unit &unit, StringView name)
 

详细描述

单位

成员类型定义说明

◆ UnitRepHandle

using ast::Unit::UnitRepHandle = std::shared_ptr<UnitRep>

单位表示

单位表示句柄

构造及析构函数说明

◆ Unit()

ast::Unit::Unit ( UnitRepHandle rep)
inlineprotected
参数
rep单位表示

成员函数说明

◆ clone()

Unit ast::Unit::clone ( ) const
inline

单位克隆

返回
新单位

◆ convertFrom()

double ast::Unit::convertFrom ( double value,
const Unit & unit ) const
inline

转换为指定单位下的值

参数
value该单位对应的值
返回
指定单位下的值

◆ convertTo()

double ast::Unit::convertTo ( double value,
const Unit & unit ) const
inline

转换为指定单位下的值

参数
value该单位对应的值
返回
指定单位下的值

◆ dimension()

Dimension ast::Unit::dimension ( ) const
inline

获取单位量纲

返回
单位量纲

◆ divide()

Unit ast::Unit::divide ( StringView newname,
const Unit & other ) const
inline

单位除法

参数
newname新单位名称
other其他单位
返回
新单位

◆ fromSI()

double ast::Unit::fromSI ( double value) const
inline

从国际单位制转换为该单位对应的值

参数
value国际单位制下的值
返回
外部值

◆ getScale()

double ast::Unit::getScale ( ) const
inline

获取单位缩放因子

返回
单位缩放因子

◆ isValid()

bool ast::Unit::isValid ( ) const
inline

是否有效单位

返回
是否有效单位

◆ multiply()

Unit ast::Unit::multiply ( StringView newname,
const Unit & other ) const
inline

单位乘法

参数
newname新单位名称
other其他单位
返回
新单位

◆ name()

const std::string & ast::Unit::name ( ) const
inline

获取单位名称

返回
单位名称

◆ operator!=()

bool ast::Unit::operator!= ( const Unit & other) const
inline

单位不相等运算符

参数
other其他单位
返回
是否不相等

◆ operator*()

Unit ast::Unit::operator* ( const Unit & other) const
inline

单位乘法运算符

参数
other其他单位
返回
新单位

◆ operator*=()

Unit & ast::Unit::operator*= ( const Unit & other)
inline

单位乘法赋值运算符

参数
other其他单位
返回
新单位

◆ operator/()

Unit ast::Unit::operator/ ( const Unit & other) const
inline

单位除法运算符

参数
other其他单位
返回
新单位

◆ operator/=()

Unit & ast::Unit::operator/= ( const Unit & other)
inline

单位除法赋值运算符

参数
other其他单位
返回
新单位

◆ operator==()

bool ast::Unit::operator== ( const Unit & other) const
inline

单位相等运算符

参数
other其他单位
返回
是否相等

◆ pow() [1/2]

Unit ast::Unit::pow ( int exponent) const
inline

单位幂运算

参数
exponent指数
返回
新单位

◆ pow() [2/2]

Unit ast::Unit::pow ( StringView newname,
int exponent ) const
inline

单位幂运算

参数
newname新单位名称
exponent指数
返回
新单位

◆ Scale()

Unit ast::Unit::Scale ( double scale)
static

新建无量纲单位

参数
scale缩放因子
返回
单位表示

◆ scale()

Unit ast::Unit::scale ( StringView newname,
double factor ) const
inline

单位缩放

参数
newname新单位名称
factor缩放因子
返回
新单位

◆ toSI()

double ast::Unit::toSI ( double value) const
inline

从该单位对应的值转换为国际单位制下的值

参数
value该单位对应的值
返回
国际单位制下的值

友元及相关符号说明

◆ unit_divide

Unit unit_divide ( const Unit & unit1,
const Unit & unit2 )
friend

单位除法

参数
unit1单位1
unit2单位2
返回
单位商

◆ unit_multiply

Unit unit_multiply ( const Unit & unit1,
const Unit & unit2 )
friend

单位乘法

参数
unit1单位1
unit2单位2
返回
单位乘积

◆ unit_power

Unit unit_power ( const Unit & unit,
int exponent )
friend

单位幂

参数
unit单位
exponent指数
返回
单位幂

◆ unit_setname

void unit_setname ( Unit & unit,
StringView name )
friend

设置单位名称

参数
unit单位
name名称

该类的文档由以下文件生成: