mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Per XLS-0095, we are taking steps to rename ripple(d) to xrpl(d). This change specifically removes all copyright notices referencing Ripple, XRPLF, and certain affiliated contributors upon mutual agreement, so the notice in the LICENSE.md file applies throughout. Copyright notices referencing external contributions remain as-is. Duplicate verbiage is also removed.
53 lines
938 B
C++
53 lines
938 B
C++
#ifndef XRPL_RESOURCE_KEY_H_INCLUDED
|
|
#define XRPL_RESOURCE_KEY_H_INCLUDED
|
|
|
|
#include <xrpl/beast/net/IPEndpoint.h>
|
|
#include <xrpl/beast/utility/instrumentation.h>
|
|
#include <xrpl/resource/detail/Kind.h>
|
|
|
|
namespace ripple {
|
|
namespace Resource {
|
|
|
|
// The consumer key
|
|
struct Key
|
|
{
|
|
Kind kind;
|
|
beast::IP::Endpoint address;
|
|
|
|
Key() = delete;
|
|
|
|
Key(Kind k, beast::IP::Endpoint const& addr) : kind(k), address(addr)
|
|
{
|
|
}
|
|
|
|
struct hasher
|
|
{
|
|
std::size_t
|
|
operator()(Key const& v) const
|
|
{
|
|
return m_addr_hash(v.address);
|
|
}
|
|
|
|
private:
|
|
beast::uhash<> m_addr_hash;
|
|
};
|
|
|
|
struct key_equal
|
|
{
|
|
key_equal() = default;
|
|
|
|
bool
|
|
operator()(Key const& lhs, Key const& rhs) const
|
|
{
|
|
return lhs.kind == rhs.kind && lhs.address == rhs.address;
|
|
}
|
|
|
|
private:
|
|
};
|
|
};
|
|
|
|
} // namespace Resource
|
|
} // namespace ripple
|
|
|
|
#endif
|