xrpld
Loading...
Searching...
No Matches
xrpl::Resource::Charge Class Reference

A consumption charge. More...

#include <Charge.h>

Collaboration diagram for xrpl::Resource::Charge:

Public Types

using value_type = int
 The type used to hold a consumption charge.

Public Member Functions

 Charge ()=delete
 Charge (value_type cost, std::string label=std::string())
 Create a charge with the specified cost and name.
std::string const & label () const
 Return the human readable label associated with the charge.
value_type cost () const
 Return the cost of the charge in Resource::Manager units.
std::string toString () const
 Converts this charge into a human readable string.
bool operator== (Charge const &) const
std::strong_ordering operator<=> (Charge const &) const
Charge operator* (value_type m) const

Private Attributes

value_type cost_
std::string label_

Detailed Description

A consumption charge.

Definition at line 8 of file Charge.h.

Member Typedef Documentation

◆ value_type

The type used to hold a consumption charge.

Definition at line 12 of file Charge.h.

Constructor & Destructor Documentation

◆ Charge() [1/2]

xrpl::Resource::Charge::Charge ( )
delete

◆ Charge() [2/2]

xrpl::Resource::Charge::Charge ( value_type cost,
std::string label = std::string() )

Create a charge with the specified cost and name.

Definition at line 11 of file Charge.cpp.

Member Function Documentation

◆ label()

std::string const & xrpl::Resource::Charge::label ( ) const
nodiscard

Return the human readable label associated with the charge.

Definition at line 16 of file Charge.cpp.

◆ cost()

Charge::value_type xrpl::Resource::Charge::cost ( ) const
nodiscard

Return the cost of the charge in Resource::Manager units.

Definition at line 22 of file Charge.cpp.

◆ toString()

std::string xrpl::Resource::Charge::toString ( ) const
nodiscard

Converts this charge into a human readable string.

Definition at line 28 of file Charge.cpp.

◆ operator==()

bool xrpl::Resource::Charge::operator== ( Charge const & c) const

Definition at line 43 of file Charge.cpp.

◆ operator<=>()

std::strong_ordering xrpl::Resource::Charge::operator<=> ( Charge const & c) const

Definition at line 48 of file Charge.cpp.

◆ operator*()

Charge xrpl::Resource::Charge::operator* ( value_type m) const

Definition at line 55 of file Charge.cpp.

Member Data Documentation

◆ cost_

value_type xrpl::Resource::Charge::cost_
private

Definition at line 42 of file Charge.h.

◆ label_

std::string xrpl::Resource::Charge::label_
private

Definition at line 43 of file Charge.h.