rippled
Loading...
Searching...
No Matches
Charge.h
1#ifndef XRPL_RESOURCE_CHARGE_H_INCLUDED
2#define XRPL_RESOURCE_CHARGE_H_INCLUDED
3
4#include <string>
5
6namespace ripple {
7namespace Resource {
8
10class Charge
11{
12public:
14 using value_type = int;
15
16 // A default constructed Charge has no way to get a label. Delete
17 Charge() = delete;
18
21
23 std::string const&
24 label() const;
25
28 cost() const;
29
32 to_string() const;
33
34 bool
35 operator==(Charge const&) const;
36
38 operator<=>(Charge const&) const;
39
40 Charge
41 operator*(value_type m) const;
42
43private:
46};
47
49operator<<(std::ostream& os, Charge const& v);
50
51} // namespace Resource
52} // namespace ripple
53
54#endif
A consumption charge.
Definition Charge.h:11
int value_type
The type used to hold a consumption charge.
Definition Charge.h:14
Charge operator*(value_type m) const
Definition Charge.cpp:56
std::string m_label
Definition Charge.h:45
std::string to_string() const
Converts this charge into a human readable string.
Definition Charge.cpp:29
bool operator==(Charge const &) const
Definition Charge.cpp:44
value_type cost() const
Return the cost of the charge in Resource::Manager units.
Definition Charge.cpp:23
std::strong_ordering operator<=>(Charge const &) const
Definition Charge.cpp:50
std::string const & label() const
Return the human readable label associated with the charge.
Definition Charge.cpp:17
std::ostream & operator<<(std::ostream &os, Charge const &v)
Definition Charge.cpp:37
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6