From 578e66db3e8e34e79c9b13c386413548ef899d54 Mon Sep 17 00:00:00 2001 From: camolezi Date: Tue, 16 Jun 2020 19:29:50 +0200 Subject: [PATCH] deleted the copy constructor and operator instead of using boost --- Utilities/XrdAdaptor/src/QualityMetric.h | 11 ++++++++--- Utilities/XrdAdaptor/src/XrdRequest.h | 6 ++++-- Utilities/XrdAdaptor/src/XrdRequestManager.cc | 7 ++++++- Utilities/XrdAdaptor/src/XrdRequestManager.h | 11 ++++++++--- Utilities/XrdAdaptor/src/XrdSource.cc | 5 ++++- Utilities/XrdAdaptor/src/XrdSource.h | 7 ++++--- 6 files changed, 34 insertions(+), 13 deletions(-) diff --git a/Utilities/XrdAdaptor/src/QualityMetric.h b/Utilities/XrdAdaptor/src/QualityMetric.h index d5460c35c75b2..077520803a0dc 100644 --- a/Utilities/XrdAdaptor/src/QualityMetric.h +++ b/Utilities/XrdAdaptor/src/QualityMetric.h @@ -7,7 +7,6 @@ #include #include "tbb/concurrent_unordered_map.h" -#include #include "FWCore/Utilities/interface/propagate_const.h" #include "FWCore/Utilities/interface/thread_safety_macros.h" @@ -18,7 +17,7 @@ namespace XrdAdaptor { class QualityMetricSource; class QualityMetricUniqueSource; - class QualityMetricWatch : boost::noncopyable { + class QualityMetricWatch { friend class QualityMetricSource; public: @@ -26,6 +25,9 @@ namespace XrdAdaptor { QualityMetricWatch(QualityMetricWatch &&); ~QualityMetricWatch(); + QualityMetricWatch(const QualityMetricWatch &) = delete; + QualityMetricWatch &operator=(const QualityMetricWatch &) = delete; + void swap(QualityMetricWatch &); private: @@ -35,13 +37,16 @@ namespace XrdAdaptor { edm::propagate_const m_parent2; }; - class QualityMetric : boost::noncopyable { + class QualityMetric { friend class QualityMetricWatch; public: QualityMetric(timespec now, int default_value = 260); unsigned get(); + QualityMetric(const QualityMetric &) = delete; + QualityMetric &operator=(const QualityMetric &) = delete; + private: void finishWatch(timespec now, int ms); diff --git a/Utilities/XrdAdaptor/src/XrdRequest.h b/Utilities/XrdAdaptor/src/XrdRequest.h index b1d64135a81de..f9cf81e499eae 100644 --- a/Utilities/XrdAdaptor/src/XrdRequest.h +++ b/Utilities/XrdAdaptor/src/XrdRequest.h @@ -4,7 +4,6 @@ #include #include -#include #include #include "Utilities/StorageFactory/interface/Storage.h" @@ -20,10 +19,13 @@ namespace XrdAdaptor { class XrdReadStatistics; - class ClientRequest : boost::noncopyable, public XrdCl::ResponseHandler { + class ClientRequest : public XrdCl::ResponseHandler { friend class Source; public: + ClientRequest(const ClientRequest &) = delete; + ClientRequest &operator=(const ClientRequest &) = delete; + ClientRequest(RequestManager &manager, void *into, IOSize size, IOOffset off) : m_failure_count(0), m_into(into), m_size(size), m_off(off), m_iolist(nullptr), m_manager(manager) {} diff --git a/Utilities/XrdAdaptor/src/XrdRequestManager.cc b/Utilities/XrdAdaptor/src/XrdRequestManager.cc index 52ede2ee6bf73..3558ca1e4771c 100644 --- a/Utilities/XrdAdaptor/src/XrdRequestManager.cc +++ b/Utilities/XrdAdaptor/src/XrdRequestManager.cc @@ -66,7 +66,7 @@ long long timeDiffMS(const timespec &a, const timespec &b) { * We do not care about the response of sending the monitoring information; * this handler class simply frees any returned buffer to prevent memory leaks. */ -class SendMonitoringInfoHandler : boost::noncopyable, public XrdCl::ResponseHandler { +class SendMonitoringInfoHandler : public XrdCl::ResponseHandler { void HandleResponse(XrdCl::XRootDStatus *status, XrdCl::AnyObject *response) override { if (response) { XrdCl::Buffer *buffer = nullptr; @@ -78,6 +78,11 @@ class SendMonitoringInfoHandler : boost::noncopyable, public XrdCl::ResponseHand delete response; delete status; } + +public: + SendMonitoringInfoHandler(const SendMonitoringInfoHandler &) = delete; + SendMonitoringInfoHandler &operator=(const SendMonitoringInfoHandler &) = delete; + SendMonitoringInfoHandler() = default; }; CMS_THREAD_SAFE SendMonitoringInfoHandler nullHandler; diff --git a/Utilities/XrdAdaptor/src/XrdRequestManager.h b/Utilities/XrdAdaptor/src/XrdRequestManager.h index a622be01eaf61..b9492589cefdd 100644 --- a/Utilities/XrdAdaptor/src/XrdRequestManager.h +++ b/Utilities/XrdAdaptor/src/XrdRequestManager.h @@ -8,7 +8,6 @@ #include #include -#include #include "tbb/concurrent_unordered_set.h" #include "FWCore/Utilities/interface/EDMException.h" @@ -42,8 +41,11 @@ namespace XrdAdaptor { uint16_t m_code; }; - class RequestManager : boost::noncopyable { + class RequestManager { public: + RequestManager(const RequestManager &) = delete; + RequestManager &operator=(const RequestManager &) = delete; + static const unsigned int XRD_DEFAULT_TIMEOUT = 3 * 60; virtual ~RequestManager() = default; @@ -232,8 +234,11 @@ namespace XrdAdaptor { std::atomic m_excluded_active_count; - class OpenHandler : boost::noncopyable, public XrdCl::ResponseHandler { + class OpenHandler : public XrdCl::ResponseHandler { public: + OpenHandler(const OpenHandler &) = delete; + OpenHandler &operator=(const OpenHandler &) = delete; + static std::shared_ptr getInstance(std::weak_ptr manager) { OpenHandler *instance_ptr = new OpenHandler(manager); std::shared_ptr instance(instance_ptr); diff --git a/Utilities/XrdAdaptor/src/XrdSource.cc b/Utilities/XrdAdaptor/src/XrdSource.cc index 420ea64d8ff87..3d504bd61fe0f 100644 --- a/Utilities/XrdAdaptor/src/XrdSource.cc +++ b/Utilities/XrdAdaptor/src/XrdSource.cc @@ -36,8 +36,11 @@ using namespace XrdAdaptor; // inactive anyway!) can even timeout. Rather than wait around for // a few minutes in the main thread, this class asynchronously closes // and deletes the XrdCl::File -class DelayedClose : boost::noncopyable, public XrdCl::ResponseHandler { +class DelayedClose : public XrdCl::ResponseHandler { public: + DelayedClose(const DelayedClose &) = delete; + DelayedClose &operator=(const DelayedClose &) = delete; + DelayedClose(std::shared_ptr fh, const std::string &id, const std::string &site) : m_fh(std::move(fh)), m_id(id), m_site(site) { if (m_fh && m_fh->IsOpen()) { diff --git a/Utilities/XrdAdaptor/src/XrdSource.h b/Utilities/XrdAdaptor/src/XrdSource.h index 1dc7b9325f508..b3c840c3ea877 100644 --- a/Utilities/XrdAdaptor/src/XrdSource.h +++ b/Utilities/XrdAdaptor/src/XrdSource.h @@ -7,8 +7,6 @@ #include #include -#include - #include "QualityMetric.h" namespace XrdCl { @@ -22,8 +20,11 @@ namespace XrdAdaptor { class XrdSiteStatistics; class XrdStatisticsService; - class Source : public std::enable_shared_from_this, boost::noncopyable { + class Source : public std::enable_shared_from_this { public: + Source(const Source &) = delete; + Source &operator=(const Source &) = delete; + Source(timespec now, std::unique_ptr fileHandle, const std::string &exclude); ~Source();