#include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace xrpl { ApplyContext::ApplyContext( ServiceRegistry& registry, OpenView& base, std::optional const& parentBatchId, STTx const& tx, TER preclaimResult, XRPAmount baseFee, ApplyFlags flags, beast::Journal journal) : registry(registry) , tx(tx) , preclaimResult(preclaimResult) , baseFee(baseFee) , journal(journal) , base_(base) , flags_(flags) , parentBatchId_(parentBatchId) { XRPL_ASSERT( parentBatchId.has_value() == ((flags_ & TapBatch) == TapBatch), "Parent Batch ID should be set if batch apply flag is set"); view_.emplace(&base_, flags_); } void ApplyContext::discard() { view_.emplace(&base_, flags_); } std::optional ApplyContext::apply(TER ter) { // NOLINTNEXTLINE(bugprone-unchecked-optional-access) view_ emplaced in constructor return view_->apply(base_, tx, ter, parentBatchId_, (flags_ & TapDryRun) != 0u, journal); } std::size_t ApplyContext::size() { return view_->size(); // NOLINT(bugprone-unchecked-optional-access) } void ApplyContext::visit( std::function const& func) { view_->visit(base_, func); // NOLINT(bugprone-unchecked-optional-access) } } // namespace xrpl