rippled
Public Types | Public Member Functions | Protected Types | Static Protected Attributes | Private Attributes | Friends | List of all members
ripple::feeunit::TaggedFee< UnitTag, T > Class Template Reference
Inheritance diagram for ripple::feeunit::TaggedFee< UnitTag, T >:
Inheritance graph
[legend]
Collaboration diagram for ripple::feeunit::TaggedFee< UnitTag, T >:
Collaboration graph
[legend]

Public Types

using unit_type = UnitTag
 
using value_type = T
 

Public Member Functions

 TaggedFee ()=default
 
constexpr TaggedFee (TaggedFee const &other)=default
 
constexpr TaggedFeeoperator= (TaggedFee const &other)=default
 
constexpr TaggedFee (beast::Zero)
 
constexpr TaggedFeeoperator= (beast::Zero)
 
constexpr TaggedFee (value_type fee)
 
TaggedFeeoperator= (value_type fee)
 
template<class Other , class = std::enable_if_t< is_compatible_v<Other> && is_safetocasttovalue_v<value_type, Other>>>
constexpr TaggedFee (TaggedFee< unit_type, Other > const &fee)
 Instances with the same unit, and a type that is "safe" to covert to this one can be converted implicitly. More...
 
constexpr TaggedFee operator* (value_type const &rhs) const
 
constexpr value_type operator/ (TaggedFee const &rhs) const
 
TaggedFeeoperator+= (TaggedFee const &other)
 
TaggedFeeoperator-= (TaggedFee const &other)
 
TaggedFeeoperator++ ()
 
TaggedFeeoperator-- ()
 
TaggedFeeoperator*= (value_type const &rhs)
 
TaggedFeeoperator/= (value_type const &rhs)
 
template<class transparent = value_type>
std::enable_if_t< std::is_integral_v< transparent >, TaggedFee & > operator%= (value_type const &rhs)
 
TaggedFee operator- () const
 
bool operator== (TaggedFee const &other) const
 
template<class Other , class = enable_if_compatible_t<Other>>
bool operator== (TaggedFee< unit_type, Other > const &other) const
 
bool operator== (value_type other) const
 
template<class Other , class = enable_if_compatible_t<Other>>
bool operator!= (TaggedFee< unit_type, Other > const &other) const
 
bool operator< (TaggedFee const &other) const
 
constexpr operator bool () const noexcept
 Returns true if the amount is not zero. More...
 
constexpr int signum () const noexcept
 Return the sign of the amount. More...
 
constexpr value_type fee () const
 Returns the number of drops. More...
 
template<class Other >
constexpr double decimalFromReference (TaggedFee< unit_type, Other > reference) const
 
std::enable_if_t< is_usable_unit_v< TaggedFee >, Json::ValuejsonClipped () const
 
constexpr value_type value () const
 Returns the underlying value. More...
 

Protected Types

template<class Other >
using enable_if_compatible_t = typename std::enable_if_t< is_compatible_v< Other > >
 
template<class OtherFee >
using enable_if_compatiblefee_t = typename std::enable_if_t< is_compatiblefee_v< OtherFee > >
 

Static Protected Attributes

template<class Other >
static constexpr bool is_compatible_v
 
template<class OtherFee , class = enable_if_unit_t<OtherFee>>
static constexpr bool is_compatiblefee_v
 

Private Attributes

value_type fee_
 

Friends

constexpr friend TaggedFee operator* (value_type lhs, TaggedFee const &rhs)
 
std::istreamoperator>> (std::istream &s, TaggedFee &val)
 

Detailed Description

template<class UnitTag, class T>
class ripple::feeunit::TaggedFee< UnitTag, T >

Definition at line 70 of file FeeUnits.h.

Member Typedef Documentation

◆ unit_type

template<class UnitTag , class T >
using ripple::feeunit::TaggedFee< UnitTag, T >::unit_type = UnitTag

Definition at line 78 of file FeeUnits.h.

◆ value_type

template<class UnitTag , class T >
using ripple::feeunit::TaggedFee< UnitTag, T >::value_type = T

Definition at line 79 of file FeeUnits.h.

◆ enable_if_compatible_t

template<class UnitTag , class T >
template<class Other >
using ripple::feeunit::TaggedFee< UnitTag, T >::enable_if_compatible_t = typename std::enable_if_t<is_compatible_v<Other> >
protected

Definition at line 97 of file FeeUnits.h.

◆ enable_if_compatiblefee_t

template<class UnitTag , class T >
template<class OtherFee >
using ripple::feeunit::TaggedFee< UnitTag, T >::enable_if_compatiblefee_t = typename std::enable_if_t<is_compatiblefee_v<OtherFee> >
protected

Definition at line 101 of file FeeUnits.h.

Constructor & Destructor Documentation

◆ TaggedFee() [1/5]

template<class UnitTag , class T >
ripple::feeunit::TaggedFee< UnitTag, T >::TaggedFee ( )
default

◆ TaggedFee() [2/5]

template<class UnitTag , class T >
constexpr ripple::feeunit::TaggedFee< UnitTag, T >::TaggedFee ( TaggedFee< UnitTag, T > const &  other)
constexprdefault

◆ TaggedFee() [3/5]

template<class UnitTag , class T >
constexpr ripple::feeunit::TaggedFee< UnitTag, T >::TaggedFee ( beast::Zero  )
explicitconstexpr

Definition at line 109 of file FeeUnits.h.

◆ TaggedFee() [4/5]

template<class UnitTag , class T >
constexpr ripple::feeunit::TaggedFee< UnitTag, T >::TaggedFee ( value_type  fee)
explicitconstexpr

Definition at line 119 of file FeeUnits.h.

◆ TaggedFee() [5/5]

template<class UnitTag , class T >
template<class Other , class = std::enable_if_t< is_compatible_v<Other> && is_safetocasttovalue_v<value_type, Other>>>
constexpr ripple::feeunit::TaggedFee< UnitTag, T >::TaggedFee ( TaggedFee< unit_type, Other > const &  fee)
constexpr

Instances with the same unit, and a type that is "safe" to covert to this one can be converted implicitly.

Definition at line 138 of file FeeUnits.h.

Member Function Documentation

◆ operator=() [1/3]

template<class UnitTag , class T >
constexpr TaggedFee& ripple::feeunit::TaggedFee< UnitTag, T >::operator= ( TaggedFee< UnitTag, T > const &  other)
constexprdefault

◆ operator=() [2/3]

template<class UnitTag , class T >
constexpr TaggedFee& ripple::feeunit::TaggedFee< UnitTag, T >::operator= ( beast::Zero  )
constexpr

Definition at line 113 of file FeeUnits.h.

◆ operator=() [3/3]

template<class UnitTag , class T >
TaggedFee& ripple::feeunit::TaggedFee< UnitTag, T >::operator= ( value_type  fee)

Definition at line 124 of file FeeUnits.h.

◆ operator*()

template<class UnitTag , class T >
constexpr TaggedFee ripple::feeunit::TaggedFee< UnitTag, T >::operator* ( value_type const &  rhs) const
constexpr

Definition at line 144 of file FeeUnits.h.

◆ operator/()

template<class UnitTag , class T >
constexpr value_type ripple::feeunit::TaggedFee< UnitTag, T >::operator/ ( TaggedFee< UnitTag, T > const &  rhs) const
constexpr

Definition at line 157 of file FeeUnits.h.

◆ operator+=()

template<class UnitTag , class T >
TaggedFee& ripple::feeunit::TaggedFee< UnitTag, T >::operator+= ( TaggedFee< UnitTag, T > const &  other)

Definition at line 163 of file FeeUnits.h.

◆ operator-=()

template<class UnitTag , class T >
TaggedFee& ripple::feeunit::TaggedFee< UnitTag, T >::operator-= ( TaggedFee< UnitTag, T > const &  other)

Definition at line 170 of file FeeUnits.h.

◆ operator++()

template<class UnitTag , class T >
TaggedFee& ripple::feeunit::TaggedFee< UnitTag, T >::operator++ ( )

Definition at line 177 of file FeeUnits.h.

◆ operator--()

template<class UnitTag , class T >
TaggedFee& ripple::feeunit::TaggedFee< UnitTag, T >::operator-- ( )

Definition at line 184 of file FeeUnits.h.

◆ operator*=()

template<class UnitTag , class T >
TaggedFee& ripple::feeunit::TaggedFee< UnitTag, T >::operator*= ( value_type const &  rhs)

Definition at line 191 of file FeeUnits.h.

◆ operator/=()

template<class UnitTag , class T >
TaggedFee& ripple::feeunit::TaggedFee< UnitTag, T >::operator/= ( value_type const &  rhs)

Definition at line 198 of file FeeUnits.h.

◆ operator%=()

template<class UnitTag , class T >
template<class transparent = value_type>
std::enable_if_t<std::is_integral_v<transparent>, TaggedFee&> ripple::feeunit::TaggedFee< UnitTag, T >::operator%= ( value_type const &  rhs)

Definition at line 206 of file FeeUnits.h.

◆ operator-()

template<class UnitTag , class T >
TaggedFee ripple::feeunit::TaggedFee< UnitTag, T >::operator- ( ) const

Definition at line 213 of file FeeUnits.h.

◆ operator==() [1/3]

template<class UnitTag , class T >
bool ripple::feeunit::TaggedFee< UnitTag, T >::operator== ( TaggedFee< UnitTag, T > const &  other) const

Definition at line 221 of file FeeUnits.h.

◆ operator==() [2/3]

template<class UnitTag , class T >
template<class Other , class = enable_if_compatible_t<Other>>
bool ripple::feeunit::TaggedFee< UnitTag, T >::operator== ( TaggedFee< unit_type, Other > const &  other) const

Definition at line 228 of file FeeUnits.h.

◆ operator==() [3/3]

template<class UnitTag , class T >
bool ripple::feeunit::TaggedFee< UnitTag, T >::operator== ( value_type  other) const

Definition at line 234 of file FeeUnits.h.

◆ operator!=()

template<class UnitTag , class T >
template<class Other , class = enable_if_compatible_t<Other>>
bool ripple::feeunit::TaggedFee< UnitTag, T >::operator!= ( TaggedFee< unit_type, Other > const &  other) const

Definition at line 241 of file FeeUnits.h.

◆ operator<()

template<class UnitTag , class T >
bool ripple::feeunit::TaggedFee< UnitTag, T >::operator< ( TaggedFee< UnitTag, T > const &  other) const

Definition at line 247 of file FeeUnits.h.

◆ operator bool()

template<class UnitTag , class T >
constexpr ripple::feeunit::TaggedFee< UnitTag, T >::operator bool ( ) const
explicitconstexprnoexcept

Returns true if the amount is not zero.

Definition at line 253 of file FeeUnits.h.

◆ signum()

template<class UnitTag , class T >
constexpr int ripple::feeunit::TaggedFee< UnitTag, T >::signum ( ) const
constexprnoexcept

Return the sign of the amount.

Definition at line 260 of file FeeUnits.h.

◆ fee()

template<class UnitTag , class T >
constexpr value_type ripple::feeunit::TaggedFee< UnitTag, T >::fee ( ) const
constexpr

Returns the number of drops.

Definition at line 267 of file FeeUnits.h.

◆ decimalFromReference()

template<class UnitTag , class T >
template<class Other >
constexpr double ripple::feeunit::TaggedFee< UnitTag, T >::decimalFromReference ( TaggedFee< unit_type, Other >  reference) const
constexpr

Definition at line 274 of file FeeUnits.h.

◆ jsonClipped()

template<class UnitTag , class T >
std::enable_if_t<is_usable_unit_v<TaggedFee>, Json::Value> ripple::feeunit::TaggedFee< UnitTag, T >::jsonClipped ( ) const

Definition at line 284 of file FeeUnits.h.

◆ value()

template<class UnitTag , class T >
constexpr value_type ripple::feeunit::TaggedFee< UnitTag, T >::value ( ) const
constexpr

Returns the underlying value.

Code SHOULD NOT call this function unless the type has been abstracted away, e.g. in a templated function.

Definition at line 313 of file FeeUnits.h.

Friends And Related Function Documentation

◆ operator*

template<class UnitTag , class T >
constexpr friend TaggedFee operator* ( value_type  lhs,
TaggedFee< UnitTag, T > const &  rhs 
)
friend

Definition at line 150 of file FeeUnits.h.

◆ operator>>

template<class UnitTag , class T >
std::istream& operator>> ( std::istream s,
TaggedFee< UnitTag, T > &  val 
)
friend

Definition at line 319 of file FeeUnits.h.

Member Data Documentation

◆ fee_

template<class UnitTag , class T >
value_type ripple::feeunit::TaggedFee< UnitTag, T >::fee_
private

Definition at line 82 of file FeeUnits.h.

◆ is_compatible_v

template<class UnitTag , class T >
template<class Other >
constexpr bool ripple::feeunit::TaggedFee< UnitTag, T >::is_compatible_v
staticconstexprprotected
Initial value:
=
std::is_arithmetic_v<Other>&& std::is_arithmetic_v<value_type>&&
std::is_convertible_v<Other, value_type>

Definition at line 86 of file FeeUnits.h.

◆ is_compatiblefee_v

template<class UnitTag , class T >
template<class OtherFee , class = enable_if_unit_t<OtherFee>>
constexpr bool ripple::feeunit::TaggedFee< UnitTag, T >::is_compatiblefee_v
staticconstexprprotected
Initial value:
=
is_compatible_v<typename OtherFee::value_type>&&
std::is_same_v<UnitTag, typename OtherFee::unit_type>

Definition at line 91 of file FeeUnits.h.