Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
FeePerUnit< Tag > Struct Template Reference

Tagged wrapper around FeeFrac to avoid unit confusion. More...

#include <feefrac.h>

Inheritance diagram for FeePerUnit< Tag >:
[legend]
Collaboration diagram for FeePerUnit< Tag >:
[legend]

Public Member Functions

constexpr FeeFrac () noexcept
 Construct an IsEmpty() FeeFrac.
constexpr FeeFrac (int64_t f, int32_t s) noexcept
 Construct a FeeFrac with specified fee and size.
constexpr FeeFrac (const FeeFrac &) noexcept=default
Public Member Functions inherited from FeeFrac
constexpr FeeFrac () noexcept
 Construct an IsEmpty() FeeFrac.
constexpr FeeFrac (int64_t f, int32_t s) noexcept
 Construct a FeeFrac with specified fee and size.
constexpr FeeFrac (const FeeFrac &) noexcept=default
constexpr FeeFracoperator= (const FeeFrac &) noexcept=default
bool IsEmpty () const noexcept
 Check if this is empty (size and fee are 0).
void operator+= (const FeeFrac &other) noexcept
 Add fee and size of another FeeFrac to this one.
void operator-= (const FeeFrac &other) noexcept
 Subtract fee and size of another FeeFrac from this one.
template<bool RoundDown>
int64_t EvaluateFee (int32_t at_size) const noexcept
 Compute the fee for a given size at_size using this object's feerate.
int64_t EvaluateFeeDown (int32_t at_size) const noexcept
 Compute the fee for a given size at_size using this object's feerate, rounding down.
int64_t EvaluateFeeUp (int32_t at_size) const noexcept
 Compute the fee for a given size at_size using this object's feerate, rounding up.

Static Public Member Functions

static FeePerUnit FromFeeFrac (const FeeFrac &feefrac) noexcept
 Convert a FeeFrac to a FeePerUnit.
Static Public Member Functions inherited from FeeFrac
static std::pair< int64_t, uint32_t > MulFallback (int64_t a, int32_t b) noexcept
 Helper function for 32*64 signed multiplication, returning an unspecified but totally ordered type.
static int64_t DivFallback (std::pair< int64_t, uint32_t > n, int32_t d, bool round_down) noexcept
 Helper function for 96/32 signed division, rounding towards negative infinity (if round_down) or positive infinity (if !round_down).

Additional Inherited Members

Public Attributes inherited from FeeFrac
int64_t fee
int32_t size
Static Public Attributes inherited from FeeFrac
static constexpr auto Mul = MulFallback
static constexpr auto Div = DivFallback

Detailed Description

template<typename Tag>
struct FeePerUnit< Tag >

Tagged wrapper around FeeFrac to avoid unit confusion.

Definition at line 238 of file feefrac.h.

Member Function Documentation

◆ FeeFrac() [1/3]

template<typename Tag>
FeeFrac::FeeFrac ( )
inlineconstexprnoexcept

Construct an IsEmpty() FeeFrac.

Definition at line 111 of file feefrac.h.

◆ FeeFrac() [2/3]

template<typename Tag>
FeeFrac::FeeFrac ( const FeeFrac & )
inlineconstexprdefaultnoexcept

◆ FeeFrac() [3/3]

template<typename Tag>
FeeFrac::FeeFrac ( int64_t f,
int32_t s )
inlineconstexprnoexcept

Construct a FeeFrac with specified fee and size.

Definition at line 114 of file feefrac.h.

◆ FromFeeFrac()

template<typename Tag>
FeePerUnit FeePerUnit< Tag >::FromFeeFrac ( const FeeFrac & feefrac)
inlinestaticnoexcept

Convert a FeeFrac to a FeePerUnit.

Definition at line 244 of file feefrac.h.


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