mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Remove boost::hash_value() overloads.
This addresses https://ripplelabs.atlassian.net/browse/RIPD-102
This commit is contained in:
committed by
Nik Bougalis
parent
61f114e655
commit
fac82204b6
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{B7F39ECD-473C-484D-BC34-31F8362506A5}</ProjectGuid>
|
||||
<ProjectGuid>{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>RippleD</RootNamespace>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
@@ -3383,9 +3383,6 @@
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\UintTypes.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\base_uint.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\strHex.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
@@ -4106,4 +4103,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -4647,9 +4647,6 @@
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\UintTypes.cpp">
|
||||
<Filter>ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\base_uint.cpp">
|
||||
<Filter>ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\strHex.cpp">
|
||||
<Filter>ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -702,16 +702,6 @@ struct uhash
|
||||
}
|
||||
};
|
||||
|
||||
struct call_hash_value
|
||||
{
|
||||
template <class T>
|
||||
std::size_t
|
||||
operator()(T const& t) const noexcept
|
||||
{
|
||||
return hash_value(t);
|
||||
}
|
||||
};
|
||||
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
|
||||
@@ -131,8 +131,6 @@ hash_append (Hasher& h, URL const& url)
|
||||
hash_append (h, url.toString());
|
||||
}
|
||||
|
||||
extern std::size_t hash_value (beast::URL const& url);
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -143,7 +141,7 @@ template <>
|
||||
struct hash <beast::URL>
|
||||
{
|
||||
std::size_t operator() (beast::URL const& v) const
|
||||
{ return beast::hash_value (v); }
|
||||
{ return v.toString().hash(); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -164,14 +164,4 @@ std::ostream& operator<< (std::ostream &os, URL const& url)
|
||||
return os;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
std::size_t hash_value (URL const& v)
|
||||
{
|
||||
return std::size_t (v.toString().hash());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// boost::hash support
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <beast/net/IPAddressV6.h>
|
||||
#include <beast/container/hash_append.h>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <ios>
|
||||
#include <string>
|
||||
@@ -277,16 +279,6 @@ is_public (Address const& addr)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** boost::hash support. */
|
||||
inline
|
||||
std::size_t
|
||||
hash_value (Address const& addr)
|
||||
{
|
||||
return (addr.is_v4 ())
|
||||
? hash_value (addr.to_v4())
|
||||
: hash_value (addr.to_v6());
|
||||
}
|
||||
|
||||
/** Returns the address represented as a string. */
|
||||
inline std::string to_string (Address const& addr)
|
||||
{
|
||||
@@ -337,7 +329,19 @@ struct hash <beast::IP::Address>
|
||||
std::size_t
|
||||
operator() (beast::IP::Address const& addr) const
|
||||
{
|
||||
return hash_value (addr);
|
||||
return beast::uhash<>{} (addr);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace boost {
|
||||
template <>
|
||||
struct hash <beast::IP::Address>
|
||||
{
|
||||
std::size_t
|
||||
operator() (beast::IP::Address const& addr) const
|
||||
{
|
||||
return beast::uhash<>{} (addr);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <beast/container/hash_append.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <ios>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -164,10 +165,6 @@ bool is_public (AddressV4 const& addr);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** boost::hash support. */
|
||||
inline std::size_t hash_value (AddressV4 const& addr)
|
||||
{ return addr.value; }
|
||||
|
||||
/** Returns the address represented as a string. */
|
||||
std::string to_string (AddressV4 const& addr);
|
||||
|
||||
@@ -197,7 +194,7 @@ template <>
|
||||
struct hash <beast::IP::AddressV4>
|
||||
{
|
||||
std::size_t operator() (beast::IP::AddressV4 const& addr) const
|
||||
{ return hash_value (addr); }
|
||||
{ return addr.value; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <ios>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -78,10 +79,6 @@ hash_append(Hasher&, AddressV6 const&)
|
||||
assert(false);
|
||||
}
|
||||
|
||||
/** boost::hash support. */
|
||||
inline std::size_t hash_value (AddressV6 const&)
|
||||
{ assert(false); return 0; }
|
||||
|
||||
/** Returns the address represented as a string. */
|
||||
std::string to_string (AddressV6 const& addr);
|
||||
|
||||
@@ -104,7 +101,7 @@ template <>
|
||||
struct hash <beast::IP::AddressV6>
|
||||
{
|
||||
std::size_t operator() (beast::IP::AddressV6 const& addr) const
|
||||
{ return hash_value (addr); }
|
||||
{ assert(false); return 0; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -132,9 +132,6 @@ inline bool is_public (Endpoint const& endpoint)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** boost::hash support. */
|
||||
std::size_t hash_value (Endpoint const& endpoint);
|
||||
|
||||
/** Returns the endpoint represented as a string. */
|
||||
inline std::string to_string (Endpoint const& endpoint)
|
||||
{ return endpoint.to_string(); }
|
||||
@@ -161,7 +158,17 @@ template <>
|
||||
struct hash <beast::IP::Endpoint>
|
||||
{
|
||||
std::size_t operator() (beast::IP::Endpoint const& endpoint) const
|
||||
{ return hash_value (endpoint); }
|
||||
{ return beast::uhash<>{} (endpoint); }
|
||||
};
|
||||
}
|
||||
|
||||
namespace boost {
|
||||
/** boost::hash support. */
|
||||
template <>
|
||||
struct hash <beast::IP::Endpoint>
|
||||
{
|
||||
std::size_t operator() (beast::IP::Endpoint const& endpoint) const
|
||||
{ return beast::uhash<>{} (endpoint); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -137,15 +137,6 @@ bool operator< (Endpoint const& lhs, Endpoint const& rhs)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
std::size_t hash_value (Endpoint const& endpoint)
|
||||
{
|
||||
std::size_t seed (hash_value (endpoint.address ()));
|
||||
// boost::hash_combine()
|
||||
seed ^= (std::hash <Port> () (endpoint.port ()))
|
||||
+ 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
return seed;
|
||||
}
|
||||
|
||||
std::istream& operator>> (std::istream& is, Endpoint& endpoint)
|
||||
{
|
||||
// VFALCO TODO Support ipv6!
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define RIPPLE_TYPES_CYCLEDSET_H_INCLUDED
|
||||
|
||||
#include <boost/unordered_set.hpp>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -37,6 +38,9 @@ template <class Key,
|
||||
class CycledSet
|
||||
{
|
||||
private:
|
||||
// HH This unordered_set can't be changed from boost until gcc allows for
|
||||
// stateful hash functions (or until rippled eliminates stateful hash
|
||||
// functions).
|
||||
typedef boost::unordered_set<
|
||||
Key, Hash, KeyEqual, Allocator> ContainerType;
|
||||
typedef typename ContainerType::iterator iterator;
|
||||
|
||||
@@ -1496,7 +1496,7 @@ private:
|
||||
}
|
||||
|
||||
// if any peers have taken a contrary position, process disputes
|
||||
boost::unordered_set<uint256> found;
|
||||
ripple::unordered_set<uint256> found;
|
||||
|
||||
for (auto& it : mPeerPositions)
|
||||
{
|
||||
@@ -1899,7 +1899,7 @@ private:
|
||||
|
||||
// Disputed transactions
|
||||
ripple::unordered_map<uint256, DisputedTx::pointer> mDisputes;
|
||||
boost::unordered_set<uint256> mCompares;
|
||||
ripple::unordered_set<uint256> mCompares;
|
||||
|
||||
// Close time estimates
|
||||
std::map<std::uint32_t, int> mCloseTimes;
|
||||
|
||||
@@ -60,10 +60,10 @@ void OrderBookDB::setup (Ledger::ref ledger)
|
||||
}
|
||||
|
||||
static void updateHelper (SLE::ref entry,
|
||||
boost::unordered_set< uint256 >& seen,
|
||||
ripple::unordered_set< uint256 >& seen,
|
||||
ripple::unordered_map< RippleAsset, std::vector<OrderBook::pointer> >& destMap,
|
||||
ripple::unordered_map< RippleAsset, std::vector<OrderBook::pointer> >& sourceMap,
|
||||
boost::unordered_set< RippleAsset >& XRPBooks,
|
||||
ripple::unordered_set< RippleAsset >& XRPBooks,
|
||||
int& books)
|
||||
{
|
||||
if ((entry->getType () == ltDIR_NODE) && (entry->isFieldPresent (sfExchangeRate)) &&
|
||||
@@ -96,10 +96,10 @@ static void updateHelper (SLE::ref entry,
|
||||
|
||||
void OrderBookDB::update (Ledger::pointer ledger)
|
||||
{
|
||||
boost::unordered_set< uint256 > seen;
|
||||
ripple::unordered_set< uint256 > seen;
|
||||
ripple::unordered_map< RippleAsset, std::vector<OrderBook::pointer> > destMap;
|
||||
ripple::unordered_map< RippleAsset, std::vector<OrderBook::pointer> > sourceMap;
|
||||
boost::unordered_set< RippleAsset > XRPBooks;
|
||||
ripple::unordered_set< RippleAsset > XRPBooks;
|
||||
|
||||
WriteLog (lsDEBUG, OrderBookDB) << "OrderBookDB::update>";
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
AssetToOrderBook mDestMap;
|
||||
|
||||
// does an order book to XRP exist
|
||||
boost::unordered_set <RippleAsset> mXRPBooks;
|
||||
ripple::unordered_set <RippleAsset> mXRPBooks;
|
||||
|
||||
typedef RippleRecursiveMutex LockType;
|
||||
typedef std::lock_guard <LockType> ScopedLockType;
|
||||
|
||||
@@ -31,7 +31,7 @@ protected:
|
||||
|
||||
typedef ripple::unordered_map<uint256, AmendmentState> amendmentMap_t;
|
||||
typedef std::pair<const uint256, AmendmentState> amendmentIt_t;
|
||||
typedef boost::unordered_set<uint256> amendmentList_t;
|
||||
typedef ripple::unordered_set<uint256> amendmentList_t;
|
||||
|
||||
typedef RippleMutex LockType;
|
||||
typedef std::lock_guard <LockType> ScopedLockType;
|
||||
|
||||
@@ -386,10 +386,10 @@ public:
|
||||
// InfoSub::Source
|
||||
//
|
||||
void subAccount (InfoSub::ref ispListener,
|
||||
const boost::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
std::uint32_t uLedgerIndex, bool rt);
|
||||
void unsubAccount (std::uint64_t uListener,
|
||||
const boost::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
bool rt);
|
||||
|
||||
bool subLedger (InfoSub::ref ispListener, Json::Value& jvResult);
|
||||
@@ -2617,7 +2617,7 @@ void NetworkOPsImp::pubAccountTransaction (Ledger::ref lpCurrent, const Accepted
|
||||
//
|
||||
|
||||
void NetworkOPsImp::subAccount (InfoSub::ref isrListener,
|
||||
const boost::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
std::uint32_t uLedgerIndex, bool rt)
|
||||
{
|
||||
SubInfoMapType& subMap = rt ? mSubRTAccount : mSubAccount;
|
||||
@@ -2653,7 +2653,7 @@ void NetworkOPsImp::subAccount (InfoSub::ref isrListener,
|
||||
}
|
||||
|
||||
void NetworkOPsImp::unsubAccount (std::uint64_t uSeq,
|
||||
const boost::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
bool rt)
|
||||
{
|
||||
SubInfoMapType& subMap = rt ? mSubRTAccount : mSubAccount;
|
||||
|
||||
@@ -1025,7 +1025,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
boost::unordered_set<std::string> usUNL;
|
||||
ripple::unordered_set<std::string> usUNL;
|
||||
|
||||
if (!vsnNodes.empty ())
|
||||
{
|
||||
@@ -2025,7 +2025,7 @@ private:
|
||||
|
||||
// XXX Make this faster, make this the contents vector unsigned char or raw public key.
|
||||
// XXX Contents needs to based on score.
|
||||
boost::unordered_set<std::string> mUNL;
|
||||
ripple::unordered_set<std::string> mUNL;
|
||||
|
||||
boost::posix_time::ptime mtpScoreNext; // When to start scoring.
|
||||
boost::posix_time::ptime mtpScoreStart; // Time currently started scoring.
|
||||
|
||||
@@ -114,11 +114,6 @@ void SHAMapNodeID::setMHash () const
|
||||
mHash = h;
|
||||
}
|
||||
|
||||
std::size_t hash_value (const SHAMapNodeID& mn)
|
||||
{
|
||||
return mn.getMHash ();
|
||||
}
|
||||
|
||||
SHAMap::pointer SHAMap::snapShot (bool isMutable)
|
||||
{
|
||||
SHAMap::pointer ret = std::make_shared<SHAMap> (mType,
|
||||
|
||||
@@ -130,8 +130,6 @@ private:
|
||||
void setMHash () const;
|
||||
};
|
||||
|
||||
extern std::size_t hash_value (SHAMapNodeID const& mn);
|
||||
|
||||
inline std::ostream& operator<< (std::ostream& out, SHAMapNodeID const& node)
|
||||
{
|
||||
return out << node.getString ();
|
||||
|
||||
@@ -77,14 +77,4 @@ std::string CBase58Data::ToString () const
|
||||
return Base58::encodeWithCheck (vch);
|
||||
}
|
||||
|
||||
std::size_t hash_value (const CBase58Data& b58)
|
||||
{
|
||||
std::size_t seed = HashMaps::getInstance ().getNonce <size_t> ()
|
||||
+ (b58.nVersion * HashMaps::goldenRatio);
|
||||
|
||||
boost::hash_combine (seed, b58.vchData);
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -96,8 +96,6 @@ public:
|
||||
{
|
||||
beast::hash_append(hasher, value.vchData);
|
||||
}
|
||||
|
||||
friend std::size_t hash_value (const CBase58Data& b58);
|
||||
};
|
||||
|
||||
inline bool
|
||||
@@ -136,8 +134,6 @@ operator>= (CBase58Data const& lhs, CBase58Data const& rhs)
|
||||
return lhs.compare (rhs) >= 0;
|
||||
}
|
||||
|
||||
extern std::size_t hash_value (const CBase58Data& b58);
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -55,11 +55,11 @@ public:
|
||||
public:
|
||||
// VFALCO TODO Rename the 'rt' parameters to something meaningful.
|
||||
virtual void subAccount (ref ispListener,
|
||||
const boost::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
std::uint32_t uLedgerIndex, bool rt) = 0;
|
||||
|
||||
virtual void unsubAccount (std::uint64_t uListener,
|
||||
const boost::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
const ripple::unordered_set<RippleAddress>& vnaAccountIDs,
|
||||
bool rt) = 0;
|
||||
|
||||
// VFALCO TODO Document the bool return value
|
||||
@@ -130,11 +130,11 @@ protected:
|
||||
private:
|
||||
Consumer m_consumer;
|
||||
Source& m_source;
|
||||
boost::unordered_set <RippleAddress> mSubAccountInfo;
|
||||
boost::unordered_set <RippleAddress> mSubAccountTransaction;
|
||||
ripple::unordered_set <RippleAddress> mSubAccountInfo;
|
||||
ripple::unordered_set <RippleAddress> mSubAccountTransaction;
|
||||
std::shared_ptr <PathRequest> mPathRequest;
|
||||
|
||||
std::uint64_t mSeq;
|
||||
std::uint64_t mSeq;
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -142,7 +142,7 @@ Json::Value doSubscribe (RPC::Context& context)
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::unordered_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (context.params_[strAccountsProposed]);
|
||||
ripple::unordered_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (context.params_[strAccountsProposed]);
|
||||
|
||||
if (usnaAccoundIds.empty ())
|
||||
{
|
||||
@@ -163,7 +163,7 @@ Json::Value doSubscribe (RPC::Context& context)
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::unordered_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (context.params_["accounts"]);
|
||||
ripple::unordered_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (context.params_["accounts"]);
|
||||
|
||||
if (usnaAccoundIds.empty ())
|
||||
{
|
||||
|
||||
@@ -88,7 +88,7 @@ Json::Value doUnsubscribe (RPC::Context& context)
|
||||
|
||||
if (context.params_.isMember ("accounts_proposed") || context.params_.isMember ("rt_accounts"))
|
||||
{
|
||||
boost::unordered_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (
|
||||
ripple::unordered_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (
|
||||
context.params_.isMember ("accounts_proposed")
|
||||
? context.params_["accounts_proposed"]
|
||||
: context.params_["rt_accounts"]); // DEPRECATED
|
||||
@@ -105,7 +105,7 @@ Json::Value doUnsubscribe (RPC::Context& context)
|
||||
|
||||
if (context.params_.isMember ("accounts"))
|
||||
{
|
||||
boost::unordered_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (context.params_["accounts"]);
|
||||
ripple::unordered_set<RippleAddress> usnaAccoundIds = RPC::parseAccountIds (context.params_["accounts"]);
|
||||
|
||||
if (usnaAccoundIds.empty ())
|
||||
{
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
namespace ripple {
|
||||
namespace RPC {
|
||||
|
||||
boost::unordered_set<RippleAddress> parseAccountIds (const Json::Value& jvArray)
|
||||
ripple::unordered_set<RippleAddress> parseAccountIds (const Json::Value& jvArray)
|
||||
{
|
||||
boost::unordered_set<RippleAddress> usnaResult;
|
||||
ripple::unordered_set<RippleAddress> usnaResult;
|
||||
|
||||
for (Json::Value::const_iterator it = jvArray.begin (); it != jvArray.end (); it++)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
namespace ripple {
|
||||
namespace RPC {
|
||||
|
||||
boost::unordered_set <RippleAddress> parseAccountIds (const Json::Value& jvArray);
|
||||
ripple::unordered_set <RippleAddress> parseAccountIds (const Json::Value& jvArray);
|
||||
|
||||
} // RPC
|
||||
} // ripple
|
||||
|
||||
@@ -479,9 +479,9 @@ OverlayImpl::onPeerActivated (Peer::ptr const& peer)
|
||||
|
||||
{
|
||||
auto const result (m_publicKeyMap.emplace (
|
||||
boost::unordered::piecewise_construct,
|
||||
boost::make_tuple (peer->getNodePublic()),
|
||||
boost::make_tuple (peer)));
|
||||
std::piecewise_construct,
|
||||
std::make_tuple (peer->getNodePublic()),
|
||||
std::make_tuple (peer)));
|
||||
assert(result.second);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/ssl/context.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include <beast/cxx14/memory.h> // <memory>
|
||||
#include <cassert>
|
||||
@@ -53,7 +52,7 @@ private:
|
||||
typedef std::unordered_map <PeerFinder::Slot::ptr,
|
||||
std::weak_ptr <PeerImp>> PeersBySlot;
|
||||
|
||||
typedef boost::unordered_map <
|
||||
typedef ripple::unordered_map <
|
||||
RippleAddress, Peer::ptr> PeerByPublicKey;
|
||||
|
||||
typedef std::unordered_map <
|
||||
|
||||
@@ -20,6 +20,13 @@
|
||||
#ifndef RIPPLE_TESTOVERLAY_CONNECTIONTYPE_H_INCLUDED
|
||||
#define RIPPLE_TESTOVERLAY_CONNECTIONTYPE_H_INCLUDED
|
||||
|
||||
// HH Todo: Stop the practice of opening a namespace and #include
|
||||
} // namespace ripple
|
||||
|
||||
#include <ripple/common/UnorderedContainers.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
namespace TestOverlay
|
||||
{
|
||||
|
||||
@@ -34,7 +41,7 @@ public:
|
||||
typedef typename State::UniqueID UniqueID;
|
||||
|
||||
typedef std::vector <Message> Messages;
|
||||
typedef boost::unordered_set <UniqueID> MessageTable;
|
||||
typedef ripple::unordered_set <UniqueID> MessageTable;
|
||||
|
||||
/** Create the 'no connection' object. */
|
||||
ConnectionType ()
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
typedef ConnectionType <Config> Connection;
|
||||
typedef std::vector <Connection> Connections;
|
||||
|
||||
typedef boost::unordered_set <UniqueID> MessageTable;
|
||||
typedef ripple::unordered_set <UniqueID> MessageTable;
|
||||
|
||||
explicit PeerType (Network& network)
|
||||
: m_network (network)
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <ripple/types/api/base_uint.h>
|
||||
#include <ripple/types/api/strHex.h>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <beast/container/hardened_hash.h>
|
||||
#include <beast/utility/Zero.h>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
#include <functional>
|
||||
|
||||
using beast::zero;
|
||||
@@ -402,13 +404,6 @@ typedef base_uint<128> uint128;
|
||||
typedef base_uint<160> uint160;
|
||||
typedef base_uint<256> uint256;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
extern std::size_t hash_value (uint128 const&);
|
||||
extern std::size_t hash_value (uint160 const&);
|
||||
extern std::size_t hash_value (uint256 const&);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
inline int compare (
|
||||
base_uint<Bits, Tag> const& a, base_uint<Bits, Tag> const& b)
|
||||
@@ -526,4 +521,21 @@ inline std::ostream& operator<< (
|
||||
|
||||
} // rippled
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
struct hash<ripple::base_uint<Bits, Tag>>
|
||||
{
|
||||
using argument_type = ripple::base_uint<Bits, Tag>;
|
||||
|
||||
std::size_t
|
||||
operator()(argument_type const& u) const
|
||||
{
|
||||
return beast::hardened_hash<argument_type>{}(u);
|
||||
}
|
||||
};
|
||||
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
|
||||
@@ -222,11 +222,11 @@ public:
|
||||
testAssetSet <std::unordered_set <RippleAssetRef>> ();
|
||||
#endif
|
||||
|
||||
testcase ("boost::unordered_set <RippleAsset>");
|
||||
testAssetSet <boost::unordered_set <RippleAsset>> ();
|
||||
testcase ("ripple::unordered_set <RippleAsset>");
|
||||
testAssetSet <ripple::unordered_set <RippleAsset>> ();
|
||||
|
||||
testcase ("boost::unordered_set <RippleAssetRef>");
|
||||
testAssetSet <boost::unordered_set <RippleAssetRef>> ();
|
||||
testcase ("ripple::unordered_set <RippleAssetRef>");
|
||||
testAssetSet <ripple::unordered_set <RippleAssetRef>> ();
|
||||
}
|
||||
|
||||
void testAssetMaps ()
|
||||
@@ -425,11 +425,11 @@ public:
|
||||
testBookSet <std::unordered_set <RippleBookRef>> ();
|
||||
#endif
|
||||
|
||||
testcase ("boost::unordered_set <RippleBook>");
|
||||
testBookSet <boost::unordered_set <RippleBook>> ();
|
||||
testcase ("ripple::unordered_set <RippleBook>");
|
||||
testBookSet <ripple::unordered_set <RippleBook>> ();
|
||||
|
||||
testcase ("boost::unordered_set <RippleBookRef>");
|
||||
testBookSet <boost::unordered_set <RippleBookRef>> ();
|
||||
testcase ("ripple::unordered_set <RippleBookRef>");
|
||||
testBookSet <ripple::unordered_set <RippleBookRef>> ();
|
||||
}
|
||||
|
||||
void testBookMaps ()
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// NIKB TODO having a dependency on HashMaps sucks. Try to remove it and combine
|
||||
// these functions into a single template.
|
||||
|
||||
std::size_t hash_value (uint128 const& u)
|
||||
{
|
||||
std::size_t seed = HashMaps::getInstance ().getNonce <std::size_t> ();
|
||||
|
||||
return beast::hardened_hash<uint128>{seed}(u);
|
||||
}
|
||||
|
||||
std::size_t hash_value (uint160 const& u)
|
||||
{
|
||||
std::size_t seed = HashMaps::getInstance ().getNonce <std::size_t> ();
|
||||
|
||||
return beast::hardened_hash<uint160>{seed}(u);
|
||||
}
|
||||
|
||||
std::size_t hash_value (uint256 const& u)
|
||||
{
|
||||
std::size_t seed = HashMaps::getInstance ().getNonce <size_t> ();
|
||||
|
||||
return beast::hardened_hash<uint256>{seed}(u);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -43,7 +43,6 @@
|
||||
#include <ripple/types/impl/ByteOrder.cpp>
|
||||
#include <ripple/types/impl/RandomNumbers.cpp>
|
||||
#include <ripple/types/impl/strHex.cpp>
|
||||
#include <ripple/types/impl/base_uint.cpp>
|
||||
#include <ripple/types/impl/UintTypes.cpp>
|
||||
#include <ripple/types/impl/RippleIdentifierTests.cpp>
|
||||
#include <ripple/types/impl/RippleAssets.cpp>
|
||||
|
||||
Reference in New Issue
Block a user