Enumerations

enum UnitType
Name Value
None 0
Other 1
Distance 2
Weight 3
Rotation 4
AngularVelocity 5
LinearVelocity 6
Acceleration 7
MagneticFlux 8
Light 9
Pressure 10
Lux 11

UnitTypes are the helpful, "default" units in the system.

These should used throughout the system.

Defined at line 16 of file ../../src/ui/input/lib/hid-parser/include/lib/hid-parser/units.h

enum System
Name Value
si_linear 0x1
si_rotation 0x2
eng_linear 0x3
eng_rotation 0x4
reserved 0x5

Each system defines the units for the following measurements:

length, mass, time, temperature, current, luminous intensity.

Defined at line 59 of file ../../src/ui/input/lib/hid-parser/include/lib/hid-parser/units.h

Records

Functions

  • Unit GetUnitFromUnitType (UnitType type)

    Get the exact unit from the UnitType.

    Defined at line 370 of file ../../src/ui/input/lib/hid-parser/units.cc

  • UnitType GetUnitTypeFromUnit (const Unit & unit)

    Get the closest convertible UnitType from the unit.

    If the unit cannot be converted into a UnitType, |Other| will be returned.

    If there are no unit's, |None| will be returned.

    Defined at line 380 of file ../../src/ui/input/lib/hid-parser/units.cc

  • double ConvertValToUnitType (const Unit & unit_in, double val_in)

    Defined at line 392 of file ../../src/ui/input/lib/hid-parser/units.cc

  • void SetSystem (Unit & unit, hid::unit::System system)

    Sets a Unit's system. A unit can only belong to a single system.

    Calling SetSystem on a Unit that already has a system defined

    will overwrite the current system.

    Defined at line 184 of file ../../src/ui/input/lib/hid-parser/units.cc

  • hid::unit::System GetSystem (const Unit & unit)

    Defined at line 188 of file ../../src/ui/input/lib/hid-parser/units.cc

  • void SetLengthExp (Unit & unit, int8_t exp)

    The functions below set the exponent for various measurements.

    exp must be within [-8, 7].

    The measurement's unit is defined by the Unit's system.

    Example: Momentum is (mass * distance / time) so it has a mass

    exponent of 1, a distance exponent of 1, and a time

    exponent of -1. Under the SI Linear system this would

    be (gram * centimeter / seconds).

    Defined at line 204 of file ../../src/ui/input/lib/hid-parser/units.cc

  • void SetMassExp (Unit & unit, int8_t exp)

    Defined at line 206 of file ../../src/ui/input/lib/hid-parser/units.cc

  • void SetTimeExp (Unit & unit, int8_t exp)

    Defined at line 208 of file ../../src/ui/input/lib/hid-parser/units.cc

  • void SetTemperatureExp (Unit & unit, int8_t exp)

    Defined at line 210 of file ../../src/ui/input/lib/hid-parser/units.cc

  • void SetCurrentExp (Unit & unit, int8_t exp)

    Defined at line 214 of file ../../src/ui/input/lib/hid-parser/units.cc

  • void SetLuminousExp (Unit & unit, int8_t exp)

    Defined at line 216 of file ../../src/ui/input/lib/hid-parser/units.cc

  • int GetLengthExp (const Unit & unit)

    The functions below get the exponent for various measurements.

    The return value will be within [-8, 7].

    Defined at line 218 of file ../../src/ui/input/lib/hid-parser/units.cc

  • int GetMassExp (const Unit & unit)

    Defined at line 220 of file ../../src/ui/input/lib/hid-parser/units.cc

  • int GetTimeExp (const Unit & unit)

    Defined at line 222 of file ../../src/ui/input/lib/hid-parser/units.cc

  • int GetTemperatureExp (const Unit & unit)

    Defined at line 224 of file ../../src/ui/input/lib/hid-parser/units.cc

  • int GetCurrentExp (const Unit & unit)

    Defined at line 226 of file ../../src/ui/input/lib/hid-parser/units.cc

  • int GetLuminousExp (const Unit & unit)

    Defined at line 228 of file ../../src/ui/input/lib/hid-parser/units.cc

  • bool ConvertUnits (const Unit & unit_indouble val_inconst Unit & unit_outdouble * val_out)

    Convert a value from one unit to another.

    Returns False if it is impossible to do the conversion.

    Defined at line 230 of file ../../src/ui/input/lib/hid-parser/units.cc