|
| | NamedQuantity () |
| | Constructs empty, then names.
|
| | NamedQuantity (std::optional< math::Rational > adopted) |
| | Constructs from a payload, then names.
|
| | NamedQuantity (Base quantity) |
| | Constructs from a plain quantity, then names.
|
|
constexpr | Quantity () noexcept=default |
| | Constructs the empty state (no recorded derivation).
|
| | Quantity (math::Rational engaged) |
| | Engages with engaged (which keeps its own runtime precision).
|
| | Quantity (std::optional< math::Rational > adopted) |
| | Adopts an optional payload as-is.
|
| | Quantity (const Quantity< U, OtherDecimals > &other) |
| | Converts from the same unit at another declared precision; the value, its runtime tag, and its derivation carry over unchanged.
|
| constexpr bool | hasValue () const noexcept |
| | Whether a value has been entered/measured.
|
| constexpr bool | withinDeclaredBounds () const noexcept |
| | Pre-decode validation seam: whether the current payload falls within this field's unit-declared bounds (UnitTraits<E>::bounds), when the unit declares any. An empty payload, or a unit with no declared bounds() (HasUnitBounds not satisfied), is always within bounds — this is an opt-in check, not a new default restriction, so a unit system that declares no bounds behaves exactly as it did before this feature existed.
|
| constexpr const std::optional< math::Rational > & | value () const noexcept |
| | The payload, for pattern-matching / -> access.
|
| constexpr math::Rational | value_or (const math::Rational &fallback) const noexcept |
| | The payload if engaged, otherwise a caller-supplied fallback.
|
| constexpr const math::Rational & | operator* () const noexcept |
| | Unchecked access to the engaged value (UB when empty, exactly like std::optional::operator*).
|
| Quantity | withDecimalPlaces (math::DecimalPlaces newPrecision) const |
| | Retags the value's runtime precision (the exact value itself is unchanged — precision only affects rounding and formatting).
|
| Quantity | roundedToDecimalPlaces (math::DecimalPlaces newPrecision, math::RoundingMode mode=math::RoundingMode::HalfAwayFromZero) const |
| | Rounds the value to a runtime precision, changing the exact value as well as the tag — unlike withDecimalPlaces, which retags only and leaves display and storage free to disagree.
|
| Quantity | atDeclaredPrecision () const |
| | Rounds the value to this field's declared precision — the one the generated schema advertises as x-decimalPlaces.
|
| Quantity | named (std::string label) const |
| | Seals this value with a name: equation() shows the name instead of expanding its derivation. Builds a fresh node (never mutates a shared one); a no-op returning empty on empty or with tracing off.
|
| std::vector< std::string > | equation (std::size_t maxSteps=kDefaultEquationSteps) const |
| | The worked derivation as print-ready lines (see docs/spec/util/quantity_type.md).
|
| | operator Quantity< To > () const |
| | Implicit within-dimension conversion to another unit; delegates to convert, propagates empty, and records a provenance step.
|
template<detail::FixedString Name, auto U>
struct morph::units::NamedQuantity< Name, U >
A Quantity that names itself on construction and slices losslessly back to a plain Quantity. The name lives in the shared history.
- Template Parameters
-
| Name | Compile-time symbol name. |
| U | Unit enumerator. |
Definition at line 1157 of file quantity.hpp.