Reduce STAmount public interface (RIPD-867):

The STAmount class includes a number of functions which serve as thin
wrappers, which are unused or used only in one place, or which break
encapsulation by exposing internal implemenation details. Removing
such functions simplifies the interface of the class and ensures
consistency.

* getSNValue and getNValue are now free functions
* canonicalizeRound is no longer exposed
* Removed addRound and subRound
* Removed overloads of multiply, mulRound, divide and divRound
This commit is contained in:
Nik Bougalis
2015-04-22 18:56:47 -07:00
parent daf4f8fcde
commit 5a7fa8cfa9
18 changed files with 110 additions and 378 deletions

View File

@@ -3007,7 +3007,9 @@ void NetworkOPsImp::getBookPage (
// Need to charge a transfer fee to offer owner.
uOfferRate = uTransferRate;
saOwnerFundsLimit = divide (
saOwnerFunds, STAmount (noIssue(), uOfferRate, -9));
saOwnerFunds,
STAmount (noIssue(), uOfferRate, -9),
saOwnerFunds.issue ());
// TODO(tom): why -9?
}
else
@@ -3030,7 +3032,7 @@ void NetworkOPsImp::getBookPage (
saTakerGetsFunded.setJson (jvOffer[jss::taker_gets_funded]);
std::min (
saTakerPays, multiply (
saTakerGetsFunded, saDirRate, saTakerPays)).setJson
saTakerGetsFunded, saDirRate, saTakerPays.issue ())).setJson
(jvOffer[jss::taker_pays_funded]);
}
@@ -3040,8 +3042,8 @@ void NetworkOPsImp::getBookPage (
saOwnerFunds,
multiply (
saTakerGetsFunded,
STAmount (noIssue(),
uOfferRate, -9)));
STAmount (noIssue(), uOfferRate, -9),
saTakerGetsFunded.issue ()));
umBalance[uOfferOwnerID] = saOwnerFunds - saOwnerPays;
@@ -3196,7 +3198,7 @@ void NetworkOPsImp::getBookPage (
// TOOD(tom): The result of this expression is not used - what's
// going on here?
std::min (saTakerPays, multiply (
saTakerGetsFunded, saDirRate, saTakerPays)).setJson (
saTakerGetsFunded, saDirRate, saTakerPays.issue ())).setJson (
jvOffer[jss::taker_pays_funded]);
}