rippled
Charge.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_RESOURCE_CHARGE_H_INCLUDED
21 #define RIPPLE_RESOURCE_CHARGE_H_INCLUDED
22 
23 #include <ios>
24 #include <string>
25 
26 namespace ripple {
27 namespace Resource {
28 
30 class Charge
31 {
32 public:
34  using value_type = int;
35 
36  // A default constructed Charge has no way to get a label. Delete
37  Charge() = delete;
38 
41 
43  std::string const&
44  label() const;
45 
48  cost() const;
49 
52  to_string() const;
53 
54  bool
55  operator==(Charge const&) const;
56  bool
57  operator!=(Charge const&) const;
58 
59 private:
62 };
63 
65 operator<<(std::ostream& os, Charge const& v);
66 
67 } // namespace Resource
68 } // namespace ripple
69 
70 #endif
ripple::Resource::Charge::operator==
bool operator==(Charge const &) const
Definition: Charge.cpp:59
std::string
STL class.
ripple::Resource::Charge::value_type
int value_type
The type used to hold a consumption charge.
Definition: Charge.h:34
ripple::Resource::Charge::to_string
std::string to_string() const
Converts this charge into a human readable string.
Definition: Charge.cpp:44
ripple::Resource::Charge::operator!=
bool operator!=(Charge const &) const
Definition: Charge.cpp:65
ripple::Resource::Charge::m_cost
value_type m_cost
Definition: Charge.h:60
ripple::Resource::operator<<
std::ostream & operator<<(std::ostream &os, Charge const &v)
Definition: Charge.cpp:52
std::ostream
STL class.
ripple::Resource::Charge::Charge
Charge()=delete
ripple::Resource::Charge::cost
value_type cost() const
Return the cost of the charge in Resource::Manager units.
Definition: Charge.cpp:38
ripple::Resource::Charge::m_label
std::string m_label
Definition: Charge.h:61
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::Resource::Charge::label
std::string const & label() const
Return the human readable label associated with the charge.
Definition: Charge.cpp:32
ripple::Resource::Charge
A consumption charge.
Definition: Charge.h:30
ios
string