rippled
ApplyViewImpl.cpp
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 #include <ripple/basics/contract.h>
21 #include <ripple/ledger/ApplyViewImpl.h>
22 #include <cassert>
23 
24 namespace ripple {
25 
27  : ApplyViewBase(base, flags)
28 {
29 }
30 
31 void
33 {
34  items_.apply(to, tx, ter, deliver_, j);
35 }
36 
39 {
40  return items_.size();
41 }
42 
43 void
45  OpenView& to,
46  std::function<void(
47  uint256 const& key,
48  bool isDelete,
49  std::shared_ptr<SLE const> const& before,
50  std::shared_ptr<SLE const> const& after)> const& func)
51 {
52  items_.visit(to, func);
53 }
54 
55 } // namespace ripple
ripple::detail::ApplyStateTable::size
std::size_t size() const
Definition: ApplyStateTable.cpp:55
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::OpenView
Writable ledger view that accumulates state and tx changes.
Definition: OpenView.h:55
ripple::detail::ApplyStateTable::visit
void visit(ReadView const &base, std::function< void(uint256 const &key, bool isDelete, std::shared_ptr< SLE const > const &before, std::shared_ptr< SLE const > const &after)> const &func) const
Definition: ApplyStateTable.cpp:74
ripple::ApplyFlags
ApplyFlags
Definition: ApplyView.h:29
std::function
ripple::detail::ApplyViewBase::items_
detail::ApplyStateTable items_
Definition: ApplyViewBase.h:125
ripple::ApplyViewImpl::deliver_
std::optional< STAmount > deliver_
Definition: ApplyViewImpl.h:88
ripple::base_uint< 256 >
ripple::detail::ApplyStateTable::apply
void apply(RawView &to) const
Definition: ApplyStateTable.cpp:31
ripple::TERSubset< CanCvtToTER >
ripple::STTx
Definition: STTx.h:45
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
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
cassert
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::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