This is an automated email from the ASF dual-hosted git repository.

bbender pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 35fcb1a  GEODE-7848: Removed inheritance of NonCopyable and 
NonAssignable (#579)
35fcb1a is described below

commit 35fcb1a668e49c029563831922c40baf1cc8ef4a
Author: Blake Bender <[email protected]>
AuthorDate: Thu Mar 5 12:47:36 2020 -0800

    GEODE-7848: Removed inheritance of NonCopyable and NonAssignable (#579)
    
    - replaced with =delete member declarations
---
 cppcache/src/AdminRegion.hpp                  |  9 +++--
 cppcache/src/CacheImpl.hpp                    |  9 ++---
 cppcache/src/ClientMetadata.hpp               |  4 +--
 cppcache/src/ClientMetadataService.hpp        |  5 +--
 cppcache/src/CqService.hpp                    | 11 ++----
 cppcache/src/LRUEntriesMap.hpp                |  7 ++--
 cppcache/src/NonCopyable.hpp                  | 51 ---------------------------
 cppcache/src/PdxType.hpp                      |  8 ++---
 cppcache/src/SerializationRegistry.hpp        |  6 ++--
 cppcache/src/ThinClientPoolDM.cpp             | 12 ++-----
 cppcache/src/ThinClientPoolDM.hpp             |  7 ++--
 cppcache/src/ThinClientRegion.cpp             | 12 +++----
 cppcache/src/statistics/HostStatSampler.hpp   |  2 --
 cppcache/src/statistics/StatArchiveWriter.hpp |  2 --
 14 files changed, 35 insertions(+), 110 deletions(-)

diff --git a/cppcache/src/AdminRegion.hpp b/cppcache/src/AdminRegion.hpp
index 0a9e0dd..da88c00 100644
--- a/cppcache/src/AdminRegion.hpp
+++ b/cppcache/src/AdminRegion.hpp
@@ -26,7 +26,6 @@
 #include <geode/Serializable.hpp>
 
 #include "ErrType.hpp"
-#include "NonCopyable.hpp"
 #include "ReadWriteLock.hpp"
 
 namespace apache {
@@ -45,10 +44,7 @@ class ThinClientBaseDM;
 class TcrConnectionManager;
 class CacheableKey;
 
-class AdminRegion : private NonCopyable,
-                    private NonAssignable,
-                    public std::enable_shared_from_this<AdminRegion> {
- private:
+class AdminRegion : public std::enable_shared_from_this<AdminRegion> {
   ThinClientBaseDM* m_distMngr;
   std::string m_fullPath;
   TcrConnectionManager* m_connectionMgr;
@@ -60,6 +56,9 @@ class AdminRegion : private NonCopyable,
   TcrConnectionManager* getConnectionManager();
 
  public:
+  AdminRegion(const AdminRegion&) = delete;
+  AdminRegion& operator=(const AdminRegion&) = delete;
+
   AdminRegion()
       : m_distMngr(nullptr),
         m_fullPath("/__ADMIN_CLIENT_HEALTH_MONITORING__"),
diff --git a/cppcache/src/CacheImpl.hpp b/cppcache/src/CacheImpl.hpp
index 7ef8036..954a8d5 100644
--- a/cppcache/src/CacheImpl.hpp
+++ b/cppcache/src/CacheImpl.hpp
@@ -35,7 +35,6 @@
 #include "ClientProxyMembershipIDFactory.hpp"
 #include "DistributedSystem.hpp"
 #include "MemberListForVersionStamp.hpp"
-#include "NonCopyable.hpp"
 #include "PdxTypeRegistry.hpp"
 #include "RemoteQueryService.hpp"
 #include "ThreadPool.hpp"
@@ -83,12 +82,10 @@ class TcrConnectionManager;
  *
  */
 
-class APACHE_GEODE_EXPORT CacheImpl : private NonCopyable,
-                                      private NonAssignable {
-  /**
-   * @brief public methods
-   */
+class APACHE_GEODE_EXPORT CacheImpl {
  public:
+  CacheImpl(const CacheImpl&) = delete;
+  CacheImpl& operator=(const CacheImpl&) = delete;
   // added netDown and revive for tests to simulate client crash and network
   // drop
   void netDown();
diff --git a/cppcache/src/ClientMetadata.hpp b/cppcache/src/ClientMetadata.hpp
index 24a9a7c..a8e4e74 100644
--- a/cppcache/src/ClientMetadata.hpp
+++ b/cppcache/src/ClientMetadata.hpp
@@ -27,7 +27,6 @@
 
 #include "BucketServerLocation.hpp"
 #include "FixedPartitionAttributesImpl.hpp"
-#include "NonCopyable.hpp"
 #include "ReadWriteLock.hpp"
 #include "ServerLocation.hpp"
 #include "util/Log.hpp"
@@ -48,7 +47,7 @@ typedef std::vector<std::shared_ptr<BucketServerLocation>>
 typedef std::vector<BucketServerLocationsType> BucketServerLocationsListType;
 typedef std::map<std::string, std::vector<int>> FixedMapType;
 
-class APACHE_GEODE_EXPORT ClientMetadata : public NonAssignable {
+class APACHE_GEODE_EXPORT ClientMetadata {
  private:
   void setPartitionNames();
   std::shared_ptr<CacheableHashSet> m_partitionNames;
@@ -102,6 +101,7 @@ class APACHE_GEODE_EXPORT ClientMetadata : public 
NonAssignable {
     return m_partitionNames;
   }
   ClientMetadata(ClientMetadata& other);
+  ClientMetadata& operator=(const ClientMetadata&) = delete;
   std::vector<std::shared_ptr<BucketServerLocation>> adviseServerLocations(
       int bucketId);
   std::shared_ptr<BucketServerLocation> advisePrimaryServerLocation(
diff --git a/cppcache/src/ClientMetadataService.hpp 
b/cppcache/src/ClientMetadataService.hpp
index 40d47a9..fa51b56 100644
--- a/cppcache/src/ClientMetadataService.hpp
+++ b/cppcache/src/ClientMetadataService.hpp
@@ -39,7 +39,6 @@
 
 #include "AppDomainContext.hpp"
 #include "BucketServerLocation.hpp"
-#include "NonCopyable.hpp"
 #include "ServerLocation.hpp"
 
 namespace apache {
@@ -99,8 +98,10 @@ class PRbuckets {
   void setBucketTimeout(int32_t bucketId) { m_buckets[bucketId].setTimeout(); }
 };
 
-class ClientMetadataService : private NonCopyable, private NonAssignable {
+class ClientMetadataService {
  public:
+  ClientMetadataService(const ClientMetadataService&) = delete;
+  ClientMetadataService& operator=(const ClientMetadataService&) = delete;
   ClientMetadataService() = delete;
   explicit ClientMetadataService(ThinClientPoolDM* pool);
   inline ~ClientMetadataService() noexcept = default;
diff --git a/cppcache/src/CqService.hpp b/cppcache/src/CqService.hpp
index 5fed8de..f260afe 100644
--- a/cppcache/src/CqService.hpp
+++ b/cppcache/src/CqService.hpp
@@ -34,7 +34,6 @@
 #include "CqServiceVsdStats.hpp"
 #include "DistributedSystem.hpp"
 #include "ErrType.hpp"
-#include "NonCopyable.hpp"
 #include "Queue.hpp"
 #include "TcrMessage.hpp"
 #include "util/synchronized_map.hpp"
@@ -53,10 +52,7 @@ class TcrEndpoint;
  *
  */
 class APACHE_GEODE_EXPORT CqService
-    : private NonCopyable,
-      private NonAssignable,
-      public std::enable_shared_from_this<CqService> {
- private:
+    : public std::enable_shared_from_this<CqService> {
   ThinClientBaseDM* m_tccdm;
   statistics::StatisticsFactory* m_statisticsFactory;
   ACE_Semaphore m_notificationSema;
@@ -73,9 +69,8 @@ class APACHE_GEODE_EXPORT CqService
  public:
   typedef std::vector<std::shared_ptr<CqQuery>> query_container_type;
 
-  /**
-   * Constructor.
-   */
+  CqService(const CqService&) = delete;
+  CqService& operator=(const CqService&) = delete;
   CqService(ThinClientBaseDM* tccdm,
             statistics::StatisticsFactory* statisticsFactory);
   ~CqService() noexcept;
diff --git a/cppcache/src/LRUEntriesMap.hpp b/cppcache/src/LRUEntriesMap.hpp
index 9fe5433..d674cff 100644
--- a/cppcache/src/LRUEntriesMap.hpp
+++ b/cppcache/src/LRUEntriesMap.hpp
@@ -30,7 +30,6 @@
 #include "LRUList.hpp"
 #include "LRUMapEntry.hpp"
 #include "MapEntryT.hpp"
-#include "NonCopyable.hpp"
 #include "util/concurrent/spinlock_mutex.hpp"
 
 namespace apache {
@@ -57,9 +56,7 @@ class EvictionController;
  * its constructor and destructor but has no user-written assignment operator.
  * Fix : Make the class Non Assinable
  */
-class APACHE_GEODE_EXPORT LRUEntriesMap : public ConcurrentEntriesMap,
-                                          private NonCopyable,
-                                          private NonAssignable {
+class APACHE_GEODE_EXPORT LRUEntriesMap : public ConcurrentEntriesMap {
  protected:
   LRUAction* m_action;
   LRUList<MapEntryImpl, MapEntryT<LRUMapEntry, 0, 0> > m_lruList;
@@ -73,6 +70,8 @@ class APACHE_GEODE_EXPORT LRUEntriesMap : public 
ConcurrentEntriesMap,
   bool m_heapLRUEnabled;
 
  public:
+  LRUEntriesMap(const LRUEntriesMap&) = delete;
+  LRUEntriesMap& operator=(const LRUEntriesMap&) = delete;
   LRUEntriesMap(ExpiryTaskManager* expiryTaskManager,
                 std::unique_ptr<EntryFactory> entryFactory,
                 RegionInternal* region, const LRUAction::Action& lruAction,
diff --git a/cppcache/src/NonCopyable.hpp b/cppcache/src/NonCopyable.hpp
deleted file mode 100644
index 7dd6cb5..0000000
--- a/cppcache/src/NonCopyable.hpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#ifndef GEODE_NONCOPYABLE_H_
-#define GEODE_NONCOPYABLE_H_
-
-#include <geode/internal/geode_base.hpp>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-class APACHE_GEODE_EXPORT NonCopyable {
- protected:
-  NonCopyable() {}
-  ~NonCopyable() {}
-
- public:
-  NonCopyable(const NonCopyable&) = delete;
-};
-
-class APACHE_GEODE_EXPORT NonAssignable {
- protected:
-  NonAssignable() {}
-  ~NonAssignable() {}
-
- public:
-  const NonAssignable& operator=(const NonAssignable&) = delete;
-};
-
-}  // namespace client
-}  // namespace geode
-}  // namespace apache
-
-#endif  // GEODE_NONCOPYABLE_H_
diff --git a/cppcache/src/PdxType.hpp b/cppcache/src/PdxType.hpp
index b76b824..de24526 100644
--- a/cppcache/src/PdxType.hpp
+++ b/cppcache/src/PdxType.hpp
@@ -31,7 +31,6 @@
 #include <geode/PdxFieldTypes.hpp>
 #include <geode/Serializable.hpp>
 
-#include "NonCopyable.hpp"
 #include "PdxFieldType.hpp"
 #include "ReadWriteLock.hpp"
 
@@ -44,10 +43,7 @@ class PdxType;
 class PdxTypeRegistry;
 
 class PdxType : public internal::DataSerializableInternal,
-                public std::enable_shared_from_this<PdxType>,
-                private NonCopyable,
-                private NonAssignable {
- private:
+                public std::enable_shared_from_this<PdxType> {
   ACE_RW_Thread_Mutex m_lockObj;
 
   static const char* m_javaPdxClass;
@@ -103,6 +99,8 @@ class PdxType : public internal::DataSerializableInternal,
       std::shared_ptr<PdxType> localType);
 
  public:
+  PdxType(const PdxType&) = delete;
+  PdxType& operator=(const PdxType&) = delete;
   PdxType(PdxTypeRegistry& pdxTypeRegistryPtr,
           const std::string& pdxDomainClassName, bool isLocal);
 
diff --git a/cppcache/src/SerializationRegistry.hpp 
b/cppcache/src/SerializationRegistry.hpp
index 232e976..7c692b9 100644
--- a/cppcache/src/SerializationRegistry.hpp
+++ b/cppcache/src/SerializationRegistry.hpp
@@ -40,7 +40,6 @@
 #include <geode/internal/geode_globals.hpp>
 
 #include "MemberListForVersionStamp.hpp"
-#include "NonCopyable.hpp"
 #include "config.h"
 #include "util/concurrent/spinlock_mutex.hpp"
 
@@ -73,8 +72,7 @@ namespace client {
 using internal::DataSerializableInternal;
 using internal::DataSerializablePrimitive;
 
-class TheTypeMap : private NonCopyable {
- private:
+class TheTypeMap {
   std::unordered_map<internal::DSCode, TypeFactoryMethod>
       m_dataSerializablePrimitiveMap;
   std::unordered_map<int32_t, TypeFactoryMethod> m_dataSerializableMap;
@@ -89,7 +87,7 @@ class TheTypeMap : private NonCopyable {
  public:
   std::unordered_map<std::type_index, int32_t> typeToClassId;
 
- public:
+  TheTypeMap(const TheTypeMap&) = delete;
   TheTypeMap() { setup(); }
 
   ~TheTypeMap() noexcept = default;
diff --git a/cppcache/src/ThinClientPoolDM.cpp 
b/cppcache/src/ThinClientPoolDM.cpp
index 91db14c..b9705cd 100644
--- a/cppcache/src/ThinClientPoolDM.cpp
+++ b/cppcache/src/ThinClientPoolDM.cpp
@@ -43,15 +43,7 @@ namespace apache {
 namespace geode {
 namespace client {
 
-/* adongre
- * CID 28730: Other violation (MISSING_COPY)
- * Class "GetAllWork" owns resources that are managed in its constructor and
- * destructor but has no user-written copy constructor.
- * FIX : Make the class NonCopyable
- */
-class GetAllWork : public PooledWork<GfErrType>,
-                   private NonCopyable,
-                   private NonAssignable {
+class GetAllWork : public PooledWork<GfErrType> {
   ThinClientPoolDM* m_poolDM;
   std::shared_ptr<BucketServerLocation> m_serverLocation;
   TcrMessage* m_request;
@@ -68,6 +60,8 @@ class GetAllWork : public PooledWork<GfErrType>,
   const std::shared_ptr<Serializable>& m_aCallbackArgument;
 
  public:
+  GetAllWork(const GetAllWork&) = delete;
+  GetAllWork& operator=(const GetAllWork&) = delete;
   GetAllWork(
       ThinClientPoolDM* poolDM, const std::shared_ptr<Region>& region,
       const std::shared_ptr<BucketServerLocation>& serverLocation,
diff --git a/cppcache/src/ThinClientPoolDM.hpp 
b/cppcache/src/ThinClientPoolDM.hpp
index 702dbf7..32078c3 100644
--- a/cppcache/src/ThinClientPoolDM.hpp
+++ b/cppcache/src/ThinClientPoolDM.hpp
@@ -36,7 +36,6 @@
 
 #include "ExecutionImpl.hpp"
 #include "FairQueue.hpp"
-#include "NonCopyable.hpp"
 #include "PoolAttributes.hpp"
 #include "PoolStatistics.hpp"
 #include "RemoteQueryService.hpp"
@@ -68,10 +67,10 @@ class ClientMetadataService;
 class ThinClientPoolDM
     : public ThinClientBaseDM,
       public Pool,
-      public FairQueue<TcrConnection, ACE_Recursive_Thread_Mutex>,
-      private NonCopyable,
-      private NonAssignable {
+      public FairQueue<TcrConnection, ACE_Recursive_Thread_Mutex> {
  public:
+  ThinClientPoolDM(const ThinClientPoolDM&) = delete;
+  ThinClientPoolDM& operator=(const ThinClientPoolDM&) = delete;
   ThinClientPoolDM(const char* name, std::shared_ptr<PoolAttributes> poolAttrs,
                    TcrConnectionManager& connManager);
 
diff --git a/cppcache/src/ThinClientRegion.cpp 
b/cppcache/src/ThinClientRegion.cpp
index 6143c8c..afefb45 100644
--- a/cppcache/src/ThinClientRegion.cpp
+++ b/cppcache/src/ThinClientRegion.cpp
@@ -54,9 +54,7 @@ static const std::regex PREDICATE_IS_FULL_QUERY_REGEX(
 
 void setThreadLocalExceptionMessage(const char* exMsg);
 
-class PutAllWork : public PooledWork<GfErrType>,
-                   private NonCopyable,
-                   private NonAssignable {
+class PutAllWork : public PooledWork<GfErrType> {
   ThinClientPoolDM* m_poolDM;
   std::shared_ptr<BucketServerLocation> m_serverLocation;
   TcrMessage* m_request;
@@ -76,6 +74,8 @@ class PutAllWork : public PooledWork<GfErrType>,
   // UNUSED const std::shared_ptr<Serializable>& m_aCallbackArgument;
 
  public:
+  PutAllWork(const PutAllWork&) = delete;
+  PutAllWork& operator=(const PutAllWork&) = delete;
   PutAllWork(
       ThinClientPoolDM* poolDM,
       const std::shared_ptr<BucketServerLocation>& serverLocation,
@@ -203,9 +203,7 @@ class PutAllWork : public PooledWork<GfErrType>,
   }
 };
 
-class RemoveAllWork : public PooledWork<GfErrType>,
-                      private NonCopyable,
-                      private NonAssignable {
+class RemoveAllWork : public PooledWork<GfErrType> {
   ThinClientPoolDM* m_poolDM;
   std::shared_ptr<BucketServerLocation> m_serverLocation;
   TcrMessage* m_request;
@@ -223,6 +221,8 @@ class RemoveAllWork : public PooledWork<GfErrType>,
   ChunkedRemoveAllResponse* m_resultCollector;
 
  public:
+  RemoveAllWork(const RemoveAllWork&) = delete;
+  RemoveAllWork& operator=(const RemoveAllWork&) = delete;
   RemoveAllWork(
       ThinClientPoolDM* poolDM,
       const std::shared_ptr<BucketServerLocation>& serverLocation,
diff --git a/cppcache/src/statistics/HostStatSampler.hpp 
b/cppcache/src/statistics/HostStatSampler.hpp
index e3f6a2a..09d8d19 100644
--- a/cppcache/src/statistics/HostStatSampler.hpp
+++ b/cppcache/src/statistics/HostStatSampler.hpp
@@ -51,8 +51,6 @@ namespace geode {
 namespace statistics {
 
 using apache::geode::client::CacheImpl;
-using apache::geode::client::NonAssignable;
-using apache::geode::client::NonCopyable;
 using std::chrono::system_clock;
 
 class StatArchiveWriter;
diff --git a/cppcache/src/statistics/StatArchiveWriter.hpp 
b/cppcache/src/statistics/StatArchiveWriter.hpp
index 8658d7c..3193573 100644
--- a/cppcache/src/statistics/StatArchiveWriter.hpp
+++ b/cppcache/src/statistics/StatArchiveWriter.hpp
@@ -62,8 +62,6 @@ class HostStatSampler;
 
 using apache::geode::client::CacheImpl;
 using apache::geode::client::DataOutput;
-using apache::geode::client::NonAssignable;
-using apache::geode::client::NonCopyable;
 using std::chrono::steady_clock;
 using std::chrono::system_clock;
 

Reply via email to