Files
rippled/include/xrpl/resource/detail/Key.h
Bart 1eb0fdac65 refactor: Rename ripple namespace to xrpl (#5982)
This change renames all occurrences of `namespace ripple` and `ripple::` to `namespace xrpl` and `xrpl::`, respectively, as well as the names of test suites. It also provides a script to allow developers to replicate the changes in their local branch or fork to avoid conflicts.
2025-12-11 16:51:49 +00:00

53 lines
934 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 xrpl {
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 xrpl
#endif