CatapultServer  v0.5.0.1 (Elephant)
InflationCalculator.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "catapult/types.h"
23 #include <map>
24 
25 namespace catapult { namespace model {
26 
29  public:
31  size_t size() const;
32 
34  bool contains(Height height, Amount amount) const;
35 
37  Amount getSpotAmount(Height height) const;
38 
40  Amount getCumulativeAmount(Height height) const;
41 
43  std::pair<Amount, bool> sumAll() const;
44 
45  public:
47  void add(Height height, Amount amount);
48 
49  private:
50  std::map<Height, Amount> m_inflationMap;
51  };
52 }}
catapult::model::InflationCalculator::add
void add(Height height, Amount amount)
Adds inflation of amount starting at height.
Definition: InflationCalculator.cpp:90
exceptions.h
catapult::model::InflationCalculator::sumAll
std::pair< Amount, bool > sumAll() const
Calculates the total inflation.
Definition: InflationCalculator.cpp:69
catapult::Amount
utils::BaseValue< uint64_t, Amount_tag > Amount
Definition: src/catapult/types.h:76
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
InflationCalculator.h
catapult::model::InflationCalculator
Calculator for calculating the inflation at a given height and the total inflation up to a given heig...
Definition: InflationCalculator.h:28
catapult::utils::BasicBaseValue::unwrap
constexpr ValueType unwrap() const
Unwraps this value and returns the underlying raw value.
Definition: BaseValue.h:53
catapult::utils::BaseValue
Immutable wrapper for basic types, to provide some type-safety.
Definition: BaseValue.h:100
catapult::model::InflationCalculator::getCumulativeAmount
Amount getCumulativeAmount(Height height) const
Gets the total inflation amount up to (but not including) height.
Definition: InflationCalculator.cpp:47
catapult::model::InflationCalculator::contains
bool contains(Height height, Amount amount) const
Returns true if the inflation map contains entry with height and amount.
Definition: InflationCalculator.cpp:30
catapult::model::InflationCalculator::getSpotAmount
Amount getSpotAmount(Height height) const
Gets the inflation amount at height.
Definition: InflationCalculator.cpp:35
CATAPULT_THROW_INVALID_ARGUMENT_1
#define CATAPULT_THROW_INVALID_ARGUMENT_1(MESSAGE, PARAM1)
Macro used to throw a catapult invalid argument with a single parameter.
Definition: exceptions.h:183
catapult::model::InflationCalculator::m_inflationMap
std::map< Height, Amount > m_inflationMap
Definition: InflationCalculator.h:50
types.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::model::InflationCalculator::size
size_t size() const
Gets the number of inflation entries.
Definition: InflationCalculator.cpp:26