xrpld
Loading...
Searching...
No Matches
xrpl::OfferEntry< ViewT > Class Template Reference

#include <OfferEntry.h>

Inheritance diagram for xrpl::OfferEntry< ViewT >:
Collaboration diagram for xrpl::OfferEntry< ViewT >:

Public Types

using Base = SLEBase<ViewT, ltOFFER>
using SlePtrType
using ViewRefType

Public Member Functions

 OfferEntry (AccountID const &id, SeqProxy const &seq, Base::ViewRefType view, beast::Journal j=beast::Journal{beast::Journal::getNullSink()})
 OfferEntry (UInt256 const &offerID, Base::ViewRefType view, beast::Journal j=beast::Journal{beast::Journal::getNullSink()})
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 * operator-> ()
 Mutable dereference operators.
STLedgerEntry const & operator* () const
STLedgerEntry & operator* ()
SlePtrType const & mutableRawSle ()
 Returns the underlying SLE for write access.
ApplyView & applyView ()
 Returns the apply view for write operations.
void insert ()
 Inserts the entry into the view.
void erase ()
 Erases the entry from the view.
void update ()
void newSLE ()
beast::Journal journal () const

Static Public Attributes

static constexpr bool kIsWritable
static constexpr LedgerEntryType kEntryType
static constexpr bool kIsTyped

Protected Attributes

ViewRefType view_
std::conditional_t< kIsWritable, Keylet, Empty > key_
SlePtrType sle_
beast::Journal j_

Detailed Description

template<typename ViewT>
class xrpl::OfferEntry< ViewT >

Definition at line 16 of file OfferEntry.h.

Member Typedef Documentation

◆ Base

template<typename ViewT>
using xrpl::OfferEntry< ViewT >::Base = SLEBase<ViewT, ltOFFER>

Definition at line 19 of file OfferEntry.h.

◆ SlePtrType

using xrpl::SLEBase< ViewT, EntryType >::SlePtrType
inherited

Definition at line 102 of file SLEBase.h.

◆ ViewRefType

using xrpl::SLEBase< ViewT, EntryType >::ViewRefType
inherited

Definition at line 106 of file SLEBase.h.

Constructor & Destructor Documentation

◆ OfferEntry() [1/2]

template<typename ViewT>
xrpl::OfferEntry< ViewT >::OfferEntry ( AccountID const & id,
SeqProxy const & seq,
Base::ViewRefType view,
beast::Journal j = beast::Journal{beast::Journal::getNullSink()} )
explicit

Definition at line 25 of file OfferEntry.h.

◆ OfferEntry() [2/2]

template<typename ViewT>
xrpl::OfferEntry< ViewT >::OfferEntry ( UInt256 const & offerID,
Base::ViewRefType view,
beast::Journal j = beast::Journal{beast::Journal::getNullSink()} )
explicit

Definition at line 34 of file OfferEntry.h.

Member Function Documentation

◆ exists()

bool xrpl::SLEBase< ViewT, EntryType >::exists ( ) const
nodiscardinherited

Returns true if the ledger entry exists.

Definition at line 227 of file SLEBase.h.

◆ operator bool()

xrpl::SLEBase< ViewT, EntryType >::operator bool ( ) const
explicitinherited

Explicit conversion to bool for convenient existence checking.

Definition at line 236 of file SLEBase.h.

◆ rawSle()

SLE::const_pointer xrpl::SLEBase< ViewT, EntryType >::rawSle ( ) const
nodiscardinherited

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()

LedgerEntryType xrpl::SLEBase< ViewT, EntryType >::type ( ) const
nodiscardinherited

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_errorfor a generic (ltANY) entry if exists() is false.

Definition at line 264 of file SLEBase.h.

◆ keylet()

Keylet xrpl::SLEBase< ViewT, EntryType >::keylet ( ) const
nodiscardinherited

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_errorfor a read-only entry if exists() is false.

Definition at line 288 of file SLEBase.h.

◆ key()

UInt256 xrpl::SLEBase< ViewT, EntryType >::key ( ) const
nodiscardinherited

Returns the ledger key of this entry.

Exceptions
std::logic_errorsame as keylet(): for read-only entries, if exists() is false.

Definition at line 313 of file SLEBase.h.

◆ readView()

ReadView const & xrpl::SLEBase< ViewT, EntryType >::readView ( ) const
nodiscardinherited

Returns the read view (always available; ApplyView inherits ReadView).

Definition at line 322 of file SLEBase.h.

◆ operator->() [1/2]

STLedgerEntry const * xrpl::SLEBase< ViewT, EntryType >::operator-> ( ) const
inherited

Const dereference operators (always available).

Exceptions
std::logic_errorif exists() is false.

Definition at line 333 of file SLEBase.h.

◆ operator->() [2/2]

STLedgerEntry * xrpl::SLEBase< ViewT, EntryType >::operator-> ( )
inherited

Mutable dereference operators.

Exceptions
std::logic_errorif exists() is false.

Definition at line 383 of file SLEBase.h.

◆ operator*() [1/2]

STLedgerEntry const & xrpl::SLEBase< ViewT, EntryType >::operator* ( ) const
inherited

Definition at line 341 of file SLEBase.h.

◆ operator*() [2/2]

STLedgerEntry & xrpl::SLEBase< ViewT, EntryType >::operator* ( )
inherited

Definition at line 392 of file SLEBase.h.

◆ mutableRawSle()

SlePtrType const & xrpl::SLEBase< ViewT, EntryType >::mutableRawSle ( )
nodiscardinherited

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()

ApplyView & xrpl::SLEBase< ViewT, EntryType >::applyView ( )
nodiscardinherited

Returns the apply view for write operations.

Definition at line 371 of file SLEBase.h.

◆ insert()

void xrpl::SLEBase< ViewT, EntryType >::insert ( )
inherited

Inserts the entry into the view.

Exceptions
std::logic_errorif exists() is false.

Definition at line 406 of file SLEBase.h.

◆ erase()

void xrpl::SLEBase< ViewT, EntryType >::erase ( )
inherited

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
std::logic_errorif exists() is false.

Definition at line 428 of file SLEBase.h.

◆ update()

void xrpl::SLEBase< ViewT, EntryType >::update ( )
inherited
Exceptions
std::logic_errorif exists() is false.

Definition at line 441 of file SLEBase.h.

◆ newSLE()

void xrpl::SLEBase< ViewT, EntryType >::newSLE ( )
inherited
Exceptions
std::logic_errorif exists() is true: newSLE() would otherwise silently discard the SLE already held.

Definition at line 454 of file SLEBase.h.

◆ journal()

beast::Journal xrpl::SLEBase< ViewT, EntryType >::journal ( ) const
nodiscardinherited

Definition at line 463 of file SLEBase.h.

Member Data Documentation

◆ kIsWritable

bool xrpl::SLEBase< ViewT, EntryType >::kIsWritable
staticconstexprinherited

Definition at line 94 of file SLEBase.h.

◆ kEntryType

LedgerEntryType xrpl::SLEBase< ViewT, EntryType >::kEntryType
staticconstexprinherited

Definition at line 98 of file SLEBase.h.

◆ kIsTyped

bool xrpl::SLEBase< ViewT, EntryType >::kIsTyped
staticconstexprinherited

Definition at line 99 of file SLEBase.h.

◆ view_

ViewRefType xrpl::SLEBase< ViewT, EntryType >::view_
protectedinherited

Definition at line 469 of file SLEBase.h.

◆ key_

std::conditional_t<kIsWritable, Keylet, Empty> xrpl::SLEBase< ViewT, EntryType >::key_
protectedinherited

Definition at line 480 of file SLEBase.h.

◆ sle_

SlePtrType xrpl::SLEBase< ViewT, EntryType >::sle_
protectedinherited

Definition at line 482 of file SLEBase.h.

◆ j_

beast::Journal xrpl::SLEBase< ViewT, EntryType >::j_
protectedinherited

Definition at line 483 of file SLEBase.h.