rippled
Loading...
Searching...
No Matches
ApplyViewImpl.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_LEDGER_APPLYVIEWIMPL_H_INCLUDED
21#define RIPPLE_LEDGER_APPLYVIEWIMPL_H_INCLUDED
22
23#include <xrpl/ledger/OpenView.h>
24#include <xrpl/ledger/detail/ApplyViewBase.h>
25#include <xrpl/protocol/STAmount.h>
26#include <xrpl/protocol/TER.h>
27
28namespace ripple {
29
37{
38public:
39 ApplyViewImpl() = delete;
40 ApplyViewImpl(ApplyViewImpl const&) = delete;
44 operator=(ApplyViewImpl const&) = delete;
45
48
56 apply(
57 OpenView& to,
58 STTx const& tx,
59 TER ter,
60 std::optional<uint256> parentBatchId,
61 bool isDryRun,
63
71 void
72 deliver(STAmount const& amount)
73 {
74 deliver_ = amount;
75 }
76
80 size();
81
84 void
85 visit(
86 OpenView& target,
87 std::function<void(
88 uint256 const& key,
89 bool isDelete,
90 std::shared_ptr<SLE const> const& before,
91 std::shared_ptr<SLE const> const& after)> const& func);
92
93private:
95};
96
97} // namespace ripple
98
99#endif
A generic endpoint for log messages.
Definition Journal.h:60
Editable, discardable view that can build metadata for one tx.
std::optional< TxMeta > apply(OpenView &to, STTx const &tx, TER ter, std::optional< uint256 > parentBatchId, bool isDryRun, beast::Journal j)
Apply the transaction.
std::optional< STAmount > deliver_
void deliver(STAmount const &amount)
Set the amount of currency delivered.
std::size_t size()
Get the number of modified entries.
ApplyViewImpl(ApplyViewImpl const &)=delete
void visit(OpenView &target, std::function< void(uint256 const &key, bool isDelete, std::shared_ptr< SLE const > const &before, std::shared_ptr< SLE const > const &after)> const &func)
Visit modified entries.
ApplyViewImpl & operator=(ApplyViewImpl const &)=delete
ApplyViewImpl & operator=(ApplyViewImpl &&)=delete
ApplyViewImpl(ApplyViewImpl &&)=default
Writable ledger view that accumulates state and tx changes.
Definition OpenView.h:65
A view into a ledger.
Definition ReadView.h:51
ApplyFlags flags() const override
Returns the tx apply flags.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3178