rippled
Loading...
Searching...
No Matches
ApplyViewBase.cpp
1#include <xrpl/ledger/detail/ApplyViewBase.h>
2
3namespace xrpl {
4namespace detail {
5
6ApplyViewBase::ApplyViewBase(ReadView const* base, ApplyFlags flags) : flags_(flags), base_(base)
7{
8}
9
10//---
11
12bool
14{
15 return base_->open();
16}
17
18LedgerHeader const&
20{
21 return base_->header();
22}
23
24Fees const&
26{
27 return base_->fees();
28}
29
30Rules const&
32{
33 return base_->rules();
34}
35
36bool
38{
39 return items_.exists(*base_, k);
40}
41
42auto
45{
46 return items_.succ(*base_, key, last);
47}
48
51{
52 return items_.read(*base_, k);
53}
54
55auto
56ApplyViewBase::slesBegin() const -> std::unique_ptr<sles_type::iter_base>
57{
58 return base_->slesBegin();
59}
60
61auto
62ApplyViewBase::slesEnd() const -> std::unique_ptr<sles_type::iter_base>
63{
64 return base_->slesEnd();
65}
66
67auto
69{
70 return base_->slesUpperBound(key);
71}
72
73auto
74ApplyViewBase::txsBegin() const -> std::unique_ptr<txs_type::iter_base>
75{
76 return base_->txsBegin();
77}
78
79auto
80ApplyViewBase::txsEnd() const -> std::unique_ptr<txs_type::iter_base>
81{
82 return base_->txsEnd();
83}
84
85bool
87{
88 return base_->txExists(key);
89}
90
91auto
93{
94 return base_->txRead(key);
95}
96
97//---
98
101{
102 return flags_;
103}
104
107{
108 return items_.peek(*base_, k);
109}
110
111void
116
117void
122
123void
128
129//---
130
131void
136
137void
142
143void
148
149void
154
155} // namespace detail
156} // namespace xrpl
A view into a ledger.
Definition ReadView.h:31
virtual Rules const & rules() const =0
Returns the tx processing rules.
virtual std::unique_ptr< txs_type::iter_base > txsBegin() const =0
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
virtual std::unique_ptr< txs_type::iter_base > txsEnd() const =0
virtual LedgerHeader const & header() const =0
Returns information about the ledger.
virtual bool txExists(key_type const &key) const =0
Returns true if a tx exists in the tx map.
virtual bool open() const =0
Returns true if this reflects an open ledger.
virtual std::unique_ptr< sles_type::iter_base > slesBegin() const =0
virtual std::unique_ptr< sles_type::iter_base > slesEnd() const =0
Rules controlling protocol behavior.
Definition Rules.h:18
void destroyXRP(XRPAmount const &fee)
bool exists(ReadView const &base, Keylet const &k) const
void insert(ReadView const &base, std::shared_ptr< SLE > const &sle)
void erase(ReadView const &base, std::shared_ptr< SLE > const &sle)
std::shared_ptr< SLE > peek(ReadView const &base, Keylet const &k)
void replace(ReadView const &base, std::shared_ptr< SLE > const &sle)
void rawErase(ReadView const &base, std::shared_ptr< SLE > const &sle)
std::shared_ptr< SLE const > read(ReadView const &base, Keylet const &k) const
void update(ReadView const &base, std::shared_ptr< SLE > const &sle)
void rawDestroyXRP(XRPAmount const &feeDrops) override
Destroy XRP.
void rawInsert(std::shared_ptr< SLE > const &sle) override
Unconditionally insert a state item.
void update(std::shared_ptr< SLE > const &sle) override
Indicate changes to a peeked SLE.
ApplyFlags flags() const override
Returns the tx apply flags.
std::optional< key_type > succ(key_type const &key, std::optional< key_type > const &last=std::nullopt) const override
Return the key of the next state item.
std::unique_ptr< sles_type::iter_base > slesEnd() const override
void erase(std::shared_ptr< SLE > const &sle) override
Remove a peeked SLE.
std::unique_ptr< txs_type::iter_base > txsBegin() const override
bool open() const override
Returns true if this reflects an open ledger.
void rawErase(std::shared_ptr< SLE > const &sle) override
Delete an existing state item.
LedgerHeader const & header() const override
Returns information about the ledger.
std::shared_ptr< SLE > peek(Keylet const &k) override
Prepare to modify the SLE associated with key.
Rules const & rules() const override
Returns the tx processing rules.
detail::ApplyStateTable items_
void rawReplace(std::shared_ptr< SLE > const &sle) override
Unconditionally replace a state item.
std::shared_ptr< SLE const > read(Keylet const &k) const override
Return the state item associated with a key.
std::unique_ptr< sles_type::iter_base > slesBegin() const override
std::unique_ptr< sles_type::iter_base > slesUpperBound(uint256 const &key) const override
tx_type txRead(key_type const &key) const override
Read a transaction from the tx map.
Fees const & fees() const override
Returns the fees for the base ledger.
std::unique_ptr< txs_type::iter_base > txsEnd() const override
bool txExists(key_type const &key) const override
Returns true if a tx exists in the tx map.
void insert(std::shared_ptr< SLE > const &sle) override
Insert a new state SLE.
bool exists(Keylet const &k) const override
Determine if a state item exists.
STL namespace.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
ApplyFlags
Definition ApplyView.h:10
Reflects the fee settings for a particular ledger.
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:19
Information about the notional ledger backing the view.