rippled
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 <ripple/ledger/OpenView.h>
24 #include <ripple/ledger/detail/ApplyViewBase.h>
25 #include <ripple/protocol/STAmount.h>
26 #include <ripple/protocol/TER.h>
27 
28 namespace ripple {
29 
37 {
38 public:
39  ApplyViewImpl() = delete;
40  ApplyViewImpl(ApplyViewImpl const&) = delete;
42  operator=(ApplyViewImpl&&) = delete;
44  operator=(ApplyViewImpl const&) = delete;
45 
46  ApplyViewImpl(ApplyViewImpl&&) = default;
47  ApplyViewImpl(ReadView const* base, ApplyFlags flags);
48 
55  void
56  apply(OpenView& to, STTx const& tx, TER ter, beast::Journal j);
57 
65  void
66  deliver(STAmount const& amount)
67  {
68  deliver_ = amount;
69  }
70 
74  size();
75 
78  void
79  visit(
80  OpenView& target,
81  std::function<void(
82  uint256 const& key,
83  bool isDelete,
84  std::shared_ptr<SLE const> const& before,
85  std::shared_ptr<SLE const> const& after)> const& func);
86 
87 private:
89 };
90 
91 } // namespace ripple
92 
93 #endif
ripple::ApplyViewImpl::visit
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.
Definition: ApplyViewImpl.cpp:44
std::shared_ptr
STL class.
ripple::ApplyViewImpl::deliver
void deliver(STAmount const &amount)
Set the amount of currency delivered.
Definition: ApplyViewImpl.h:66
ripple::OpenView
Writable ledger view that accumulates state and tx changes.
Definition: OpenView.h:55
ripple::ApplyFlags
ApplyFlags
Definition: ApplyView.h:29
ripple::ApplyViewImpl
Editable, discardable view that can build metadata for one tx.
Definition: ApplyViewImpl.h:36
std::function
ripple::ApplyViewImpl::deliver_
std::optional< STAmount > deliver_
Definition: ApplyViewImpl.h:88
ripple::base_uint< 256 >
ripple::TERSubset< CanCvtToTER >
ripple::STAmount
Definition: STAmount.h:45
ripple::STTx
Definition: STTx.h:45
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
ripple::detail::ApplyViewBase::flags
ApplyFlags flags() const override
Returns the tx apply flags.
Definition: ApplyViewBase.cpp:122
ripple::ReadView
A view into a ledger.
Definition: ReadView.h:125
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::ApplyViewImpl::operator=
ApplyViewImpl & operator=(ApplyViewImpl &&)=delete
std::optional< STAmount >
ripple::after
static bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition: Escrow.cpp:88
std::size_t
ripple::ApplyViewImpl::size
std::size_t size()
Get the number of modified entries.
Definition: ApplyViewImpl.cpp:38
ripple::detail::ApplyViewBase
Definition: ApplyViewBase.h:32
ripple::ApplyViewImpl::apply
void apply(OpenView &to, STTx const &tx, TER ter, beast::Journal j)
Apply the transaction.
Definition: ApplyViewImpl.cpp:32
ripple::ApplyViewImpl::ApplyViewImpl
ApplyViewImpl()=delete