geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject [03/23] geode-native git commit: GEODE-2741: Code cleanup to move to std::shared_ptr
Date Tue, 06 Jun 2017 17:56:29 GMT
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/Utils.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Utils.hpp b/src/cppcache/src/Utils.hpp
index 4ebb78b..392bd6d 100644
--- a/src/cppcache/src/Utils.hpp
+++ b/src/cppcache/src/Utils.hpp
@@ -69,11 +69,12 @@ class CPPCACHE_EXPORT Utils {
 #ifdef __GNUC__
   inline static char* _gnuDemangledName(const char* typeIdName, size_t& len) {
     int status;
-    char* demangledName = abi::__cxa_demangle(typeIdName, NULL, &len, &status);
-    if (status == 0 && demangledName != NULL) {
+    char* demangledName =
+        abi::__cxa_demangle(typeIdName, nullptr, &len, &status);
+    if (status == 0 && demangledName != nullptr) {
       return demangledName;
     }
-    return NULL;
+    return nullptr;
   }
 #endif
 
@@ -82,7 +83,7 @@ class CPPCACHE_EXPORT Utils {
 #ifdef __GNUC__
     size_t len;
     char* demangledName = _gnuDemangledName(typeIdName, len);
-    if (demangledName != NULL) {
+    if (demangledName != nullptr) {
       str.append(demangledName, len);
       free(demangledName);
       return;
@@ -95,7 +96,7 @@ class CPPCACHE_EXPORT Utils {
 #ifdef __GNUC__
     size_t len;
     char* demangledName = _gnuDemangledName(typeIdName, len);
-    if (demangledName != NULL) {
+    if (demangledName != nullptr) {
       return CacheableString::createNoCopy(demangledName, len);
     }
 #endif
@@ -147,7 +148,7 @@ class CPPCACHE_EXPORT Utils {
   }
 
   inline static int64_t startStatOpTime() {
-    if (DistributedSystem::getSystemProperties() != NULL) {
+    if (DistributedSystem::getSystemProperties() != nullptr) {
       return (DistributedSystem::getSystemProperties()
                   ->getEnableTimeStatistics())
                  ? NanoTimer::now()
@@ -181,7 +182,7 @@ class CPPCACHE_EXPORT Utils {
 
   inline static void updateStatOpTime(statistics::Statistics* m_regionStats,
                                       int32_t statId, int64_t start) {
-    if (DistributedSystem::getSystemProperties() != NULL) {
+    if (DistributedSystem::getSystemProperties() != nullptr) {
       if (DistributedSystem::getSystemProperties()->getEnableTimeStatistics()) {
         m_regionStats->incLong(statId, startStatOpTime() - start);
       }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/VectorOfSharedBase.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/VectorOfSharedBase.cpp b/src/cppcache/src/VectorOfSharedBase.cpp
index 8621bcd..dbc6df7 100644
--- a/src/cppcache/src/VectorOfSharedBase.cpp
+++ b/src/cppcache/src/VectorOfSharedBase.cpp
@@ -119,28 +119,28 @@ VectorOfSharedBase::Iterator VectorOfSharedBase::end() const {
 }
 
 /** Create an empty vector. */
-VectorOfSharedBase::VectorOfSharedBase() : m_stdvector(NULL) {
+VectorOfSharedBase::VectorOfSharedBase() : m_stdvector(nullptr) {
   m_stdvector = new VofSBP();
 }
 
 /** Create a vector with n elements allocated */
-VectorOfSharedBase::VectorOfSharedBase(int32_t n) : m_stdvector(NULL) {
+VectorOfSharedBase::VectorOfSharedBase(int32_t n) : m_stdvector(nullptr) {
   m_stdvector = new VofSBP(n);
 }
 
 /** Create a vector with n copies of t */
 VectorOfSharedBase::VectorOfSharedBase(int32_t n, const SharedBasePtr& t)
-    : m_stdvector(NULL) {
+    : m_stdvector(nullptr) {
   m_stdvector = new VofSBP(n, t);
 }
 
 /** copy constructor */
 VectorOfSharedBase::VectorOfSharedBase(const VectorOfSharedBase& other)
-    : m_stdvector(NULL) {
+    : m_stdvector(nullptr) {
   m_stdvector = new VofSBP(*(other.m_stdvector));
 }
 
-/** destructor, sets all SharedPtr elements to NULL */
+/** destructor, sets all SharedPtr elements to nullptr */
 VectorOfSharedBase::~VectorOfSharedBase() {
   m_stdvector->clear();
   delete m_stdvector;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/VersionStamp.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/VersionStamp.cpp b/src/cppcache/src/VersionStamp.cpp
index 7abbb85..6c7becc 100644
--- a/src/cppcache/src/VersionStamp.cpp
+++ b/src/cppcache/src/VersionStamp.cpp
@@ -69,7 +69,7 @@ GfErrType VersionStamp::processVersionTag(const RegionInternal* region,
   std::string keystr(key, keyLen);
 
   if (nullptr == tag) {
-    LOGERROR("Cannot process version tag as it is NULL.");
+    LOGERROR("Cannot process version tag as it is nullptr.");
     return GF_CACHE_ILLEGAL_STATE_EXCEPTION;
   }
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/VersionedCacheableObjectPartList.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/VersionedCacheableObjectPartList.cpp b/src/cppcache/src/VersionedCacheableObjectPartList.cpp
index 3bbdfbc..94ec919 100644
--- a/src/cppcache/src/VersionedCacheableObjectPartList.cpp
+++ b/src/cppcache/src/VersionedCacheableObjectPartList.cpp
@@ -59,26 +59,26 @@ void VersionedCacheableObjectPartList::readObjectPart(int32_t index,
       const char* exMsg = exMsgPtr->asChar();
       if (strstr(exMsg,
                  "org.apache.geode.security."
-                 "NotAuthorizedException") != NULL) {
+                 "NotAuthorizedException") != nullptr) {
         ex = std::make_shared<NotAuthorizedException>(
             "Authorization exception at server:", exMsg);
       } else {
         ex = std::make_shared<CacheServerException>(
             "Exception at remote server:", exMsg);
       }
-      m_exceptions->insert(keyPtr, ex);
+      m_exceptions->emplace(keyPtr, ex);
     }
   } else if (m_serializeValues) {
     // read length
     int32_t skipLen;
     input.readArrayLen(&skipLen);
-    uint8_t* bytes = NULL;
+    uint8_t* bytes = nullptr;
     if (skipLen > 0) {
       // readObject
       bytes = new uint8_t[skipLen];
       input.readBytesOnly(bytes, skipLen);
     }
-    m_values->insert(keyPtr, CacheableBytes::create(bytes, skipLen));
+    m_values->emplace(keyPtr, CacheableBytes::create(bytes, skipLen));
 
     /* adongre
      * CID 29377: Resource leak (RESOURCE_LEAK)Calling allocation function
@@ -92,7 +92,7 @@ void VersionedCacheableObjectPartList::readObjectPart(int32_t index,
     // index
     // readObject
     input.readObject(value);
-    if (m_values != nullptr) m_values->insert(keyPtr, value);
+    if (m_values) m_values->emplace(keyPtr, value);
   }
 }
 
@@ -111,7 +111,7 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
   CacheableStringPtr exMsgPtr;
   int32_t len = 0;
   bool valuesNULL = false;
-  int32_t keysOffset = (m_keysOffset != NULL ? *m_keysOffset : 0);
+  int32_t keysOffset = (m_keysOffset != nullptr ? *m_keysOffset : 0);
   // bool readObjLen = false;
   // int32_t lenOfObjects = 0;
   if (m_values == nullptr) {
@@ -123,7 +123,7 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
     LOGDEBUG(
         "VersionedCacheableObjectPartList::fromData: Looks like message has no "
         "data. Returning,");
-    return NULL;
+    return nullptr;
   }
 
   auto localKeys = std::make_shared<VectorOfCacheableKey>();
@@ -140,8 +140,8 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
       m_tempKeys->push_back(key);
       localKeys->push_back(key);
     }
-  } else if (m_keys != NULL) {
-    LOGDEBUG("VersionedCacheableObjectPartList::fromData: m_keys NOT NULL");
+  } else if (m_keys != nullptr) {
+    LOGDEBUG("VersionedCacheableObjectPartList::fromData: m_keys NOT nullptr");
     /*
        if (m_hasKeys) {
        int64_t tempLen;
@@ -159,13 +159,13 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
        }
        }*/
   } else if (hasObjects) {
-    if (m_keys == NULL && m_resultKeys == nullptr) {
+    if (m_keys == nullptr && m_resultKeys == nullptr) {
       LOGERROR(
           "VersionedCacheableObjectPartList::fromData: Exception: hasObjects "
-          "is true and m_keys and m_resultKeys are also NULL");
+          "is true and m_keys and m_resultKeys are also nullptr");
       throw FatalInternalException(
           "VersionedCacheableObjectPartList: "
-          "hasObjects is true and m_keys is also NULL");
+          "hasObjects is true and m_keys is also nullptr");
     } else {
       LOGDEBUG(
           "VersionedCacheableObjectPartList::fromData m_keys or m_resultKeys "
@@ -174,7 +174,7 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
   } else {
     LOGDEBUG(
         "VersionedCacheableObjectPartList::fromData m_hasKeys, m_keys, "
-        "hasObjects all are NULL");
+        "hasObjects all are nullptr");
   }  // m_hasKeys else ends here
 
   if (hasObjects) {
@@ -183,13 +183,14 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
     len = static_cast<int32_t>(tempLen);
     m_byteArray.resize(len);
     for (int32_t index = 0; index < len; ++index) {
-      if (m_keys != NULL && !m_hasKeys) {
+      if (m_keys != nullptr && !m_hasKeys) {
         readObjectPart(index, input, m_keys->at(index + keysOffset));
       } else /*if (m_resultKeys != nullptr && m_resultKeys->size() > 0)*/ {
         readObjectPart(index, input, localKeys->at(index));
       } /*else{
          LOGERROR("VersionedCacheableObjectPartList::fromData: hasObjects = true
-       but m_keys is NULL and m_resultKeys== NULL or m_resultKeys->size=0" );
+       but m_keys is nullptr and m_resultKeys== nullptr or m_resultKeys->size=0"
+       );
        }*/
     }
   }  // hasObjects ends here
@@ -264,17 +265,18 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
     CacheablePtr value;
 
     for (int32_t index = 0; index < len; ++index) {
-      if (m_keys != NULL && !m_hasKeys) {
+      if (m_keys != nullptr && !m_hasKeys) {
         key = m_keys->at(index + keysOffset);
       } else /*if (m_resultKeys != nullptr && m_resultKeys->size() > 0)*/ {
         key = localKeys->at(index);
       } /*else{
          LOGERROR("VersionedCacheableObjectPartList::fromData: hasObjects = true
-       but m_keys is NULL AND m_resultKeys=nullptr or m_resultKeys->size=0" );
+       but m_keys is nullptr AND m_resultKeys=nullptr or m_resultKeys->size=0"
+       );
        }*/
 
-      HashMapOfCacheable::Iterator iter = m_values->find(key);
-      value = iter == m_values->end() ? nullptr : iter.second();
+      const auto& iter = m_values->find(key);
+      value = iter == m_values->end() ? nullptr : iter->second;
       if (m_byteArray[index] != 3) {  // 3 - key not found on server
         CacheablePtr oldValue;
         if (m_addToLocalCache) {
@@ -289,10 +291,8 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
                 "VersionedCacheableObjectPartList::fromData putLocal for key [%s] failed because the cache \
                   already contains an entry with higher version.",
                 Utils::getCacheableKeyString(key)->asChar());
-            // erase the  value
-            m_values->erase(key);
-            // add the value with higher version tag
-            m_values->insert(key, oldValue);
+            // replace the value with higher version tag
+            (*m_values)[key] = oldValue;
           }
         }       // END::m_addToLocalCache
         else {  // m_addToLocalCache = false
@@ -300,16 +300,14 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
           // if value has already been received via notification or put by
           // another thread, then return that
           if (oldValue != nullptr && !CacheableToken::isInvalid(oldValue)) {
-            // erase the old value
-            m_values->erase(key);
-            // add the value with new value
-            m_values->insert(key, oldValue);
+            // replace the value with new value
+            (*m_values)[key] = oldValue;
           }
         }
       }
     }
   }
-  if (m_keysOffset != NULL) *m_keysOffset += len;
+  if (m_keysOffset != nullptr) *m_keysOffset += len;
   if (valuesNULL) m_values = nullptr;
   return this;
 }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/VersionedCacheableObjectPartList.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/VersionedCacheableObjectPartList.hpp b/src/cppcache/src/VersionedCacheableObjectPartList.hpp
index 7b6561f..a4ed6f0 100644
--- a/src/cppcache/src/VersionedCacheableObjectPartList.hpp
+++ b/src/cppcache/src/VersionedCacheableObjectPartList.hpp
@@ -116,7 +116,7 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList {
   VersionedCacheableObjectPartList(VectorOfCacheableKey* keys,
                                    int32_t totalMapSize,
                                    ACE_Recursive_Thread_Mutex& responseLock)
-      : m_tempKeys(keys), m_responseLock(responseLock)  {
+      : m_tempKeys(keys), m_responseLock(responseLock) {
     m_regionIsVersioned = false;
     m_serializeValues = false;
     m_hasTags = false;
@@ -169,8 +169,8 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList {
 
   inline VersionedCacheableObjectPartList(
       uint16_t endpointMemId, ACE_Recursive_Thread_Mutex& responseLock)
-      : m_tempKeys(std::make_shared<VectorOfCacheableKey>()), m_responseLock(responseLock)
-         {
+      : m_tempKeys(std::make_shared<VectorOfCacheableKey>()),
+        m_responseLock(responseLock) {
     m_regionIsVersioned = false;
     m_serializeValues = false;
     m_endpointMemId = endpointMemId;
@@ -185,7 +185,7 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList {
       if (this->m_tempKeys == nullptr) {
         this->m_tempKeys = std::make_shared<VectorOfCacheableKey>();
         this->m_hasKeys = true;
-        int size = other->m_tempKeys->size();
+        const auto size = other->m_tempKeys->size();
         for (int i = 0; i < size; i++) {
           this->m_tempKeys->push_back(other->m_tempKeys->at(i));
         }
@@ -195,7 +195,7 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList {
             LOGDEBUG(" VCOPL::addAll m_hasKeys should be true here");
             this->m_hasKeys = true;
           }
-          int size = other->m_tempKeys->size();
+          const auto size = other->m_tempKeys->size();
           for (int i = 0; i < size; i++) {
             this->m_tempKeys->push_back(other->m_tempKeys->at(i));
           }
@@ -218,7 +218,7 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList {
 
   int size() {
     if (this->m_hasKeys) {
-      return this->m_tempKeys->size();
+      return static_cast<int>(this->m_tempKeys->size());
     } else if (this->m_hasTags) {
       return static_cast<int>(this->m_versionTags.size());
     } else {

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/dllmain.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/dllmain.cpp b/src/cppcache/src/dllmain.cpp
index a6a0f02..9cd30a6 100644
--- a/src/cppcache/src/dllmain.cpp
+++ b/src/cppcache/src/dllmain.cpp
@@ -73,7 +73,7 @@ LIBEXP void DllMainGetPath(char *result, int maxLen) {
   dotNetLibName += ".dll";
   HMODULE module = GetModuleHandle(cppLibName.c_str());
   if (module == 0) {
-      module = GetModuleHandle(dotNetLibName.c_str());
+    module = GetModuleHandle(dotNetLibName.c_str());
   }
   if (module != 0) {
     GetModuleFileName(module, result, maxLen);
@@ -92,7 +92,7 @@ void DllMainGetPath(char *result, int maxLen) {
   }
   Dl_info dlInfo;
   dladdr((void *)DllMainGetPath, &dlInfo);
-  if (realpath(dlInfo.dli_fname, result) == NULL) {
+  if (realpath(dlInfo.dli_fname, result) == nullptr) {
     result[0] = '\0';
   }
 }
@@ -117,9 +117,8 @@ void setDefaultNewAndDelete() {
   Utils::s_pDelete = (pDelete)&free;  // operator delete;
 }
 
-
-}
-}
-}
+}  // namespace client
+}  // namespace geode
+}  // namespace apache
 
 #endif  // _WIN32

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/AtomicStatisticsImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/AtomicStatisticsImpl.cpp b/src/cppcache/src/statistics/AtomicStatisticsImpl.cpp
index adf982c..0d6c6e0 100644
--- a/src/cppcache/src/statistics/AtomicStatisticsImpl.cpp
+++ b/src/cppcache/src/statistics/AtomicStatisticsImpl.cpp
@@ -33,7 +33,7 @@ using namespace apache::geode::statistics;
 //////////////////////  Static Methods  //////////////////////
 
 int64_t AtomicStatisticsImpl::calcNumericId(StatisticsFactory* system,
-                                          int64_t userValue) {
+                                            int64_t userValue) {
   int64_t result;
   if (userValue != 0) {
     result = userValue;
@@ -45,10 +45,10 @@ int64_t AtomicStatisticsImpl::calcNumericId(StatisticsFactory* system,
 
 const char* AtomicStatisticsImpl::calcTextId(StatisticsFactory* system,
                                              const char* userValue) {
-  if (userValue != NULL && strcmp(userValue, "") != 0) {
+  if (userValue != nullptr && strcmp(userValue, "") != 0) {
     return userValue;
   } else {
-    if (system != NULL) {
+    if (system != nullptr) {
       return system->getName();
     } else {
       return "";
@@ -88,59 +88,59 @@ AtomicStatisticsImpl::AtomicStatisticsImpl(StatisticsType* typeArg,
     this->uniqueId = uniqueIdArg;
     this->closed = false;
     this->statsType = dynamic_cast<StatisticsTypeImpl*>(typeArg);
-    GF_D_ASSERT(this->statsType != NULL);
+    GF_D_ASSERT(this->statsType != nullptr);
     int32_t intCount = statsType->getIntStatCount();
     int32_t longCount = statsType->getLongStatCount();
     int32_t doubleCount = statsType->getDoubleStatCount();
 
     if (intCount > 0) {
       intStorage =
-          new ACE_Atomic_Op<ACE_Recursive_Thread_Mutex, int32_t>[ intCount ];
+          new ACE_Atomic_Op<ACE_Recursive_Thread_Mutex, int32_t>[intCount];
       for (int32_t i = 0; i < intCount; i++) {
         intStorage[i] = 0;  // Un-initialized state
       }
 
     } else {
-      intStorage = NULL;
+      intStorage = nullptr;
     }
     if (longCount > 0) {
       longStorage =
-          new ACE_Atomic_Op<ACE_Recursive_Thread_Mutex, int64_t>[ longCount ];
+          new ACE_Atomic_Op<ACE_Recursive_Thread_Mutex, int64_t>[longCount];
       for (int32_t i = 0; i < longCount; i++) {
         longStorage[i] = 0;  // Un-initialized state
       }
 
     } else {
-      longStorage = NULL;
+      longStorage = nullptr;
     }
     if (doubleCount > 0) {
       doubleStorage =
-          new ACE_Atomic_Op<ACE_Recursive_Thread_Mutex, double>[ doubleCount ];
+          new ACE_Atomic_Op<ACE_Recursive_Thread_Mutex, double>[doubleCount];
       for (int32_t i = 0; i < doubleCount; i++) {
         doubleStorage[i] = 0;  // Un-initialized state
       }
     } else {
-      doubleStorage = NULL;
+      doubleStorage = nullptr;
     }
   } catch (...) {
-    statsType = NULL;  // Will be deleted by the class who calls this ctor
+    statsType = nullptr;  // Will be deleted by the class who calls this ctor
   }
 }
 
 AtomicStatisticsImpl::~AtomicStatisticsImpl() {
   try {
-    statsType = NULL;
-    if (intStorage != NULL) {
+    statsType = nullptr;
+    if (intStorage != nullptr) {
       delete[] intStorage;
-      intStorage = NULL;
+      intStorage = nullptr;
     }
-    if (longStorage != NULL) {
+    if (longStorage != nullptr) {
       delete[] longStorage;
-      longStorage = NULL;
+      longStorage = nullptr;
     }
-    if (doubleStorage != NULL) {
+    if (doubleStorage != nullptr) {
       delete[] doubleStorage;
-      doubleStorage = NULL;
+      doubleStorage = nullptr;
     }
   } catch (...) {
   }
@@ -472,7 +472,7 @@ int32_t AtomicStatisticsImpl::incInt(char* name, int32_t delta) {
 }
 
 int32_t AtomicStatisticsImpl::incInt(StatisticDescriptor* descriptor,
-                                   int32_t delta) {
+                                     int32_t delta) {
   int32_t id = getIntId(descriptor);
   return incInt(id, delta);
 }
@@ -494,7 +494,7 @@ int64_t AtomicStatisticsImpl::incLong(char* name, int64_t delta) {
 }
 
 int64_t AtomicStatisticsImpl::incLong(StatisticDescriptor* descriptor,
-                                    int64_t delta) {
+                                      int64_t delta) {
   return incLong(getLongId(descriptor), delta);
 }
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/GeodeStatisticsFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/GeodeStatisticsFactory.cpp b/src/cppcache/src/statistics/GeodeStatisticsFactory.cpp
index 3f3c2bf..ae5ec92 100644
--- a/src/cppcache/src/statistics/GeodeStatisticsFactory.cpp
+++ b/src/cppcache/src/statistics/GeodeStatisticsFactory.cpp
@@ -36,7 +36,7 @@ using namespace apache::geode::statistics;
 /**
  * static member initialization
  */
-GeodeStatisticsFactory* GeodeStatisticsFactory::s_singleton = NULL;
+GeodeStatisticsFactory* GeodeStatisticsFactory::s_singleton = nullptr;
 
 GeodeStatisticsFactory::GeodeStatisticsFactory(StatisticsManager* statMngr) {
   m_name = "GeodeStatisticsFactory";
@@ -65,15 +65,15 @@ GeodeStatisticsFactory* GeodeStatisticsFactory::getExistingInstance() {
 
 /**************************Dtor*******************************************/
 void GeodeStatisticsFactory::clean() {
-  if (s_singleton != NULL) {
+  if (s_singleton != nullptr) {
     delete s_singleton;
-    s_singleton = NULL;
+    s_singleton = nullptr;
   }
 }
 
 GeodeStatisticsFactory::~GeodeStatisticsFactory() {
   try {
-    m_statMngr = NULL;
+    m_statMngr = nullptr;
 
     // Clean Map : Delete all the pointers of StatisticsType from the map.
     if (statsTypeMap.total_size() == 0) return;
@@ -83,7 +83,7 @@ GeodeStatisticsFactory::~GeodeStatisticsFactory() {
         statsTypeMap.begin();
     while (iterFind != statsTypeMap.end()) {
       delete (*iterFind).int_id_;
-      (*iterFind).int_id_ = NULL;
+      (*iterFind).int_id_ = nullptr;
       iterFind++;
     }
     statsTypeMap.unbind_all();
@@ -106,7 +106,7 @@ const char* GeodeStatisticsFactory::getName() { return m_name; }
 int64_t GeodeStatisticsFactory::getId() { return m_id; }
 
 Statistics* GeodeStatisticsFactory::createStatistics(StatisticsType* type) {
-  return createAtomicStatistics(type, NULL, 0);
+  return createAtomicStatistics(type, nullptr, 0);
 }
 
 Statistics* GeodeStatisticsFactory::createStatistics(StatisticsType* type,
@@ -124,7 +124,7 @@ Statistics* GeodeStatisticsFactory::createOsStatistics(StatisticsType* type,
                                                        const char* textId,
                                                        int64_t numericId) {
   // Validate input
-  if (type == NULL) {
+  if (type == nullptr) {
     throw IllegalArgumentException("StatisticsType* is Null");
   }
 
@@ -143,7 +143,7 @@ Statistics* GeodeStatisticsFactory::createOsStatistics(StatisticsType* type,
 
 Statistics* GeodeStatisticsFactory::createAtomicStatistics(
     StatisticsType* type) {
-  return createAtomicStatistics(type, NULL, 0);
+  return createAtomicStatistics(type, nullptr, 0);
 }
 
 Statistics* GeodeStatisticsFactory::createAtomicStatistics(StatisticsType* type,
@@ -155,7 +155,7 @@ Statistics* GeodeStatisticsFactory::createAtomicStatistics(StatisticsType* type,
                                                            const char* textId,
                                                            int64_t numericId) {
   // Validate input
-  if (type == NULL) {
+  if (type == nullptr) {
     throw IllegalArgumentException("StatisticsType* is Null");
   }
   int64_t myUniqueId;
@@ -209,7 +209,7 @@ StatisticsType* GeodeStatisticsFactory::createType(const char* name,
   StatisticsTypeImpl* st =
       new StatisticsTypeImpl(name, description, stats, statsLength);
 
-  if (st != NULL) {
+  if (st != nullptr) {
     st = addType(st);
   } else {
     throw OutOfMemoryException(
@@ -220,14 +220,14 @@ StatisticsType* GeodeStatisticsFactory::createType(const char* name,
 
 StatisticsType* GeodeStatisticsFactory::findType(const char* name) {
   std::string statName = name;
-  StatisticsTypeImpl* st = NULL;
+  StatisticsTypeImpl* st = nullptr;
   int status = statsTypeMap.find(statName, st);
   if (status == -1) {
     std::string temp(name);
     std::string s = "There is no statistic named \"" + temp + "\"";
     // LOGWARN(s.c_str());
     // throw IllegalArgumentException(s.c_str());
-    return NULL;
+    return nullptr;
   } else {
     return st;
   }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/GeodeStatisticsFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/GeodeStatisticsFactory.hpp b/src/cppcache/src/statistics/GeodeStatisticsFactory.hpp
index 49ab21a..ba9157c 100644
--- a/src/cppcache/src/statistics/GeodeStatisticsFactory.hpp
+++ b/src/cppcache/src/statistics/GeodeStatisticsFactory.hpp
@@ -37,7 +37,7 @@
 using namespace apache::geode::client;
 
 /** @file
-*/
+ */
 
 namespace apache {
 namespace geode {
@@ -66,7 +66,7 @@ class GeodeStatisticsFactory : public StatisticsFactory {
   GeodeStatisticsFactory(StatisticsManager* statMngr);
 
   int64_t m_statsListUniqueId;  // Creates a unique id for each stats object in
-                              // the list
+                                // the list
 
   ACE_Recursive_Thread_Mutex m_statsListUniqueIdLock;
 
@@ -143,12 +143,12 @@ class GeodeStatisticsFactory : public StatisticsFactory {
                                          const char* description,
                                          const char* units, bool largerBetter);
 
-  /** Return the first instance that matches the type, or NULL */
+  /** Return the first instance that matches the type, or nullptr */
   Statistics* findFirstStatisticsByType(StatisticsType* type);
 
 };  // class
 
-}  // namespace client
+}  // namespace statistics
 }  // namespace geode
 }  // namespace apache
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/HostStatHelper.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/HostStatHelper.cpp b/src/cppcache/src/statistics/HostStatHelper.cpp
index ff5437c..4767ce5 100644
--- a/src/cppcache/src/statistics/HostStatHelper.cpp
+++ b/src/cppcache/src/statistics/HostStatHelper.cpp
@@ -33,7 +33,7 @@ int32_t HostStatHelper::PROCESS_STAT_FLAG = 1;
 int32_t HostStatHelper::SYSTEM_STAT_FLAG = 2;
 GFS_OSTYPES HostStatHelper::osCode =
     static_cast<GFS_OSTYPES>(0);  // Default OS is Linux
-ProcessStats* HostStatHelper::processStats = NULL;
+ProcessStats* HostStatHelper::processStats = nullptr;
 
 /**
  * Determine the OS and creates Process Statistics Type for that OS
@@ -64,7 +64,7 @@ void HostStatHelper::initOSCode() {
  * Refresh statistics of the process through operating system specific calls
  */
 void HostStatHelper::refresh() {
-  if (processStats != NULL) {
+  if (processStats != nullptr) {
 #if defined(_WIN32)
     HostStatHelperWin::refreshProcess(processStats);
 #elif defined(_SOLARIS)
@@ -105,7 +105,7 @@ void HostStatHelper::newProcessStats(int64_t pid, const char* name) {
       throw IllegalArgumentException(
           "HostStatHelper::newProcess:unhandled osCodem");
   }
-  GF_D_ASSERT(processStats != NULL);
+  GF_D_ASSERT(processStats != nullptr);
 }
 
 void HostStatHelper::close() {
@@ -123,25 +123,25 @@ void HostStatHelper::cleanup() {
 #endif
   if (processStats) {
     delete processStats;
-    processStats = NULL;
+    processStats = nullptr;
   }
 }
 
 int32_t HostStatHelper::getCpuUsage() {
-  if (HostStatHelper::processStats != NULL) {
+  if (HostStatHelper::processStats != nullptr) {
     return HostStatHelper::processStats->getCpuUsage();
   }
   return 0;
 }
 
 int64_t HostStatHelper::getCpuTime() {
-  if (HostStatHelper::processStats != NULL) {
+  if (HostStatHelper::processStats != nullptr) {
     return HostStatHelper::processStats->getAllCpuTime();
   }
   return 0;
 }
 int32_t HostStatHelper::getNumThreads() {
-  if (HostStatHelper::processStats != NULL) {
+  if (HostStatHelper::processStats != nullptr) {
     return HostStatHelper::processStats->getNumThreads();
   }
   return 0;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/HostStatHelperLinux.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/HostStatHelperLinux.cpp b/src/cppcache/src/statistics/HostStatHelperLinux.cpp
index 1ff5b71..971c65c 100644
--- a/src/cppcache/src/statistics/HostStatHelperLinux.cpp
+++ b/src/cppcache/src/statistics/HostStatHelperLinux.cpp
@@ -32,7 +32,7 @@ namespace geode {
 namespace statistics {
 double lastIdle = 0;
 double lastUptime = 0;
-}  // namespace client
+}  // namespace statistics
 }  // namespace geode
 }  // namespace apache
 
@@ -43,7 +43,7 @@ void HostStatHelperLinux::refreshProcess(ProcessStats* processStats) {
   // Get pid, LinuxProcessStats
   LinuxProcessStats* linProcessStat =
       dynamic_cast<LinuxProcessStats*>(processStats);
-  if (linProcessStat == NULL) {
+  if (linProcessStat == nullptr) {
     LOGFINE(
         "HostStatHelperLinux::refreshProcess failed due to null processStat");
     return;
@@ -66,9 +66,10 @@ void HostStatHelperLinux::refreshProcess(ProcessStats* processStats) {
   char procFileName[64];
 
   FILE* fPtr;
-  ACE_OS::snprintf(procFileName, 64, "/proc/%" PRIu32 "/stat", (uint32_t)thePid);
+  ACE_OS::snprintf(procFileName, 64, "/proc/%" PRIu32 "/stat",
+                   (uint32_t)thePid);
   fPtr = fopen(procFileName, "r"); /* read only */
-  if (fPtr != NULL) {
+  if (fPtr != nullptr) {
     int32_t status = fscanf(
         fPtr,
         "%d %100s %c %*d %*d %*d %*d %*d %*u %*u \
@@ -96,7 +97,7 @@ void HostStatHelperLinux::refreshProcess(ProcessStats* processStats) {
         // start_time,
         &vsize,
         &rss  //  mm ? mm->rss : 0, /* you might want to shift this left 3 */
-        );
+    );
 
     if (status != 7 && status != EOF) {
       int32_t errNum = errno;  // for debugging
@@ -131,7 +132,7 @@ void HostStatHelperLinux::refreshProcess(ProcessStats* processStats) {
     temprssSize = (4 * rss) / 1024;
   }
   fPtr = fopen("/proc/uptime", "r");
-  if (fPtr != NULL) {
+  if (fPtr != nullptr) {
     double newUptime = 0;
     double newIdle = 0;
     int32_t status = fscanf(fPtr, "%lf %lf", &newUptime, &newIdle);
@@ -160,7 +161,7 @@ void HostStatHelperLinux::refreshProcess(ProcessStats* processStats) {
   // thread count
   int threadCount = 0;
   glob_t g;
-  if (glob("/proc/self/task/*", GLOB_ONLYDIR, NULL, &g) == 0) {
+  if (glob("/proc/self/task/*", GLOB_ONLYDIR, nullptr, &g) == 0) {
     threadCount = g.gl_pathc;
     // LOGDEBUG("gl_pathc: %d",g.gl_pathc);
     // for( unsigned int i =0; i < g.gl_pathc; i++ ) {

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/HostStatHelperSolaris.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/HostStatHelperSolaris.cpp b/src/cppcache/src/statistics/HostStatHelperSolaris.cpp
index 89b469a..30801ec 100644
--- a/src/cppcache/src/statistics/HostStatHelperSolaris.cpp
+++ b/src/cppcache/src/statistics/HostStatHelperSolaris.cpp
@@ -39,14 +39,14 @@ using namespace apache::geode::statistics;
 uint8_t HostStatHelperSolaris::m_logStatErrorCountDown = 5;
 uint32_t HostStatHelperSolaris::m_cpuUtilPrev[CPU_STATES] = {0};
 bool HostStatHelperSolaris::m_initialized = false;
-kstat_ctl_t* HostStatHelperSolaris::m_kstat = NULL;
+kstat_ctl_t* HostStatHelperSolaris::m_kstat = nullptr;
 
 void HostStatHelperSolaris::refreshProcess(ProcessStats* processStats) {
   static bool threadCountMissingWarning = false;
   // Get pid, SolarisProcessStats
   SolarisProcessStats* solProcessStat =
       dynamic_cast<SolarisProcessStats*>(processStats);
-  if (solProcessStat == NULL) {
+  if (solProcessStat == nullptr) {
     LOGFINE(
         "HostStatHelperSolaris::refreshProcess failed due to null processStat");
     return;
@@ -146,7 +146,7 @@ void HostStatHelperSolaris::refreshProcess(ProcessStats* processStats) {
   // thread count
   int threadCount = 0;
   glob_t g;
-  if (glob("/proc/self/lwp/*", 0, NULL, &g) == 0) {
+  if (glob("/proc/self/lwp/*", 0, nullptr, &g) == 0) {
     threadCount = g.gl_pathc;
     // LOGDEBUG("gl_pathc: %d",g.gl_pathc);
     // for( unsigned int i =0; i < g.gl_pathc; i++ ) {
@@ -170,9 +170,9 @@ void HostStatHelperSolaris::refreshProcess(ProcessStats* processStats) {
 }
 
 void HostStatHelperSolaris::getKernelStats(uint32_t* cpuUtil) {
-  if (m_kstat == NULL) {
+  if (m_kstat == nullptr) {
     m_kstat = kstat_open();
-    if (m_kstat == NULL) {
+    if (m_kstat == nullptr) {
       char buf[128];
       ACE_OS::snprintf(buf, 128, "Unable to obtain kstat data, errno %d",
                        errno);
@@ -189,7 +189,7 @@ void HostStatHelperSolaris::getKernelStats(uint32_t* cpuUtil) {
   // Make a copy of it.
   memcpy(&wkc, m_kstat, sizeof(kstat_ctl_t));
   // Walk the chain.
-  for (ksp = wkc.kc_chain; ksp != NULL; ksp = ksp->ks_next) {
+  for (ksp = wkc.kc_chain; ksp != nullptr; ksp = ksp->ks_next) {
     // Header information
     // kstats are identified by module, instance, class, and name.
     strncpy(module, ksp->ks_module, KSTAT_STRLEN);
@@ -223,9 +223,9 @@ void HostStatHelperSolaris::getKernelStats(uint32_t* cpuUtil) {
 }
 
 void HostStatHelperSolaris::closeHostStatHelperSolaris() {
-  if (m_kstat != NULL) {
+  if (m_kstat != nullptr) {
     kstat_close(m_kstat);
-    m_kstat = NULL;
+    m_kstat = nullptr;
   }
 }
 #endif /* SOLARIS */

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/HostStatHelperWin.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/HostStatHelperWin.cpp b/src/cppcache/src/statistics/HostStatHelperWin.cpp
index 4c97ebb..4e323b1 100644
--- a/src/cppcache/src/statistics/HostStatHelperWin.cpp
+++ b/src/cppcache/src/statistics/HostStatHelperWin.cpp
@@ -31,12 +31,12 @@
 #if defined(_WIN32)
 using namespace apache::geode::statistics;
 
-PPERF_DATA_BLOCK HostStatHelperWin::PerfData = NULL;
-PPERF_OBJECT_TYPE HostStatHelperWin::ProcessObj = NULL;
-PPERF_OBJECT_TYPE HostStatHelperWin::ProcessorObj = NULL;
-PPERF_OBJECT_TYPE HostStatHelperWin::MemoryObj = NULL;
-PPERF_OBJECT_TYPE HostStatHelperWin::SystemObj = NULL;
-PPERF_OBJECT_TYPE HostStatHelperWin::ObjectsObj = NULL;
+PPERF_DATA_BLOCK HostStatHelperWin::PerfData = nullptr;
+PPERF_OBJECT_TYPE HostStatHelperWin::ProcessObj = nullptr;
+PPERF_OBJECT_TYPE HostStatHelperWin::ProcessorObj = nullptr;
+PPERF_OBJECT_TYPE HostStatHelperWin::MemoryObj = nullptr;
+PPERF_OBJECT_TYPE HostStatHelperWin::SystemObj = nullptr;
+PPERF_OBJECT_TYPE HostStatHelperWin::ObjectsObj = nullptr;
 DWORD HostStatHelperWin::BufferSize = 65536;
 int32_t HostStatHelperWin::pidCtrOffset = -1;
 
@@ -104,14 +104,14 @@ PPERF_COUNTER_DEFINITION HostStatHelperWin::NextCounter(
 
 void HostStatHelperWin::HostStatsFetchData() {
   DWORD o;
-  PPERF_OBJECT_TYPE objPtr = NULL;
+  PPERF_OBJECT_TYPE objPtr = nullptr;
   DWORD res;
   PPERF_COUNTER_DEFINITION PerfCntr;
   DWORD oldBufferSize = BufferSize;
   const char* qstr;
   qstr = LEVEL1_QUERY_STRING;
 
-  while ((res = RegQueryValueEx(HKEY_PERFORMANCE_DATA, qstr, NULL, NULL,
+  while ((res = RegQueryValueEx(HKEY_PERFORMANCE_DATA, qstr, nullptr, nullptr,
                                 (LPBYTE)PerfData, &BufferSize)) ==
          ERROR_MORE_DATA) {
     oldBufferSize += 4096;
@@ -122,11 +122,11 @@ void HostStatHelperWin::HostStatsFetchData() {
 #ifdef NTDBG
   LOGDEBUG("HostStatHeleperWin: buffersize is %ld\n", BufferSize);
 #endif
-  ProcessObj = NULL;
-  ProcessorObj = NULL;
-  MemoryObj = NULL;
-  SystemObj = NULL;
-  ObjectsObj = NULL;
+  ProcessObj = nullptr;
+  ProcessorObj = nullptr;
+  MemoryObj = nullptr;
+  SystemObj = nullptr;
+  ObjectsObj = nullptr;
 
   if (res != ERROR_SUCCESS) {
     LOGDEBUG(
@@ -519,13 +519,13 @@ void HostStatHelperWin::HostStatsFetchData() {
 }
 
 int32_t HostStatHelperWin::getPid(int32_t pidCtrOffset,
-                                PPERF_COUNTER_BLOCK PerfCntrBlk) {
+                                  PPERF_COUNTER_BLOCK PerfCntrBlk) {
   int32_t* result = (int32_t*)((char*)PerfCntrBlk + pidCtrOffset);
   return *result;
 }
 
 uint32_t HostStatHelperWin::getInt32Value(PPERF_COUNTER_DEFINITION PerfCntr,
-                                        PPERF_COUNTER_BLOCK PerfCntrBlk) {
+                                          PPERF_COUNTER_BLOCK PerfCntrBlk) {
   if (PerfCntr->CounterOffset == 0) {
 #ifdef FLG_DEBUG
     LOGDEBUG("HostStatHeleperWin: missing counter id=%d\n",
@@ -567,8 +567,8 @@ uint32_t HostStatHelperWin::getInt32Value(PPERF_COUNTER_DEFINITION PerfCntr,
 }
 
 int64_t HostStatHelperWin::getInt64Value(PPERF_COUNTER_DEFINITION PerfCntr,
-                                       PPERF_COUNTER_BLOCK PerfCntrBlk,
-                                       bool convertMS) {
+                                         PPERF_COUNTER_BLOCK PerfCntrBlk,
+                                         bool convertMS) {
   if (PerfCntr->CounterOffset == 0) {
 #ifdef FLG_DEBUG
     LOGDEBUG("HostStatHeleperWin: missing counter id=%d\n",
@@ -656,7 +656,7 @@ void HostStatHelperWin::refreshProcess(ProcessStats* processStats) {
   // Get pid, WindowsProcessStats
   WindowsProcessStats* winProcessStat =
       dynamic_cast<WindowsProcessStats*>(processStats);
-  if (winProcessStat == NULL) {
+  if (winProcessStat == nullptr) {
     LOGFINE("HostStatHelperWin::refreshProcess failed due to null processStat");
     return;
   }
@@ -785,7 +785,7 @@ int HostStatHelperWin::calculateCpuUsage(PPERF_COUNTER_BLOCK& ctrBlk) {
 void HostStatHelperWin::closeHostStatHelperWin() {
   if (PerfData) {
     free((char*)PerfData);
-    PerfData = NULL;
+    PerfData = nullptr;
   }
   RegCloseKey(HKEY_PERFORMANCE_DATA);
   firstTime = true;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/HostStatSampler.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/HostStatSampler.cpp b/src/cppcache/src/statistics/HostStatSampler.cpp
index c5f5be2..966187a 100644
--- a/src/cppcache/src/statistics/HostStatSampler.cpp
+++ b/src/cppcache/src/statistics/HostStatSampler.cpp
@@ -125,7 +125,7 @@ HostStatSampler::HostStatSampler(const char* filePath, int64_t sampleIntervalMs,
   m_adminError = false;
   m_running = false;
   m_stopRequested = false;
-  m_archiver = NULL;
+  m_archiver = nullptr;
   m_samplerStats = new StatSamplerStats();
 
   ACE_Time_Value startTimeValue = ACE_OS::gettimeofday();
@@ -185,7 +185,7 @@ HostStatSampler::HostStatSampler(const char* filePath, int64_t sampleIntervalMs,
     }
     g_statFile = slashtmp;
     delete[] slashtmp;
-    slashtmp = NULL;
+    slashtmp = nullptr;
 #endif
 
     std::string dirname = ACE::dirname(g_statFile.c_str());
@@ -216,16 +216,16 @@ HostStatSampler::HostStatSampler(const char* filePath, int64_t sampleIntervalMs,
     }
     if (entries_count >= 0) {
       ACE_OS::free( resultArray );
-      resultArray = NULL;
+      resultArray = nullptr;
     }*/
 
     FILE* existingFile = fopen(g_statFileWithExt.c_str(), "r");
-    if (existingFile != NULL && statFileLimit > 0) {
+    if (existingFile != nullptr && statFileLimit > 0) {
       fclose(existingFile);
       /* adongre
        * CID 28820: Resource leak (RESOURCE_LEAK)
        */
-      existingFile = NULL;
+      existingFile = nullptr;
       changeArchive(g_statFileWithExt);
     } else {
       writeGfs();
@@ -233,9 +233,9 @@ HostStatSampler::HostStatSampler(const char* filePath, int64_t sampleIntervalMs,
     /* adongre
      * CID 28820: Resource leak (RESOURCE_LEAK)
      */
-    if (existingFile != NULL) {
+    if (existingFile != nullptr) {
       fclose(existingFile);
-      existingFile = NULL;
+      existingFile = nullptr;
     }
   }
 }
@@ -247,13 +247,13 @@ std::string HostStatSampler::initStatFileWithExt() {
 }
 
 HostStatSampler::~HostStatSampler() {
-  if (m_samplerStats != NULL) {
+  if (m_samplerStats != nullptr) {
     delete m_samplerStats;
-    m_samplerStats = NULL;
+    m_samplerStats = nullptr;
   }
-  if (m_archiver != NULL) {
+  if (m_archiver != nullptr) {
     delete m_archiver;
-    m_archiver = NULL;
+    m_archiver = nullptr;
   }
 }
 
@@ -316,7 +316,7 @@ Statistics* HostStatSampler::findStatistics(const int64_t id) {
       return *i;
     }
   }
-  return NULL;
+  return nullptr;
 }
 
 ACE_Recursive_Thread_Mutex& HostStatSampler::getStatListMutex() {
@@ -357,25 +357,25 @@ void HostStatSampler::changeArchive(std::string filename) {
     return;
   }
   filename = chkForGFSExt(filename);
-  if (m_archiver != NULL) {
+  if (m_archiver != nullptr) {
     g_previoussamplesize = m_archiver->getSampleSize();
     m_archiver->closeFile();
   }
   // create new file only when tis file has some data; otherwise reuse it
   if (rollArchive(filename) != 0) {
     delete m_archiver;
-    m_archiver = NULL;
+    m_archiver = nullptr;
     // throw exception
     return;
   } else {
     /*
-    if (m_archiver != NULL) {
+    if (m_archiver != nullptr) {
       m_archiver->openFile(filename);
       m_archiver->close();
     }
     */
     delete m_archiver;
-    m_archiver = NULL;
+    m_archiver = nullptr;
   }
 
   m_archiver = new StatArchiveWriter(filename, this);
@@ -420,7 +420,7 @@ std::string HostStatSampler::chkForGFSExt(std::string filename) {
 
 int32_t HostStatSampler::rollArchive(std::string filename) {
   FILE* fpExist = fopen(filename.c_str(), "r");
-  if (fpExist == NULL) {
+  if (fpExist == nullptr) {
     return 0;  // no need to roll
   } else {
     fclose(fpExist);
@@ -446,8 +446,8 @@ int32_t HostStatSampler::rollArchive(std::string filename) {
   statsbasename = filename.substr(lastPosOfSep + 1, len);
   char gfsFileExtAfter = '.';
   int32_t baselen = static_cast<int32_t>(statsbasename.length());
-  int32_t posOfExt = static_cast<int32_t>(
-      statsbasename.find_last_of(gfsFileExtAfter, static_cast<int32_t>(baselen)));
+  int32_t posOfExt = static_cast<int32_t>(statsbasename.find_last_of(
+      gfsFileExtAfter, static_cast<int32_t>(baselen)));
   if (posOfExt == -1) {
     // throw IllegalArgument;
   } else {
@@ -470,7 +470,7 @@ int32_t HostStatSampler::rollArchive(std::string filename) {
     }
     FILE* fp = fopen(newfilename, "r");
 
-    if (fp != NULL) {
+    if (fp != nullptr) {
       // file exists; increment i and try the next filename
       i++;
       fclose(fp);
@@ -572,9 +572,9 @@ void HostStatSampler::putStatsInAdminRegion() {
           uint16_t hostPort = 0;
           SystemProperties* sysProp = DistributedSystem::getSystemProperties();
           const char* durableId =
-              (sysProp != NULL) ? sysProp->durableClientId() : NULL;
+              (sysProp != nullptr) ? sysProp->durableClientId() : nullptr;
           const uint32_t durableTimeOut =
-              (sysProp != NULL) ? sysProp->durableTimeout() : 0;
+              (sysProp != nullptr) ? sysProp->durableTimeout() : 0;
 
           ClientProxyMembershipID memId(hostName, hostAddr, hostPort, durableId,
                                         durableTimeOut);
@@ -621,7 +621,8 @@ void HostStatSampler::doSample(std::string& archivefilename) {
 
   if (m_archiveFileSizeLimit != 0) {
     int64_t size = m_archiver->getSampleSize();
-    int64_t bytesWritten = m_archiver->bytesWritten();  // + g_previoussamplesize;
+    int64_t bytesWritten =
+        m_archiver->bytesWritten();  // + g_previoussamplesize;
     if (bytesWritten > (m_archiveFileSizeLimit - size)) {
       // roll the archive
       changeArchive(archivefilename);
@@ -667,7 +668,7 @@ void HostStatSampler::checkDiskLimit() {
     }
     if (entries_count >= 0) {
     ACE_OS::free( resultArray );
-    resultArray = NULL;
+    resultArray = nullptr;
     }*/
     sds.close();
   }
@@ -747,7 +748,7 @@ int32_t HostStatSampler::svc(void) {
     }
     closeSpecialStats();
     m_samplerStats->close();
-    if (m_archiver != NULL) {
+    if (m_archiver != nullptr) {
       m_archiver->close();
     }
   } catch (Exception& e) {

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/LinuxProcessStats.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/LinuxProcessStats.cpp b/src/cppcache/src/statistics/LinuxProcessStats.cpp
index 8e958da..ca77bba 100644
--- a/src/cppcache/src/statistics/LinuxProcessStats.cpp
+++ b/src/cppcache/src/statistics/LinuxProcessStats.cpp
@@ -37,7 +37,7 @@ LinuxProcessStats::LinuxProcessStats(int64_t pid, const char* name) {
 
   // Create Statistics
   this->stats = statFactory->createOsStatistics(m_statsType, name, pid);
-  GF_D_ASSERT(this->stats != NULL);
+  GF_D_ASSERT(this->stats != nullptr);
 
 // Refresh Stats Values
 #if defined(_LINUX)
@@ -84,7 +84,7 @@ void LinuxProcessStats::createType(StatisticsFactory* statFactory) {
     } catch (Exception&) {
       m_statsType = statFactory->findType("LinuxProcessStats");
     }
-    if (m_statsType == NULL) {
+    if (m_statsType == nullptr) {
       throw OutOfMemoryException("LinuxProcessStats::createType: out memory");
     }
     imageSizeINT = m_statsType->nameToId("imageSize");
@@ -113,12 +113,12 @@ int64_t LinuxProcessStats::getAllCpuTime() {
 }
 
 void LinuxProcessStats::close() {
-  if (stats != NULL) {
+  if (stats != nullptr) {
     stats->close();
   }
 }
 
 LinuxProcessStats::~LinuxProcessStats() {
-  m_statsType = NULL;
-  stats = NULL;
+  m_statsType = nullptr;
+  stats = nullptr;
 }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/OsStatisticsImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/OsStatisticsImpl.cpp b/src/cppcache/src/statistics/OsStatisticsImpl.cpp
index 1ce4e95..a10effa 100644
--- a/src/cppcache/src/statistics/OsStatisticsImpl.cpp
+++ b/src/cppcache/src/statistics/OsStatisticsImpl.cpp
@@ -32,7 +32,7 @@ using namespace apache::geode::statistics;
 //////////////////////  Static Methods  //////////////////////
 
 int64_t OsStatisticsImpl::calcNumericId(StatisticsFactory* system,
-                                      int64_t userValue) {
+                                        int64_t userValue) {
   int64_t result;
   if (userValue != 0) {
     result = userValue;
@@ -44,10 +44,10 @@ int64_t OsStatisticsImpl::calcNumericId(StatisticsFactory* system,
 
 const char* OsStatisticsImpl::calcTextId(StatisticsFactory* system,
                                          const char* userValue) {
-  if (userValue != NULL && strcmp(userValue, "") != 0) {
+  if (userValue != nullptr && strcmp(userValue, "") != 0) {
     return userValue;
   } else {
-    if (system != NULL) {
+    if (system != nullptr) {
       return system->getName();
     } else {
       return "";
@@ -74,7 +74,8 @@ const char* OsStatisticsImpl::calcTextId(StatisticsFactory* system,
  */
 OsStatisticsImpl::OsStatisticsImpl(StatisticsType* typeArg,
                                    const char* textIdArg, int64_t numericIdArg,
-                                   int64_t uniqueIdArg, StatisticsFactory* system)
+                                   int64_t uniqueIdArg,
+                                   StatisticsFactory* system)
 
 {
   this->textId = calcTextId(system, textIdArg);
@@ -89,7 +90,7 @@ OsStatisticsImpl::OsStatisticsImpl(StatisticsType* typeArg,
   intStorage = (int32_t*)0;
   longStorage = (int64_t*)0;
 
-  if (statsType != NULL) {
+  if (statsType != nullptr) {
     int32_t intCount = statsType->getIntStatCount();
     int32_t longCount = statsType->getLongStatCount();
     int32_t doubleCount = statsType->getDoubleStatCount();
@@ -99,7 +100,7 @@ OsStatisticsImpl::OsStatisticsImpl(StatisticsType* typeArg,
         intStorage[i] = 0;  // Un-initialized state
       }
     } else {
-      intStorage = NULL;
+      intStorage = nullptr;
     }
     if (longCount > 0) {
       longStorage = new int64_t[longCount];
@@ -107,7 +108,7 @@ OsStatisticsImpl::OsStatisticsImpl(StatisticsType* typeArg,
         longStorage[i] = 0;  // Un-initialized state
       }
     } else {
-      longStorage = NULL;
+      longStorage = nullptr;
     }
     if (doubleCount > 0) {
       doubleStorage = new double[doubleCount];
@@ -115,25 +116,25 @@ OsStatisticsImpl::OsStatisticsImpl(StatisticsType* typeArg,
         doubleStorage[i] = 0;  // Un-initialized state
       }
     } else {
-      doubleStorage = NULL;
+      doubleStorage = nullptr;
     }
-  }  // if(statsType == NULL)
+  }  // if(statsType == nullptr)
 }
 
 OsStatisticsImpl::~OsStatisticsImpl() {
   try {
-    statsType = NULL;
-    if (intStorage != NULL) {
+    statsType = nullptr;
+    if (intStorage != nullptr) {
       delete[] intStorage;
-      intStorage = NULL;
+      intStorage = nullptr;
     }
-    if (longStorage != NULL) {
+    if (longStorage != nullptr) {
       delete[] longStorage;
-      longStorage = NULL;
+      longStorage = nullptr;
     }
-    if (doubleStorage != NULL) {
+    if (doubleStorage != nullptr) {
       delete[] doubleStorage;
-      doubleStorage = NULL;
+      doubleStorage = nullptr;
     }
   } catch (...) {
     LOGERROR("Exception in ~OsStatisticsImpl");
@@ -462,7 +463,8 @@ int32_t OsStatisticsImpl::incInt(char* name, int32_t delta) {
   return incInt(nameToDescriptor(name), delta);
 }
 
-int32_t OsStatisticsImpl::incInt(StatisticDescriptor* descriptor, int32_t delta) {
+int32_t OsStatisticsImpl::incInt(StatisticDescriptor* descriptor,
+                                 int32_t delta) {
   return incInt(getIntId(descriptor), delta);
 }
 
@@ -480,7 +482,8 @@ int64_t OsStatisticsImpl::incLong(char* name, int64_t delta) {
   return incLong(nameToDescriptor(name), delta);
 }
 
-int64_t OsStatisticsImpl::incLong(StatisticDescriptor* descriptor, int64_t delta) {
+int64_t OsStatisticsImpl::incLong(StatisticDescriptor* descriptor,
+                                  int64_t delta) {
   return incLong(getLongId(descriptor), delta);
 }
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/SolarisProcessStats.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/SolarisProcessStats.cpp b/src/cppcache/src/statistics/SolarisProcessStats.cpp
index 1b4e0ec..27275b1 100644
--- a/src/cppcache/src/statistics/SolarisProcessStats.cpp
+++ b/src/cppcache/src/statistics/SolarisProcessStats.cpp
@@ -37,7 +37,7 @@ SolarisProcessStats::SolarisProcessStats(int64_t pid, const char* name) {
 
   // Create Statistics
   this->stats = statFactory->createOsStatistics(m_statsType, name, pid);
-  GF_D_ASSERT(this->stats != NULL);
+  GF_D_ASSERT(this->stats != nullptr);
 
 // Refresh Stats Values
 #if defined(_SOLARIS)
@@ -89,7 +89,7 @@ void SolarisProcessStats::createType(StatisticsFactory* statFactory) {
     } catch (Exception&) {
       m_statsType = statFactory->findType("SolarisProcessStats");
     }
-    if (m_statsType == NULL) {
+    if (m_statsType == nullptr) {
       throw OutOfMemoryException("SolarisProcessStats::createType: out memory");
     }
     imageSizeINT = m_statsType->nameToId("imageSize");
@@ -113,18 +113,20 @@ int32_t SolarisProcessStats::getCpuUsage() {
   return stats->getInt(hostCpuUsageINT);
 }
 int64_t SolarisProcessStats::getCPUTime() { return stats->getInt(userTimeINT); }
-int32_t SolarisProcessStats::getNumThreads() { return stats->getInt(threadsINT); }
+int32_t SolarisProcessStats::getNumThreads() {
+  return stats->getInt(threadsINT);
+}
 int64_t SolarisProcessStats::getAllCpuTime() {
   return ((stats->getInt(userTimeINT)) + (stats->getInt(systemTimeINT)));
 }
 
 void SolarisProcessStats::close() {
-  if (stats != NULL) {
+  if (stats != nullptr) {
     stats->close();
   }
 }
 
 SolarisProcessStats::~SolarisProcessStats() {
-  m_statsType = NULL;
-  stats = NULL;
+  m_statsType = nullptr;
+  stats = nullptr;
 }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/StatArchiveWriter.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/StatArchiveWriter.cpp b/src/cppcache/src/statistics/StatArchiveWriter.cpp
index 7c0a42c..03bd92e 100644
--- a/src/cppcache/src/statistics/StatArchiveWriter.cpp
+++ b/src/cppcache/src/statistics/StatArchiveWriter.cpp
@@ -42,14 +42,14 @@ StatDataOutput::StatDataOutput(std::string filename) {
   closed = false;
   bytesWritten = 0;
   m_fp = fopen(outFile.c_str(), "a+b");
-  if (m_fp == NULL) {
+  if (m_fp == nullptr) {
     std::string s("error in opening archive file for writing");
     throw NullPointerException(s.c_str());
   }
 }
 
 StatDataOutput::~StatDataOutput() {
-  if (!closed && m_fp != NULL) {
+  if (!closed && m_fp != nullptr) {
     fclose(m_fp);
   }
 }
@@ -58,12 +58,12 @@ int64_t StatDataOutput::getBytesWritten() { return this->bytesWritten; }
 
 void StatDataOutput::flush() {
   const uint8_t *buffBegin = dataBuffer.getBuffer();
-  if (buffBegin == NULL) {
+  if (buffBegin == nullptr) {
     std::string s("undefined stat data buffer beginning");
     throw NullPointerException(s.c_str());
   }
   const uint8_t *buffEnd = dataBuffer.getCursor();
-  if (buffEnd == NULL) {
+  if (buffEnd == nullptr) {
     std::string s("undefined stat data buffer end");
     throw NullPointerException(s.c_str());
   }
@@ -124,13 +124,13 @@ void StatDataOutput::writeUTF(std::wstring s) {
 
 void StatDataOutput::close() {
   fclose(m_fp);
-  m_fp = NULL;
+  m_fp = nullptr;
   closed = true;
 }
 
 void StatDataOutput::openFile(std::string filename, int64_t size) {
   m_fp = fopen(filename.c_str(), "a+b");
-  if (m_fp == NULL) {
+  if (m_fp == nullptr) {
     std::string s("error in opening archive file for writing");
     throw NullPointerException(s.c_str());
   }
@@ -142,7 +142,7 @@ void StatDataOutput::openFile(std::string filename, int64_t size) {
 
 ResourceType::ResourceType(int32_t idArg, StatisticsType *typeArg) {
   StatisticsType *typeImpl = dynamic_cast<StatisticsType *>(typeArg);
-  if (typeImpl == NULL) {
+  if (typeImpl == nullptr) {
     std::string s("could not down cast to StatisticsType");
     throw NullPointerException(s.c_str());
   }
@@ -192,8 +192,8 @@ void ResourceInst::writeSample() {
   bool wroteInstId = false;
   bool checkForChange = true;
   StatisticDescriptor **stats = this->type->getStats();
-  GF_D_ASSERT(stats != NULL);
-  GF_D_ASSERT(*stats != NULL);
+  GF_D_ASSERT(stats != nullptr);
+  GF_D_ASSERT(*stats != nullptr);
   if (this->resource->isClosed()) {
     return;
   }
@@ -221,7 +221,7 @@ void ResourceInst::writeSample() {
 
 void ResourceInst::writeStatValue(StatisticDescriptor *sd, int64_t v) {
   StatisticDescriptorImpl *sdImpl = (StatisticDescriptorImpl *)sd;
-  if (sdImpl == NULL) {
+  if (sdImpl == nullptr) {
     throw NullPointerException("could not downcast to StatisticDescriptorImpl");
   }
   FieldType typeCode = sdImpl->getTypeCode();
@@ -288,7 +288,8 @@ void ResourceInst::writeCompactValue(int64_t v) {
   }
 }
 
-void ResourceInst::writeResourceInst(StatDataOutput *dataOutArg, int32_t instId) {
+void ResourceInst::writeResourceInst(StatDataOutput *dataOutArg,
+                                     int32_t instId) {
   if (instId > MAX_BYTE_RESOURCE_INST_ID) {
     if (instId > MAX_SHORT_RESOURCE_INST_ID) {
       dataOutArg->writeByte(static_cast<int8_t>(INT_RESOURCE_INST_ID_TOKEN));
@@ -373,9 +374,9 @@ StatArchiveWriter::StatArchiveWriter(std::string outfile,
 }
 
 StatArchiveWriter::~StatArchiveWriter() {
-  if (dataBuffer != NULL) {
+  if (dataBuffer != nullptr) {
     delete dataBuffer;
-    dataBuffer = NULL;
+    dataBuffer = nullptr;
   }
   std::map<StatisticsType *, ResourceType *>::iterator p;
   for (p = resourceTypeMap.begin(); p != resourceTypeMap.end(); p++) {
@@ -398,7 +399,7 @@ void StatArchiveWriter::sample(int64_t timeStamp) {
   std::map<Statistics *, ResourceInst *>::iterator p;
   for (p = resourceInstMap.begin(); p != resourceInstMap.end(); p++) {
     ResourceInst *ri = (*p).second;
-    if (!!ri && (*p).first != NULL) {
+    if (!!ri && (*p).first != nullptr) {
       ri->writeSample();
     }
   }
@@ -426,12 +427,12 @@ void StatArchiveWriter::openFile(std::string filename) {
   StatDataOutput *p_dataBuffer = new StatDataOutput(filename);
 
   const uint8_t *buffBegin = dataBuffer->dataBuffer.getBuffer();
-  if (buffBegin == NULL) {
+  if (buffBegin == nullptr) {
     std::string s("undefined stat data buffer beginning");
     throw NullPointerException(s.c_str());
   }
   const uint8_t *buffEnd = dataBuffer->dataBuffer.getCursor();
-  if (buffEnd == NULL) {
+  if (buffEnd == nullptr) {
     std::string s("undefined stat data buffer end");
     throw NullPointerException(s.c_str());
   }
@@ -454,7 +455,7 @@ void StatArchiveWriter::flush() {
   /*
     // have to figure out the problem with this code.
     delete dataBuffer;
-    dataBuffer = NULL;
+    dataBuffer = nullptr;
 
     dataBuffer = new StatDataOutput(archiveFile);
    */
@@ -539,7 +540,7 @@ void StatArchiveWriter::allocateResourceInst(Statistics *s) {
   ResourceType *type = getResourceType(s);
 
   ResourceInst *ri = new ResourceInst(resourceInstId, s, type, dataBuffer);
-  if (ri == NULL) {
+  if (ri == nullptr) {
     std::string s("could not create new resource instance");
     throw NullPointerException(s.c_str());
   }
@@ -555,18 +556,18 @@ void StatArchiveWriter::allocateResourceInst(Statistics *s) {
 
 ResourceType *StatArchiveWriter::getResourceType(Statistics *s) {
   StatisticsType *type = s->getType();
-  if (type == NULL) {
+  if (type == nullptr) {
     std::string s("could not know the type of the statistics object");
     throw NullPointerException(s.c_str());
   }
-  ResourceType *rt = NULL;
+  ResourceType *rt = nullptr;
   std::map<StatisticsType *, ResourceType *>::iterator p;
   p = resourceTypeMap.find(type);
   if (p != resourceTypeMap.end()) {
     rt = (*p).second;
   } else {
     rt = new ResourceType(resourceTypeId, type);
-    if (type == NULL) {
+    if (type == nullptr) {
       std::string s("could not allocate memory for a new resourcetype");
       throw NullPointerException(s.c_str());
     }
@@ -584,7 +585,7 @@ ResourceType *StatArchiveWriter::getResourceType(Statistics *s) {
       std::string statsName = stats[i]->getName();
       this->dataBuffer->writeString(statsName);
       StatisticDescriptorImpl *sdImpl = (StatisticDescriptorImpl *)stats[i];
-      if (sdImpl == NULL) {
+      if (sdImpl == nullptr) {
         std::string err("could not down cast to StatisticDescriptorImpl");
         throw NullPointerException(err.c_str());
       }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/StatArchiveWriter.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/StatArchiveWriter.hpp b/src/cppcache/src/statistics/StatArchiveWriter.hpp
index b41d8e7..10b50a3 100644
--- a/src/cppcache/src/statistics/StatArchiveWriter.hpp
+++ b/src/cppcache/src/statistics/StatArchiveWriter.hpp
@@ -57,7 +57,7 @@ const int32_t INT_TIMESTAMP_TOKEN = 65535;
 const int64_t NANOS_PER_MILLI = 1000000;
 
 /** @file
-*/
+ */
 
 namespace apache {
 namespace geode {
@@ -74,7 +74,7 @@ namespace statistics {
 
 class CPPCACHE_EXPORT StatDataOutput {
  public:
-  StatDataOutput() : bytesWritten(0), m_fp(NULL), closed(false) {}
+  StatDataOutput() : bytesWritten(0), m_fp(nullptr), closed(false) {}
   StatDataOutput(std::string);
   ~StatDataOutput();
   /**

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/StatSamplerStats.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/StatSamplerStats.cpp b/src/cppcache/src/statistics/StatSamplerStats.cpp
index 4097322..10ea6b4 100644
--- a/src/cppcache/src/statistics/StatSamplerStats.cpp
+++ b/src/cppcache/src/statistics/StatSamplerStats.cpp
@@ -19,8 +19,8 @@
 using namespace apache::geode::statistics;
 
 /**
-  * Statistics related to the statistic sampler.
-*/
+ * Statistics related to the statistic sampler.
+ */
 
 StatSamplerStats::StatSamplerStats() {
   StatisticsFactory* statFactory = StatisticsFactory::getExistingInstance();
@@ -78,15 +78,15 @@ void StatSamplerStats::close() {
 /**
  * All objects are created by factory, and the reference is passed to this class
  * Factory takes the responsibility of deleting the objetcs.
- * Hence they can be simply set to NULL here.
+ * Hence they can be simply set to nullptr here.
  * But it is mandatory that StatSamplerStats::close() be called
  * before this destructor gets called,
  * otherwise samplerStats will not get deleted and a memory leak will occur.
  */
 StatSamplerStats::~StatSamplerStats() {
-  samplerType = NULL;
+  samplerType = nullptr;
   for (int32_t i = 0; i < 2; i++) {
-    statDescriptorArr[i] = NULL;
+    statDescriptorArr[i] = nullptr;
   }
-  samplerStats = NULL;
+  samplerStats = nullptr;
 }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/StatisticDescriptorImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/StatisticDescriptorImpl.cpp b/src/cppcache/src/statistics/StatisticDescriptorImpl.cpp
index 117acba..bddca4a 100644
--- a/src/cppcache/src/statistics/StatisticDescriptorImpl.cpp
+++ b/src/cppcache/src/statistics/StatisticDescriptorImpl.cpp
@@ -70,7 +70,7 @@ StatisticDescriptor* StatisticDescriptorImpl::createIntCounter(
   FieldType fieldType = INT_TYPE;
   StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
       statName, fieldType, description, units, true, isLargerBetter);
-  if (sdi == NULL) {
+  if (sdi == nullptr) {
     throw OutOfMemoryException(
         "StatisticDescriptorImpl::createIntCounter: out of memory");
   }
@@ -83,7 +83,7 @@ StatisticDescriptor* StatisticDescriptorImpl::createLongCounter(
   FieldType fieldType = LONG_TYPE;
   StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
       name, fieldType, description, units, true, isLargerBetter);
-  if (sdi == NULL) {
+  if (sdi == nullptr) {
     throw OutOfMemoryException(
         "StatisticDescriptorImpl::createLongCounter: out of memory");
   }
@@ -96,7 +96,7 @@ StatisticDescriptor* StatisticDescriptorImpl::createDoubleCounter(
   FieldType fieldType = DOUBLE_TYPE;
   StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
       name, fieldType, description, units, true, isLargerBetter);
-  if (sdi == NULL) {
+  if (sdi == nullptr) {
     throw OutOfMemoryException(
         "StatisticDescriptorImpl::createDoubleCounter: out of memory");
   }
@@ -109,7 +109,7 @@ StatisticDescriptor* StatisticDescriptorImpl::createIntGauge(
   FieldType fieldType = INT_TYPE;
   StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
       name, fieldType, description, units, false, isLargerBetter);
-  if (sdi == NULL) {
+  if (sdi == nullptr) {
     throw OutOfMemoryException(
         "StatisticDescriptorImpl::createIntGauge: out of memory");
   }
@@ -123,7 +123,7 @@ StatisticDescriptor* StatisticDescriptorImpl::createLongGauge(
   StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
       name, fieldType, description, units, false, isLargerBetter);
 
-  if (sdi == NULL) {
+  if (sdi == nullptr) {
     throw OutOfMemoryException(
         "StatisticDescriptorImpl::createLongGauge: out of memory");
   }
@@ -136,7 +136,7 @@ StatisticDescriptor* StatisticDescriptorImpl::createDoubleGauge(
   FieldType fieldType = DOUBLE_TYPE;
   StatisticDescriptorImpl* sdi = new StatisticDescriptorImpl(
       name, fieldType, description, units, false, isLargerBetter);
-  if (sdi == NULL) {
+  if (sdi == nullptr) {
     throw OutOfMemoryException(
         "StatisticDescriptorImpl::createDoubleGauge: out of memory");
   }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/Statistics.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/Statistics.cpp b/src/cppcache/src/statistics/Statistics.cpp
index 0b969bc..7a52e50 100644
--- a/src/cppcache/src/statistics/Statistics.cpp
+++ b/src/cppcache/src/statistics/Statistics.cpp
@@ -25,12 +25,12 @@ void Statistics::close() {}
 int32_t Statistics::nameToId(const char* name) { return 0; }
 
 StatisticDescriptor* Statistics::nameToDescriptor(const char* name) {
-  return NULL;
+  return nullptr;
 }
 
 int64_t Statistics::getUniqueId() { return 0; }
 
-StatisticsType* Statistics::getType() { return NULL; }
+StatisticsType* Statistics::getType() { return nullptr; }
 
 const char* Statistics::getTextId() { return ""; }
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/StatisticsManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/StatisticsManager.cpp b/src/cppcache/src/statistics/StatisticsManager.cpp
index 8bfe46a..daab20a 100644
--- a/src/cppcache/src/statistics/StatisticsManager.cpp
+++ b/src/cppcache/src/statistics/StatisticsManager.cpp
@@ -38,19 +38,20 @@ using namespace apache::geode::statistics;
 /**
  * static member initialization
  */
-StatisticsManager* StatisticsManager::s_singleton = NULL;
+StatisticsManager* StatisticsManager::s_singleton = nullptr;
 
-StatisticsManager::StatisticsManager(const char* filePath, int64_t sampleInterval,
-                                     bool enabled, int64_t statFileLimit,
+StatisticsManager::StatisticsManager(const char* filePath,
+                                     int64_t sampleInterval, bool enabled,
+                                     int64_t statFileLimit,
                                      int64_t statDiskSpaceLimit)
-    : m_sampler(NULL), m_adminRegion(nullptr) {
+    : m_sampler(nullptr), m_adminRegion(nullptr) {
   m_sampleIntervalMs =
       static_cast<int32_t>(sampleInterval) * 1000; /* convert to millis */
   m_newlyAddedStatsList.reserve(16);               // Allocate initial sizes
   GeodeStatisticsFactory::initInstance(this);
 
   try {
-    if (m_sampler == NULL && enabled) {
+    if (m_sampler == nullptr && enabled) {
       m_sampler = new HostStatSampler(filePath, m_sampleIntervalMs, this,
                                       statFileLimit, statDiskSpaceLimit);
       m_sampler->start();
@@ -61,11 +62,9 @@ StatisticsManager::StatisticsManager(const char* filePath, int64_t sampleInterva
   }
 }
 
-StatisticsManager* StatisticsManager::initInstance(const char* filePath,
-                                                   int64_t sampleIntervalMs,
-                                                   bool enabled,
-                                                   int64_t statsFileLimit,
-                                                   int64_t statsDiskSpaceLimit) {
+StatisticsManager* StatisticsManager::initInstance(
+    const char* filePath, int64_t sampleIntervalMs, bool enabled,
+    int64_t statsFileLimit, int64_t statsDiskSpaceLimit) {
   if (!s_singleton) {
     s_singleton = new StatisticsManager(filePath, sampleIntervalMs, enabled,
                                         statsFileLimit, statsDiskSpaceLimit);
@@ -79,7 +78,7 @@ StatisticsManager* StatisticsManager::getExistingInstance() {
     return s_singleton;
   }
 
-  return NULL;
+  return nullptr;
 }
 
 void StatisticsManager::forceSample() {
@@ -101,7 +100,7 @@ StatisticsManager::~StatisticsManager() {
       LOGFINEST("~StatisticsManager has found %d leftover statistics:", count);
       std::vector<Statistics*>::iterator iterFind = m_statsList.begin();
       while (iterFind != m_statsList.end()) {
-        if (*iterFind != NULL) {
+        if (*iterFind != nullptr) {
           std::string temp((*iterFind)->getType()->getName());
           LOGFINEST("Leftover statistic: %s", temp.c_str());
           /* adongre
@@ -112,7 +111,7 @@ StatisticsManager::~StatisticsManager() {
            * FIX : Put the call into the if condition
            */
           deleteStatistics(*iterFind);
-          *iterFind = NULL;
+          *iterFind = nullptr;
         }
         ++iterFind;
       }
@@ -136,9 +135,9 @@ StatisticsManager::~StatisticsManager() {
 }
 
 void StatisticsManager::clean() {
-  if (s_singleton != NULL) {
+  if (s_singleton != nullptr) {
     delete s_singleton;
-    s_singleton = NULL;
+    s_singleton = nullptr;
   }
 }
 
@@ -149,10 +148,10 @@ ACE_Recursive_Thread_Mutex& StatisticsManager::getListMutex() {
 }
 
 void StatisticsManager::closeSampler() {
-  if (m_sampler != NULL) {
+  if (m_sampler != nullptr) {
     m_sampler->stop();
     delete m_sampler;
-    m_sampler = NULL;
+    m_sampler = nullptr;
   }
 }
 void StatisticsManager::addStatisticsToList(Statistics* stat) {
@@ -190,7 +189,7 @@ Statistics* StatisticsManager::findFirstStatisticsByType(StatisticsType* type) {
     }
     start++;
   }
-  return NULL;
+  return nullptr;
 }
 
 std::vector<Statistics*> StatisticsManager::findStatisticsByType(
@@ -252,7 +251,7 @@ Statistics* StatisticsManager::findStatisticsByUniqueId(int64_t uniqueId) {
     }
     start++;
   }
-  return NULL;
+  return nullptr;
 }
 
 void StatisticsManager::deleteStatistics(Statistics*& stat) {
@@ -263,5 +262,5 @@ void StatisticsManager::deleteStatistics(Statistics*& stat) {
     OsStatisticsImpl* ptr = dynamic_cast<OsStatisticsImpl*>(stat);
     delete ptr;
   }
-  stat = NULL;
+  stat = nullptr;
 }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/StatisticsManager.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/StatisticsManager.hpp b/src/cppcache/src/statistics/StatisticsManager.hpp
index f85ec3f..0fa9ed2 100644
--- a/src/cppcache/src/statistics/StatisticsManager.hpp
+++ b/src/cppcache/src/statistics/StatisticsManager.hpp
@@ -34,7 +34,7 @@
 #include <AdminRegion.hpp>
 
 /** @file
-*/
+ */
 
 namespace apache {
 namespace geode {
@@ -71,8 +71,9 @@ class StatisticsManager {
 
   static StatisticsManager* s_singleton;
 
-  StatisticsManager(const char* filePath, int64_t sampleIntervalMs, bool enabled,
-                    int64_t statFileLimit = 0, int64_t statDiskSpaceLimit = 0);
+  StatisticsManager(const char* filePath, int64_t sampleIntervalMs,
+                    bool enabled, int64_t statFileLimit = 0,
+                    int64_t statDiskSpaceLimit = 0);
 
   void closeSampler();
 
@@ -112,7 +113,7 @@ class StatisticsManager {
 
   //------------ Find Statistics ---------------------
 
-  /** Return the first instance that matches the type, or NULL */
+  /** Return the first instance that matches the type, or nullptr */
   Statistics* findFirstStatisticsByType(StatisticsType* type);
 
   std::vector<Statistics*> findStatisticsByType(StatisticsType* type);

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/StatisticsTypeImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/StatisticsTypeImpl.cpp b/src/cppcache/src/statistics/StatisticsTypeImpl.cpp
index 0df815f..3603652 100644
--- a/src/cppcache/src/statistics/StatisticsTypeImpl.cpp
+++ b/src/cppcache/src/statistics/StatisticsTypeImpl.cpp
@@ -22,30 +22,30 @@
 using namespace apache::geode::statistics;
 
 /**
-* Gathers together a number of {@link StatisticDescriptor statistics}
-* into one logical type.
-*
-*/
+ * Gathers together a number of {@link StatisticDescriptor statistics}
+ * into one logical type.
+ *
+ */
 
 /**
-* Creates a new <code>StatisticsType</code> with the given name,
-* description, and statistics.
-*
-* @param name
-*        The name of this statistics type (for example,
-*        <code>"DatabaseStatistics"</code>)
-* @param description
-*        A description of this statistics type (for example,
-*        "Information about the application's use of the
-*        database").
-* @param stats
-*        Descriptions of the individual statistics grouped together
-*        in this statistics type{@link StatisticDescriptor}.
-*
-* @throws NullPointerException
-*         If either <code>name</code> or <code>stats</code> is
-*         <code>null</code>.
-*/
+ * Creates a new <code>StatisticsType</code> with the given name,
+ * description, and statistics.
+ *
+ * @param name
+ *        The name of this statistics type (for example,
+ *        <code>"DatabaseStatistics"</code>)
+ * @param description
+ *        A description of this statistics type (for example,
+ *        "Information about the application's use of the
+ *        database").
+ * @param stats
+ *        Descriptions of the individual statistics grouped together
+ *        in this statistics type{@link StatisticDescriptor}.
+ *
+ * @throws NullPointerException
+ *         If either <code>name</code> or <code>stats</code> is
+ *         <code>null</code>.
+ */
 
 StatisticsTypeImpl::StatisticsTypeImpl(const char* nameArg,
                                        const char* descriptionArg,
@@ -55,7 +55,7 @@ StatisticsTypeImpl::StatisticsTypeImpl(const char* nameArg,
     const char* s = "Cannot have a null statistics type name";
     throw NullPointerException(s);
   }
-  if (statsArg == NULL) {
+  if (statsArg == nullptr) {
     const char* s = "Cannot have a null statistic descriptors";
     throw NullPointerException(s);
   }
@@ -89,7 +89,7 @@ StatisticsTypeImpl::StatisticsTypeImpl(const char* nameArg,
      *       catch the exception thrown by the dynamic_cast
      */
 
-    if (sd != NULL) {
+    if (sd != nullptr) {
       if (sd->getTypeCode() == INT_TYPE) {
         sd->setId(intCount);
         intCount++;
@@ -125,13 +125,13 @@ StatisticsTypeImpl::~StatisticsTypeImpl() {
     // Delete the descriptor pointers from the array
     for (int32_t i = 0; i < statsLength; i++) {
       delete stats[i];
-      stats[i] = NULL;
+      stats[i] = nullptr;
     }
     // same pointers are also stored in this map.
     // So, Set the pointers to null.
     StatisticsDescMap::iterator iterFind = statsDescMap.begin();
     while (iterFind != statsDescMap.end()) {
-      (*iterFind).second = NULL;
+      (*iterFind).second = nullptr;
       iterFind++;
     }
   } catch (...) {
@@ -166,21 +166,21 @@ StatisticDescriptor* StatisticsTypeImpl::nameToDescriptor(const char* nameArg) {
 //////////////////////  Instance Methods  //////////////////////
 
 /**
-* Gets the number of statistics in this type that are ints.
-*/
+ * Gets the number of statistics in this type that are ints.
+ */
 int32_t StatisticsTypeImpl::getIntStatCount() { return intStatCount; }
 
 /**
-* Gets the number of statistics in this type that are longs.
-*/
+ * Gets the number of statistics in this type that are longs.
+ */
 int32_t StatisticsTypeImpl::getLongStatCount() { return longStatCount; }
 
 /**
-* Gets the number of statistics that are doubles.
-*/
+ * Gets the number of statistics that are doubles.
+ */
 int32_t StatisticsTypeImpl::getDoubleStatCount() { return doubleStatCount; }
 
 /**
-* Gets the total number of statistic descriptors.
-*/
+ * Gets the total number of statistic descriptors.
+ */
 int32_t StatisticsTypeImpl::getDescriptorsCount() { return statsLength; }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/statistics/WindowsProcessStats.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/WindowsProcessStats.cpp b/src/cppcache/src/statistics/WindowsProcessStats.cpp
index 4c7edc5..f9213ec 100644
--- a/src/cppcache/src/statistics/WindowsProcessStats.cpp
+++ b/src/cppcache/src/statistics/WindowsProcessStats.cpp
@@ -33,7 +33,7 @@ WindowsProcessStats::WindowsProcessStats(int64_t pid, const char* name) {
 
   // Create Statistics
   this->stats = statFactory->createOsStatistics(m_statsType, name, pid);
-  GF_D_ASSERT(this->stats != NULL);
+  GF_D_ASSERT(this->stats != nullptr);
 
 // Refresh Stats Values
 #if defined(_WIN32)
@@ -181,7 +181,7 @@ void WindowsProcessStats::createType(StatisticsFactory* statFactory) {
     m_statsType = statFactory->findType("WindowsProcessStats");
   }
 
-  if (m_statsType == NULL) {
+  if (m_statsType == nullptr) {
     throw OutOfMemoryException("WindowsProcessStats::createType: out memory");
   }
 
@@ -216,18 +216,20 @@ int32_t WindowsProcessStats::getCpuUsage() {
 int64_t WindowsProcessStats::getCPUTime() {
   return stats->getLong(activeTimeLONG);
 }
-int32_t WindowsProcessStats::getNumThreads() { return stats->getInt(threadsINT); }
+int32_t WindowsProcessStats::getNumThreads() {
+  return stats->getInt(threadsINT);
+}
 int64_t WindowsProcessStats::getAllCpuTime() {
   return ((stats->getLong(userTimeLONG)) + (stats->getLong(systemTimeLONG)));
 }
 
 void WindowsProcessStats::close() {
-  if (stats != NULL) {
+  if (stats != nullptr) {
     stats->close();
   }
 }
 
 WindowsProcessStats::~WindowsProcessStats() {
-  m_statsType = NULL;
-  stats = NULL;
+  m_statsType = nullptr;
+  stats = nullptr;
 }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/test/ByteArrayTest.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/test/ByteArrayTest.cpp b/src/cppcache/test/ByteArrayTest.cpp
index ac91599..61d18fe 100644
--- a/src/cppcache/test/ByteArrayTest.cpp
+++ b/src/cppcache/test/ByteArrayTest.cpp
@@ -22,7 +22,7 @@ using namespace apache::geode::client;
 TEST(ByteArrayTest, TestNoArgConstructor) {
   const ByteArray ba;
   EXPECT_EQ(0U, ba.size()) << "Zero size for no-arg constructor";
-  EXPECT_EQ((const uint8_t *)NULL, (const uint8_t *)ba)
+  EXPECT_EQ((const uint8_t *)nullptr, (const uint8_t *)ba)
       << "Null pointer for no-arg constructor";
 }
 
@@ -30,7 +30,7 @@ TEST(ByteArrayTest, TestTwoArgConstructor) {
   const uint8_t bytes[] = {0xDE, 0xAD, 0xBE, 0xEF};
   const ByteArray ba(bytes, 4);
   EXPECT_EQ(4U, ba.size()) << "Correct size for two-arg constructor";
-  EXPECT_NE((const uint8_t *)NULL, (const uint8_t *)ba)
+  EXPECT_NE((const uint8_t *)nullptr, (const uint8_t *)ba)
       << "Non-null pointer for two-arg constructor";
   EXPECT_EQ(0xDE, ba[0]) << "Correct zeroth byte for two-arg constructor";
   EXPECT_EQ(0xAD, ba[1]) << "Correct first byte for two-arg constructor";
@@ -43,7 +43,7 @@ TEST(ByteArrayTest, TestCopyConstructor) {
   const ByteArray ba1(bytes, 4U);
   const ByteArray ba2(ba1);
   EXPECT_EQ(4U, ba2.size()) << "Correct size for copy constructor";
-  EXPECT_NE((const uint8_t *)NULL, (const uint8_t *)ba2)
+  EXPECT_NE((const uint8_t *)nullptr, (const uint8_t *)ba2)
       << "Non-null pointer for copy constructor";
   EXPECT_EQ(0xDE, ba2[0]) << "Correct zeroth byte for copy constructor";
   EXPECT_EQ(0xAD, ba2[1]) << "Correct first byte for copy constructor";
@@ -57,7 +57,7 @@ TEST(ByteArrayTest, TestAssignmentOperator) {
   const ByteArray ba1(bytes, 4U);
   ba2 = ba1;
   EXPECT_EQ(4U, ba2.size()) << "Correct size for assignment operator";
-  EXPECT_NE((const uint8_t *)NULL, (const uint8_t *)ba2)
+  EXPECT_NE((const uint8_t *)nullptr, (const uint8_t *)ba2)
       << "Non-null pointer for assignment operator";
   EXPECT_EQ(0xDE, ba2[0]) << "Correct zeroth byte for assignment operator";
   EXPECT_EQ(0xAD, ba2[1]) << "Correct first byte for assignment operator";
@@ -69,7 +69,7 @@ TEST(ByteArrayTest, TestFromStringForEmpty) {
   const std::string empty;
   const ByteArray ba(ByteArray::fromString(empty));
   EXPECT_EQ(0U, ba.size()) << "Zero size for empty string";
-  EXPECT_EQ((const uint8_t *)NULL, (const uint8_t *)ba)
+  EXPECT_EQ((const uint8_t *)nullptr, (const uint8_t *)ba)
       << "Null pointer for empty string";
 }
 
@@ -77,7 +77,7 @@ TEST(ByteArrayTest, TestFromStringForOneCharacter) {
   const std::string one("A");
   const ByteArray ba(ByteArray::fromString(one));
   EXPECT_EQ(1U, ba.size()) << "Correct size for one character";
-  EXPECT_NE((const uint8_t *)NULL, (const uint8_t *)ba)
+  EXPECT_NE((const uint8_t *)nullptr, (const uint8_t *)ba)
       << "Non-null pointer for one character";
   EXPECT_EQ(0xA0, ba[0]) << "Correct zeroth byte for one character";
 }
@@ -86,7 +86,7 @@ TEST(ByteArrayTest, TestFromStringForEightCharacters) {
   const std::string eight("BABEFACE");
   const ByteArray ba(ByteArray::fromString(eight));
   EXPECT_EQ(4U, ba.size()) << "Correct size for eight characters";
-  EXPECT_NE((const uint8_t *)NULL, (const uint8_t *)ba)
+  EXPECT_NE((const uint8_t *)nullptr, (const uint8_t *)ba)
       << "Non-null pointer for eight characters";
   EXPECT_EQ(0xBA, ba[0]) << "Correct zeroth byte for eight characters";
   EXPECT_EQ(0xBE, ba[1]) << "Correct first byte for eight characters";

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/test/CacheableStringEqualityTest.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/test/CacheableStringEqualityTest.cpp b/src/cppcache/test/CacheableStringEqualityTest.cpp
new file mode 100644
index 0000000..2f62248
--- /dev/null
+++ b/src/cppcache/test/CacheableStringEqualityTest.cpp
@@ -0,0 +1,178 @@
+/*
+ * 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.
+ */
+
+#include <gtest/gtest.h>
+
+#include <functional>
+#include <unordered_set>
+#include <unordered_map>
+
+#include <geode/utils.hpp>
+#include <geode/CacheableString.hpp>
+
+using namespace apache::geode::client;
+
+TEST(CacheableStringEqualityTest, StdHashSpecializationViaStdSharedPtr) {
+  auto s = CacheableString::create("test");
+  typedef decltype(s) key_type;
+  EXPECT_EQ(s->hashcode(), dereference_hash<key_type>{}(s));
+}
+
+TEST(CacheableStringEqualityTest, StdHashSpecializationViaStdPtr) {
+  auto s = CacheableString::create("test");
+  typedef decltype(s)::element_type* key_type;
+
+  EXPECT_EQ(s->hashcode(), dereference_hash<key_type>{}(s.get()));
+}
+
+TEST(CacheableStringEqualityTest, CacheableEqualToCalled) {
+  auto s1 = CacheableString::create("test");
+  auto s2 = CacheableString::create("test");
+  typedef decltype(s1) key_type;
+
+  EXPECT_NE(s1, s2);
+  EXPECT_EQ(*s1, *s2);
+  EXPECT_TRUE(dereference_equal_to<key_type>{}(s1, s2));
+}
+
+TEST(CacheableStringEqualityTest, CacheableHashSet) {
+  auto s1 = CacheableString::create("test");
+  auto s2 = CacheableString::create("test");
+  auto s3 = CacheableString::create("nope");
+  typedef decltype(s1) key_type;
+
+  EXPECT_NE(s1, s2);
+  EXPECT_EQ(*s1, *s2);
+  EXPECT_EQ(s1->hashcode(), s2->hashcode());
+
+  std::unordered_set<key_type, dereference_hash<key_type>, dereference_equal_to<key_type>> set = {s1};
+
+  {
+    const auto& f = set.find(s2);
+    EXPECT_NE(set.end(), f);
+    EXPECT_EQ(s1, *f);
+    EXPECT_NE(s2, *f);
+  }
+
+  {
+    const auto& f = set.find(s3);
+    EXPECT_EQ(set.end(), f);
+  }
+}
+
+TEST(CacheableStringEqualityTest, CacheableHashSetExplicitHash) {
+  auto s1 = CacheableString::create("test");
+  auto s2 = CacheableString::create("test");
+  auto s3 = CacheableString::create("nope");
+  typedef decltype(s1) key_type;
+
+  EXPECT_NE(s1, s2);
+  EXPECT_EQ(*s1, *s2);
+  EXPECT_EQ(s1->hashcode(), s2->hashcode());
+
+  std::unordered_set<key_type, CacheableKey::hash, CacheableKey::equal_to> set = {s1};
+
+  {
+    const auto& f = set.find(s2);
+    EXPECT_NE(set.end(), f);
+    EXPECT_EQ(s1, *f);
+    EXPECT_NE(s2, *f);
+  }
+
+  {
+    const auto& f = set.find(s3);
+    EXPECT_EQ(set.end(), f);
+  }
+}
+
+TEST(CacheableStringEqualityTest, CacheableHashMapViaSharedPtr) {
+  auto s1 = CacheableString::create("test");
+  auto s2 = CacheableString::create("test");
+  auto s3 = CacheableString::create("nope");
+  typedef decltype(s1) key_type;
+
+  EXPECT_NE(s1, s2);
+  EXPECT_EQ(*s1, *s2);
+  EXPECT_EQ(s1->hashcode(), s2->hashcode());
+
+  std::unordered_map<key_type, int, dereference_hash<key_type>, dereference_equal_to<key_type>>
+    map = {{s1, 1}};
+
+  {
+    const auto& f = map.find(s2);
+    EXPECT_NE(map.end(), f);
+    EXPECT_EQ(s1, f->first);
+    EXPECT_NE(s2, f->first);
+  }
+
+  {
+    const auto& f = map.find(s3);
+    EXPECT_EQ(map.end(), f);
+  }
+}
+
+TEST(CacheableStringEqualityTest, CacheableHashMapViaPtr) {
+  auto s1 = CacheableString::create("test");
+  auto s2 = CacheableString::create("test");
+  auto s3 = CacheableString::create("nope");
+  typedef decltype(s1)::element_type* key_type;
+
+  EXPECT_NE(s1, s2);
+  EXPECT_EQ(*s1, *s2);
+  EXPECT_EQ(s1->hashcode(), s2->hashcode());
+
+  std::unordered_map<key_type, int, dereference_hash<key_type>, dereference_equal_to<key_type>>
+    map = {{s1.get(), 1}};
+
+  {
+    const auto& f = map.find(s2.get());
+    EXPECT_NE(map.end(), f);
+    EXPECT_EQ(s1.get(), f->first);
+    EXPECT_NE(s2.get(), f->first);
+  }
+
+  {
+    const auto& f = map.find(s3.get());
+    EXPECT_EQ(map.end(), f);
+  }
+}
+
+TEST(CacheableStringEqualityTest, CacheableHashMapExplicitHash) {
+  auto s1 = CacheableString::create("test");
+  auto s2 = CacheableString::create("test");
+  auto s3 = CacheableString::create("nope");
+  typedef decltype(s1) key_type;
+
+  EXPECT_NE(s1, s2);
+  EXPECT_EQ(*s1, *s2);
+  EXPECT_EQ(s1->hashcode(), s2->hashcode());
+
+  std::unordered_map<key_type, int, CacheableKey::hash, CacheableKey::equal_to>
+    map = {{s1, 1}};
+
+  {
+    const auto& f = map.find(s2);
+    EXPECT_NE(map.end(), f);
+    EXPECT_EQ(s1, f->first);
+    EXPECT_NE(s2, f->first);
+  }
+
+  {
+    const auto& f = map.find(s3);
+    EXPECT_EQ(map.end(), f);
+  }
+}


Mime
View raw message