xrpld
Loading...
Searching...
No Matches
xrpl::TOfferStreamBase< TIn, TOut > Class Template Referenceabstract

#include <OfferStream.h>

Inheritance diagram for xrpl::TOfferStreamBase< TIn, TOut >:
Collaboration diagram for xrpl::TOfferStreamBase< TIn, TOut >:

Classes

class  StepCounter

Public Member Functions

 TOfferStreamBase (ApplyView &view, ApplyView &cancelView, Book const &book, NetClock::time_point when, StepCounter &counter, beast::Journal journal)
virtual ~TOfferStreamBase ()=default
TOffer< TIn, TOut > & tip () const
 Returns the offer at the tip of the order book.
bool step ()
 Advance to the next valid offer.
TOut ownerFunds () const

Protected Member Functions

void erase (ApplyView &view)
virtual void permRmOffer (uint256 const &offerIndex)=0
template<class TTakerPays, class TTakerGets>
bool shouldRmSmallIncreasedQOffer () const

Protected Attributes

beast::Journal const j_
ApplyViewview_
ApplyViewcancelView_
Book book_
bool validBook_
NetClock::time_point const expire_
BookTip tip_
TOffer< TIn, TOut > offer_
std::optional< TOut > ownerFunds_
StepCountercounter_

Detailed Description

template<StepAmount TIn, StepAmount TOut>
class xrpl::TOfferStreamBase< TIn, TOut >

Definition at line 16 of file OfferStream.h.

Constructor & Destructor Documentation

◆ TOfferStreamBase()

template<StepAmount TIn, StepAmount TOut>
xrpl::TOfferStreamBase< TIn, TOut >::TOfferStreamBase ( ApplyView & view,
ApplyView & cancelView,
Book const & book,
NetClock::time_point when,
StepCounter & counter,
beast::Journal journal )

Definition at line 48 of file OfferStream.cpp.

◆ ~TOfferStreamBase()

template<StepAmount TIn, StepAmount TOut>
virtual xrpl::TOfferStreamBase< TIn, TOut >::~TOfferStreamBase ( )
virtualdefault

Member Function Documentation

◆ erase()

template<StepAmount TIn, StepAmount TOut>
void xrpl::TOfferStreamBase< TIn, TOut >::erase ( ApplyView & view)
protected

Definition at line 71 of file OfferStream.cpp.

◆ permRmOffer()

template<StepAmount TIn, StepAmount TOut>
virtual void xrpl::TOfferStreamBase< TIn, TOut >::permRmOffer ( uint256 const & offerIndex)
protectedpure virtual

◆ shouldRmSmallIncreasedQOffer()

template<StepAmount TIn, StepAmount TOut>
template<class TTakerPays, class TTakerGets>
bool xrpl::TOfferStreamBase< TIn, TOut >::shouldRmSmallIncreasedQOffer ( ) const
nodiscardprotected

Definition at line 136 of file OfferStream.cpp.

◆ tip()

template<StepAmount TIn, StepAmount TOut>
TOffer< TIn, TOut > & xrpl::TOfferStreamBase< TIn, TOut >::tip ( ) const
nodiscard

Returns the offer at the tip of the order book.

Offers are always presented in decreasing quality. Only valid if step() returned true.

Definition at line 88 of file OfferStream.h.

◆ step()

template<StepAmount TIn, StepAmount TOut>
bool xrpl::TOfferStreamBase< TIn, TOut >::step ( )

Advance to the next valid offer.

This automatically removes:

  • Offers with missing ledger entries
  • Offers found unfunded
  • expired offers
    Returns
    true if there is a valid offer.

Definition at line 192 of file OfferStream.cpp.

◆ ownerFunds()

template<StepAmount TIn, StepAmount TOut>
TOut xrpl::TOfferStreamBase< TIn, TOut >::ownerFunds ( ) const
nodiscard

Definition at line 104 of file OfferStream.h.

Member Data Documentation

◆ j_

template<StepAmount TIn, StepAmount TOut>
beast::Journal const xrpl::TOfferStreamBase< TIn, TOut >::j_
protected

Definition at line 50 of file OfferStream.h.

◆ view_

template<StepAmount TIn, StepAmount TOut>
ApplyView& xrpl::TOfferStreamBase< TIn, TOut >::view_
protected

Definition at line 51 of file OfferStream.h.

◆ cancelView_

template<StepAmount TIn, StepAmount TOut>
ApplyView& xrpl::TOfferStreamBase< TIn, TOut >::cancelView_
protected

Definition at line 52 of file OfferStream.h.

◆ book_

template<StepAmount TIn, StepAmount TOut>
Book xrpl::TOfferStreamBase< TIn, TOut >::book_
protected

Definition at line 53 of file OfferStream.h.

◆ validBook_

template<StepAmount TIn, StepAmount TOut>
bool xrpl::TOfferStreamBase< TIn, TOut >::validBook_
protected

Definition at line 54 of file OfferStream.h.

◆ expire_

template<StepAmount TIn, StepAmount TOut>
NetClock::time_point const xrpl::TOfferStreamBase< TIn, TOut >::expire_
protected

Definition at line 55 of file OfferStream.h.

◆ tip_

template<StepAmount TIn, StepAmount TOut>
BookTip xrpl::TOfferStreamBase< TIn, TOut >::tip_
protected

Definition at line 56 of file OfferStream.h.

◆ offer_

template<StepAmount TIn, StepAmount TOut>
TOffer<TIn, TOut> xrpl::TOfferStreamBase< TIn, TOut >::offer_
protected

Definition at line 57 of file OfferStream.h.

◆ ownerFunds_

template<StepAmount TIn, StepAmount TOut>
std::optional<TOut> xrpl::TOfferStreamBase< TIn, TOut >::ownerFunds_
protected

Definition at line 58 of file OfferStream.h.

◆ counter_

template<StepAmount TIn, StepAmount TOut>
StepCounter& xrpl::TOfferStreamBase< TIn, TOut >::counter_
protected

Definition at line 59 of file OfferStream.h.