rippled
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
ripple::Resource::Charge Class Reference

A consumption charge. More...

#include <Charge.h>

Collaboration diagram for ripple::Resource::Charge:
Collaboration graph
[legend]

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 const &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 to_string () 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 m_cost
 
std::string m_label
 

Detailed Description

A consumption charge.

Definition at line 10 of file Charge.h.

Member Typedef Documentation

◆ value_type

The type used to hold a consumption charge.

Definition at line 14 of file Charge.h.

Constructor & Destructor Documentation

◆ Charge() [1/2]

ripple::Resource::Charge::Charge ( )
delete

◆ Charge() [2/2]

ripple::Resource::Charge::Charge ( value_type  cost,
std::string const &  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 & ripple::Resource::Charge::label ( ) const

Return the human readable label associated with the charge.

Definition at line 17 of file Charge.cpp.

◆ cost()

Charge::value_type ripple::Resource::Charge::cost ( ) const

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

Definition at line 23 of file Charge.cpp.

◆ to_string()

std::string ripple::Resource::Charge::to_string ( ) const

Converts this charge into a human readable string.

Definition at line 29 of file Charge.cpp.

◆ operator==()

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

Definition at line 44 of file Charge.cpp.

◆ operator<=>()

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

Definition at line 49 of file Charge.cpp.

◆ operator*()

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

Definition at line 56 of file Charge.cpp.

Member Data Documentation

◆ m_cost

value_type ripple::Resource::Charge::m_cost
private

Definition at line 44 of file Charge.h.

◆ m_label

std::string ripple::Resource::Charge::m_label
private

Definition at line 45 of file Charge.h.