Basis Unit

A unit representing a fixed multiple of a native dimension.

Context

_images/ditaa-cec989073f835607919dbe4cb7ee2cecf0fa3971.png

Introduction

A basis_unit represents a unit belonging to a single native dimension. For example bu::meter representing a distance of 1 meter.

#include <xo/unit/basis_unit.hpp>

object bu1<<basis_unit>>
bu1 : native_dim = time
bu1 : scalefactor = 60

basis unit representing 1 minute

basis_unit is intended as an implementation-level abstraction. Application code will normally interact with the more-capable scaled_unit instead of basis_unit.

Class

class basis_unit

A dimensionless multiple of a single natively-specified basis dimension.

For example “3600 minutes” or “1e-6 grams”

Member Variables

group basis-unit-instance-vars

Variables

dimension native_dim_ = dimension::invalid

identifies a native unit, e.g. time (in seconds)

scalefactor_ratio_type scalefactor_

this unit defined as multiple scalefactor times native unit

Constructors

group basis-unit-constructors

Functions

constexpr basis_unit() = default
inline constexpr basis_unit(dimension native_dim, const scalefactor_ratio_type &scalefactor)

Access Methods

group basis-unit-access-methods

Functions

inline constexpr dimension native_dim() const
inline constexpr const scalefactor_ratio_type &scalefactor() const

Comparison

group basis-unit-comparison-support

Functions

inline constexpr bool operator==(const basis_unit &x, const basis_unit &y)
inline constexpr bool operator!=(const basis_unit &x, const basis_unit &y)