mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-23 15:10:34 +00:00
43 lines
834 B
C++
43 lines
834 B
C++
#pragma once
|
|
|
|
#include <xrpl/beast/insight/HookImpl.h>
|
|
|
|
#include <memory>
|
|
#include <utility>
|
|
|
|
namespace beast::insight {
|
|
|
|
/**
|
|
* A reference to a handler for performing polled collection.
|
|
*/
|
|
class Hook final
|
|
{
|
|
public:
|
|
/**
|
|
* Create a null hook.
|
|
* A null hook has no associated handler.
|
|
*/
|
|
Hook() = default;
|
|
|
|
/**
|
|
* Create a hook referencing the specified implementation.
|
|
* Normally this won't be called directly. Instead, call the appropriate
|
|
* factory function in the Collector interface.
|
|
* @see Collector.
|
|
*/
|
|
explicit Hook(std::shared_ptr<HookImpl> impl) : impl_(std::move(impl))
|
|
{
|
|
}
|
|
|
|
[[nodiscard]] std::shared_ptr<HookImpl> const&
|
|
impl() const
|
|
{
|
|
return impl_;
|
|
}
|
|
|
|
private:
|
|
std::shared_ptr<HookImpl> impl_;
|
|
};
|
|
|
|
} // namespace beast::insight
|