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

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


The following commit(s) were added to refs/heads/develop by this push:
     new a32f882  GEODE-4688: Refactor the addServerLocatorEPs (#220)
a32f882 is described below

commit a32f8821da53e5e80c2eab57356f3f65cfeefd17
Author: Michael Martell <mmart...@pivotal.io>
AuthorDate: Tue Feb 13 14:58:36 2018 -0800

    GEODE-4688: Refactor the addServerLocatorEPs (#220)
    
    - pass PoolFactory by reference
    - improve readability by converting to C++11
---
 cppcache/integration-test/CacheHelper.cpp | 18 +++++++-----------
 cppcache/integration-test/CacheHelper.hpp | 22 ++++++++--------------
 2 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/cppcache/integration-test/CacheHelper.cpp 
b/cppcache/integration-test/CacheHelper.cpp
index 9a50832..496d50e 100644
--- a/cppcache/integration-test/CacheHelper.cpp
+++ b/cppcache/integration-test/CacheHelper.cpp
@@ -595,23 +595,19 @@ std::shared_ptr<Region> 
CacheHelper::createRegionAndAttachPool2(
   return regionFactory.create(name);
 }
 
-void CacheHelper::addServerLocatorEPs(const char* epList,
-                                     PoolFactory pf,
+void CacheHelper::addServerLocatorEPs(const char* epList, PoolFactory& pf,
                                       bool poolLocators) {
   std::unordered_set<std::string> endpointNames;
   Utils::parseEndpointNamesString(epList, endpointNames);
-  for (std::unordered_set<std::string>::iterator iter = endpointNames.begin();
-       iter != endpointNames.end(); ++iter) {
-    size_t position = (*iter).find_first_of(":");
+  for (const auto& endpointName : endpointNames) {
+    auto position = endpointName.find_first_of(":");
     if (position != std::string::npos) {
-      std::string hostname = (*iter).substr(0, position);
-      int portnumber = atoi(((*iter).substr(position + 1)).c_str());
+      auto hostname = endpointName.substr(0, position);
+      auto portnumber = std::stoi(endpointName.substr(position + 1));
       if (poolLocators) {
-        LOG((*iter));
-
-        pf.addLocator(hostname.c_str(), portnumber);
+        pf.addLocator(hostname, portnumber);
       } else {
-        pf.addServer(hostname.c_str(), portnumber);
+        pf.addServer(hostname, portnumber);
       }
     }
   }
diff --git a/cppcache/integration-test/CacheHelper.hpp 
b/cppcache/integration-test/CacheHelper.hpp
index a105a1d..8dcbb17 100644
--- a/cppcache/integration-test/CacheHelper.hpp
+++ b/cppcache/integration-test/CacheHelper.hpp
@@ -183,13 +183,8 @@ class CacheHelper {
       const std::chrono::seconds& rit = std::chrono::seconds::zero(),
       int lel = 0, ExpirationAction action = ExpirationAction::DESTROY);
 
-  void addServerLocatorEPs(const char* epList,
-                           PoolFactory pfPtr,
-                           bool poolLocators = true);
-
-  void addServerLocatorEPs(const char* epList,
-                           std::shared_ptr<CacheFactory> cacheFac,
-                           bool poolLocators = true);
+  static void addServerLocatorEPs(const char* epList, PoolFactory& pfPtr,
+                                  bool poolLocators = true);
 
   std::shared_ptr<Region> createPooledRegion(
       const char* name, bool ack, const char* locators = 0,
@@ -350,7 +345,8 @@ class CacheHelper {
   // starting locator
   static void initLocator(int instance, bool ssl = false, bool multiDS = false,
                           int dsId = -1, int remoteLocator = 0,
-                          bool untrustedCert = false, bool useSecurityManager 
= false);
+                          bool untrustedCert = false,
+                          bool useSecurityManager = false);
 
   static void clearSecProp();
 
@@ -369,12 +365,10 @@ class CacheHelper {
   static int staticMcastAddress;
 
  private:
-  static std::string generateGeodeProperties(const std::string& path,
-                                             const bool ssl = false,
-                                             const int dsId = -1,
-                                             const int remoteLocator = 0,
-                                             const bool untrustedCert = false,
-                                             const bool useSecurityManager = 
false);
+  static std::string generateGeodeProperties(
+      const std::string& path, const bool ssl = false, const int dsId = -1,
+      const int remoteLocator = 0, const bool untrustedCert = false,
+      const bool useSecurityManager = false);
 };
 
 #ifndef test_cppcache_utils_static

-- 
To stop receiving notification emails like this one, please contact
jbarr...@apache.org.

Reply via email to