View-parameterized base class for all ledger entries.
More...
#include <SLEBase.h>
Inherited by xrpl::AMMEntry< ReadView >, xrpl::AMMEntry< ApplyView >, xrpl::AccountRootEntry< ReadView >, xrpl::AccountRootEntry< ApplyView >, xrpl::AmendmentsEntry< ReadView >, xrpl::AmendmentsEntry< ApplyView >, xrpl::BridgeEntry< ReadView >, xrpl::BridgeEntry< ApplyView >, xrpl::CheckEntry< ReadView >, xrpl::CheckEntry< ApplyView >, xrpl::CredentialEntry< ReadView >, xrpl::CredentialEntry< ApplyView >, xrpl::DIDEntry< ReadView >, xrpl::DIDEntry< ApplyView >, xrpl::DelegateEntry< ReadView >, xrpl::DelegateEntry< ApplyView >, xrpl::DepositPreauthEntry< ReadView >, xrpl::DepositPreauthEntry< ApplyView >, xrpl::DirectoryNodeEntry< ReadView >, xrpl::DirectoryNodeEntry< ApplyView >, xrpl::EscrowEntry< ReadView >, xrpl::EscrowEntry< ApplyView >, xrpl::FeeSettingsEntry< ReadView >, xrpl::FeeSettingsEntry< ApplyView >, xrpl::LedgerHashesEntry< ReadView >, xrpl::LedgerHashesEntry< ApplyView >, xrpl::LoanBrokerEntry< ReadView >, xrpl::LoanBrokerEntry< ApplyView >, xrpl::LoanEntry< ReadView >, xrpl::LoanEntry< ApplyView >, xrpl::MPTokenEntry< ReadView >, xrpl::MPTokenEntry< ApplyView >, xrpl::MPTokenIssuanceEntry< ReadView >, xrpl::MPTokenIssuanceEntry< ApplyView >, xrpl::NFTokenOfferEntry< ReadView >, xrpl::NFTokenOfferEntry< ApplyView >, xrpl::NFTokenPageEntry< ReadView >, xrpl::NFTokenPageEntry< ApplyView >, xrpl::NegativeUNLEntry< ReadView >, xrpl::NegativeUNLEntry< ApplyView >, xrpl::OfferEntry< ReadView >, xrpl::OfferEntry< ApplyView >, xrpl::OracleEntry< ReadView >, xrpl::OracleEntry< ApplyView >, xrpl::PayChannelEntry< ReadView >, xrpl::PayChannelEntry< ApplyView >, xrpl::PermissionedDomainEntry< ReadView >, xrpl::PermissionedDomainEntry< ApplyView >, xrpl::RippleStateEntry< ReadView >, xrpl::RippleStateEntry< ApplyView >, xrpl::SignerListEntry< ReadView >, xrpl::SignerListEntry< ApplyView >, xrpl::SponsorshipEntry< ReadView >, xrpl::SponsorshipEntry< ApplyView >, xrpl::TicketEntry< ReadView >, xrpl::TicketEntry< ApplyView >, xrpl::TransactionProposalEntry< ReadView >, xrpl::TransactionProposalEntry< ApplyView >, xrpl::VaultEntry< ReadView >, xrpl::VaultEntry< ApplyView >, xrpl::XChainOwnedClaimIDEntry< ReadView >, xrpl::XChainOwnedClaimIDEntry< ApplyView >, xrpl::XChainOwnedCreateAccountClaimIDEntry< ReadView >, and xrpl::XChainOwnedCreateAccountClaimIDEntry< ApplyView >.
|
| | ~SLEBase ()=default |
| | SLEBase (SLEBase const &)=default |
| | SLEBase (SLEBase &&)=default |
| SLEBase & | operator= (SLEBase const &)=delete |
| SLEBase & | operator= (SLEBase &&)=delete |
| | SLEBase ()=delete |
| | SLEBase (SLE::const_pointer sle, ViewRefType view, beast::Journal j=beast::Journal{beast::Journal::getNullSink()}) |
| | Constructor for read-only context (adopt an already-fetched SLE).
|
| | SLEBase (Keylet const &key, ViewRefType view, beast::Journal j=beast::Journal{beast::Journal::getNullSink()}) |
| | Constructor for read-only context (read from view by keylet).
|
template<typename OtherViewT, LedgerEntryType OtherType>
requires (!kIsWritable && IsWritableView<OtherViewT> && (OtherType == EntryType || EntryType == ltANY)) |
| | SLEBase (SLEBase< OtherViewT, OtherType > const &other) |
| | Converting constructor: writable → read-only.
|
| | SLEBase (Keylet const &key, ApplyView &view, beast::Journal j=beast::Journal{beast::Journal::getNullSink()}) |
| | Constructor for writable context (peek from view by keylet).
|
| | SLEBase (Keylet const &key, ApplyViewContext const &ctx, beast::Journal j=beast::Journal{beast::Journal::getNullSink()}) |
| | Constructor for writable context, for call sites that hold an ApplyViewContext (peek from ctx.view by keylet).
|
| bool | exists () const |
| | Returns true if the ledger entry exists.
|
| | operator bool () const |
| | Explicit conversion to bool for convenient existence checking.
|
| SLE::const_pointer | rawSle () const |
| | Returns the underlying SLE for read access.
|
| LedgerEntryType | type () const |
| | Returns the ledger entry type of this entry.
|
| Keylet | keylet () const |
| | Returns the keylet identifying this entry.
|
| UInt256 | key () const |
| | Returns the ledger key of this entry.
|
| ReadView const & | readView () const |
| | Returns the read view (always available; ApplyView inherits ReadView).
|
| STLedgerEntry const * | operator-> () const |
| | Const dereference operators (always available).
|
| STLedgerEntry const & | operator* () const |
| SlePtrType const & | mutableRawSle () |
| | Returns the underlying SLE for write access.
|
| ApplyView & | applyView () |
| | Returns the apply view for write operations.
|
| STLedgerEntry * | operator-> () |
| | Mutable dereference operators.
|
| STLedgerEntry & | operator* () |
| void | insert () |
| | Inserts the entry into the view.
|
| void | erase () |
| | Erases the entry from the view.
|
| void | update () |
| void | newSLE () |
| beast::Journal | journal () const |
template<typename ViewT,
LedgerEntryType EntryType = ltANY>
class xrpl::SLEBase< ViewT, EntryType >
View-parameterized base class for all ledger entries.
SLEBase<ReadView> — read-only: holds shared_ptr<SLE const> + ReadView const& SLEBase<ApplyView> — writable: holds shared_ptr<SLE> + ApplyView& + Keylet, plus insert/update/erase operations
Write-only members are gated by requires clauses, providing compile-time guarantees that read-only entries cannot mutate state.
- Template Parameters
-
| EntryType | the ledger entry type this entry is statically bound to. Derived per-type entries pass their own type (e.g. ltACCOUNT_ROOT); the generic ReadOnlySLE / WritableSLE aliases leave it at ltANY, which opts out of the static type check. Binding the type here is what keeps an entry for one entry type from being constructed or converted from another – see the converting constructor below. |
Derived classes should provide domain-specific accessors that hide implementation details of the underlying ledger entry format.
Definition at line 91 of file SLEBase.h.
◆ SlePtrType
◆ ViewRefType
◆ ~SLEBase()
◆ SLEBase() [1/8]
| xrpl::SLEBase< ViewT, EntryType >::SLEBase |
( |
SLEBase< ViewT, EntryType > const & | | ) |
|
|
default |
◆ SLEBase() [2/8]
| xrpl::SLEBase< ViewT, EntryType >::SLEBase |
( |
SLEBase< ViewT, EntryType > && | | ) |
|
|
default |
◆ SLEBase() [3/8]
◆ SLEBase() [4/8]
Constructor for read-only context (adopt an already-fetched SLE).
There is deliberately no writable equivalent: a writable entry needs a Keylet so that newSLE() can still build an entry when none exists, and that cannot be recovered from a null SLE.
Definition at line 140 of file SLEBase.h.
◆ SLEBase() [5/8]
Constructor for read-only context (read from view by keylet).
Definition at line 155 of file SLEBase.h.
◆ SLEBase() [6/8]
template<typename OtherViewT,
LedgerEntryType OtherType>
requires (!
kIsWritable && IsWritableView<OtherViewT> && (OtherType == EntryType || EntryType ==
ltANY))
| xrpl::SLEBase< ViewT, EntryType >::SLEBase |
( |
SLEBase< OtherViewT, OtherType > const & | other | ) |
|
Converting constructor: writable → read-only.
Enables implicit conversion from SLEBase<ApplyView> to SLEBase<ReadView>, so functions taking ReadOnlySLE const& can accept WritableSLE.
Constrained to the same entry type (or to a ltANY target, i.e. widening a typed entry to a generic ReadOnlySLE). The constraint is load-bearing: this constructor is inherited into every per-type entry, and unconstrained it would bind any writable entry that slices to SLEBase, so an OfferEntryW would convert to an AccountRootEntryR with no cast at the call site.
Definition at line 181 of file SLEBase.h.
◆ SLEBase() [7/8]
Constructor for writable context (peek from view by keylet).
Definition at line 191 of file SLEBase.h.
◆ SLEBase() [8/8]
Constructor for writable context, for call sites that hold an ApplyViewContext (peek from ctx.view by keylet).
ctx.tx is not retained: this exists purely so transactors can pass the context they already have instead of spelling out ctx.view. If an entry ever needs the applying transaction, store it here rather than adding another overload.
Definition at line 212 of file SLEBase.h.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ exists()
Returns true if the ledger entry exists.
Definition at line 227 of file SLEBase.h.
◆ operator bool()
Explicit conversion to bool for convenient existence checking.
Definition at line 236 of file SLEBase.h.
◆ rawSle()
Returns the underlying SLE for read access.
Prefer operator-> / operator* for field access; this is for the call sites that need the shared_ptr itself.
Definition at line 248 of file SLEBase.h.
◆ type()
Returns the ledger entry type of this entry.
For a per-type entry this is kEntryType, known at compile time and valid whether or not the entry exists. Only the generic ReadOnlySLE / WritableSLE aliases have to read it back out of the SLE.
- Exceptions
-
| std::logic_error | for a generic (ltANY) entry if exists() is false. |
Definition at line 264 of file SLEBase.h.
◆ keylet()
Returns the keylet identifying this entry.
Writable entries keep the keylet they were built from, so it is valid even before newSLE(). Read-only entries derive it from the SLE, which must therefore exist.
- Exceptions
-
| std::logic_error | for a read-only entry if exists() is false. |
Definition at line 288 of file SLEBase.h.
◆ key()
Returns the ledger key of this entry.
- Exceptions
-
Definition at line 313 of file SLEBase.h.
◆ readView()
◆ operator->() [1/2]
Const dereference operators (always available).
- Exceptions
-
Definition at line 333 of file SLEBase.h.
◆ operator*() [1/2]
◆ mutableRawSle()
Returns the underlying SLE for write access.
Prefer operator-> / operator* for field access; this is for the call sites that need the shared_ptr itself.
Definition at line 361 of file SLEBase.h.
◆ applyView()
Returns the apply view for write operations.
Definition at line 371 of file SLEBase.h.
◆ operator->() [2/2]
Mutable dereference operators.
- Exceptions
-
Definition at line 383 of file SLEBase.h.
◆ operator*() [2/2]
◆ insert()
Inserts the entry into the view.
- Exceptions
-
Definition at line 406 of file SLEBase.h.
◆ erase()
Erases the entry from the view.
Drops the SLE afterwards, so the entry reports !exists() and any further use throws here rather than either throwing from deep inside ApplyStateTable or – worse – silently succeeding. For an entry that already existed, ApplyStateTable::erase keeps holding this exact SLE and builds the DeletedNode's FinalFields from it, so a write through the entry after erase() would land in transaction metadata with no diagnostic at all.
- Exceptions
-
Definition at line 428 of file SLEBase.h.
◆ update()
◆ newSLE()
◆ journal()
◆ kIsWritable
| bool xrpl::SLEBase< ViewT, EntryType >::kIsWritable = IsWritableView<ViewT> |
|
staticconstexpr |
◆ kEntryType
◆ kIsTyped
◆ view_
◆ key_
◆ sle_
◆ j_