diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj index 40b4967b0b..f5907cca31 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj +++ b/Builds/VisualStudio2015/RippleD.vcxproj @@ -2749,6 +2749,10 @@ True True + + True + True + True True @@ -2785,6 +2789,10 @@ True True + + True + True + True True diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters index a7d3c809de..e1bb737a57 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters @@ -3468,6 +3468,9 @@ ripple\protocol\impl + + ripple\protocol\impl + ripple\protocol\impl @@ -3495,6 +3498,9 @@ ripple\protocol\impl + + ripple\protocol\impl + ripple\protocol\impl diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index b6ba77d7b9..b68f8406e3 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -2650,7 +2650,7 @@ void NetworkOPsImp::getBookPage ( { // If either asset is globally frozen, consider all offers // that aren't ours to be totally unfunded - saOwnerFunds.clear (IssueRef (book.out.currency, book.out.account)); + saOwnerFunds.clear (book.out); } else { @@ -2817,7 +2817,7 @@ void NetworkOPsImp::getBookPage ( { // If either asset is globally frozen, consider all offers // that aren't ours to be totally unfunded - saOwnerFunds.clear (IssueRef (book.out.currency, book.out.account)); + saOwnerFunds.clear (book.out); } else { diff --git a/src/ripple/app/tx/impl/BookTip.cpp b/src/ripple/app/tx/impl/BookTip.cpp index 954e44b5f0..6fbfa178cd 100644 --- a/src/ripple/app/tx/impl/BookTip.cpp +++ b/src/ripple/app/tx/impl/BookTip.cpp @@ -23,7 +23,7 @@ namespace ripple { -BookTip::BookTip (ApplyView& view, BookRef book) +BookTip::BookTip (ApplyView& view, Book const& book) : view_ (view) , m_valid (false) , m_book (getBookBase (book)) diff --git a/src/ripple/app/tx/impl/BookTip.h b/src/ripple/app/tx/impl/BookTip.h index 661b3cf0e8..1d127095be 100644 --- a/src/ripple/app/tx/impl/BookTip.h +++ b/src/ripple/app/tx/impl/BookTip.h @@ -49,7 +49,7 @@ private: public: /** Create the iterator. */ - BookTip (ApplyView& view, BookRef book); + BookTip (ApplyView& view, Book const& book); uint256 const& dir() const noexcept diff --git a/src/ripple/app/tx/impl/CreateOffer.cpp b/src/ripple/app/tx/impl/CreateOffer.cpp index 58bcd3147d..aafbf881db 100644 --- a/src/ripple/app/tx/impl/CreateOffer.cpp +++ b/src/ripple/app/tx/impl/CreateOffer.cpp @@ -131,7 +131,7 @@ CreateOffer::preflight (PreflightContext const& ctx) } TER -CreateOffer::checkAcceptAsset(IssueRef issue) const +CreateOffer::checkAcceptAsset(Issue const& issue) const { // Only valid for custom currencies assert (!isXRP (issue.currency)); diff --git a/src/ripple/app/tx/impl/CreateOffer.h b/src/ripple/app/tx/impl/CreateOffer.h index d9677ae657..d0072aad13 100644 --- a/src/ripple/app/tx/impl/CreateOffer.h +++ b/src/ripple/app/tx/impl/CreateOffer.h @@ -61,7 +61,7 @@ public: private: /** Determine if we are authorized to hold the asset we want to get */ TER - checkAcceptAsset(IssueRef issue) const; + checkAcceptAsset(Issue const& issue) const; bool dry_offer (ApplyView& view, Offer const& offer); diff --git a/src/ripple/app/tx/impl/OfferStream.cpp b/src/ripple/app/tx/impl/OfferStream.cpp index f84aa91521..7d8715f736 100644 --- a/src/ripple/app/tx/impl/OfferStream.cpp +++ b/src/ripple/app/tx/impl/OfferStream.cpp @@ -24,7 +24,7 @@ namespace ripple { OfferStream::OfferStream (ApplyView& view, ApplyView& cancelView, - BookRef book, Clock::time_point when, + Book const& book, Clock::time_point when, StepCounter& counter, beast::Journal journal) : j_ (journal) , view_ (view) diff --git a/src/ripple/app/tx/impl/OfferStream.h b/src/ripple/app/tx/impl/OfferStream.h index 5ec30e0067..47b6c62834 100644 --- a/src/ripple/app/tx/impl/OfferStream.h +++ b/src/ripple/app/tx/impl/OfferStream.h @@ -92,7 +92,7 @@ private: public: OfferStream (ApplyView& view, ApplyView& cancelView, - BookRef book, Clock::time_point when, + Book const& book, Clock::time_point when, StepCounter& counter, beast::Journal journal); /** Returns the offer at the tip of the order book. diff --git a/src/ripple/ledger/impl/View.cpp b/src/ripple/ledger/impl/View.cpp index 337bd74ea1..9230cd40d8 100644 --- a/src/ripple/ledger/impl/View.cpp +++ b/src/ripple/ledger/impl/View.cpp @@ -136,7 +136,7 @@ accountHolds (ReadView const& view, else if ((zeroIfFrozen == fhZERO_IF_FROZEN) && isFrozen(view, account, currency, issuer)) { - amount.clear (IssueRef (currency, issuer)); + amount.clear (Issue (currency, issuer)); } else { diff --git a/src/ripple/protocol/Book.h b/src/ripple/protocol/Book.h index fc0250ed32..5620ebda9b 100644 --- a/src/ripple/protocol/Book.h +++ b/src/ripple/protocol/Book.h @@ -29,154 +29,75 @@ namespace ripple { The order book is a pair of Issues called in and out. @see Issue. */ -template -class BookType +class Book { public: - using Issue = IssueType ; - Issue in; Issue out; - BookType () + Book () { } - BookType (Issue const& in_, Issue const& out_) + Book (Issue const& in_, Issue const& out_) : in (in_) , out (out_) { } - - template - BookType (BookType const& other) - : in (other.in) - , out (other.out) - { - } - - /** Assignment. - This is only valid when ByValue == `true` - */ - template - BookType& operator= (BookType const& other) - { - in = other.in; - out = other.out; - return *this; - } }; -template -bool isConsistent(BookType const& book) -{ - return isConsistent(book.in) && isConsistent (book.out) - && book.in != book.out; -} +bool +isConsistent (Book const& book); -template -std::string to_string (BookType const& book) -{ - return to_string(book.in) + "->" + to_string(book.out); -} +std::string +to_string (Book const& book); -template -std::ostream& operator<<(std::ostream& os, BookType const& x) -{ - os << to_string (x); - return os; -} +std::ostream& +operator<< (std::ostream& os, Book const& x); -template -void hash_append (Hasher& h, BookType const& b) +template +void +hash_append (Hasher& h, Book const& b) { using beast::hash_append; - hash_append (h, b.in, b.out); + hash_append(h, b.in, b.out); } -template -BookType reversed (BookType const& book) -{ - return BookType (book.out, book.in); -} +Book +reversed (Book const& book); /** Ordered comparison. */ -template -int compare (BookType const& lhs, - BookType const& rhs) -{ - int const diff (compare (lhs.in, rhs.in)); - if (diff != 0) - return diff; - return compare (lhs.out, rhs.out); -} +int +compare (Book const& lhs, Book const& rhs); /** Equality comparison. */ /** @{ */ -template -bool operator== (BookType const& lhs, - BookType const& rhs) -{ - return (lhs.in == rhs.in) && - (lhs.out == rhs.out); -} - -template -bool operator!= (BookType const& lhs, - BookType const& rhs) -{ - return (lhs.in != rhs.in) || - (lhs.out != rhs.out); -} +bool +operator== (Book const& lhs, Book const& rhs); +bool +operator!= (Book const& lhs, Book const& rhs); /** @} */ /** Strict weak ordering. */ /** @{ */ -template -bool operator< (BookType const& lhs, - BookType const& rhs) -{ - int const diff (compare (lhs.in, rhs.in)); - if (diff != 0) - return diff < 0; - return lhs.out < rhs.out; -} - -template -bool operator> (BookType const& lhs, - BookType const& rhs) -{ - return rhs < lhs; -} - -template -bool operator>= (BookType const& lhs, - BookType const& rhs) -{ - return ! (lhs < rhs); -} - -template -bool operator<= (BookType const& lhs, - BookType const& rhs) -{ - return ! (rhs < lhs); -} +bool +operator< (Book const& lhs,Book const& rhs); +bool +operator> (Book const& lhs, Book const& rhs); +bool +operator>= (Book const& lhs, Book const& rhs); +bool +operator<= (Book const& lhs, Book const& rhs); /** @} */ -//------------------------------------------------------------------------------ - -using Book = BookType ; -using BookRef = BookType ; - } //------------------------------------------------------------------------------ namespace std { -template -struct hash > +template <> +struct hash : private boost::base_from_member , 0> , private boost::base_from_member , 1> { @@ -188,7 +109,7 @@ private: public: using value_type = std::size_t; - using argument_type = ripple::IssueType ; + using argument_type = ripple::Issue; value_type operator() (argument_type const& value) const { @@ -202,17 +123,17 @@ public: //------------------------------------------------------------------------------ -template -struct hash > +template <> +struct hash { private: - using hasher = std::hash >; + using hasher = std::hash ; hasher m_hasher; public: using value_type = std::size_t; - using argument_type = ripple::BookType ; + using argument_type = ripple::Book; value_type operator() (argument_type const& value) const { @@ -228,20 +149,20 @@ public: namespace boost { -template -struct hash > - : std::hash > +template <> +struct hash + : std::hash { - using Base = std::hash >; + using Base = std::hash ; // VFALCO NOTE broken in vs2012 //using Base::Base; // inherit ctors }; -template -struct hash > - : std::hash > +template <> +struct hash + : std::hash { - using Base = std::hash >; + using Base = std::hash ; // VFALCO NOTE broken in vs2012 //using Base::Base; // inherit ctors }; diff --git a/src/ripple/protocol/Issue.h b/src/ripple/protocol/Issue.h index 2d9e71a2b8..9832fe4aa3 100644 --- a/src/ripple/protocol/Issue.h +++ b/src/ripple/protocol/Issue.h @@ -29,153 +29,70 @@ namespace ripple { /** A currency issued by an account. - - When ByValue is `false`, this only stores references, and the caller - is responsible for managing object lifetime. - - @see Currency, AccountID, Issue, IssueRef, Book + @see Currency, AccountID, Issue, Book */ -template -class IssueType +class Issue { public: - using IssueCurrency = typename - std::conditional ::type; + Currency currency; + AccountID account; - using IssueAccount = typename - std::conditional ::type; - - IssueCurrency currency; - IssueAccount account; - - IssueType () + Issue () { } - IssueType (Currency const& c, AccountID const& a) + Issue (Currency const& c, AccountID const& a) : currency (c), account (a) { } - - template - IssueType (IssueType const& other) - : currency (other.currency) - , account (other.account) - { - } - - /** Assignment. */ - template - std::enable_if_t - operator= (IssueType const& other) - { - currency = other.currency; - account = other.account; - return *this; - } }; -template -bool isConsistent(IssueType const& ac) -{ - return isXRP (ac.currency) == isXRP (ac.account); -} +bool +isConsistent (Issue const& ac); -template -std::string to_string (IssueType const& ac) -{ - if (isXRP (ac.account)) - return to_string (ac.currency); +std::string +to_string (Issue const& ac); - return to_string(ac.account) + "/" + to_string(ac.currency); -} +std::ostream& +operator<< (std::ostream& os, Issue const& x); -template -std::ostream& operator<< ( - std::ostream& os, IssueType const& x) -{ - os << to_string (x); - return os; -} - -template -void hash_append (Hasher& h, IssueType const& r) +template +void +hash_append(Hasher& h, Issue const& r) { using beast::hash_append; - hash_append (h, r.currency, r.account); + hash_append(h, r.currency, r.account); } /** Ordered comparison. The assets are ordered first by currency and then by account, if the currency is not XRP. */ -template -int compare (IssueType const& lhs, - IssueType const& rhs) -{ - int diff = compare (lhs.currency, rhs.currency); - if (diff != 0) - return diff; - if (isXRP (lhs.currency)) - return 0; - return compare (lhs.account, rhs.account); -} +int +compare (Issue const& lhs, Issue const& rhs); /** Equality comparison. */ /** @{ */ -template -bool operator== (IssueType const& lhs, - IssueType const& rhs) -{ - return compare (lhs, rhs) == 0; -} - -template -bool operator!= (IssueType const& lhs, - IssueType const& rhs) -{ - return ! (lhs == rhs); -} +bool +operator== (Issue const& lhs, Issue const& rhs); +bool +operator!= (Issue const& lhs, Issue const& rhs); /** @} */ /** Strict weak ordering. */ /** @{ */ -template -bool operator< (IssueType const& lhs, - IssueType const& rhs) -{ - return compare (lhs, rhs) < 0; -} - -template -bool operator> (IssueType const& lhs, - IssueType const& rhs) -{ - return rhs < lhs; -} - -template -bool operator>= (IssueType const& lhs, - IssueType const& rhs) -{ - return ! (lhs < rhs); -} - -template -bool operator<= (IssueType const& lhs, - IssueType const& rhs) -{ - return ! (rhs < lhs); -} +bool +operator< (Issue const& lhs, Issue const& rhs); +bool +operator> (Issue const& lhs, Issue const& rhs); +bool +operator>= (Issue const& lhs, Issue const& rhs); +bool +operator<= (Issue const& lhs, Issue const& rhs); /** @} */ //------------------------------------------------------------------------------ -using Issue = IssueType ; -using IssueRef = IssueType ; - -//------------------------------------------------------------------------------ - /** Returns an asset specifier that represents XRP. */ inline Issue const& xrpIssue () { diff --git a/src/ripple/protocol/impl/Book.cpp b/src/ripple/protocol/impl/Book.cpp new file mode 100644 index 0000000000..e6d4c27459 --- /dev/null +++ b/src/ripple/protocol/impl/Book.cpp @@ -0,0 +1,106 @@ +//------------------------------------------------------------------------------ +/* + This file is part of rippled: https://github.com/ripple/rippled + Copyright (c) 2012, 2013 Ripple Labs Inc. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +//============================================================================== + +#include + +namespace ripple { + +bool +isConsistent (Book const& book) +{ + return isConsistent(book.in) && isConsistent (book.out) + && book.in != book.out; +} + +std::string +to_string (Book const& book) +{ + return to_string(book.in) + "->" + to_string(book.out); +} + +std::ostream& +operator<< (std::ostream& os, Book const& x) +{ + os << to_string (x); + return os; +} + +Book +reversed (Book const& book) +{ + return Book (book.out, book.in); +} + +/** Ordered comparison. */ +int +compare (Book const& lhs, Book const& rhs) +{ + int const diff (compare (lhs.in, rhs.in)); + if (diff != 0) + return diff; + return compare (lhs.out, rhs.out); +} + +/** Equality comparison. */ +/** @{ */ +bool +operator== (Book const& lhs, Book const& rhs) +{ + return (lhs.in == rhs.in) && + (lhs.out == rhs.out); +} + +bool +operator!= (Book const& lhs, Book const& rhs) +{ + return (lhs.in != rhs.in) || + (lhs.out != rhs.out); +} +/** @} */ + +/** Strict weak ordering. */ +/** @{ */ +bool +operator< (Book const& lhs,Book const& rhs) +{ + int const diff (compare (lhs.in, rhs.in)); + if (diff != 0) + return diff < 0; + return lhs.out < rhs.out; +} + +bool +operator> (Book const& lhs, Book const& rhs) +{ + return rhs < lhs; +} + +bool +operator>= (Book const& lhs, Book const& rhs) +{ + return ! (lhs < rhs); +} + +bool +operator<= (Book const& lhs, Book const& rhs) +{ + return ! (rhs < lhs); +} + +} // ripple diff --git a/src/ripple/protocol/impl/Issue.cpp b/src/ripple/protocol/impl/Issue.cpp new file mode 100644 index 0000000000..a8617a1798 --- /dev/null +++ b/src/ripple/protocol/impl/Issue.cpp @@ -0,0 +1,102 @@ +//------------------------------------------------------------------------------ +/* + This file is part of rippled: https://github.com/ripple/rippled + Copyright (c) 2012, 2013 Ripple Labs Inc. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +//============================================================================== + +#include + +namespace ripple { + +bool +isConsistent (Issue const& ac) +{ + return isXRP (ac.currency) == isXRP (ac.account); +} + +std::string +to_string (Issue const& ac) +{ + if (isXRP (ac.account)) + return to_string (ac.currency); + + return to_string(ac.account) + "/" + to_string(ac.currency); +} + +std::ostream& +operator<< (std::ostream& os, Issue const& x) +{ + os << to_string (x); + return os; +} + +/** Ordered comparison. + The assets are ordered first by currency and then by account, + if the currency is not XRP. +*/ +int +compare (Issue const& lhs, Issue const& rhs) +{ + int diff = compare (lhs.currency, rhs.currency); + if (diff != 0) + return diff; + if (isXRP (lhs.currency)) + return 0; + return compare (lhs.account, rhs.account); +} + +/** Equality comparison. */ +/** @{ */ +bool +operator== (Issue const& lhs, Issue const& rhs) +{ + return compare (lhs, rhs) == 0; +} + +bool +operator!= (Issue const& lhs, Issue const& rhs) +{ + return ! (lhs == rhs); +} +/** @} */ + +/** Strict weak ordering. */ +/** @{ */ +bool +operator< (Issue const& lhs, Issue const& rhs) +{ + return compare (lhs, rhs) < 0; +} + +bool +operator> (Issue const& lhs, Issue const& rhs) +{ + return rhs < lhs; +} + +bool +operator>= (Issue const& lhs, Issue const& rhs) +{ + return ! (lhs < rhs); +} + +bool +operator<= (Issue const& lhs, Issue const& rhs) +{ + return ! (rhs < lhs); +} + +} // ripple diff --git a/src/ripple/protocol/tests/Issue.test.cpp b/src/ripple/protocol/tests/Issue.test.cpp index 078bb8e282..74fbf2331d 100644 --- a/src/ripple/protocol/tests/Issue.test.cpp +++ b/src/ripple/protocol/tests/Issue.test.cpp @@ -75,9 +75,9 @@ public: //-------------------------------------------------------------------------- - // Comparison, hash tests for IssueType + // Comparison, hash tests for Issue template - void testIssueType () + void testIssue () { Currency const c1 (1); AccountID const i1 (1); Currency const c2 (2); AccountID const i2 (2); @@ -128,8 +128,8 @@ public: AccountID const i1 (1); Currency const c2 (2); AccountID const i2 (2); - IssueRef const a1 (c1, i1); - IssueRef const a2 (c2, i2); + Issue const a1 (c1, i1); + Issue const a2 (c2, i2); { Set c; @@ -153,9 +153,9 @@ public: c.insert (a2); if (! expect (c.size () == 2)) return; - if (! expect (c.erase (IssueRef (c1, i2)) == 0)) return; - if (! expect (c.erase (IssueRef (c1, i1)) == 1)) return; - if (! expect (c.erase (IssueRef (c2, i2)) == 1)) return; + if (! expect (c.erase (Issue (c1, i2)) == 0)) return; + if (! expect (c.erase (Issue (c1, i1)) == 1)) return; + if (! expect (c.erase (Issue (c2, i2)) == 1)) return; if (! expect (c.empty ())) return; #if STL_SET_HAS_EMPLACE @@ -174,8 +174,8 @@ public: AccountID const i1 (1); Currency const c2 (2); AccountID const i2 (2); - IssueRef const a1 (c1, i1); - IssueRef const a2 (c2, i2); + Issue const a1 (c1, i1); + Issue const a2 (c2, i2); { Map c; @@ -199,9 +199,9 @@ public: c.insert (std::make_pair (a2, 2)); if (! expect (c.size () == 2)) return; - if (! expect (c.erase (IssueRef (c1, i2)) == 0)) return; - if (! expect (c.erase (IssueRef (c1, i1)) == 1)) return; - if (! expect (c.erase (IssueRef (c2, i2)) == 1)) return; + if (! expect (c.erase (Issue (c1, i2)) == 0)) return; + if (! expect (c.erase (Issue (c1, i1)) == 1)) return; + if (! expect (c.erase (Issue (c2, i2)) == 1)) return; if (! expect (c.empty ())) return; } } @@ -211,22 +211,22 @@ public: testcase ("std::set "); testIssueSet > (); - testcase ("std::set "); - testIssueSet > (); + testcase ("std::set "); + testIssueSet > (); #if RIPPLE_ASSETS_ENABLE_STD_HASH testcase ("std::unordered_set "); testIssueSet > (); - testcase ("std::unordered_set "); - testIssueSet > (); + testcase ("std::unordered_set "); + testIssueSet > (); #endif testcase ("hash_set "); testIssueSet > (); - testcase ("hash_set "); - testIssueSet > (); + testcase ("hash_set "); + testIssueSet > (); } void testIssueMaps () @@ -234,28 +234,28 @@ public: testcase ("std::map "); testIssueMap > (); - testcase ("std::map "); - testIssueMap > (); + testcase ("std::map "); + testIssueMap > (); #if RIPPLE_ASSETS_ENABLE_STD_HASH testcase ("std::unordered_map "); testIssueMap > (); - testcase ("std::unordered_map "); - testIssueMap > (); + testcase ("std::unordered_map "); + testIssueMap > (); testcase ("hash_map "); testIssueMap > (); - testcase ("hash_map "); - testIssueMap > (); + testcase ("hash_map "); + testIssueMap > (); #endif } //-------------------------------------------------------------------------- - // Comparison, hash tests for BookType + // Comparison, hash tests for Book template void testBook () { @@ -320,10 +320,10 @@ public: AccountID const i1 (1); Currency const c2 (2); AccountID const i2 (2); - IssueRef const a1 (c1, i1); - IssueRef const a2 (c2, i2); - BookRef const b1 (a1, a2); - BookRef const b2 (a2, a1); + Issue const a1 (c1, i1); + Issue const a2 (c2, i2); + Book const b1 (a1, a2); + Book const b2 (a2, a1); { Set c; @@ -347,9 +347,9 @@ public: c.insert (b2); if (! expect (c.size () == 2)) return; - if (! expect (c.erase (BookRef (a1, a1)) == 0)) return; - if (! expect (c.erase (BookRef (a1, a2)) == 1)) return; - if (! expect (c.erase (BookRef (a2, a1)) == 1)) return; + if (! expect (c.erase (Book (a1, a1)) == 0)) return; + if (! expect (c.erase (Book (a1, a2)) == 1)) return; + if (! expect (c.erase (Book (a2, a1)) == 1)) return; if (! expect (c.empty ())) return; #if STL_SET_HAS_EMPLACE @@ -368,13 +368,13 @@ public: AccountID const i1 (1); Currency const c2 (2); AccountID const i2 (2); - IssueRef const a1 (c1, i1); - IssueRef const a2 (c2, i2); - BookRef const b1 (a1, a2); - BookRef const b2 (a2, a1); + Issue const a1 (c1, i1); + Issue const a2 (c2, i2); + Book const b1 (a1, a2); + Book const b2 (a2, a1); //typename Map::value_type value_type; - //std::pair value_type; + //std::pair value_type; { Map c; @@ -402,9 +402,9 @@ public: c.insert (std::make_pair (b2, 1)); if (! expect (c.size () == 2)) return; - if (! expect (c.erase (BookRef (a1, a1)) == 0)) return; - if (! expect (c.erase (BookRef (a1, a2)) == 1)) return; - if (! expect (c.erase (BookRef (a2, a1)) == 1)) return; + if (! expect (c.erase (Book (a1, a1)) == 0)) return; + if (! expect (c.erase (Book (a1, a2)) == 1)) return; + if (! expect (c.erase (Book (a2, a1)) == 1)) return; if (! expect (c.empty ())) return; } } @@ -414,22 +414,22 @@ public: testcase ("std::set "); testBookSet > (); - testcase ("std::set "); - testBookSet > (); + testcase ("std::set "); + testBookSet > (); #if RIPPLE_ASSETS_ENABLE_STD_HASH testcase ("std::unordered_set "); testBookSet > (); - testcase ("std::unordered_set "); - testBookSet > (); + testcase ("std::unordered_set "); + testBookSet > (); #endif testcase ("hash_set "); testBookSet > (); - testcase ("hash_set "); - testBookSet > (); + testcase ("hash_set "); + testBookSet > (); } void testBookMaps () @@ -437,21 +437,21 @@ public: testcase ("std::map "); testBookMap > (); - testcase ("std::map "); - testBookMap > (); + testcase ("std::map "); + testBookMap > (); #if RIPPLE_ASSETS_ENABLE_STD_HASH testcase ("std::unordered_map "); testBookMap > (); - testcase ("std::unordered_map "); - testBookMap > (); + testcase ("std::unordered_map "); + testBookMap > (); testcase ("hash_map "); testBookMap > (); - testcase ("hash_map "); - testBookMap > (); + testcase ("hash_map "); + testBookMap > (); #endif } @@ -468,10 +468,10 @@ public: // --- testcase ("Issue"); - testIssueType (); + testIssue (); - testcase ("IssueRef"); - testIssueType (); + testcase ("Issue"); + testIssue (); testIssueSets (); testIssueMaps (); @@ -481,8 +481,8 @@ public: testcase ("Book"); testBook (); - testcase ("BookRef"); - testBook (); + testcase ("Book"); + testBook (); testBookSets (); testBookMaps (); diff --git a/src/ripple/unity/protocol.cpp b/src/ripple/unity/protocol.cpp index eb69f77605..982460800f 100644 --- a/src/ripple/unity/protocol.cpp +++ b/src/ripple/unity/protocol.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -27,6 +28,7 @@ #include #include #include +#include #include #include #include