Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C43E5200CDA for ; Fri, 21 Jul 2017 01:19:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C2F1C16C515; Thu, 20 Jul 2017 23:19:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E169716C517 for ; Fri, 21 Jul 2017 01:19:14 +0200 (CEST) Received: (qmail 96069 invoked by uid 500); 20 Jul 2017 23:19:14 -0000 Mailing-List: contact commits-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list commits@geode.apache.org Received: (qmail 96056 invoked by uid 99); 20 Jul 2017 23:19:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jul 2017 23:19:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 15E57E360F; Thu, 20 Jul 2017 23:19:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: echobravo@apache.org To: commits@geode.apache.org Message-Id: <8d1f993fe6f2486caae4f9c4b375ccd9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: geode-native git commit: GEODE-2741: Fixed quickstarts impacted by shared_ptr Date: Thu, 20 Jul 2017 23:19:12 +0000 (UTC) archived-at: Thu, 20 Jul 2017 23:19:16 -0000 Repository: geode-native Updated Branches: refs/heads/develop d898e629b -> ce35534e6 GEODE-2741: Fixed quickstarts impacted by shared_ptr Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/ce35534e Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/ce35534e Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/ce35534e Branch: refs/heads/develop Commit: ce35534e61469857682f55edc476e7e72a602f6d Parents: d898e62 Author: Ernest Burghardt Authored: Thu Jul 20 17:18:21 2017 -0600 Committer: Ernest Burghardt Committed: Thu Jul 20 17:19:03 2017 -0600 ---------------------------------------------------------------------- src/quickstart/cpp/DataExpiration.cpp | 7 ++++--- src/quickstart/cpp/DurableClient.cpp | 2 ++ src/quickstart/cpp/HACache.cpp | 4 +++- src/quickstart/cpp/PdxInstance.cpp | 2 +- src/quickstart/cpp/PdxSerializer.cpp | 2 +- src/quickstart/cpp/PutAllGetAllOperations.cpp | 3 +-- src/quickstart/cpp/TransactionsXA.cpp | 2 +- src/quickstart/cpp/queryobjects/Portfolio.cpp | 8 ++++---- src/quickstart/cpp/queryobjects/PortfolioPdx.cpp | 9 ++++----- 9 files changed, 21 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode-native/blob/ce35534e/src/quickstart/cpp/DataExpiration.cpp ---------------------------------------------------------------------- diff --git a/src/quickstart/cpp/DataExpiration.cpp b/src/quickstart/cpp/DataExpiration.cpp index 004213d..130fc1a 100644 --- a/src/quickstart/cpp/DataExpiration.cpp +++ b/src/quickstart/cpp/DataExpiration.cpp @@ -36,6 +36,8 @@ // Include the Geode library. #include +#include +#include // Include the SimpleCacheListener plugin. #include "plugins/SimpleCacheListener.hpp" @@ -85,8 +87,7 @@ int main(int argc, char** argv) { LOGINFO("Got Entry Idle Timeout as %d seconds", entryIdleTimeout); // Wait for half the Entry Idle Timeout duration, using - // apache::geode::client::millisleep(). - millisleep(entryIdleTimeout * 1000 / 2); + std::this_thread::sleep_for(std::chrono::milliseconds(entryIdleTimeout * 1000 / 2)); // Get the number of Keys remaining in the Region, should be all 3. VectorOfCacheableKey keys; @@ -103,7 +104,7 @@ int main(int argc, char** argv) { // Wait for the entire Entry Idle Timeout duration, using // apache::geode::client::millisleep(). - apache::geode::client::millisleep(entryIdleTimeout * 1000); + std::this_thread::sleep_for(std::chrono::milliseconds(entryIdleTimeout * 1000)); // Get the number of Keys remaining in the Region, should be 0 now. regionPtr->keys(keys); http://git-wip-us.apache.org/repos/asf/geode-native/blob/ce35534e/src/quickstart/cpp/DurableClient.cpp ---------------------------------------------------------------------- diff --git a/src/quickstart/cpp/DurableClient.cpp b/src/quickstart/cpp/DurableClient.cpp index b406237..3d82abb 100644 --- a/src/quickstart/cpp/DurableClient.cpp +++ b/src/quickstart/cpp/DurableClient.cpp @@ -31,6 +31,8 @@ // Include the Geode library. #include +#include +#include // Include cachelistener #include "plugins/DurableCacheListener.hpp" http://git-wip-us.apache.org/repos/asf/geode-native/blob/ce35534e/src/quickstart/cpp/HACache.cpp ---------------------------------------------------------------------- diff --git a/src/quickstart/cpp/HACache.cpp b/src/quickstart/cpp/HACache.cpp index bef557d..73a1bac 100644 --- a/src/quickstart/cpp/HACache.cpp +++ b/src/quickstart/cpp/HACache.cpp @@ -32,6 +32,8 @@ // Include the Geode library. #include +#include +#include // Use the "geode" namespace. using namespace apache::geode::client; @@ -77,7 +79,7 @@ int main(int argc, char** argv) { LOGINFO("Called put() on Region"); LOGINFO("Waiting for updates on keys"); - millisleep(10000); + std::this_thread::sleep_for(std::chrono::milliseconds(10000)); int count = 0; http://git-wip-us.apache.org/repos/asf/geode-native/blob/ce35534e/src/quickstart/cpp/PdxInstance.cpp ---------------------------------------------------------------------- diff --git a/src/quickstart/cpp/PdxInstance.cpp b/src/quickstart/cpp/PdxInstance.cpp index d5277a1..64ea59a 100644 --- a/src/quickstart/cpp/PdxInstance.cpp +++ b/src/quickstart/cpp/PdxInstance.cpp @@ -93,7 +93,7 @@ int main(int argc, char** argv) { LOGINFO("Populated PdxInstance Object"); - PdxInstancePtr retPdxInstance = regionPtr->get("Key1"); + PdxInstancePtr retPdxInstance = std::dynamic_pointer_cast(regionPtr->get("Key1")); LOGINFO("Got PdxInstance Object"); http://git-wip-us.apache.org/repos/asf/geode-native/blob/ce35534e/src/quickstart/cpp/PdxSerializer.cpp ---------------------------------------------------------------------- diff --git a/src/quickstart/cpp/PdxSerializer.cpp b/src/quickstart/cpp/PdxSerializer.cpp index 1d76ad3..b394c28 100644 --- a/src/quickstart/cpp/PdxSerializer.cpp +++ b/src/quickstart/cpp/PdxSerializer.cpp @@ -218,7 +218,7 @@ int main(int argc, char** argv) { LOGINFO("Region Query returned %d rows", resultsPtr->size()); // Execute the Region selectValue() API. - PdxWrapperPtr pdxWrapperPtr = regionPtr->selectValue("m_id = 3"); + PdxWrapperPtr pdxWrapperPtr = std::dynamic_pointer_cast(regionPtr->selectValue("m_id = 3")); Person* per = reinterpret_cast(pdxWrapperPtr->getObject()); LOGINFO( http://git-wip-us.apache.org/repos/asf/geode-native/blob/ce35534e/src/quickstart/cpp/PutAllGetAllOperations.cpp ---------------------------------------------------------------------- diff --git a/src/quickstart/cpp/PutAllGetAllOperations.cpp b/src/quickstart/cpp/PutAllGetAllOperations.cpp index f79ed0b..5750fc4 100644 --- a/src/quickstart/cpp/PutAllGetAllOperations.cpp +++ b/src/quickstart/cpp/PutAllGetAllOperations.cpp @@ -60,8 +60,7 @@ int main(int argc, char** argv) { for (int32_t item = 0; item < 100; item++) { sprintf(key, "key-%d", item); sprintf(value, "%d", item); - entryMap.insert(CacheableKey::create(key), - CacheableString::create(value)); + entryMap[CacheableKey::create(key)] = CacheableString::create(value); } regionPtr->putAll(entryMap); http://git-wip-us.apache.org/repos/asf/geode-native/blob/ce35534e/src/quickstart/cpp/TransactionsXA.cpp ---------------------------------------------------------------------- diff --git a/src/quickstart/cpp/TransactionsXA.cpp b/src/quickstart/cpp/TransactionsXA.cpp index 61dfc5a..745f83f 100644 --- a/src/quickstart/cpp/TransactionsXA.cpp +++ b/src/quickstart/cpp/TransactionsXA.cpp @@ -65,7 +65,7 @@ int main(int argc, char** argv) { LOGINFO("Created the Region Programmatically."); InternalCacheTransactionManager2PCPtr txManager = - static_cast( + std::dynamic_pointer_cast( cachePtr->getCacheTransactionManager()); // start a transaction http://git-wip-us.apache.org/repos/asf/geode-native/blob/ce35534e/src/quickstart/cpp/queryobjects/Portfolio.cpp ---------------------------------------------------------------------- diff --git a/src/quickstart/cpp/queryobjects/Portfolio.cpp b/src/quickstart/cpp/queryobjects/Portfolio.cpp index f9828eb..351c714 100644 --- a/src/quickstart/cpp/queryobjects/Portfolio.cpp +++ b/src/quickstart/cpp/queryobjects/Portfolio.cpp @@ -16,6 +16,7 @@ */ #include "Portfolio.hpp" +#include using namespace apache::geode::client; using namespace testobject; @@ -38,16 +39,15 @@ Portfolio::Portfolio(int32_t i, uint32_t size, CacheableStringArrayPtr nm) type = CacheableString::create(buf); int numSecIds = sizeof(secIds) / sizeof(char*); position1 = - new Position(secIds[Position::cnt % numSecIds], Position::cnt * 1000); + std::make_shared(secIds[Position::cnt % numSecIds], Position::cnt * 1000); if (i % 2 != 0) { position2 = - new Position(secIds[Position::cnt % numSecIds], Position::cnt * 1000); + std::make_shared(secIds[Position::cnt % numSecIds], Position::cnt * 1000); } else { position2 = nullptr; } positions = CacheableHashMap::create(); - positions->insert(CacheableString::create(secIds[Position::cnt % numSecIds]), - position1); + (*positions)[CacheableString::create(secIds[Position::cnt % numSecIds])] = position1; newVal = new uint8_t[size + 1]; memset(newVal, 'B', size); newVal[size] = '\0'; http://git-wip-us.apache.org/repos/asf/geode-native/blob/ce35534e/src/quickstart/cpp/queryobjects/PortfolioPdx.cpp ---------------------------------------------------------------------- diff --git a/src/quickstart/cpp/queryobjects/PortfolioPdx.cpp b/src/quickstart/cpp/queryobjects/PortfolioPdx.cpp index c505514..516921b 100644 --- a/src/quickstart/cpp/queryobjects/PortfolioPdx.cpp +++ b/src/quickstart/cpp/queryobjects/PortfolioPdx.cpp @@ -44,17 +44,16 @@ PortfolioPdx::PortfolioPdx(int32_t i, int32_t size, char** nm) : names(nm) { memcpy(type, buf, strSize2); int numSecIds = sizeof(secIds) / sizeof(char*); - position1 = new PositionPdx(secIds[PositionPdx::cnt % numSecIds], + position1 = std::make_shared(secIds[PositionPdx::cnt % numSecIds], PositionPdx::cnt * 1000); if (i % 2 != 0) { - position2 = new PositionPdx(secIds[PositionPdx::cnt % numSecIds], - PositionPdx::cnt * 1000); + position2 = std::make_shared(secIds[PositionPdx::cnt % numSecIds], + PositionPdx::cnt * 1000); } else { position2 = nullptr; } positions = CacheableHashMap::create(); - positions->insert( - CacheableString::create(secIds[PositionPdx::cnt % numSecIds]), position1); + (*positions)[CacheableString::create(secIds[PositionPdx::cnt % numSecIds])] = position1; if (size > 0) { newVal = new int8_t[size];