rippled
Public Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ripple::Taker_test::TestTaker Class Reference
Inheritance diagram for ripple::Taker_test::TestTaker:
Inheritance graph
[legend]
Collaboration diagram for ripple::Taker_test::TestTaker:
Collaboration graph
[legend]

Public Member Functions

 TestTaker (CrossType cross_type, Amounts const &amount, Quality const &quality, STAmount const &funds, std::uint32_t flags, Rate const &rate_in, Rate const &rate_out)
 
void set_funds (STAmount const &funds)
 
STAmount get_funds (AccountID const &owner, STAmount const &funds) const override
 
Amounts cross (Amounts offer, Quality quality)
 
std::pair< Amounts, Amounts > cross (Amounts offer1, Quality quality1, Amounts offer2, Quality quality2)
 
Amounts remaining_offer () const
 Returns the amount remaining on the offer. More...
 
Amounts const & original_offer () const
 Returns the amount that the offer was originally placed at. More...
 
AccountID const & account () const noexcept
 Returns the account identifier of the taker. More...
 
bool reject (Quality const &quality) const noexcept
 Returns true if the quality does not meet the taker's requirements. More...
 
CrossType cross_type () const
 Returns the type of crossing that is being performed. More...
 
Issue const & issue_in () const
 Returns the Issue associated with the input of the offer. More...
 
Issue const & issue_out () const
 Returns the Issue associated with the output of the offer. More...
 
bool unfunded () const
 Returns true if the taker has run out of funds. More...
 
bool done () const
 Returns true if order crossing should not continue. More...
 
BasicTaker::Flow do_cross (Amounts offer, Quality quality, AccountID const &owner)
 Perform direct crossing through given offer. More...
 
std::pair< BasicTaker::Flow, BasicTaker::Flowdo_cross (Amounts offer1, Quality quality1, AccountID const &owner1, Amounts offer2, Quality quality2, AccountID const &owner2)
 Perform bridged crossing through given offers. More...
 

Protected Attributes

const beast::Journal journal_
 

Private Member Functions

void log_flow (char const *description, Flow const &flow)
 
Flow flow_xrp_to_iou (Amounts const &offer, Quality quality, STAmount const &owner_funds, STAmount const &taker_funds, Rate const &rate_out)
 
Flow flow_iou_to_xrp (Amounts const &offer, Quality quality, STAmount const &owner_funds, STAmount const &taker_funds, Rate const &rate_in)
 
Flow flow_iou_to_iou (Amounts const &offer, Quality quality, STAmount const &owner_funds, STAmount const &taker_funds, Rate const &rate_in, Rate const &rate_out)
 
Rate in_rate (AccountID const &from, AccountID const &to) const
 
Rate out_rate (AccountID const &from, AccountID const &to) const
 

Static Private Member Functions

static Rate effective_rate (Rate const &rate, Issue const &issue, AccountID const &from, AccountID const &to)
 

Private Attributes

STAmount funds_
 
STAmount cross_funds
 
AccountID account_
 
Quality quality_
 
Quality threshold_
 
bool sell_
 
const Amounts original_
 
Amounts remaining_
 
Issue const & issue_in_
 
Issue const & issue_out_
 
const Rate m_rate_in
 
const Rate m_rate_out
 
CrossType cross_type_
 

Detailed Description

Definition at line 32 of file Taker_test.cpp.

Constructor & Destructor Documentation

◆ TestTaker()

ripple::Taker_test::TestTaker::TestTaker ( CrossType  cross_type,
Amounts const &  amount,
Quality const &  quality,
STAmount const &  funds,
std::uint32_t  flags,
Rate const &  rate_in,
Rate const &  rate_out 
)

Definition at line 38 of file Taker_test.cpp.

Member Function Documentation

◆ set_funds()

void ripple::Taker_test::TestTaker::set_funds ( STAmount const &  funds)

Definition at line 59 of file Taker_test.cpp.

◆ get_funds()

STAmount ripple::Taker_test::TestTaker::get_funds ( AccountID const &  owner,
STAmount const &  funds 
) const
overridevirtual

Implements ripple::BasicTaker.

Definition at line 65 of file Taker_test.cpp.

◆ cross() [1/2]

Amounts ripple::Taker_test::TestTaker::cross ( Amounts  offer,
Quality  quality 
)

Definition at line 74 of file Taker_test.cpp.

◆ cross() [2/2]

std::pair<Amounts, Amounts> ripple::Taker_test::TestTaker::cross ( Amounts  offer1,
Quality  quality1,
Amounts  offer2,
Quality  quality2 
)

Definition at line 94 of file Taker_test.cpp.

◆ log_flow()

void ripple::BasicTaker::log_flow ( char const *  description,
Flow const &  flow 
)
privateinherited

Definition at line 192 of file Taker.cpp.

◆ flow_xrp_to_iou()

BasicTaker::Flow ripple::BasicTaker::flow_xrp_to_iou ( Amounts const &  offer,
Quality  quality,
STAmount const &  owner_funds,
STAmount const &  taker_funds,
Rate const &  rate_out 
)
privateinherited

Definition at line 214 of file Taker.cpp.

◆ flow_iou_to_xrp()

BasicTaker::Flow ripple::BasicTaker::flow_iou_to_xrp ( Amounts const &  offer,
Quality  quality,
STAmount const &  owner_funds,
STAmount const &  taker_funds,
Rate const &  rate_in 
)
privateinherited

Definition at line 268 of file Taker.cpp.

◆ flow_iou_to_iou()

BasicTaker::Flow ripple::BasicTaker::flow_iou_to_iou ( Amounts const &  offer,
Quality  quality,
STAmount const &  owner_funds,
STAmount const &  taker_funds,
Rate const &  rate_in,
Rate const &  rate_out 
)
privateinherited

Definition at line 325 of file Taker.cpp.

◆ effective_rate()

Rate ripple::BasicTaker::effective_rate ( Rate const &  rate,
Issue const &  issue,
AccountID const &  from,
AccountID const &  to 
)
staticprivateinherited

Definition at line 83 of file Taker.cpp.

◆ in_rate()

Rate ripple::BasicTaker::in_rate ( AccountID const &  from,
AccountID const &  to 
) const
privateinherited

Definition at line 129 of file Taker.h.

◆ out_rate()

Rate ripple::BasicTaker::out_rate ( AccountID const &  from,
AccountID const &  to 
) const
privateinherited

Definition at line 136 of file Taker.h.

◆ remaining_offer()

Amounts ripple::BasicTaker::remaining_offer ( ) const
inherited

Returns the amount remaining on the offer.

This is the amount at which the offer should be placed. It may either be for the full amount when there were no crossing offers, or for zero when the offer fully crossed, or any amount in between. It is always at the original offer quality (quality_)

Definition at line 141 of file Taker.cpp.

◆ original_offer()

Amounts const & ripple::BasicTaker::original_offer ( ) const
inherited

Returns the amount that the offer was originally placed at.

Definition at line 170 of file Taker.cpp.

◆ account()

AccountID const& ripple::BasicTaker::account ( ) const
noexceptinherited

Returns the account identifier of the taker.

Definition at line 172 of file Taker.h.

◆ reject()

bool ripple::BasicTaker::reject ( Quality const &  quality) const
noexceptinherited

Returns true if the quality does not meet the taker's requirements.

Definition at line 179 of file Taker.h.

◆ cross_type()

CrossType ripple::BasicTaker::cross_type ( ) const
inherited

Returns the type of crossing that is being performed.

Definition at line 186 of file Taker.h.

◆ issue_in()

Issue const& ripple::BasicTaker::issue_in ( ) const
inherited

Returns the Issue associated with the input of the offer.

Definition at line 193 of file Taker.h.

◆ issue_out()

Issue const& ripple::BasicTaker::issue_out ( ) const
inherited

Returns the Issue associated with the output of the offer.

Definition at line 200 of file Taker.h.

◆ unfunded()

bool ripple::BasicTaker::unfunded ( ) const
inherited

Returns true if the taker has run out of funds.

Definition at line 102 of file Taker.cpp.

◆ done()

bool ripple::BasicTaker::done ( ) const
inherited

Returns true if order crossing should not continue.

Order processing is stopped if the taker's order quantities have been reached, or if the taker has run out of input funds.

Definition at line 112 of file Taker.cpp.

◆ do_cross() [1/2]

BasicTaker::Flow ripple::BasicTaker::do_cross ( Amounts  offer,
Quality  quality,
AccountID const &  owner 
)
inherited

Perform direct crossing through given offer.

Returns
an Amounts describing the flow achieved during cross

Definition at line 385 of file Taker.cpp.

◆ do_cross() [2/2]

std::pair< BasicTaker::Flow, BasicTaker::Flow > ripple::BasicTaker::do_cross ( Amounts  offer1,
Quality  quality1,
AccountID const &  owner1,
Amounts  offer2,
Quality  quality2,
AccountID const &  owner2 
)
inherited

Perform bridged crossing through given offers.

Returns
a pair of Amounts describing the flow achieved during cross

Definition at line 434 of file Taker.cpp.

Member Data Documentation

◆ funds_

STAmount ripple::Taker_test::TestTaker::funds_
private

Definition at line 34 of file Taker_test.cpp.

◆ cross_funds

STAmount ripple::Taker_test::TestTaker::cross_funds
private

Definition at line 35 of file Taker_test.cpp.

◆ account_

AccountID ripple::BasicTaker::account_
privateinherited

Definition at line 42 of file Taker.h.

◆ quality_

Quality ripple::BasicTaker::quality_
privateinherited

Definition at line 43 of file Taker.h.

◆ threshold_

Quality ripple::BasicTaker::threshold_
privateinherited

Definition at line 44 of file Taker.h.

◆ sell_

bool ripple::BasicTaker::sell_
privateinherited

Definition at line 46 of file Taker.h.

◆ original_

const Amounts ripple::BasicTaker::original_
privateinherited

Definition at line 49 of file Taker.h.

◆ remaining_

Amounts ripple::BasicTaker::remaining_
privateinherited

Definition at line 52 of file Taker.h.

◆ issue_in_

Issue const& ripple::BasicTaker::issue_in_
privateinherited

Definition at line 55 of file Taker.h.

◆ issue_out_

Issue const& ripple::BasicTaker::issue_out_
privateinherited

Definition at line 56 of file Taker.h.

◆ m_rate_in

const Rate ripple::BasicTaker::m_rate_in
privateinherited

Definition at line 60 of file Taker.h.

◆ m_rate_out

const Rate ripple::BasicTaker::m_rate_out
privateinherited

Definition at line 61 of file Taker.h.

◆ cross_type_

CrossType ripple::BasicTaker::cross_type_
privateinherited

Definition at line 64 of file Taker.h.

◆ journal_

const beast::Journal ripple::BasicTaker::journal_
protectedinherited

Definition at line 67 of file Taker.h.