Remove unneeded and unused base classes in insight

This commit is contained in:
Howard Hinnant
2019-07-01 10:22:42 -04:00
committed by Nik Bougalis
parent 28b942b186
commit 4ff0f482c3
14 changed files with 15 additions and 118 deletions

View File

@@ -1,41 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_INSIGHT_BASE_H_INCLUDED
#define BEAST_INSIGHT_BASE_H_INCLUDED
#include <memory>
namespace beast {
namespace insight {
/** Base for all metrics and hooks. */
class Base
{
public:
virtual ~Base () = 0;
Base() = default;
Base(Base const&) = default;
Base& operator=(Base const&) = default;
};
}
}
#endif

View File

@@ -1,43 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_INSIGHT_BASEIMPL_H_INCLUDED
#define BEAST_INSIGHT_BASEIMPL_H_INCLUDED
#include <chrono>
#include <cstdint>
#include <functional>
#include <memory>
namespace beast {
namespace insight {
/** Base for all metrics and hook implementations. */
class BaseImpl
{
public:
using ptr = std::shared_ptr <BaseImpl>;
virtual ~BaseImpl () = 0;
};
}
}
#endif

View File

@@ -20,7 +20,6 @@
#ifndef BEAST_INSIGHT_COUNTER_H_INCLUDED
#define BEAST_INSIGHT_COUNTER_H_INCLUDED
#include <ripple/beast/insight/Base.h>
#include <ripple/beast/insight/CounterImpl.h>
#include <memory>
@@ -36,7 +35,7 @@ namespace insight {
This is a lightweight reference wrapper which is cheap to copy and assign.
When the last reference goes away, the metric is no longer collected.
*/
class Counter : public Base
class Counter final
{
public:
using value_type = CounterImpl::value_type;
@@ -108,13 +107,6 @@ public:
increment (-1);
return *this;
}
/** @} */
std::shared_ptr <CounterImpl> const&
impl () const
{
return m_impl;
}
private:
std::shared_ptr <CounterImpl> m_impl;

View File

@@ -20,7 +20,8 @@
#ifndef BEAST_INSIGHT_COUNTERIMPL_H_INCLUDED
#define BEAST_INSIGHT_COUNTERIMPL_H_INCLUDED
#include <ripple/beast/insight/BaseImpl.h>
#include <cstdint>
#include <memory>
namespace beast {
namespace insight {
@@ -29,7 +30,6 @@ class Counter;
class CounterImpl
: public std::enable_shared_from_this <CounterImpl>
, public BaseImpl
{
public:
using value_type = std::int64_t;

View File

@@ -20,7 +20,6 @@
#ifndef BEAST_INSIGHT_EVENT_H_INCLUDED
#define BEAST_INSIGHT_EVENT_H_INCLUDED
#include <ripple/beast/insight/Base.h>
#include <ripple/beast/insight/EventImpl.h>
#include <ripple/basics/date.h>
@@ -40,7 +39,7 @@ namespace insight {
This is a lightweight reference wrapper which is cheap to copy and assign.
When the last reference goes away, the metric is no longer collected.
*/
class Event : public Base
class Event final
{
public:
using value_type = EventImpl::value_type;

View File

@@ -20,7 +20,8 @@
#ifndef BEAST_INSIGHT_EVENTIMPL_H_INCLUDED
#define BEAST_INSIGHT_EVENTIMPL_H_INCLUDED
#include <ripple/beast/insight/BaseImpl.h>
#include <chrono>
#include <memory>
namespace beast {
namespace insight {
@@ -29,7 +30,6 @@ class Event;
class EventImpl
: public std::enable_shared_from_this <EventImpl>
, public BaseImpl
{
public:
using value_type = std::chrono::milliseconds;

View File

@@ -20,7 +20,6 @@
#ifndef BEAST_INSIGHT_GAUGE_H_INCLUDED
#define BEAST_INSIGHT_GAUGE_H_INCLUDED
#include <ripple/beast/insight/Base.h>
#include <ripple/beast/insight/GaugeImpl.h>
#include <memory>
@@ -37,7 +36,7 @@ namespace insight {
This is a lightweight reference wrapper which is cheap to copy and assign.
When the last reference goes away, the metric is no longer collected.
*/
class Gauge : public Base
class Gauge final
{
public:
using value_type = GaugeImpl::value_type;

View File

@@ -20,7 +20,8 @@
#ifndef BEAST_INSIGHT_GAUGEIMPL_H_INCLUDED
#define BEAST_INSIGHT_GAUGEIMPL_H_INCLUDED
#include <ripple/beast/insight/BaseImpl.h>
#include <cstdint>
#include <memory>
namespace beast {
namespace insight {
@@ -29,7 +30,6 @@ class Gauge;
class GaugeImpl
: public std::enable_shared_from_this <GaugeImpl>
, public BaseImpl
{
public:
using value_type = std::uint64_t;

View File

@@ -20,7 +20,6 @@
#ifndef BEAST_INSIGHT_HOOK_H_INCLUDED
#define BEAST_INSIGHT_HOOK_H_INCLUDED
#include <ripple/beast/insight/Base.h>
#include <ripple/beast/insight/HookImpl.h>
#include <memory>
@@ -29,7 +28,7 @@ namespace beast {
namespace insight {
/** A reference to a handler for performing polled collection. */
class Hook : public Base
class Hook final
{
public:
/** Create a null hook.

View File

@@ -20,14 +20,14 @@
#ifndef BEAST_INSIGHT_HOOKIMPL_H_INCLUDED
#define BEAST_INSIGHT_HOOKIMPL_H_INCLUDED
#include <ripple/beast/insight/BaseImpl.h>
#include <functional>
#include <memory>
namespace beast {
namespace insight {
class HookImpl
: public std::enable_shared_from_this <HookImpl>
, public BaseImpl
{
public:
using HandlerType = std::function <void (void)>;

View File

@@ -22,7 +22,6 @@
#include <memory>
#include <ripple/beast/insight/Base.h>
#include <ripple/beast/insight/MeterImpl.h>
namespace beast {
@@ -35,7 +34,7 @@ namespace insight {
This is a lightweight reference wrapper which is cheap to copy and assign.
When the last reference goes away, the metric is no longer collected.
*/
class Meter : public Base
class Meter final
{
public:
using value_type = MeterImpl::value_type;

View File

@@ -20,7 +20,8 @@
#ifndef BEAST_INSIGHT_METERIMPL_H_INCLUDED
#define BEAST_INSIGHT_METERIMPL_H_INCLUDED
#include <ripple/beast/insight/BaseImpl.h>
#include <cstdint>
#include <memory>
namespace beast {
namespace insight {
@@ -29,7 +30,6 @@ class Meter;
class MeterImpl
: public std::enable_shared_from_this <MeterImpl>
, public BaseImpl
{
public:
using value_type = std::uint64_t;

View File

@@ -33,7 +33,6 @@ class GroupImp
, public Group
{
public:
using Items = std::vector <std::shared_ptr <BaseImpl>>;
std::string const m_name;
Collector::ptr m_collector;

View File

@@ -17,8 +17,6 @@
*/
//==============================================================================
#include <ripple/beast/insight/Base.h>
#include <ripple/beast/insight/BaseImpl.h>
#include <ripple/beast/insight/CounterImpl.h>
#include <ripple/beast/insight/EventImpl.h>
#include <ripple/beast/insight/GaugeImpl.h>
@@ -27,10 +25,6 @@
namespace beast {
namespace insight {
Base::~Base() = default;
BaseImpl::~BaseImpl() = default;
CounterImpl::~CounterImpl() = default;
EventImpl::~EventImpl() = default;