Bitcoin Core 29.99.0
P2P Digital Currency
Public Member Functions | Static Public Member Functions | List of all members
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. More...
 
constexpr FeeFrac (int64_t f, int32_t s) noexcept
 Construct a FeeFrac with specified fee and size. More...
 
constexpr FeeFrac (const FeeFrac &) noexcept=default
 
- Public Member Functions inherited from FeeFrac
constexpr FeeFrac () noexcept
 Construct an IsEmpty() FeeFrac. More...
 
constexpr FeeFrac (int64_t f, int32_t s) noexcept
 Construct a FeeFrac with specified fee and size. More...
 
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). More...
 
void operator+= (const FeeFrac &other) noexcept
 Add fee and size of another FeeFrac to this one. More...
 
void operator-= (const FeeFrac &other) noexcept
 Subtract fee and size of another FeeFrac from this one. More...
 
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. More...
 
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. More...
 
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. More...
 

Static Public Member Functions

static FeePerUnit FromFeeFrac (const FeeFrac &feefrac) noexcept
 Convert a FeeFrac to a FeePerUnit. More...
 
- 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. More...
 
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). More...
 

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 237 of file feefrac.h.

Member Function Documentation

◆ FeeFrac() [1/3]

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

Construct an IsEmpty() FeeFrac.

Definition at line 110 of file feefrac.h.

◆ FeeFrac() [2/3]

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

◆ FeeFrac() [3/3]

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

Construct a FeeFrac with specified fee and size.

Definition at line 113 of file feefrac.h.

◆ FromFeeFrac()

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

Convert a FeeFrac to a FeePerUnit.

Definition at line 243 of file feefrac.h.


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