MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
mtcore::units::Unit< UnitCategory, S, PiPow, Tr, exp > Struct Template Reference

Represents a single unit of measurement. More...

#include <base.hpp>

Inheritance diagram for mtcore::units::Unit< UnitCategory, S, PiPow, Tr, exp >:

Public Types

using Scale = S
 
using Translation = Tr
 

Static Public Attributes

static constexpr size_t Id = UnitCategory
 
static constexpr auto PiPower = PiPow
 
static constexpr auto EXPONENT = exp
 

Detailed Description

template<size_t UnitCategory, typename S = std::ratio<1>, int PiPow = 0, typename Tr = std::ratio<0>, int exp = 1>
struct mtcore::units::Unit< UnitCategory, S, PiPow, Tr, exp >

Represents a single unit of measurement.

Template Parameters
UnitCategoryCategory of the unit (e.g. Length, Temperature, Time, etc.). Used for tracking dimensions and conversions.
SScale of the unit compared to the base unit. Expressed in a std::ratio as a fraction.
PiPowPower of pi for multiplications (1 == x * pi, -1 == x / pi)
TrTranslation offset relative to the base unit
expDimension exponent. Don't set manually, used for internal calculations.

Definition at line 57 of file units/base.hpp.

Member Typedef Documentation

◆ Scale

template<size_t UnitCategory, typename S = std::ratio<1>, int PiPow = 0, typename Tr = std::ratio<0>, int exp = 1>
using mtcore::units::Unit< UnitCategory, S, PiPow, Tr, exp >::Scale = S

Definition at line 59 of file units/base.hpp.

◆ Translation

template<size_t UnitCategory, typename S = std::ratio<1>, int PiPow = 0, typename Tr = std::ratio<0>, int exp = 1>
using mtcore::units::Unit< UnitCategory, S, PiPow, Tr, exp >::Translation = Tr

Definition at line 61 of file units/base.hpp.

Member Data Documentation

◆ EXPONENT

template<size_t UnitCategory, typename S = std::ratio<1>, int PiPow = 0, typename Tr = std::ratio<0>, int exp = 1>
auto mtcore::units::Unit< UnitCategory, S, PiPow, Tr, exp >::EXPONENT = exp
staticconstexpr

Definition at line 62 of file units/base.hpp.

◆ Id

template<size_t UnitCategory, typename S = std::ratio<1>, int PiPow = 0, typename Tr = std::ratio<0>, int exp = 1>
size_t mtcore::units::Unit< UnitCategory, S, PiPow, Tr, exp >::Id = UnitCategory
staticconstexpr

Definition at line 58 of file units/base.hpp.

◆ PiPower

template<size_t UnitCategory, typename S = std::ratio<1>, int PiPow = 0, typename Tr = std::ratio<0>, int exp = 1>
auto mtcore::units::Unit< UnitCategory, S, PiPow, Tr, exp >::PiPower = PiPow
staticconstexpr

Definition at line 60 of file units/base.hpp.


The documentation for this struct was generated from the following file: