|
xrpld
|
Represents the logical ratio of output currency to input currency. More...
#include <Quality.h>

Public Types | |
| using | value_type = std::uint64_t |
Public Member Functions | |
| Quality ()=default | |
| Quality (std::uint64_t value) | |
| Create a quality from the integer encoding of an STAmount. | |
| Quality (Amounts const &amount) | |
| Create a quality from the ratio of two amounts. | |
| template<class In, class Out> | |
| Quality (TAmounts< In, Out > const &amount) | |
| Create a quality from the ratio of two amounts. | |
| template<class In, class Out> | |
| Quality (Out const &out, In const &in) | |
| Create a quality from the ratio of two amounts. | |
| STAmount | rate () const |
| Returns the quality as STAmount. | |
| Quality | round (int tickSize) const |
| Returns the quality rounded up to the specified number of decimal digits. | |
| Amounts | ceilIn (Amounts const &amount, STAmount const &limit) const |
| Returns the scaled amount with in capped. | |
| template<class In, class Out> | |
| TAmounts< In, Out > | ceilIn (TAmounts< In, Out > const &amount, In const &limit) const |
| Amounts | ceilInStrict (Amounts const &amount, STAmount const &limit, bool roundUp) const |
| template<class In, class Out> | |
| TAmounts< In, Out > | ceilInStrict (TAmounts< In, Out > const &amount, In const &limit, bool roundUp) const |
| Amounts | ceilOut (Amounts const &amount, STAmount const &limit) const |
| Returns the scaled amount with out capped. | |
| template<class In, class Out> | |
| TAmounts< In, Out > | ceilOut (TAmounts< In, Out > const &amount, Out const &limit) const |
| Amounts | ceilOutStrict (Amounts const &amount, STAmount const &limit, bool roundUp) const |
| template<class In, class Out> | |
| TAmounts< In, Out > | ceilOutStrict (TAmounts< In, Out > const &amount, Out const &limit, bool roundUp) const |
| Quality & | operator++ () |
| Advances to the next higher quality level. | |
| Quality | operator++ (int) |
| Quality & | operator-- () |
| Advances to the next lower quality level. | |
| Quality | operator-- (int) |
Static Public Attributes | |
| static int const | kMinTickSize = 3 |
| static int const | kMaxTickSize = 16 |
Private Member Functions | |
| template<class In, class Out, class Lim, typename FnPtr, std::same_as< bool >... Round> | |
| TAmounts< In, Out > | ceilTAmountsHelper (TAmounts< In, Out > const &amount, Lim const &limit, Lim const &limitCmp, FnPtr ceilFunction, Round... round) const |
Private Attributes | |
| value_type | value_ |
Friends | |
| bool | operator< (Quality const &lhs, Quality const &rhs) noexcept |
| Returns true if lhs is lower quality than rhs. | |
| bool | operator> (Quality const &lhs, Quality const &rhs) noexcept |
| bool | operator<= (Quality const &lhs, Quality const &rhs) noexcept |
| bool | operator>= (Quality const &lhs, Quality const &rhs) noexcept |
| bool | operator== (Quality const &lhs, Quality const &rhs) noexcept |
| bool | operator!= (Quality const &lhs, Quality const &rhs) noexcept |
| std::ostream & | operator<< (std::ostream &os, Quality const &quality) |
| double | relativeDistance (Quality const &q1, Quality const &q2) |
Represents the logical ratio of output currency to input currency.
Internally this is stored using a custom floating point representation, as the inverse of the ratio, so that quality will be descending in a sequence of actual values that represent qualities.
|
default |
|
explicit |
Create a quality from the integer encoding of an STAmount.
Definition at line 13 of file Quality.cpp.
|
explicit |
Create a quality from the ratio of two amounts.
Definition at line 17 of file Quality.cpp.
|
explicit |
| xrpl::Quality::Quality | ( | Out const & | out, |
| In const & | in ) |
| Quality & xrpl::Quality::operator++ | ( | ) |
Advances to the next higher quality level.
Definition at line 22 of file Quality.cpp.
| Quality xrpl::Quality::operator++ | ( | int | ) |
Definition at line 30 of file Quality.cpp.
| Quality & xrpl::Quality::operator-- | ( | ) |
Advances to the next lower quality level.
Definition at line 38 of file Quality.cpp.
| Quality xrpl::Quality::operator-- | ( | int | ) |
Definition at line 48 of file Quality.cpp.
|
nodiscard |
|
nodiscard |
Returns the quality rounded up to the specified number of decimal digits.
Definition at line 134 of file Quality.cpp.
Returns the scaled amount with in capped.
Math is avoided if the result is exact. The output is clamped to prevent money creation.
Definition at line 73 of file Quality.cpp.
|
nodiscard |
Definition at line 79 of file Quality.cpp.
Returns the scaled amount with out capped.
Math is avoided if the result is exact. The input is clamped to prevent money creation.
Definition at line 102 of file Quality.cpp.
|
nodiscard |
Definition at line 108 of file Quality.cpp.
|
friend |
|
private |