xrpld
Loading...
Searching...
No Matches
Charge.h
1#pragma once
2
3#include <string>
4
5namespace xrpl::Resource {
6
8class Charge
9{
10public:
12 using value_type = int;
13
14 // A default constructed Charge has no way to get a label. Delete
15 Charge() = delete;
16
19
21 [[nodiscard]] std::string const&
22 label() const;
23
25 [[nodiscard]] value_type
26 cost() const;
27
29 [[nodiscard]] std::string
30 toString() const;
31
32 bool
33 operator==(Charge const&) const;
34
36 operator<=>(Charge const&) const;
37
38 Charge
39 operator*(value_type m) const;
40
41private:
44};
45
47operator<<(std::ostream& os, Charge const& v);
48
49} // namespace xrpl::Resource
A consumption charge.
Definition Charge.h:9
std::string const & label() const
Return the human readable label associated with the charge.
Definition Charge.cpp:16
std::string toString() const
Converts this charge into a human readable string.
Definition Charge.cpp:28
Charge operator*(value_type m) const
Definition Charge.cpp:55
std::string label_
Definition Charge.h:43
value_type cost() const
Return the cost of the charge in Resource::Manager units.
Definition Charge.cpp:22
std::strong_ordering operator<=>(Charge const &) const
Definition Charge.cpp:49
int value_type
The type used to hold a consumption charge.
Definition Charge.h:12
bool operator==(Charge const &) const
Definition Charge.cpp:43
value_type cost_
Definition Charge.h:42
std::ostream & operator<<(std::ostream &os, Charge const &v)
Definition Charge.cpp:36