rippled
Loading...
Searching...
No Matches
Charge.h
1#pragma once
2
3#include <string>
4
5namespace xrpl {
6namespace Resource {
7
9class Charge
10{
11public:
13 using value_type = int;
14
15 // A default constructed Charge has no way to get a label. Delete
16 Charge() = delete;
17
20
22 std::string const&
23 label() const;
24
27 cost() const;
28
31 to_string() const;
32
33 bool
34 operator==(Charge const&) const;
35
37 operator<=>(Charge const&) const;
38
39 Charge
40 operator*(value_type m) const;
41
42private:
45};
46
48operator<<(std::ostream& os, Charge const& v);
49
50} // namespace Resource
51} // namespace xrpl
A consumption charge.
Definition Charge.h:10
std::string const & label() const
Return the human readable label associated with the charge.
Definition Charge.cpp:16
std::string m_label
Definition Charge.h:44
Charge operator*(value_type m) const
Definition Charge.cpp:55
value_type m_cost
Definition Charge.h:43
std::string to_string() const
Converts this charge into a human readable string.
Definition Charge.cpp:28
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:13
bool operator==(Charge const &) const
Definition Charge.cpp:43
std::ostream & operator<<(std::ostream &os, Charge const &v)
Definition Charge.cpp:36
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5