http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
----------------------------------------------------------------------
diff --git 
a/src/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp 
b/src/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
index 18f0d34..aac3381 100644
--- a/src/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
@@ -101,7 +101,7 @@ class MyCqListener : public CqListener {
     printf(" in cqEvent.getQueryOperation() %d id = %d\n",
            cqEvent.getQueryOperation(), m_id);
     printf(" in update key = %s \n",
-           (dynamic_cast<CacheableString*>(cqEvent.getKey().ptr()))->asChar());
+           (dynamic_cast<CacheableString*>(cqEvent.getKey().get()))->asChar());
     m_numEvents++;
     switch (cqEvent.getQueryOperation()) {
       case CqOperation::OP_TYPE_CREATE:
@@ -144,7 +144,7 @@ std::string getXmlPath() {
 void initCredentialGenerator() {
   credentialGeneratorHandler = CredentialGenerator::create("DUMMY3");
 
-  if (credentialGeneratorHandler == NULLPTR) {
+  if (credentialGeneratorHandler == nullptr) {
     FAIL("credentialGeneratorHandler is NULL");
   }
 }
@@ -207,7 +207,7 @@ void stepOne(bool pool = false, bool locator = false) {
   LOG("StepOne1 complete. 1");
   initClientCq(true);
   LOG("StepOne1 complete. 2");
-  createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, NULLPTR, false, 
true);
+  createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, nullptr, false, 
true);
   LOG("StepOne1 complete. 3");
   RegionPtr regptr = getHelper()->getRegion(regionNamesCq[0]);
   LOG("StepOne1 complete. 4");
@@ -222,7 +222,7 @@ void stepOne2(bool pool = false, bool locator = false) {
   LOG("StepOne2 complete. 1");
   initClientCq(true);
   LOG("StepOne2 complete. 2");
-  createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, NULLPTR, false, 
true);
+  createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, nullptr, false, 
true);
   LOG("StepOne2 complete. 3");
   RegionPtr regptr = getHelper()->getRegion(regionNamesCq[0]);
   LOG("StepOne2 complete. 4");
@@ -290,7 +290,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
 
     try {
       for (i = 0; i < MAX_LISTNER; i++) {
-        CqListenerPtr cqLstner(new MyCqListener(i));
+        auto cqLstner = std::make_shared<MyCqListener>(i);
         CqAttributesFactory cqFac;
         cqFac.addCqListener(cqLstner);
         CqAttributesPtr cqAttr = cqFac.create();
@@ -335,7 +335,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo2)
     qh->populatePortfolioData(regPtr0, 3, 2, 1);
     qh->populatePositionData(subregPtr0, 3, 2);
     for (int i = 1; i <= 4; i++) {
-      CacheablePtr port(new Portfolio(i, 2));
+      auto port = std::make_shared<Portfolio>(i, 2);
 
       char tmp[25] = {'\0'};
       sprintf(tmp, "port1-%d", i);
@@ -380,12 +380,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
     }
 
     // if key port1-4 then only query 3 and 4 will satisfied
-    CqQueryPtr cqy = qs->getCq(cqNames[3]);
-    CqAttributesPtr cqAttr = cqy->getCqAttributes();
-    VectorOfCqListener vl;
+    auto cqy = qs->getCq(cqNames[3]);
+    auto cqAttr = cqy->getCqAttributes();
+    std::vector<CqListenerPtr> vl;
     cqAttr->getCqListeners(vl);
 
-    MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].ptr());
+    auto cqListener_3 = static_cast<MyCqListener*>(vl[0].get());
     printf(" cqListener_3 should have one create event = %d \n",
            cqListener_3->getNumInserts());
     ASSERT(cqListener_3->getNumInserts() == 1,
@@ -397,7 +397,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
     cqAttr = cqy->getCqAttributes();
     cqAttr->getCqListeners(vl);
 
-    MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].ptr());
+    auto cqListener_4 = static_cast<MyCqListener*>(vl[0].get());
     printf(" cqListener_4 should have one create event = %d \n",
            cqListener_4->getNumInserts());
     ASSERT(cqListener_4->getNumInserts() == 1,
@@ -420,10 +420,7 @@ END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
   {
-    // CachePtr userCache = getVirtualCache(userCreds, regionNamesCq[0]);
-    QueryServicePtr qs;
-
-    qs = userQueryService;
+    auto qs = userQueryService;
 
     char buf[1024];
 
@@ -440,7 +437,6 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
       events[i] = 0;
     }
 
-    CqAttributesFactory cqFac;
     for (i = 0; i < MAX_LISTNER; i++) {
       sprintf(buf, "get info for cq[%s]:", cqNames[i]);
       LOG(buf);
@@ -449,12 +445,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
     }
 
     // if key port1-4 then only query 3 and 4 will satisfied
-    CqQueryPtr cqy = qs->getCq(cqNames[3]);
-    CqAttributesPtr cqAttr = cqy->getCqAttributes();
-    VectorOfCqListener vl;
+    auto cqy = qs->getCq(cqNames[3]);
+    auto cqAttr = cqy->getCqAttributes();
+    std::vector<CqListenerPtr> vl;
     cqAttr->getCqListeners(vl);
 
-    MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].ptr());
+    MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].get());
     printf(" cqListener_3 should have one update event = %d \n",
            cqListener_3->getNumUpdates());
     ASSERT(cqListener_3->getNumUpdates() == 1,
@@ -466,7 +462,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
     cqAttr = cqy->getCqAttributes();
     cqAttr->getCqListeners(vl);
 
-    MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].ptr());
+    auto cqListener_4 = static_cast<MyCqListener*>(vl[0].get());
     printf(" cqListener_4 should have one update event = %d \n",
            cqListener_4->getNumUpdates());
     ASSERT(cqListener_4->getNumUpdates() == 1,

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityDH.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityDH.cpp 
b/src/cppcache/integration-test/testThinClientSecurityDH.cpp
index 2f0dbde..943b4ac 100644
--- a/src/cppcache/integration-test/testThinClientSecurityDH.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityDH.cpp
@@ -93,7 +93,7 @@ void initCredentialGenerator() {
     }
   }
 
-  if (credentialGeneratorHandler == NULLPTR) {
+  if (credentialGeneratorHandler == nullptr) {
     FAIL("credentialGeneratorHandler is NULL");
   }
 
@@ -113,7 +113,7 @@ void initClientAuth(char credentialsType, const char* 
dhAlgo) {
   printf("KeyStore Path is: %s", testsrc.c_str());
   config->insert("security-client-kspath", testsrc.c_str());
 
-  if (credentialGeneratorHandler == NULLPTR) {
+  if (credentialGeneratorHandler == nullptr) {
     FAIL("credentialGeneratorHandler is NULL");
   }
   bool insertAuthInit = true;
@@ -193,9 +193,9 @@ void DoNetSearch() {
     createRegionForSecurity(regionNamesAuth[1], USE_ACK, true);
     RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
     CacheableKeyPtr keyPtr = CacheableKey::create(keys[0]);
-    CacheableStringPtr checkPtr =
-        dynCast<CacheableStringPtr>(regPtr0->get(keyPtr));
-    if (checkPtr != NULLPTR && !strcmp(nvals[0], checkPtr->asChar())) {
+    auto checkPtr =
+        std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr));
+    if (checkPtr != nullptr && !strcmp(nvals[0], checkPtr->asChar())) {
       LOG("checkPtr is not null");
       char buf[1024];
       sprintf(buf, "In net search, get returned %s for key %s",
@@ -213,7 +213,7 @@ void DoNetSearch() {
 
 void initSecurityServer(int instance) {
   std::string cmdServerAuthenticator;
-  if (credentialGeneratorHandler == NULLPTR) {
+  if (credentialGeneratorHandler == nullptr) {
     FAIL("credentialGeneratorHandler is NULL");
   }
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityDH_MU.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityDH_MU.cpp 
b/src/cppcache/integration-test/testThinClientSecurityDH_MU.cpp
index 999b4e5..52f067f 100644
--- a/src/cppcache/integration-test/testThinClientSecurityDH_MU.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityDH_MU.cpp
@@ -96,7 +96,7 @@ void initCredentialGenerator() {
     }
   }
 
-  if (credentialGeneratorHandler == NULLPTR) {
+  if (credentialGeneratorHandler == nullptr) {
     FAIL("credentialGeneratorHandler is NULL");
   }
 
@@ -119,7 +119,7 @@ void initClientAuth(char credentialsType, const char* 
dhAlgo) {
   printf("KeyStore Path is: %s", testsrc.c_str());
   config->insert("security-client-kspath", testsrc.c_str());
 
-  if (credentialGeneratorHandler == NULLPTR) {
+  if (credentialGeneratorHandler == nullptr) {
     FAIL("credentialGeneratorHandler is NULL");
   }
   bool insertAuthInit = true;
@@ -163,11 +163,11 @@ void InitIncorrectClients(const char* dhAlgo) {
   }
 
   try {
-    createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, false,
+    createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false,
                             -1, true, 0);
     PoolPtr pool = getPool(regionNamesAuth[0]);
     LOG(" 6");
-    if (pool != NULLPTR) {
+    if (pool != nullptr) {
       LOG(" 7");
       RegionServicePtr virtualCache = getVirtualCache(userCreds, pool);
       LOG(" 8");
@@ -194,7 +194,7 @@ void InitCorrectClients(const char* dhAlgo) {
     LOG(other.getMessage());
   }
   try {
-    createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, false,
+    createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false,
                             -1, true, 0);
     PoolPtr pool = getPool(regionNamesAuth[0]);
     LOG(" 6");
@@ -214,7 +214,7 @@ void InitCorrectClients(const char* dhAlgo) {
 
 void DoNetSearch() {
   try {
-    createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, NULLPTR, false,
+    createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, nullptr, false,
                             -1, true, 0);
     PoolPtr pool = getPool(regionNamesAuth[1]);
     LOG(" 6");
@@ -225,9 +225,8 @@ void DoNetSearch() {
     RegionPtr regionPtr = virtualCache->getRegion(regionNamesAuth[1]);
 
     CacheableKeyPtr keyPtr = CacheableKey::create(keys[0]);
-    CacheableStringPtr checkPtr =
-        dynCast<CacheableStringPtr>(regionPtr->get(keyPtr));
-    if (checkPtr != NULLPTR && !strcmp(vals[0], checkPtr->asChar())) {
+    auto checkPtr = 
std::dynamic_pointer_cast<CacheableString>(regionPtr->get(keyPtr));
+    if (checkPtr != nullptr && !strcmp(vals[0], checkPtr->asChar())) {
       LOG("checkPtr is not null");
       char buf[1024];
       sprintf(buf, "In net search, get returned %s for key %s",
@@ -245,7 +244,7 @@ void DoNetSearch() {
 
 void initSecurityServer(int instance) {
   std::string cmdServerAuthenticator;
-  if (credentialGeneratorHandler == NULLPTR) {
+  if (credentialGeneratorHandler == nullptr) {
     FAIL("credentialGeneratorHandler is NULL");
   }
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
----------------------------------------------------------------------
diff --git 
a/src/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
 
b/src/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
index d81c4ba..59224aa 100644
--- 
a/src/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
+++ 
b/src/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
@@ -101,7 +101,7 @@ class MyCqListener : public CqListener {
     printf(" in cqEvent.getQueryOperation() %d id = %d\n",
            cqEvent.getQueryOperation(), m_id);
     printf(" in update key = %s \n",
-           (dynamic_cast<CacheableString*>(cqEvent.getKey().ptr()))->asChar());
+           (dynamic_cast<CacheableString*>(cqEvent.getKey().get()))->asChar());
     m_numEvents++;
     switch (cqEvent.getQueryOperation()) {
       case CqOperation::OP_TYPE_CREATE:
@@ -144,7 +144,7 @@ std::string getXmlPath() {
 void initCredentialGenerator() {
   credentialGeneratorHandler = CredentialGenerator::create("DUMMY3");
 
-  if (credentialGeneratorHandler == NULLPTR) {
+  if (credentialGeneratorHandler == nullptr) {
     FAIL("credentialGeneratorHandler is NULL");
   }
 }
@@ -216,7 +216,7 @@ void stepOne(bool pool = false, bool locator = false) {
   LOG("StepOne1 complete. 1");
   initClientCq(true, 0);
   LOG("StepOne1 complete. 2");
-  createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, NULLPTR, false, 
true);
+  createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, nullptr, false, 
true);
   LOG("StepOne1 complete. 3");
   RegionPtr regptr = getHelper()->getRegion(regionNamesCq[0]);
   LOG("StepOne1 complete. 4");
@@ -240,7 +240,7 @@ void stepOne2(bool pool = false, bool locator = false) {
   LOG("StepOne2 complete. 1");
   initClientCq(true, 1);
   LOG("StepOne2 complete. 2");
-  createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, NULLPTR, false, 
true);
+  createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, nullptr, false, 
true);
   LOG("StepOne2 complete. 3");
   RegionPtr regptr = getHelper()->getRegion(regionNamesCq[0]);
   LOG("StepOne2 complete. 4");
@@ -312,7 +312,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
 
     try {
       for (i = 0; i < MAX_LISTNER; i++) {
-        CqListenerPtr cqLstner(new MyCqListener(i));
+        auto cqLstner = std::make_shared<MyCqListener>(i);
         CqAttributesFactory cqFac;
         cqFac.addCqListener(cqLstner);
         CqAttributesPtr cqAttr = cqFac.create();
@@ -366,7 +366,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo2)
     qh->populatePortfolioData(regPtr0, 3, 2, 1);
     qh->populatePositionData(subregPtr0, 3, 2);
     for (int i = 1; i <= 4; i++) {
-      CacheablePtr port(new Portfolio(i, 2));
+      auto port = std::make_shared<Portfolio>(i, 2);
 
       char tmp[25] = {'\0'};
       sprintf(tmp, "port1-%d", i);
@@ -383,9 +383,7 @@ END_TASK_DEFINITION
 DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
   {
     // CachePtr userCache = getVirtualCache(userCreds, regionNamesCq[0]);
-    QueryServicePtr qs;
-
-    qs = userQueryService;
+    auto qs = userQueryService;
 
     char buf[1024];
 
@@ -402,7 +400,6 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
       events[i] = 0;
     }
 
-    CqAttributesFactory cqFac;
     for (i = 0; i < MAX_LISTNER; i++) {
       sprintf(buf, "get info for cq[%s]:", cqNames[i]);
       LOG(buf);
@@ -411,12 +408,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
     }
 
     // if key port1-4 then only query 3 and 4 will satisfied
-    CqQueryPtr cqy = qs->getCq(cqNames[3]);
-    CqAttributesPtr cqAttr = cqy->getCqAttributes();
-    VectorOfCqListener vl;
+    auto cqy = qs->getCq(cqNames[3]);
+    auto cqAttr = cqy->getCqAttributes();
+    std::vector<CqListenerPtr> vl;
     cqAttr->getCqListeners(vl);
 
-    MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].ptr());
+    auto cqListener_3 = static_cast<MyCqListener*>(vl[0].get());
     printf(" cqListener_3 should have one create event = %d \n",
            cqListener_3->getNumInserts());
     ASSERT(cqListener_3->getNumInserts() == 1,
@@ -428,7 +425,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
     cqAttr = cqy->getCqAttributes();
     cqAttr->getCqListeners(vl);
 
-    MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].ptr());
+    auto cqListener_4 = static_cast<MyCqListener*>(vl[0].get());
     printf(" cqListener_4 should have one create event = %d \n",
            cqListener_4->getNumInserts());
     ASSERT(cqListener_4->getNumInserts() == 1,
@@ -444,9 +441,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
     SLEEP(15000);  // sleep .25 min
     // CachePtr userCache = getVirtualCache(userCreds, regionNamesCq[0]);
     userQueryService = userCache->getQueryService();
-    QueryServicePtr qs;
-
-    qs = userQueryService;
+    auto qs = userQueryService;
 
     char buf[1024];
 
@@ -463,7 +458,6 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
       events[i] = 0;
     }
 
-    CqAttributesFactory cqFac;
     for (i = 0; i < MAX_LISTNER; i++) {
       sprintf(buf, "get info for cq[%s]:", cqNames[i]);
       LOG(buf);
@@ -474,12 +468,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
     if ((durableCq && !logicalCacheKeepAlive && !closeLogicalCache) ||
         (durableCq && logicalCacheKeepAlive && closeLogicalCache)) {
       // if key port1-4 then only query 3 and 4 will satisfied
-      CqQueryPtr cqy = qs->getCq(cqNames[3]);
-      CqAttributesPtr cqAttr = cqy->getCqAttributes();
-      VectorOfCqListener vl;
+      auto cqy = qs->getCq(cqNames[3]);
+      auto cqAttr = cqy->getCqAttributes();
+      std::vector<CqListenerPtr> vl;
       cqAttr->getCqListeners(vl);
 
-      MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].ptr());
+      auto cqListener_3 = static_cast<MyCqListener*>(vl[0].get());
       printf(" cqListener_3 should have one update event = %d \n",
              cqListener_3->getNumUpdates());
       ASSERT(cqListener_3->getNumUpdates() == 1,
@@ -491,7 +485,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
       cqAttr = cqy->getCqAttributes();
       cqAttr->getCqListeners(vl);
 
-      MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].ptr());
+      MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].get());
       printf(" cqListener_4 should have one update event = %d \n",
              cqListener_4->getNumUpdates());
       ASSERT(cqListener_4->getNumUpdates() == 1,
@@ -501,12 +495,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
     if ((!durableCq && !logicalCacheKeepAlive && !closeLogicalCache) ||
         (durableCq && !logicalCacheKeepAlive && closeLogicalCache)) {
       // if key port1-4 then only query 3 and 4 will satisfied
-      CqQueryPtr cqy = qs->getCq(cqNames[3]);
-      CqAttributesPtr cqAttr = cqy->getCqAttributes();
-      VectorOfCqListener vl;
+      auto cqy = qs->getCq(cqNames[3]);
+      auto cqAttr = cqy->getCqAttributes();
+      std::vector<CqListenerPtr> vl;
       cqAttr->getCqListeners(vl);
 
-      MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].ptr());
+      auto cqListener_3 = static_cast<MyCqListener*>(vl[0].get());
       printf(" cqListener_3 should have zero update event = %d \n",
              cqListener_3->getNumUpdates());
       ASSERT(cqListener_3->getNumUpdates() == 0,
@@ -518,7 +512,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
       cqAttr = cqy->getCqAttributes();
       cqAttr->getCqListeners(vl);
 
-      MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].ptr());
+      auto cqListener_4 = static_cast<MyCqListener*>(vl[0].get());
       printf(" cqListener_4 should have zero update event = %d \n",
              cqListener_4->getNumUpdates());
       ASSERT(cqListener_4->getNumUpdates() == 0,

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp
----------------------------------------------------------------------
diff --git 
a/src/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp 
b/src/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp
index 775efae..75ec233 100644
--- a/src/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp
@@ -67,7 +67,7 @@ void initCredentialGenerator() {
     }
   }
 
-  if (credentialGeneratorHandler == NULLPTR) {
+  if (credentialGeneratorHandler == nullptr) {
     FAIL("credentialGeneratorHandler is NULL");
   }
 
@@ -356,7 +356,7 @@ DUNIT_TASK_DEFINITION(CLIENT_1, StepOne)
     initClientAuth();
     try {
       LOG("Tying Region creation");
-      createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR,
+      createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr,
                               false, -1, true, 0);
       LOG("Region created successfully");
       PoolPtr pool = getPool(regionNamesAuth[0]);

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp
----------------------------------------------------------------------
diff --git 
a/src/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp 
b/src/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp
index 5f953ce..cea188d 100644
--- a/src/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp
@@ -140,7 +140,7 @@ void checkValuesMap(const HashMapOfCacheablePtr& values, 
int clientNum,
     key = CacheableString::create(keys[index]);
     HashMapOfCacheable::Iterator iter = values->find(key);
     ASSERT(iter != values->end(), "key not found in values map");
-    val = dynCast<CacheableStringPtr>(iter.second());
+    val = std::dynamic_pointer_cast<CacheableString>(iter.second());
     expectedVal = CacheableString::create(nvals[index]);
     ASSERT(*val == *expectedVal, "unexpected value in values map");
   }
@@ -159,8 +159,9 @@ void checkExceptionsMap(const HashMapOfExceptionPtr& 
exceptions, int clientNum,
       key = CacheableString::create(keys[index]);
       HashMapOfException::Iterator iter = exceptions->find(key);
       ASSERT(iter != exceptions->end(), "key not found in exceptions map");
-      ASSERT(instanceOf<NotAuthorizedExceptionPtr>(iter.second()),
-             "unexpected exception type in exception map");
+      ASSERT(
+          std::dynamic_pointer_cast<NotAuthorizedExceptionPtr>(iter.second()),
+          "unexpected exception type in exception map");
       printf("Got expected NotAuthorizedException: %s",
              iter.second()->getMessage());
     }
@@ -219,7 +220,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
       createEntry(regionNamesAuth[0], keys[0], vals[0]);
       createEntry(regionNamesAuth[0], keys[2], nvals[2]);
       RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
-      if (regPtr0 != NULLPTR) {
+      if (regPtr0 != nullptr) {
         regPtr0->registerAllKeys();
         regPtr0->unregisterAllKeys();
       }
@@ -227,13 +228,13 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
       VectorOfCacheableKey keysVec;
       keysVec.push_back(key0);
       keysVec.push_back(key2);
-      HashMapOfCacheablePtr values(new HashMapOfCacheable());
-      HashMapOfExceptionPtr exceptions(new HashMapOfException());
+      auto values = std::make_shared<HashMapOfCacheable>();
+      auto exceptions = std::make_shared<HashMapOfException>();
       regPtr0->getAll(keysVec, values, exceptions);
       ASSERT(values->size() == 2, "Expected 2 entries");
       ASSERT(exceptions->size() == (size_t)0, "Expected no exceptions");
-      CacheableStringPtr res0 = dynCast<CacheableStringPtr>((*values)[key0]);
-      CacheableStringPtr res2 = dynCast<CacheableStringPtr>((*values)[key2]);
+      auto res0 = std::dynamic_pointer_cast<CacheableString>((*values)[key0]);
+      auto res2 = std::dynamic_pointer_cast<CacheableString>((*values)[key2]);
       ASSERT(*res0 == *val0, "Unexpected value for key");
       ASSERT(*res2 == *val2, "Unexpected value for key");
     }
@@ -265,8 +266,8 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
       createRegionForSecurity(regionNamesAuth[0], USE_ACK, true);
       RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
       CacheableKeyPtr keyPtr = CacheableKey::create(keys[0]);
-      CacheableStringPtr checkPtr =
-          dynCast<CacheableStringPtr>(regPtr0->get(keyPtr));
+      auto checkPtr =
+          std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr));
       FAIL("Should get NotAuthorizedException");
     }
     HANDLE_NOT_AUTHORIZED_EXCEPTION
@@ -290,8 +291,8 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
     createRegionForSecurity(regionNamesAuth[0], USE_ACK, true);
 
     VectorOfCacheableKey keys;
-    HashMapOfCacheablePtr values(new HashMapOfCacheable());
-    HashMapOfExceptionPtr exceptions(new HashMapOfException());
+    auto values = std::make_shared<HashMapOfCacheable>();
+    auto exceptions = std::make_shared<HashMapOfException>();
     getKeysVector(keys, 6);
     RegionPtr rptr = getHelper()->getRegion(regionNamesAuth[0]);
     rptr->getAll(keys, values, exceptions);
@@ -309,8 +310,8 @@ DUNIT_TASK_DEFINITION(READER2_CLIENT, StepFour)
     createRegionForSecurity(regionNamesAuth[0], USE_ACK, true);
 
     VectorOfCacheableKey keys;
-    HashMapOfCacheablePtr values(new HashMapOfCacheable());
-    HashMapOfExceptionPtr exceptions(new HashMapOfException());
+    auto values = std::make_shared<HashMapOfCacheable>();
+    auto exceptions = std::make_shared<HashMapOfException>();
     getKeysVector(keys, 6);
     RegionPtr rptr = getHelper()->getRegion(regionNamesAuth[0]);
     rptr->getAll(keys, values, exceptions);

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientStatistics.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientStatistics.cpp 
b/src/cppcache/integration-test/testThinClientStatistics.cpp
index af985d4..ec9e1d0 100644
--- a/src/cppcache/integration-test/testThinClientStatistics.cpp
+++ b/src/cppcache/integration-test/testThinClientStatistics.cpp
@@ -168,10 +168,10 @@ void DoRegionOpsAndVerify() {
   bool flag ATTR_UNUSED = regPtr0->remove(keyptr);
 
   RegionEntryPtr remRegEntry = regPtr0->getEntry(keyptr);
-  ASSERT(remRegEntry == NULLPTR,
-         "regionEntry pointer to removed entry must be NULLPTR");
+  ASSERT(remRegEntry == nullptr,
+         "regionEntry pointer to removed entry must be nullptr");
 
-  if (remRegEntry != NULLPTR) {
+  if (remRegEntry != nullptr) {
     LOGINFO("remRegEntry->isDestroyed() = %d ", remRegEntry->isDestroyed());
     ASSERT(remRegEntry->isDestroyed() == true,
            "regionEntry is not destroyed, remRegEntry->isDestroyed must return 
"
@@ -180,10 +180,10 @@ void DoRegionOpsAndVerify() {
     LOGINFO("regionEntry pointer for removed key is NULL");
   }
 
-  CacheStatisticsPtr cacheStatptr(new CacheStatistics());
+  auto cacheStatptr = std::make_shared<CacheStatistics>();
   // CacheStatisticsPtr cacheStatptr;
   try {
-    CachePtr cache = dynCast<CachePtr>(
+    auto cache = std::dynamic_pointer_cast<Cache>(
         regPtr0->getRegionService());  // This depends on LocalCache
                                        // implementing RegionService...
     bool flag = cache->getDistributedSystem()
@@ -198,7 +198,7 @@ void DoRegionOpsAndVerify() {
   } catch (Exception& ex) {
     LOGINFO("Exception Caught:: %s", ex.getMessage());
   }
-  if (cacheStatptr != NULLPTR) {
+  if (cacheStatptr != nullptr) {
     LOGINFO("LastAccessedTime = %d ", cacheStatptr->getLastAccessedTime());
   } else {
     LOGINFO("cacheStatptr is NULL");

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientTicket303.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientTicket303.cpp 
b/src/cppcache/integration-test/testThinClientTicket303.cpp
index 5617d9e..e369906 100644
--- a/src/cppcache/integration-test/testThinClientTicket303.cpp
+++ b/src/cppcache/integration-test/testThinClientTicket303.cpp
@@ -28,7 +28,7 @@ void createAuthzRegion() {
   initCredentialGenerator();
   initClientAuth('A');
   RegionPtr regPtr = createOverflowRegion(regionNamesAuth[0], false, 1);
-  ASSERT(regPtr != NULLPTR, "Failed to create region.");
+  ASSERT(regPtr != nullptr, "Failed to create region.");
   LOG("Region created.");
 }
 DUNIT_TASK_DEFINITION(SERVER, StartServer1)

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientTicket317.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientTicket317.cpp 
b/src/cppcache/integration-test/testThinClientTicket317.cpp
index ff7d35e..bcd4e0e 100644
--- a/src/cppcache/integration-test/testThinClientTicket317.cpp
+++ b/src/cppcache/integration-test/testThinClientTicket317.cpp
@@ -37,7 +37,7 @@ END_TASK_DEFINITION
 DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1)
   {
     initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
-                       NULLPTR, 0, true);
+                       nullptr, 0, true);
     getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
                                     "__TEST_POOL1__", true, true);
     LOG("Client1 started");
@@ -46,7 +46,7 @@ END_TASK_DEFINITION
 DUNIT_TASK_DEFINITION(CLIENT2, SetupClient2)
   {
     initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
-                       NULLPTR, 0, true);
+                       nullptr, 0, true);
     getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
                                     "__TEST_POOL1__", true, true);
     LOG("Client2 started");
@@ -79,7 +79,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyKeyDestroyedOnServer)
   {
     RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
     CacheablePtr value = regPtr->get(keys[0]);
-    if (value != NULLPTR) {
+    if (value != nullptr) {
       FAIL("Entry not destroyed on server.");
     }
   }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientTracking.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientTracking.cpp 
b/src/cppcache/integration-test/testThinClientTracking.cpp
index 91eee59..9f8c0db 100644
--- a/src/cppcache/integration-test/testThinClientTracking.cpp
+++ b/src/cppcache/integration-test/testThinClientTracking.cpp
@@ -39,11 +39,11 @@ void createAuthzRegion() {
 void verifyEntry(const char *value) {
   RegionPtr rptr = getHelper()->getRegion(regionNamesAuth[0]);
   RegionEntryPtr entry = rptr->getEntry("key-1");
-  ASSERT(entry != NULLPTR, "Key should have been found in region.");
-  CacheableStringPtr valuePtr = dynCast<CacheableStringPtr>(entry->getValue());
+  ASSERT(entry != nullptr, "Key should have been found in region.");
+  auto valuePtr = 
std::dynamic_pointer_cast<CacheableString>(entry->getValue());
   char buf1[1024];
 
-  if (valuePtr == NULLPTR) {
+  if (valuePtr == nullptr) {
     FAIL("Value was null.");
   }
   sprintf(buf1, "value for key-1 is %s", valuePtr->asChar());

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientWriterException.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientWriterException.cpp 
b/src/cppcache/integration-test/testThinClientWriterException.cpp
index 4acb2f0..ded57fa 100644
--- a/src/cppcache/integration-test/testThinClientWriterException.cpp
+++ b/src/cppcache/integration-test/testThinClientWriterException.cpp
@@ -73,7 +73,7 @@ void initCredentialGenerator() {
     }
   }
 
-  if (credentialGeneratorHandler == NULLPTR) {
+  if (credentialGeneratorHandler == nullptr) {
     FAIL("credentialGeneratorHandler is NULL");
   }
 
@@ -110,7 +110,7 @@ void initClientAuth() {
   credentialGeneratorHandler->getAuthInit(config);
   credentialGeneratorHandler->getAllowedCredentialsForOps(rt, config, NULL);
   printf("User is %s Pass is %s ", config->find("security-username")->asChar(),
-         (config->find("security-password") != NULLPTR
+         (config->find("security-password") != nullptr
               ? config->find("security-password")->asChar()
               : " not set"));
   try {
@@ -160,9 +160,9 @@ void startClient() {
   int i = 102;
   LOG("Creating region in READER_CLIENT , no-ack, no-cache, with-listener and "
       "writer");
-  regListener = new TallyListener();
+  regListener = std::make_shared<TallyListener>();
   createRegionForSecurity(regionNamesAuth[0], false, true, regListener);
-  regWriter = new TallyWriter();
+  regWriter = std::make_shared<TallyWriter>();
   setCacheWriter(regionNamesAuth[0], regWriter);
   rptr = getHelper()->getRegion(regionNamesAuth[0]);
   rptr->registerAllKeys();

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testUtils.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testUtils.hpp 
b/src/cppcache/integration-test/testUtils.hpp
index 5b85ebe..b5b59b8 100644
--- a/src/cppcache/integration-test/testUtils.hpp
+++ b/src/cppcache/integration-test/testUtils.hpp
@@ -48,11 +48,11 @@ namespace unitTests {
 class TestUtils {
  public:
   static RegionInternal* getRegionInternal(RegionPtr& rptr) {
-    return dynamic_cast<RegionInternal*>(rptr.ptr());
+    return dynamic_cast<RegionInternal*>(rptr.get());
   }
 
   static CacheImpl* getCacheImpl(const CachePtr& cptr) {
-    return CacheRegionHelper::getCacheImpl(cptr.ptr());
+    return CacheRegionHelper::getCacheImpl(cptr.get());
   }
 
   static int testGetNumberOfPdxIds() {
@@ -102,7 +102,7 @@ class TestUtils {
     int tries = 0;
     bool found = false;
     // @TODO: ? How will valPtr every point to something else in this loop?
-    while ((found = (valPtr == NULLPTR)) && (tries < maxTry)) {
+    while ((found = (valPtr == nullptr)) && (tries < maxTry)) {
       SLEEP(msleepTime);
       tries++;
     }
@@ -115,8 +115,8 @@ class TestUtils {
     int tries = 0;
     int val = 0;
     do {
-      valPtr = dynCast<CacheableStringPtr>(rptr->get(keyPtr));
-      ASSERT(valPtr != NULLPTR, "value should not be null.");
+      valPtr = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr));
+      ASSERT(valPtr != nullptr, "value should not be null.");
       val = atoi(valPtr->asChar());
       SLEEP(msleepTime);
       tries++;
@@ -125,7 +125,7 @@ class TestUtils {
   }
   static void showKeys(RegionPtr& rptr) {
     char buf[2048];
-    if (rptr == NULLPTR) {
+    if (rptr == nullptr) {
       sprintf(buf, "this region does not exist!\n");
       LOG(buf);
       return;
@@ -139,13 +139,13 @@ class TestUtils {
       char keyText[100];
       v[i]->logString(keyText, 100);
       sprintf(buf, "key[%u] = '%s'\n", i,
-              (v[i] == NULLPTR) ? "NULL KEY" : keyText);
+              (v[i] == nullptr) ? "NULL KEY" : keyText);
       LOG(buf);
     }
   }
   static void showKeyValues(RegionPtr& rptr) {
     char buf[2048];
-    if (rptr == NULLPTR) {
+    if (rptr == nullptr) {
       sprintf(buf, "this region does not exist!\n");
       LOG(buf);
       return;
@@ -159,17 +159,17 @@ class TestUtils {
       CacheableKeyPtr keyPtr = v[i];
       char keyText[100];
       keyPtr->logString(keyText, 100);
-      CacheableStringPtr valPtr =
-          dynCast<CacheableStringPtr>(rptr->get(keyPtr));
+      auto valPtr =
+          std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr));
       sprintf(buf, "key[%u] = '%s', value[%u]='%s'\n", i,
-              (keyPtr == NULLPTR) ? "NULL KEY" : keyText, i,
-              (valPtr == NULLPTR) ? "NULL_VALUE" : valPtr->asChar());
+              (keyPtr == nullptr) ? "NULL KEY" : keyText, i,
+              (valPtr == nullptr) ? "NULL_VALUE" : valPtr->asChar());
       LOG(buf);
     }
   }
   static void showValues(RegionPtr& rptr) {
     char buf[2048];
-    if (rptr == NULLPTR) {
+    if (rptr == nullptr) {
       sprintf(buf, "this region does not exist!\n");
       LOG(buf);
       return;
@@ -180,9 +180,9 @@ class TestUtils {
     sprintf(buf, "Total values in region %s : %u\n", rptr->getName(), len);
     LOG(buf);
     for (uint32_t i = 0; i < len; i++) {
-      CacheableStringPtr value = dynCast<CacheableStringPtr>(v[i]);
+      auto value = std::dynamic_pointer_cast<CacheableString>(v[i]);
       sprintf(buf, "value[%u] = '%s'\n", i,
-              (value == NULLPTR) ? "NULL VALUE" : value->asChar());
+              (value == nullptr) ? "NULL VALUE" : value->asChar());
       LOG(buf);
     }
   }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp 
b/src/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
index d60b30d..e02db11 100644
--- a/src/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
+++ b/src/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
@@ -94,7 +94,7 @@ int testXmlCacheCreationWithOverflow() {
 
   cout << "Root regions in Cache :" << endl;
   for (int32_t i = 0; i < vrp.size(); i++) {
-    cout << "vc[" << i << "].m_reaPtr=" << vrp.at(i).ptr() << endl;
+    cout << "vc[" << i << "].m_reaPtr=" << vrp.at(i).get() << endl;
     cout << "vc[" << i << "]=" << vrp.at(i)->getName() << endl;
   }
   RegionPtr regPtr1 = vrp.at(0);
@@ -114,7 +114,7 @@ int testXmlCacheCreationWithOverflow() {
   cout << "get subregions from the root region :" << vrp.at(0)->getName()
        << endl;
   for (int32_t i = 0; i < vr.size(); i++) {
-    cout << "vc[" << i << "].m_reaPtr=" << vr.at(i).ptr() << endl;
+    cout << "vc[" << i << "].m_reaPtr=" << vr.at(i).get() << endl;
     cout << "vc[" << i << "]=" << vr.at(i)->getName() << endl;
   }
 
@@ -125,11 +125,11 @@ int testXmlCacheCreationWithOverflow() {
   VectorOfRegion vsr;
   regPtr2->subregions(true, vsr);
   for (uint32_t i = 0; i < static_cast<uint32_t>(vsr.size()); i++) {
-    Region* regPtr = vsr.at(i).ptr();
+    Region* regPtr = vsr.at(i).get();
     childName = regPtr->getName();
 
     RegionPtr x = regPtr->getParentRegion();
-    parentName = (x.ptr())->getName();
+    parentName = (x.get())->getName();
     if (strcmp(childName, "SubSubRegion221") == 0) {
       if (strcmp(parentName, "SubRegion22") != 0) {
         cout << "Incorrect parent: tree structure not formed correctly" << 
endl;
@@ -146,7 +146,7 @@ int testXmlCacheCreationWithOverflow() {
   cout << "Test the attributes of region" << endl;
 
   RegionAttributesPtr raPtr = regPtr1->getAttributes();
-  RegionAttributes* regAttr = raPtr.ptr();
+  RegionAttributes* regAttr = raPtr.get();
   cout << "Attributes of root region Root1 are : " << endl;
 
   bool cachingEnabled = regAttr->getCachingEnabled();
@@ -194,7 +194,7 @@ int testXmlCacheCreationWithOverflow() {
   cout << "persistence library = " << regAttr->getPersistenceLibrary() << endl;
   cout << "persistence function = " << regAttr->getPersistenceFactory() << 
endl;
   PropertiesPtr pconfig = regAttr->getPersistenceProperties();
-  if (pconfig != NULLPTR) {
+  if (pconfig != nullptr) {
     cout << " persistence property is not null" << endl;
     cout << " persistencedir = "
          << pconfig->find("PersistenceDirectory")->asChar() << endl;
@@ -205,16 +205,15 @@ int testXmlCacheCreationWithOverflow() {
   cout << "****Attributes of Root1 are correctly set****" << endl;
 
   RegionAttributesPtr raPtr2 = regPtr2->getAttributes();
-  RegionAttributes* regAttr2 = raPtr2.ptr();
-  const char* lib2 = regAttr2->getPersistenceLibrary();
-  const char* libFun2 = regAttr2->getPersistenceFactory();
+  const char* lib2 = raPtr2->getPersistenceLibrary();
+  const char* libFun2 = raPtr2->getPersistenceFactory();
   printf(" persistence library2 = %s\n", lib2);
   printf(" persistence function2 = %s\n", libFun2);
-  cout << "persistence library = " << regAttr2->getPersistenceLibrary() << 
endl;
-  cout << "persistence function = " << regAttr2->getPersistenceFactory()
+  cout << "persistence library = " << raPtr2->getPersistenceLibrary() << endl;
+  cout << "persistence function = " << raPtr2->getPersistenceFactory()
        << endl;
-  PropertiesPtr pconfig2 = regAttr2->getPersistenceProperties();
-  if (pconfig2 != NULLPTR) {
+  PropertiesPtr pconfig2 = raPtr2->getPersistenceProperties();
+  if (pconfig2 != nullptr) {
     cout << " persistence property is not null for Root2" << endl;
     cout << " persistencedir2 = "
          << pconfig2->find("PersistenceDirectory")->asChar() << endl;
@@ -232,12 +231,12 @@ int testXmlCacheCreationWithOverflow() {
     return -1;
   }
 
-  regPtr1 = NULLPTR;
-  regPtr2 = NULLPTR;
+  regPtr1 = nullptr;
+  regPtr2 = nullptr;
 
   if (!cptr->isClosed()) {
     cptr->close();
-    cptr = NULLPTR;
+    cptr = nullptr;
   }
   ////////////////////////////testing of cache.xml completed///////////////////
 
@@ -301,9 +300,9 @@ int testXmlCacheCreationWithOverflow() {
   cout << "disconnecting..." << endl;
   try {
     cout << "just before disconnecting..." << endl;
-    if (cptr != NULLPTR && !cptr->isClosed()) {
+    if (cptr != nullptr && !cptr->isClosed()) {
       cptr->close();
-      cptr = NULLPTR;
+      cptr = nullptr;
     }
   } catch (Exception& ex) {
     ex.showMessage();

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp 
b/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
index 448c9b1..337a2e5 100644
--- a/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
+++ b/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
@@ -55,9 +55,9 @@ bool findString(string& item, CacheableStringArrayPtr array) {
 }
 
 bool checkStringArray(SLIST& first, CacheableStringArrayPtr second) {
-  if (second == NULLPTR && first.size() > 0) return false;
+  if (second == nullptr && first.size() > 0) return false;
 
-  if (second == NULLPTR && first.size() == 0) return true;
+  if (second == nullptr && first.size() == 0) return true;
 
   if (first.size() != second->length()) return false;
 
@@ -82,7 +82,7 @@ bool checkPoolAttribs(PoolPtr pool, SLIST& locators, SLIST& 
servers,
                       bool prSingleHopEnabled, int updateLocatorListInterval) {
   char logmsg[500] = {0};
 
-  if (pool == NULLPTR) {
+  if (pool == nullptr) {
     LOG("checkPoolAttribs: PoolPtr is NULL");
     return false;
   }
@@ -290,7 +290,7 @@ int testXmlCacheCreationWithPools() {
 
   test::cout << "Root regions in Cache :" << test::endl;
   for (int32_t i = 0; i < vrp.size(); i++) {
-    test::cout << "vc[" << i << "].m_regionPtr=" << vrp.at(i).ptr()
+    test::cout << "vc[" << i << "].m_regionPtr=" << vrp.at(i).get()
                << test::endl;
     test::cout << "vc[" << i << "]=" << vrp.at(i)->getName() << test::endl;
   }
@@ -310,7 +310,7 @@ int testXmlCacheCreationWithPools() {
   test::cout << "get subregions from the root region :" << vrp.at(0)->getName()
              << test::endl;
   for (int32_t i = 0; i < vr.size(); i++) {
-    test::cout << "vc[" << i << "].m_regionPtr=" << vr.at(i).ptr()
+    test::cout << "vc[" << i << "].m_regionPtr=" << vr.at(i).get()
                << test::endl;
     test::cout << "vc[" << i << "]=" << vr.at(i)->getName() << test::endl;
   }
@@ -389,7 +389,7 @@ int testXmlCacheCreationWithPools() {
 
   if (!cptr->isClosed()) {
     cptr->close();
-    cptr = NULLPTR;
+    cptr = nullptr;
   }
 
   if (!check1 || !check2 || !check3) {
@@ -453,7 +453,7 @@ int testXmlCacheCreationWithPools() {
   test::cout << "disconnecting..." << test::endl;
   try {
     test::cout << "just before disconnecting..." << test::endl;
-    if (cptr != NULLPTR) cptr->close();
+    if (cptr != nullptr) cptr->close();
   } catch (Exception& ex) {
     ex.showMessage();
     ex.printStackTrace();
@@ -506,27 +506,27 @@ int testXmlDeclarativeCacheCreation() {
 
   test::cout << "Root regions in Cache :" << test::endl;
   for (int32_t i = 0; i < vrp.size(); i++) {
-    test::cout << "vc[" << i << "].m_reaPtr=" << vrp.at(i).ptr() << test::endl;
+    test::cout << "vc[" << i << "].m_reaPtr=" << vrp.at(i).get() << test::endl;
     test::cout << "vc[" << i << "]=" << vrp.at(i)->getName() << test::endl;
   }
   RegionPtr regPtr1 = vrp.at(0);
 
   RegionAttributesPtr raPtr = regPtr1->getAttributes();
-  RegionAttributes* regAttr = raPtr.ptr();
+  RegionAttributes* regAttr = raPtr.get();
   test::cout << "Test Attributes of root region Root1 " << test::endl;
   test::cout << "Region name " << regPtr1->getName() << test::endl;
 
-  if (regAttr->getCacheLoader() == NULLPTR) {
+  if (regAttr->getCacheLoader() == nullptr) {
     test::cout << "Cache Loader not initialized." << test::endl;
     return -1;
   }
 
-  if (regAttr->getCacheListener() == NULLPTR) {
+  if (regAttr->getCacheListener() == nullptr) {
     test::cout << "Cache Listener not initialized." << test::endl;
     return -1;
   }
 
-  if (regAttr->getCacheWriter() == NULLPTR) {
+  if (regAttr->getCacheWriter() == nullptr) {
     test::cout << "Cache Writer not initialized." << test::endl;
     return -1;
   }
@@ -535,7 +535,7 @@ int testXmlDeclarativeCacheCreation() {
 
   if (!cptr->isClosed()) {
     cptr->close();
-    cptr = NULLPTR;
+    cptr = nullptr;
   }
 
   return 0;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/AdminRegion.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/AdminRegion.cpp b/src/cppcache/src/AdminRegion.cpp
index c6a5de8..271fd66 100644
--- a/src/cppcache/src/AdminRegion.cpp
+++ b/src/cppcache/src/AdminRegion.cpp
@@ -20,35 +20,34 @@
 #include "ThinClientRegion.hpp"
 #include <statistics/StatisticsManager.hpp>
 #include "ThinClientPoolDM.hpp"
-using namespace apache::geode::client;
-AdminRegion::AdminRegion(CacheImpl* cache, ThinClientBaseDM* distMan)
-    : m_distMngr((ThinClientBaseDM*)0)
-      /* adongre
-       * CID 28925: Uninitialized pointer field (UNINIT_CTOR)
-       */
-      ,
-      m_connectionMgr((TcrConnectionManager*)0),
-      m_destroyPending(false) {
-  m_fullPath = "/__ADMIN_CLIENT_HEALTH_MONITORING__";
 
-  // Only if Stats are enabled
+namespace apache {
+namespace geode {
+namespace client {
+
+AdminRegionPtr AdminRegion::create(CacheImpl* cache,
+                                   ThinClientBaseDM* distMan) {
+  auto adminRegion = std::make_shared<AdminRegion>();
 
   SystemProperties* props =
       cache->getCache()->getDistributedSystem()->getSystemProperties();
   if (props && props->statisticsEnabled()) {
     // no need to create a region .. just create a cacheDistribution Manager
-    m_connectionMgr = &(cache->tcrConnectionManager());
+    adminRegion->m_connectionMgr = &(cache->tcrConnectionManager());
     if (!distMan) {
-      m_distMngr = new ThinClientCacheDistributionManager(*m_connectionMgr);
+      adminRegion->m_distMngr =
+          new 
ThinClientCacheDistributionManager(*adminRegion->m_connectionMgr);
       StatisticsManager* mngr = StatisticsManager::getExistingInstance();
       if (mngr) {
         // Register it with StatisticsManager
-        mngr->RegisterAdminRegion(AdminRegionPtr(this));
+        mngr->RegisterAdminRegion(adminRegion);
       }
     } else {
-      m_distMngr = distMan;
+      adminRegion->m_distMngr = distMan;
     }
   }
+
+  return adminRegion;
 }
 
 void AdminRegion::init() {
@@ -79,7 +78,7 @@ GfErrType AdminRegion::putNoThrow(const CacheableKeyPtr& 
keyPtr,
   // put obj to region
   GfErrType err = GF_NOERR;
 
-  TcrMessagePut request(NULL, keyPtr, valuePtr, NULLPTR, false, m_distMngr,
+  TcrMessagePut request(NULL, keyPtr, valuePtr, nullptr, false, m_distMngr,
                         true, false, m_fullPath.c_str());
   request.setMetaRegion(true);
   TcrMessageReply reply(true, m_distMngr);
@@ -142,3 +141,7 @@ AdminRegion::~AdminRegion() {
 
 const bool& AdminRegion::isDestroyed() { return m_destroyPending; }
 ACE_RW_Thread_Mutex& AdminRegion::getRWLock() { return m_rwLock; }
+
+}  // namespace client
+}  // namespace geode
+}  // namespace apache

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/AdminRegion.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/AdminRegion.hpp b/src/cppcache/src/AdminRegion.hpp
index 9c930f5..84f24f6 100644
--- a/src/cppcache/src/AdminRegion.hpp
+++ b/src/cppcache/src/AdminRegion.hpp
@@ -55,7 +55,8 @@ class CacheImpl;
  */
 class AdminRegion : public SharedBase,
                     private NonCopyable,
-                    private NonAssignable {
+                    private NonAssignable,
+                    public std::enable_shared_from_this<AdminRegion> {
  private:
   ThinClientBaseDM* m_distMngr;
   std::string m_fullPath;
@@ -67,14 +68,25 @@ class AdminRegion : public SharedBase,
                        const CacheablePtr& valuePtr);
   TcrConnectionManager* getConnectionManager();
 
+  AdminRegion()
+      : m_distMngr(nullptr),
+        m_fullPath("/__ADMIN_CLIENT_HEALTH_MONITORING__"),
+        m_connectionMgr(nullptr),
+        m_destroyPending(false)
+       {}
+
+  ~AdminRegion();
+
+  FRIEND_STD_SHARED_PTR(AdminRegion)
+
  public:
+  static std::shared_ptr<AdminRegion> create(CacheImpl* cache,
+                                             ThinClientBaseDM* distMan = NULL);
   ACE_RW_Thread_Mutex& getRWLock();
   const bool& isDestroyed();
   void close();
   void init();
   void put(const CacheableKeyPtr& keyPtr, const CacheablePtr& valuePtr);
-  AdminRegion(CacheImpl* cache, ThinClientBaseDM* distMan = NULL);
-  ~AdminRegion();
   friend class apache::geode::statistics::HostStatSampler;
 };
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/AttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/AttributesFactory.cpp 
b/src/cppcache/src/AttributesFactory.cpp
index 249e078..ddfb220 100644
--- a/src/cppcache/src/AttributesFactory.cpp
+++ b/src/cppcache/src/AttributesFactory.cpp
@@ -15,14 +15,6 @@
  * limitations under the License.
  */
 
-namespace apache {
-namespace geode {
-namespace client {
-class Region;
-}  // namespace client
-}  // namespace geode
-}  // namespace apache
-
 #include <geode/Cache.hpp>
 #include <geode/ExpirationAttributes.hpp>
 #include <Utils.hpp>
@@ -31,7 +23,12 @@ class Region;
 #include <string>
 #include <geode/Pool.hpp>
 #include <geode/PoolManager.hpp>
-using namespace apache::geode::client;
+
+namespace apache {
+namespace geode {
+namespace client {
+
+class Region;
 
 AttributesFactory::AttributesFactory() : m_regionAttributes() {}
 
@@ -115,13 +112,13 @@ void AttributesFactory::setStatisticsEnabled( bool 
statisticsEnabled)
 }
 */
 
-RegionAttributesPtr AttributesFactory::createRegionAttributes() {
+std::unique_ptr<RegionAttributes> AttributesFactory::createRegionAttributes() {
   RegionAttributesPtr res;
   /*
   if( m_regionAttributes.m_poolName != NULL )
   {
           PoolPtr pool= PoolManager::find( m_regionAttributes.m_poolName );
-    if (pool == NULLPTR) {
+    if (pool == nullptr) {
       throw IllegalStateException("Pool not found while creating region
   attributes");
     }
@@ -131,8 +128,8 @@ RegionAttributesPtr 
AttributesFactory::createRegionAttributes() {
   }
   */
   validateAttributes(m_regionAttributes);
-  res = new RegionAttributes(m_regionAttributes);
-  return res;
+  return std::unique_ptr<RegionAttributes>(
+      new RegionAttributes(m_regionAttributes));
 }
 
 void AttributesFactory::validateAttributes(RegionAttributes& attrs) {
@@ -161,7 +158,7 @@ void 
AttributesFactory::validateAttributes(RegionAttributes& attrs) {
   }
 
   if (attrs.m_diskPolicy != DiskPolicyType::NONE) {
-    if (attrs.m_persistenceManager == NULLPTR &&
+    if (attrs.m_persistenceManager == nullptr &&
         (attrs.m_persistenceLibrary == NULL ||
          attrs.m_persistenceFactory == NULL)) {
       throw IllegalStateException(
@@ -214,3 +211,7 @@ void AttributesFactory::setCloningEnabled(bool isClonable) {
 void AttributesFactory::setConcurrencyChecksEnabled(bool enable) {
   m_regionAttributes.setConcurrencyChecksEnabled(enable);
 }
+
+}  // namespace client
+}  // namespace geode
+}  // namespace apache

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/AttributesMutator.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/AttributesMutator.cpp 
b/src/cppcache/src/AttributesMutator.cpp
index 096d5c8..67042f2 100644
--- a/src/cppcache/src/AttributesMutator.cpp
+++ b/src/cppcache/src/AttributesMutator.cpp
@@ -25,7 +25,7 @@ namespace client {
 AttributesMutator::AttributesMutator(const RegionPtr& region)
     : m_region(region) {}
 
-AttributesMutator::~AttributesMutator() { m_region = NULLPTR; }
+AttributesMutator::~AttributesMutator() { m_region = nullptr; }
 
 /** Sets the idleTimeout duration for region entries.
  * @param idleTimeout the idleTimeout in seconds for entries in this region.
@@ -35,7 +35,7 @@ AttributesMutator::~AttributesMutator() { m_region = NULLPTR; 
}
  *   disabled to enabled or enabled to disabled.
  */
 int32_t AttributesMutator::setEntryIdleTimeout(int32_t idleTimeout) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   return rImpl->adjustEntryExpiryDuration(idleTimeout);
 }
 
@@ -46,7 +46,7 @@ int32_t AttributesMutator::setEntryIdleTimeout(int32_t 
idleTimeout) {
  */
 ExpirationAction::Action AttributesMutator::setEntryIdleTimeoutAction(
     ExpirationAction::Action action) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   return rImpl->adjustEntryExpiryAction(action);
 }
 
@@ -58,7 +58,7 @@ ExpirationAction::Action 
AttributesMutator::setEntryIdleTimeoutAction(
  *   disabled to enabled or enabled to disabled.
  */
 int32_t AttributesMutator::setEntryTimeToLive(int32_t timeToLive) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   return rImpl->adjustEntryExpiryDuration(timeToLive);
 }
 
@@ -69,7 +69,7 @@ int32_t AttributesMutator::setEntryTimeToLive(int32_t 
timeToLive) {
  */
 ExpirationAction::Action AttributesMutator::setEntryTimeToLiveAction(
     ExpirationAction::Action action) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   return rImpl->adjustEntryExpiryAction(action);
 }
 
@@ -81,7 +81,7 @@ ExpirationAction::Action 
AttributesMutator::setEntryTimeToLiveAction(
  *   disabled to enabled or enabled to disabled.
  */
 int32_t AttributesMutator::setRegionIdleTimeout(int32_t idleTimeout) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   return rImpl->adjustRegionExpiryDuration(idleTimeout);
 }
 
@@ -91,7 +91,7 @@ int32_t AttributesMutator::setRegionIdleTimeout(int32_t 
idleTimeout) {
  */
 ExpirationAction::Action AttributesMutator::setRegionIdleTimeoutAction(
     ExpirationAction::Action action) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   return rImpl->adjustRegionExpiryAction(action);
 }
 
@@ -103,7 +103,7 @@ ExpirationAction::Action 
AttributesMutator::setRegionIdleTimeoutAction(
  *   disabled to enabled or enabled to disabled.
  */
 int32_t AttributesMutator::setRegionTimeToLive(int32_t timeToLive) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   return rImpl->adjustRegionExpiryDuration(timeToLive);
 }
 
@@ -113,7 +113,7 @@ int32_t AttributesMutator::setRegionTimeToLive(int32_t 
timeToLive) {
  */
 ExpirationAction::Action AttributesMutator::setRegionTimeToLiveAction(
     ExpirationAction::Action action) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   return rImpl->adjustRegionExpiryAction(action);
 }
 
@@ -124,40 +124,40 @@ ExpirationAction::Action 
AttributesMutator::setRegionTimeToLiveAction(
  *   disabled to enabled or enabled to disabled.
  */
 uint32_t AttributesMutator::setLruEntriesLimit(uint32_t entriesLimit) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   return rImpl->adjustLruEntriesLimit(entriesLimit);
 }
 
 void AttributesMutator::setCacheListener(const CacheListenerPtr& aListener) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   rImpl->adjustCacheListener(aListener);
 }
 
 void AttributesMutator::setCacheListener(const char* libpath,
                                          const char* factoryFuncName) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   rImpl->adjustCacheListener(libpath, factoryFuncName);
 }
 
 void AttributesMutator::setCacheLoader(const CacheLoaderPtr& aLoader) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   rImpl->adjustCacheLoader(aLoader);
 }
 
 void AttributesMutator::setCacheLoader(const char* libpath,
                                        const char* factoryFuncName) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   rImpl->adjustCacheLoader(libpath, factoryFuncName);
 }
 
 void AttributesMutator::setCacheWriter(const CacheWriterPtr& aWriter) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   rImpl->adjustCacheWriter(aWriter);
 }
 
 void AttributesMutator::setCacheWriter(const char* libpath,
                                        const char* factoryFuncName) {
-  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+  RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
   rImpl->adjustCacheWriter(libpath, factoryFuncName);
 }
 }  // namespace client

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/BucketServerLocation.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/BucketServerLocation.hpp 
b/src/cppcache/src/BucketServerLocation.hpp
index 00dda10..b5afea1 100644
--- a/src/cppcache/src/BucketServerLocation.hpp
+++ b/src/cppcache/src/BucketServerLocation.hpp
@@ -42,7 +42,7 @@ class BucketServerLocation : public ServerLocation {
         m_bucketId(-1),
         m_isPrimary(false),
         m_version(0),
-        m_serverGroups(NULLPTR),
+        m_serverGroups(nullptr),
         m_numServerGroups(static_cast<int8_t>(0)) {}
 
   BucketServerLocation(std::string host)
@@ -50,7 +50,7 @@ class BucketServerLocation : public ServerLocation {
         m_bucketId(-1),
         m_isPrimary(false),
         m_version(0),
-        m_serverGroups(NULLPTR),
+        m_serverGroups(nullptr),
         m_numServerGroups(static_cast<int8_t>(0)) {}
 
   BucketServerLocation(int bucketId, int port, std::string host, bool 
isPrimary,
@@ -59,7 +59,7 @@ class BucketServerLocation : public ServerLocation {
         m_bucketId(bucketId),
         m_isPrimary(isPrimary),
         m_version(version),
-        m_serverGroups(NULLPTR),
+        m_serverGroups(nullptr),
         m_numServerGroups(static_cast<int8_t>(0)) {}
 
   BucketServerLocation(int bucketId, int port, std::string host, bool 
isPrimary,
@@ -85,7 +85,7 @@ class BucketServerLocation : public ServerLocation {
       m_serverGroups = CacheableStringArray::createNoCopy(ptrArr, size);
       m_numServerGroups = static_cast<int8_t>(size);
     } else {
-      m_serverGroups = NULLPTR;
+      m_serverGroups = nullptr;
       m_numServerGroups = static_cast<int8_t>(0);
     }
   }
@@ -104,7 +104,7 @@ class BucketServerLocation : public ServerLocation {
     output.write(static_cast<int8_t>(m_numServerGroups));
     if (m_numServerGroups > 0) {
       for (int i = 0; i < m_numServerGroups; i++) {
-        output.writeNativeString(m_serverGroups[i]->asChar());
+        output.writeNativeString((*m_serverGroups)[i]->asChar());
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/Cache.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Cache.cpp b/src/cppcache/src/Cache.cpp
index c49ac3c..d7226ab 100644
--- a/src/cppcache/src/Cache.cpp
+++ b/src/cppcache/src/Cache.cpp
@@ -93,7 +93,7 @@ RegionPtr Cache::getRegion(const char* path) {
   RegionPtr result;
   m_cacheImpl->getRegion(path, result);
 
-  if (result != NULLPTR) {
+  if (result != nullptr) {
     if (isPoolInMultiuserMode(result)) {
       LOGWARN(
           "Pool [%s] attached with region [%s] is in multiuser authentication "
@@ -149,18 +149,14 @@ CacheTransactionManagerPtr 
Cache::getCacheTransactionManager() {
   return m_cacheImpl->getCacheTransactionManager();
 }
 
-Cache::Cache(const char* name, DistributedSystemPtr sys,
-             bool ignorePdxUnreadFields, bool readPdxSerialized) {
-  m_cacheImpl =
-      new CacheImpl(this, name, sys, ignorePdxUnreadFields, readPdxSerialized);
-}
 Cache::Cache(const char* name, DistributedSystemPtr sys, const char* id_data,
              bool ignorePdxUnreadFields, bool readPdxSerialized) {
-  m_cacheImpl = new CacheImpl(this, name, sys, id_data, ignorePdxUnreadFields,
-                              readPdxSerialized);
+  m_cacheImpl = std::unique_ptr<CacheImpl>(new CacheImpl(
+      this, name, sys, id_data, ignorePdxUnreadFields, readPdxSerialized));
 }
 
-Cache::~Cache() { delete m_cacheImpl; }
+Cache::Cache() = default;
+Cache::~Cache() = default;
 
 /** Initialize the cache by the contents of an xml file
   * @param  cacheXml
@@ -192,7 +188,7 @@ bool Cache::isPoolInMultiuserMode(RegionPtr regionPtr) {
 
   if (poolName != NULL) {
     PoolPtr poolPtr = PoolManager::find(poolName);
-    if (poolPtr != NULLPTR && !poolPtr->isDestroyed()) {
+    if (poolPtr != nullptr && !poolPtr->isDestroyed()) {
       return poolPtr->getMultiuserAuthentication();
     }
   }
@@ -208,14 +204,13 @@ bool Cache::getPdxReadSerialized() {
 }
 
 PdxInstanceFactoryPtr Cache::createPdxInstanceFactory(const char* className) {
-  PdxInstanceFactoryPtr pIFPtr(new PdxInstanceFactoryImpl(className));
-  return pIFPtr;
+  return std::make_shared<PdxInstanceFactoryImpl>(className);
 }
 
 RegionServicePtr Cache::createAuthenticatedView(
     PropertiesPtr userSecurityProperties, const char* poolName) {
   if (poolName == NULL) {
-    if (!this->isClosed() && m_cacheImpl->getDefaultPool() != NULLPTR) {
+    if (!this->isClosed() && m_cacheImpl->getDefaultPool() != nullptr) {
       return m_cacheImpl->getDefaultPool()->createSecureUserCache(
           userSecurityProperties);
     }
@@ -227,7 +222,7 @@ RegionServicePtr Cache::createAuthenticatedView(
     if (!this->isClosed()) {
       if (poolName != NULL) {
         PoolPtr poolPtr = PoolManager::find(poolName);
-        if (poolPtr != NULLPTR && !poolPtr->isDestroyed()) {
+        if (poolPtr != nullptr && !poolPtr->isDestroyed()) {
           return poolPtr->createSecureUserCache(userSecurityProperties);
         }
         throw IllegalStateException(
@@ -238,5 +233,5 @@ RegionServicePtr Cache::createAuthenticatedView(
 
     throw IllegalStateException("Cache has been closed");
   }
-  return NULLPTR;
+  return nullptr;
 }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheConfig.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheConfig.cpp b/src/cppcache/src/CacheConfig.cpp
index 530df4e..35de702 100644
--- a/src/cppcache/src/CacheConfig.cpp
+++ b/src/cppcache/src/CacheConfig.cpp
@@ -122,7 +122,7 @@ bool CacheConfig::parseAttributes(const char* name, 
xmlNode* node) {
   std::string cachingStr =
       (caching == NULL ? "true" : reinterpret_cast<const char*>(caching));
 
-  RegionConfigPtr reg(new RegionConfig(scopeStr, initialCapacityStr));
+  auto reg = std::make_shared<RegionConfig>(scopeStr, initialCapacityStr);
 
   reg->setLru(limitStr);
   reg->setConcurrency(concStr);

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheFactory.cpp 
b/src/cppcache/src/CacheFactory.cpp
index b6fca2a..ec332e5 100644
--- a/src/cppcache/src/CacheFactory.cpp
+++ b/src/cppcache/src/CacheFactory.cpp
@@ -55,26 +55,26 @@ typedef std::map<std::string, CachePtr> StringToCachePtrMap;
 
 void* CacheFactory::m_cacheMap = (void*)NULL;
 
-CacheFactoryPtr CacheFactory::default_CacheFactory = NULLPTR;
+CacheFactoryPtr CacheFactory::default_CacheFactory = nullptr;
 
 PoolPtr CacheFactory::createOrGetDefaultPool() {
   ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
 
   CachePtr cache = CacheFactory::getAnyInstance();
 
-  if (cache != NULLPTR && cache->isClosed() == false &&
-      cache->m_cacheImpl->getDefaultPool() != NULLPTR) {
+  if (cache != nullptr && cache->isClosed() == false &&
+      cache->m_cacheImpl->getDefaultPool() != nullptr) {
     return cache->m_cacheImpl->getDefaultPool();
   }
 
   PoolPtr pool = PoolManager::find(DEFAULT_POOL_NAME);
 
   // if default_poolFactory is null then we are not using latest API....
-  if (pool == NULLPTR && Cache_CreatedFromCacheFactory) {
-    if (default_CacheFactory != NULLPTR) {
+  if (pool == nullptr && Cache_CreatedFromCacheFactory) {
+    if (default_CacheFactory != nullptr) {
       pool = default_CacheFactory->determineDefaultPool(cache);
     }
-    default_CacheFactory = NULLPTR;
+    default_CacheFactory = nullptr;
   }
 
   return pool;
@@ -82,9 +82,7 @@ PoolPtr CacheFactory::createOrGetDefaultPool() {
 
 CacheFactoryPtr CacheFactory::createCacheFactory(
     const PropertiesPtr& configPtr) {
-  // need to create PoolFactory instance
-  CacheFactoryPtr cf(new CacheFactory(configPtr));
-  return cf;
+  return std::make_shared<CacheFactory>(configPtr);
 }
 
 void CacheFactory::init() {
@@ -101,12 +99,12 @@ void CacheFactory::create_(const char* name, 
DistributedSystemPtr& system,
                            bool ignorePdxUnreadFields, bool readPdxSerialized) 
{
   CppCacheLibrary::initLib();
 
-  cptr = NULLPTR;
+  cptr = nullptr;
   if (!reinterpret_cast<StringToCachePtrMap*>(m_cacheMap)) {
     throw IllegalArgumentException(
         "CacheFactory::create: cache map is not initialized");
   }
-  if (system == NULLPTR) {
+  if (system == nullptr) {
     throw IllegalArgumentException(
         "CacheFactory::create: system uninitialized");
   }
@@ -117,17 +115,13 @@ void CacheFactory::create_(const char* name, 
DistributedSystemPtr& system,
     name = "NativeCache";
   }
 
-  CachePtr cp = NULLPTR;
+  CachePtr cp = nullptr;
   basicGetInstance(system, true, cp);
-  if ((cp == NULLPTR) || (cp->isClosed() == true)) {
-    Cache* cep = new Cache(name, system, id_data, ignorePdxUnreadFields,
-                           readPdxSerialized);
-    if (!cep) {
-      throw OutOfMemoryException("Out of Memory");
-    }
-    cptr = cep;
+  if ((cp == nullptr) || (cp->isClosed() == true)) {
+    cptr = std::make_shared<Cache>(name, system, id_data, 
ignorePdxUnreadFields,
+                                   readPdxSerialized);
     std::string key(system->getName());
-    if (cp != NULLPTR) {
+    if (cp != nullptr) {
       ACE_Guard<ACE_Recursive_Thread_Mutex> guard(g_cfLock);
       (reinterpret_cast<StringToCachePtrMap*>(m_cacheMap))
           ->erase(
@@ -144,7 +138,7 @@ void CacheFactory::create_(const char* name, 
DistributedSystemPtr& system,
 CachePtr CacheFactory::getInstance(const DistributedSystemPtr& system) {
   CachePtr cptr;
   CppCacheLibrary::initLib();
-  if (system == NULLPTR) {
+  if (system == nullptr) {
     throw IllegalArgumentException(
         "CacheFactory::getInstance: system uninitialized");
   }
@@ -156,7 +150,7 @@ CachePtr CacheFactory::getInstance(const 
DistributedSystemPtr& system) {
 CachePtr CacheFactory::getInstanceCloseOk(const DistributedSystemPtr& system) {
   CachePtr cptr;
   CppCacheLibrary::initLib();
-  if (system == NULLPTR) {
+  if (system == nullptr) {
     throw IllegalArgumentException(
         "CacheFactory::getInstanceClosedOK: system uninitialized");
   }
@@ -176,7 +170,7 @@ CachePtr CacheFactory::getAnyInstance(bool throwException) {
       throw EntryNotFoundException(
           "CacheFactory::getAnyInstance: not found, no cache created yet");
     } else {
-      return NULLPTR;
+      return nullptr;
     }
   }
   for (StringToCachePtrMap::iterator p =
@@ -187,7 +181,7 @@ CachePtr CacheFactory::getAnyInstance(bool throwException) {
       return cptr;
     }
   }
-  return NULLPTR;
+  return nullptr;
 }
 
 const char* CacheFactory::getVersion() { return PRODUCT_VERSION; }
@@ -200,15 +194,15 @@ const char* CacheFactory::getProductDescription() {
 CacheFactory::CacheFactory() {
   ignorePdxUnreadFields = false;
   pdxReadSerialized = false;
-  dsProp = NULLPTR;
-  pf = NULLPTR;
+  dsProp = nullptr;
+  pf = nullptr;
 }
 
 CacheFactory::CacheFactory(const PropertiesPtr dsProps) {
   ignorePdxUnreadFields = false;
   pdxReadSerialized = false;
   this->dsProp = dsProps;
-  this->pf = NULLPTR;
+  this->pf = nullptr;
 }
 
 CachePtr CacheFactory::create() {
@@ -216,7 +210,7 @@ CachePtr CacheFactory::create() {
   // bool pdxReadSerialized = false;
 
   ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
-  DistributedSystemPtr dsPtr = NULLPTR;
+  DistributedSystemPtr dsPtr = nullptr;
 
   // should we compare deafult DS properties here??
   if (DistributedSystem::isConnected()) {
@@ -226,27 +220,26 @@ CachePtr CacheFactory::create() {
     LOGFINE("CacheFactory called DistributedSystem::connect");
   }
 
-  CachePtr cache = NULLPTR;
+  CachePtr cache = nullptr;
 
   cache = getAnyInstance(false);
 
-  if (cache == NULLPTR) {
-    CacheFactoryPtr cacheFac(this);
-    default_CacheFactory = cacheFac;
+  if (cache == nullptr) {
+    default_CacheFactory = shared_from_this();
     Cache_CreatedFromCacheFactory = true;
     cache = create(DEFAULT_CACHE_NAME, dsPtr,
-                   dsPtr->getSystemProperties()->cacheXMLFile(), NULLPTR);
-    // if(cache->m_cacheImpl->getDefaultPool() == NULLPTR)
+                   dsPtr->getSystemProperties()->cacheXMLFile(), nullptr);
+    // if(cache->m_cacheImpl->getDefaultPool() == nullptr)
     // determineDefaultPool(cache);
   } else {
-    if (cache->m_cacheImpl->getDefaultPool() != NULLPTR) {
+    if (cache->m_cacheImpl->getDefaultPool() != nullptr) {
       // we already choose or created deafult pool
       determineDefaultPool(cache);
     } else {
       // not yet created, create from first cacheFactory instance
-      if (default_CacheFactory != NULLPTR) {
+      if (default_CacheFactory != nullptr) {
         default_CacheFactory->determineDefaultPool(cache);
-        default_CacheFactory = NULLPTR;
+        default_CacheFactory = nullptr;
       }
       determineDefaultPool(cache);
     }
@@ -265,9 +258,9 @@ CachePtr CacheFactory::create() {
 }
 
 CachePtr CacheFactory::create(const char* name,
-                              DistributedSystemPtr system /*= NULLPTR*/,
+                              DistributedSystemPtr system /*= nullptr*/,
                               const char* cacheXml /*= 0*/,
-                              const CacheAttributesPtr& attrs /*= NULLPTR*/) {
+                              const CacheAttributesPtr& attrs /*= nullptr*/) {
   ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
 
   CachePtr cptr;
@@ -290,13 +283,13 @@ CachePtr CacheFactory::create(const char* name,
   } catch (const apache::geode::client::Exception&) {
     if (!cptr->isClosed()) {
       cptr->close();
-      cptr = NULLPTR;
+      cptr = nullptr;
     }
     throw;
   } catch (...) {
     if (!cptr->isClosed()) {
       cptr->close();
-      cptr = NULLPTR;
+      cptr = nullptr;
     }
     throw apache::geode::client::UnknownException(
         "Exception thrown in CacheFactory::create");
@@ -306,12 +299,12 @@ CachePtr CacheFactory::create(const char* name,
 }
 
 PoolPtr CacheFactory::determineDefaultPool(CachePtr cachePtr) {
-  PoolPtr pool = NULLPTR;
+  PoolPtr pool = nullptr;
   HashMapOfPools allPools = PoolManager::getAll();
   size_t currPoolSize = allPools.size();
 
   // means user has not set any pool attributes
-  if (this->pf == NULLPTR) {
+  if (this->pf == nullptr) {
     this->pf = getPoolFactory();
     if (currPoolSize == 0) {
       if (!this->pf->m_addedServerOrLocator) {
@@ -330,7 +323,7 @@ PoolPtr CacheFactory::determineDefaultPool(CachePtr 
cachePtr) {
       return pool;
     } else {
       // can't set anything as deafult pool
-      return NULLPTR;
+      return nullptr;
     }
   } else {
     PoolPtr defaulPool = cachePtr->m_cacheImpl->getDefaultPool();
@@ -339,7 +332,7 @@ PoolPtr CacheFactory::determineDefaultPool(CachePtr 
cachePtr) {
       this->pf->addServer(DEFAULT_SERVER_HOST, DEFAULT_SERVER_PORT);
     }
 
-    if (defaulPool != NULLPTR) {
+    if (defaulPool != nullptr) {
       // once default pool is created, we will not create
       if (*(defaulPool->m_attrs) == *(this->pf->m_attrs)) {
         return defaulPool;
@@ -349,21 +342,20 @@ PoolPtr CacheFactory::determineDefaultPool(CachePtr 
cachePtr) {
       }
     }
 
-    pool = NULLPTR;
+    pool = nullptr;
 
     // return any existing pool if it matches
-    for (HashMapOfPools::Iterator iter = allPools.begin();
-         iter != allPools.end(); ++iter) {
-      PoolPtr currPool(iter.second());
+    for (auto iter = allPools.begin(); iter != allPools.end(); ++iter) {
+      auto currPool = iter.second();
       if (*(currPool->m_attrs) == *(this->pf->m_attrs)) {
         return currPool;
       }
     }
 
     // defaul pool is null
-    GF_DEV_ASSERT(defaulPool == NULLPTR);
+    GF_DEV_ASSERT(defaulPool == nullptr);
 
-    if (defaulPool == NULLPTR) {
+    if (defaulPool == nullptr) {
       pool = this->pf->create(DEFAULT_POOL_NAME);
       LOGINFO("Created default pool");
       // creating default so setting this as defaul pool
@@ -375,7 +367,7 @@ PoolPtr CacheFactory::determineDefaultPool(CachePtr 
cachePtr) {
 }
 
 PoolFactoryPtr CacheFactory::getPoolFactory() {
-  if (this->pf == NULLPTR) {
+  if (this->pf == nullptr) {
     this->pf = PoolManager::createFactory();
   }
   return this->pf;
@@ -395,10 +387,10 @@ void CacheFactory::cleanup() {
 GfErrType CacheFactory::basicGetInstance(const DistributedSystemPtr& system,
                                          const bool closeOk, CachePtr& cptr) {
   GfErrType err = GF_NOERR;
-  if (system == NULLPTR) {
+  if (system == nullptr) {
     return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
   }
-  cptr = NULLPTR;
+  cptr = nullptr;
   ACE_Guard<ACE_Recursive_Thread_Mutex> guard(g_cfLock);
   if ((reinterpret_cast<StringToCachePtrMap*>(m_cacheMap))->empty() == true) {
     return GF_CACHE_ENTRY_NOT_FOUND;
@@ -448,135 +440,111 @@ void CacheFactory::handleXML(CachePtr& cachePtr, const 
char* cachexml,
 }
 
 CacheFactoryPtr CacheFactory::set(const char* name, const char* value) {
-  if (this->dsProp == NULLPTR) this->dsProp = Properties::create();
+  if (this->dsProp == nullptr) this->dsProp = Properties::create();
   this->dsProp->insert(name, value);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 
 CacheFactoryPtr CacheFactory::setFreeConnectionTimeout(int connectionTimeout) {
   getPoolFactory()->setFreeConnectionTimeout(connectionTimeout);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setLoadConditioningInterval(
     int loadConditioningInterval) {
   getPoolFactory()->setLoadConditioningInterval(loadConditioningInterval);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setSocketBufferSize(int bufferSize) {
   getPoolFactory()->setSocketBufferSize(bufferSize);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setThreadLocalConnections(
     bool threadLocalConnections) {
   getPoolFactory()->setThreadLocalConnections(threadLocalConnections);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setReadTimeout(int timeout) {
   getPoolFactory()->setReadTimeout(timeout);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setMinConnections(int minConnections) {
   getPoolFactory()->setMinConnections(minConnections);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setMaxConnections(int maxConnections) {
   getPoolFactory()->setMaxConnections(maxConnections);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setIdleTimeout(long idleTimeout) {
   getPoolFactory()->setIdleTimeout(idleTimeout);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setRetryAttempts(int retryAttempts) {
   getPoolFactory()->setRetryAttempts(retryAttempts);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setPingInterval(long pingInterval) {
   getPoolFactory()->setPingInterval(pingInterval);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setUpdateLocatorListInterval(
     long updateLocatorListInterval) {
   getPoolFactory()->setUpdateLocatorListInterval(updateLocatorListInterval);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setStatisticInterval(int statisticInterval) {
   getPoolFactory()->setStatisticInterval(statisticInterval);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setServerGroup(const char* group) {
   getPoolFactory()->setServerGroup(group);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::addLocator(const char* host, int port) {
   getPoolFactory()->addLocator(host, port);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::addServer(const char* host, int port) {
   getPoolFactory()->addServer(host, port);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setSubscriptionEnabled(bool enabled) {
   getPoolFactory()->setSubscriptionEnabled(enabled);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setSubscriptionRedundancy(int redundancy) {
   getPoolFactory()->setSubscriptionRedundancy(redundancy);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setSubscriptionMessageTrackingTimeout(
     int messageTrackingTimeout) {
   getPoolFactory()->setSubscriptionMessageTrackingTimeout(
       messageTrackingTimeout);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setSubscriptionAckInterval(int ackInterval) {
   getPoolFactory()->setSubscriptionAckInterval(ackInterval);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 CacheFactoryPtr CacheFactory::setMultiuserAuthentication(
     bool multiuserAuthentication) {
   getPoolFactory()->setMultiuserAuthentication(multiuserAuthentication);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 
 CacheFactoryPtr CacheFactory::setPRSingleHopEnabled(bool enabled) {
   getPoolFactory()->setPRSingleHopEnabled(enabled);
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 
 CacheFactoryPtr CacheFactory::setPdxIgnoreUnreadFields(bool ignore) {
   ignorePdxUnreadFields = ignore;
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 
 CacheFactoryPtr CacheFactory::setPdxReadSerialized(bool prs) {
   pdxReadSerialized = prs;
-  CacheFactoryPtr cfPtr(this);
-  return cfPtr;
+  return shared_from_this();
 }
 }  // namespace client
 }  // namespace geode

Reply via email to