http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp b/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp index 89d18b6..675f876 100644 --- a/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp +++ b/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp @@ -15,13 +15,14 @@ * limitations under the License. */ +#include <string> +#include <iostream> +#include <vector> + #include "fw_dunit.hpp" #include <geode/GeodeCppCache.hpp> -#include <string> -#include <vector> - #define CLIENT1 s1p1 #define CLIENT2 s1p2 #define SERVER1 s2p1 @@ -87,7 +88,7 @@ bool checkPoolAttribs(PoolPtr pool, SLIST& locators, SLIST& servers, return false; } - test::cout << "Checking pool " << pool->getName() << test::endl; + std::cout << "Checking pool " << pool->getName() << std::endl; if (strcmp(pool->getName(), name)) { sprintf(logmsg, "checkPoolAttribs: Pool name expected [%s], actual [%s]", @@ -244,7 +245,7 @@ int testXmlCacheCreationWithPools() { CacheFactoryPtr cacheFactory; CachePtr cptr; - test::cout << "create DistributedSytem with name=" << host_name << test::endl; + std::cout << "create DistributedSytem with name=" << host_name << std::endl; try { cacheFactory = CacheFactory::createCacheFactory(); } catch (Exception& ex) { @@ -253,9 +254,9 @@ int testXmlCacheCreationWithPools() { return -1; } - test::cout + std::cout << "Create cache with the configurations provided in valid_cache_pool.xml" - << test::endl; + << std::endl; try { std::string filePath = "valid_cache_pool.xml"; @@ -263,11 +264,11 @@ int testXmlCacheCreationWithPools() { CacheHelper::createDuplicateXMLFile(duplicateFile, filePath); cptr = cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create(); if (cptr->getPdxIgnoreUnreadFields() != true) { - test::cout << "getPdxIgnoreUnreadFields should return true." - << test::endl; + std::cout << "getPdxIgnoreUnreadFields should return true." + << std::endl; return -1; } else { - test::cout << "getPdxIgnoreUnreadFields returned true." << test::endl; + std::cout << "getPdxIgnoreUnreadFields returned true." << std::endl; } } catch (Exception& ex) { ex.showMessage(); @@ -279,40 +280,40 @@ int testXmlCacheCreationWithPools() { } VectorOfRegion vrp; - test::cout << "Test if number of root regions are correct" << test::endl; + std::cout << "Test if number of root regions are correct" << std::endl; cptr->rootRegions(vrp); - test::cout << " vrp.size=" << vrp.size() << test::endl; + std::cout << " vrp.size=" << vrp.size() << std::endl; if (vrp.size() != 2) { - test::cout << "Number of root regions does not match" << test::endl; + std::cout << "Number of root regions does not match" << std::endl; return -1; } - test::cout << "Root regions in Cache :" << test::endl; + std::cout << "Root regions in Cache :" << std::endl; for (int32_t i = 0; i < vrp.size(); i++) { - test::cout << "vc[" << i << "].m_regionPtr=" << vrp.at(i).get() - << test::endl; - test::cout << "vc[" << i << "]=" << vrp.at(i)->getName() << test::endl; + std::cout << "vc[" << i << "].m_regionPtr=" << vrp.at(i).get() + << std::endl; + std::cout << "vc[" << i << "]=" << vrp.at(i)->getName() << std::endl; } RegionPtr regPtr1 = vrp.at(0); VectorOfRegion vr; - test::cout << "Test if the number of sub regions with the root region Root1 " + std::cout << "Test if the number of sub regions with the root region Root1 " "are correct" - << test::endl; + << std::endl; regPtr1->subregions(true, vr); - test::cout << " vr.size=" << vr.size() << test::endl; + std::cout << " vr.size=" << vr.size() << std::endl; if (vr.size() != 1) { - test::cout << "Number of Subregions does not match" << test::endl; + std::cout << "Number of Subregions does not match" << std::endl; return -1; } - test::cout << "get subregions from the root region :" << vrp.at(0)->getName() - << test::endl; + std::cout << "get subregions from the root region :" << vrp.at(0)->getName() + << std::endl; for (int32_t i = 0; i < vr.size(); i++) { - test::cout << "vc[" << i << "].m_regionPtr=" << vr.at(i).get() - << test::endl; - test::cout << "vc[" << i << "]=" << vr.at(i)->getName() << test::endl; + std::cout << "vc[" << i << "].m_regionPtr=" << vr.at(i).get() + << std::endl; + std::cout << "vc[" << i << "]=" << vr.at(i)->getName() << std::endl; } RegionPtr subRegPtr = vr.at(0); @@ -320,35 +321,35 @@ int testXmlCacheCreationWithPools() { RegionPtr regPtr2 = vrp.at(1); - test::cout << "Test if the number of sub regions with the root region Root2 " + std::cout << "Test if the number of sub regions with the root region Root2 " "are correct" - << test::endl; + << std::endl; regPtr2->subregions(true, vr); - test::cout << " vr.size=" << vr.size() << test::endl; + std::cout << " vr.size=" << vr.size() << std::endl; if (vr.size() != 0) { - test::cout << "Number of Subregions does not match" << test::endl; + std::cout << "Number of Subregions does not match" << std::endl; return -1; } vr.clear(); vrp.clear(); - test::cout << "Test the attributes of region" << test::endl; + std::cout << "Test the attributes of region" << std::endl; const char* poolNameReg1 = regPtr1->getAttributes()->getPoolName(); const char* poolNameSubReg = subRegPtr->getAttributes()->getPoolName(); const char* poolNameReg2 = regPtr2->getAttributes()->getPoolName(); if (strcmp(poolNameReg1, "test_pool_1")) { - test::cout << "Wrong pool name for region 1" << test::endl; + std::cout << "Wrong pool name for region 1" << std::endl; return -1; } if (strcmp(poolNameReg2, "test_pool_2")) { - test::cout << "Wrong pool name for region 2" << test::endl; + std::cout << "Wrong pool name for region 2" << std::endl; return -1; } if (strcmp(poolNameSubReg, "test_pool_2")) { - test::cout << "Wrong pool name for sub region" << test::endl; + std::cout << "Wrong pool name for sub region" << std::endl; return -1; } @@ -393,74 +394,74 @@ int testXmlCacheCreationWithPools() { } if (!check1 || !check2 || !check3) { - test::cout << "Property check failed" << test::endl; + std::cout << "Property check failed" << std::endl; return -1; } ////////////////////////////testing of cache.xml completed/////////////////// try { - test::cout << "Testing invalid pool xml 1" << test::endl; + std::cout << "Testing invalid pool xml 1" << std::endl; std::string filePath = "invalid_cache_pool.xml"; std::string duplicateFile; CacheHelper::createDuplicateXMLFile(duplicateFile, filePath); cptr = cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create(); return -1; } catch (Exception& ex) { - test::cout << "EXPECTED EXCEPTION" << test::endl; + std::cout << "EXPECTED EXCEPTION" << std::endl; ex.showMessage(); ex.printStackTrace(); } try { - test::cout << "Testing invalid pool xml 2" << test::endl; + std::cout << "Testing invalid pool xml 2" << std::endl; std::string filePath = "invalid_cache_pool2.xml"; std::string duplicateFile; CacheHelper::createDuplicateXMLFile(duplicateFile, filePath); cptr = cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create(); return -1; } catch (Exception& ex) { - test::cout << "EXPECTED EXCEPTION" << test::endl; + std::cout << "EXPECTED EXCEPTION" << std::endl; ex.showMessage(); ex.printStackTrace(); } try { - test::cout << "Testing invalid pool xml 3" << test::endl; + std::cout << "Testing invalid pool xml 3" << std::endl; std::string filePath = "invalid_cache_pool3.xml"; std::string duplicateFile; CacheHelper::createDuplicateXMLFile(duplicateFile, filePath); cptr = cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create(); return -1; } catch (Exception& ex) { - test::cout << "EXPECTED EXCEPTION" << test::endl; + std::cout << "EXPECTED EXCEPTION" << std::endl; ex.showMessage(); ex.printStackTrace(); } try { - test::cout << "Testing invalid pool xml 4" << test::endl; + std::cout << "Testing invalid pool xml 4" << std::endl; std::string filePath = "invalid_cache_pool4.xml"; std::string duplicateFile; CacheHelper::createDuplicateXMLFile(duplicateFile, filePath); cptr = cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create(); return -1; } catch (Exception& ex) { - test::cout << "EXPECTED EXCEPTION" << test::endl; + std::cout << "EXPECTED EXCEPTION" << std::endl; ex.showMessage(); ex.printStackTrace(); } - test::cout << "disconnecting..." << test::endl; + std::cout << "disconnecting..." << std::endl; try { - test::cout << "just before disconnecting..." << test::endl; + std::cout << "just before disconnecting..." << std::endl; if (cptr != nullptr) cptr->close(); } catch (Exception& ex) { ex.showMessage(); ex.printStackTrace(); return -1; } - test::cout << "done with test" << test::endl; - test::cout << "Test successful!" << test::endl; + std::cout << "done with test" << std::endl; + std::cout << "Test successful!" << std::endl; return 0; } @@ -472,7 +473,7 @@ int testXmlDeclarativeCacheCreation() { char* path = ACE_OS::getenv("TESTSRC"); std::string directory(path); - test::cout << "create DistributedSytem with name=" << host_name << test::endl; + std::cout << "create DistributedSytem with name=" << host_name << std::endl; try { cacheFactory = CacheFactory::createCacheFactory(); } catch (Exception& ex) { @@ -495,43 +496,43 @@ int testXmlDeclarativeCacheCreation() { } VectorOfRegion vrp; - test::cout << "Test if number of root regions are correct" << test::endl; + std::cout << "Test if number of root regions are correct" << std::endl; cptr->rootRegions(vrp); - test::cout << " vrp.size=" << vrp.size() << test::endl; + std::cout << " vrp.size=" << vrp.size() << std::endl; if (vrp.size() != 1) { - test::cout << "Number of root regions does not match" << test::endl; + std::cout << "Number of root regions does not match" << std::endl; return -1; } - test::cout << "Root regions in Cache :" << test::endl; + std::cout << "Root regions in Cache :" << std::endl; for (int32_t i = 0; i < vrp.size(); i++) { - test::cout << "vc[" << i << "].m_reaPtr=" << vrp.at(i).get() << test::endl; - test::cout << "vc[" << i << "]=" << vrp.at(i)->getName() << test::endl; + std::cout << "vc[" << i << "].m_reaPtr=" << vrp.at(i).get() << std::endl; + std::cout << "vc[" << i << "]=" << vrp.at(i)->getName() << std::endl; } RegionPtr regPtr1 = vrp.at(0); RegionAttributesPtr raPtr = regPtr1->getAttributes(); RegionAttributes* regAttr = raPtr.get(); - test::cout << "Test Attributes of root region Root1 " << test::endl; - test::cout << "Region name " << regPtr1->getName() << test::endl; + std::cout << "Test Attributes of root region Root1 " << std::endl; + std::cout << "Region name " << regPtr1->getName() << std::endl; if (regAttr->getCacheLoader() == nullptr) { - test::cout << "Cache Loader not initialized." << test::endl; + std::cout << "Cache Loader not initialized." << std::endl; return -1; } if (regAttr->getCacheListener() == nullptr) { - test::cout << "Cache Listener not initialized." << test::endl; + std::cout << "Cache Listener not initialized." << std::endl; return -1; } if (regAttr->getCacheWriter() == nullptr) { - test::cout << "Cache Writer not initialized." << test::endl; + std::cout << "Cache Writer not initialized." << std::endl; return -1; } - test::cout << "Attributes of Root1 are correctly set" << test::endl; + std::cout << "Attributes of Root1 are correctly set" << std::endl; if (!cptr->isClosed()) { cptr->close();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp b/src/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp index ec30261..da2fd88 100644 --- a/src/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp +++ b/src/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp @@ -17,13 +17,15 @@ #define ROOT_NAME "testXmlCacheCreationWithRefid" +#include <string> +#include <iostream> +#include <math.h> + #include <geode/GeodeCppCache.hpp> #include "fw_helper.hpp" -#include <string> -#include <math.h> + using namespace apache::geode::client; -using namespace test; int testXmlCacheCreationWithRefid(const char* fileName) { char* host_name = (char*)"XML_CACHE_CREATION_TEST"; @@ -33,7 +35,7 @@ int testXmlCacheCreationWithRefid(const char* fileName) { char* path = ACE_OS::getenv("TESTSRC"); std::string directory(path); - cout << "create DistributedSytem with name=" << host_name << endl; + std::cout << "create DistributedSytem with name=" << host_name << std::endl; try { cacheFactory = CacheFactory::createCacheFactory(); } catch (Exception& ex) { @@ -42,18 +44,18 @@ int testXmlCacheCreationWithRefid(const char* fileName) { return -1; } - cout << "Create cache with the configurations provided in " + std::cout << "Create cache with the configurations provided in " "valid_cache_refid.xml" - << endl; + << std::endl; try { std::string filePath = directory + fileName; cptr = cacheFactory->set("cache-xml-file", filePath.c_str())->create(); if (cptr->getPdxIgnoreUnreadFields() != false) { - cout << "getPdxIgnoreUnreadFields should return false." << endl; + std::cout << "getPdxIgnoreUnreadFields should return false." << std::endl; return -1; } else { - cout << "getPdxIgnoreUnreadFields returned false." << endl; + std::cout << "getPdxIgnoreUnreadFields returned false." << std::endl; } } catch (CacheXmlException& ex) { ex.showMessage(); @@ -69,7 +71,7 @@ int testXmlCacheCreationWithRefid(const char* fileName) { RegionPtr Root2; RegionPtr SubRegion21; - cout << "Verify whether all the regions are created" << endl; + std::cout << "Verify whether all the regions are created" << std::endl; try { Root1 = cptr->getRegion("Root1"); @@ -84,7 +86,7 @@ int testXmlCacheCreationWithRefid(const char* fileName) { return -1; } - cout << "Verify whether region 'SubRegion11' has correct attributes" << endl; + std::cout << "Verify whether region 'SubRegion11' has correct attributes" << std::endl; RegionAttributesPtr atts = SubRegion11->getAttributes(); @@ -108,7 +110,7 @@ int testXmlCacheCreationWithRefid(const char* fileName) { return -1; } - cout << "Verify whether region 'SubRegion2' has correct attributes" << endl; + std::cout << "Verify whether region 'SubRegion2' has correct attributes" << std::endl; atts = SubRegion2->getAttributes(); @@ -132,7 +134,7 @@ int testXmlCacheCreationWithRefid(const char* fileName) { return -1; } - cout << "Verify whether region 'SubRegion21' has correct attributes" << endl; + std::cout << "Verify whether region 'SubRegion21' has correct attributes" << std::endl; atts = SubRegion21->getAttributes(); @@ -176,7 +178,7 @@ int testXmlCacheCreationWithRefid(const char* fileName) { return -1; } - cout << "Verify whether region 'Root2' has correct attributes" << endl; + std::cout << "Verify whether region 'Root2' has correct attributes" << std::endl; atts = Root2->getAttributes(); http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/AdminRegion.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/AdminRegion.hpp b/src/cppcache/src/AdminRegion.hpp index 1b0196a..2123a2e 100644 --- a/src/cppcache/src/AdminRegion.hpp +++ b/src/cppcache/src/AdminRegion.hpp @@ -24,7 +24,7 @@ #include "ThinClientCacheDistributionManager.hpp" #include "ReadWriteLock.hpp" #include <geode/Serializable.hpp> -#include <geode/SharedPtr.hpp> +#include <memory> //#include <statistics/HostStatSampler.hpp> #include "NonCopyable.hpp" @@ -40,19 +40,6 @@ namespace apache { namespace geode { namespace client { class CacheImpl; -/* adongre - * CID 28724: Other violation (MISSING_COPY) - * Class "apache::geode::client::AdminRegion" owns resources that are managed in - * its - * constructor and destructor but has no user-written copy constructor. - * - * CID 28710: Other violation (MISSING_ASSIGN) - * Class "apache::geode::client::AdminRegion" owns resources that are managed in - * its - * constructor and destructor but has no user-written assignment operator. - * - * FIX : Make the class noncopyabl3 - */ class AdminRegion : private NonCopyable, private NonAssignable, public std::enable_shared_from_this<AdminRegion> { @@ -88,7 +75,7 @@ class AdminRegion : private NonCopyable, friend class apache::geode::statistics::HostStatSampler; }; -typedef SharedPtr<AdminRegion> AdminRegionPtr; +typedef std::shared_ptr<AdminRegion> AdminRegionPtr; } // namespace client } // namespace geode } // namespace apache http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/Cache.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/Cache.cpp b/src/cppcache/src/Cache.cpp index 5d7f574..5bda631 100644 --- a/src/cppcache/src/Cache.cpp +++ b/src/cppcache/src/Cache.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ #include <geode/geode_globals.hpp> -#include <geode/SharedPtr.hpp> +#include <memory> #include <geode/DistributedSystem.hpp> #include <DistributedSystemImpl.hpp> @@ -155,7 +155,6 @@ Cache::Cache(const char* name, DistributedSystemPtr sys, const char* id_data, this, name, sys, id_data, ignorePdxUnreadFields, readPdxSerialized)); } -Cache::Cache() = default; Cache::~Cache() = default; /** Initialize the cache by the contents of an xml file http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/CacheImpl.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheImpl.cpp b/src/cppcache/src/CacheImpl.cpp index 084d4a1..4995d60 100644 --- a/src/cppcache/src/CacheImpl.cpp +++ b/src/cppcache/src/CacheImpl.cpp @@ -890,7 +890,8 @@ CacheTransactionManagerPtr CacheImpl::getCacheTransactionManager() { return m_cacheTXManager; } MemberListForVersionStampPtr CacheImpl::getMemberListForVersionStamp() { - - static auto versionStampMemIdList = std::make_shared<MemberListForVersionStamp>(); - return versionStampMemIdList; + static auto versionStampMemIdList = + new std::shared_ptr<MemberListForVersionStamp>( + new MemberListForVersionStamp()); + return *versionStampMemIdList; } http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/CacheImpl.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheImpl.hpp b/src/cppcache/src/CacheImpl.hpp index 03c0805..540d32c 100644 --- a/src/cppcache/src/CacheImpl.hpp +++ b/src/cppcache/src/CacheImpl.hpp @@ -21,7 +21,7 @@ */ #include <geode/geode_globals.hpp> -#include <geode/SharedPtr.hpp> +#include <memory> #include <geode/Cache.hpp> #include <geode/CacheAttributes.hpp> @@ -81,14 +81,6 @@ class ExpiryTaskManager; * */ -/* adongre - * CID 28711: Other violation (MISSING_ASSIGN) - * Class "apache::geode::client::CacheImpl" owns resources that are managed - * in its constructor and destructor but has no user-written assignment - * operator. - * - * Fix : Make the class Non copyable and non assignable - */ class CPPCACHE_EXPORT CacheImpl : private NonCopyable, private NonAssignable { /** * @brief public methods http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/CacheTransactionManagerImpl.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheTransactionManagerImpl.cpp b/src/cppcache/src/CacheTransactionManagerImpl.cpp index 5527018..b5c633d 100644 --- a/src/cppcache/src/CacheTransactionManagerImpl.cpp +++ b/src/cppcache/src/CacheTransactionManagerImpl.cpp @@ -112,7 +112,7 @@ void CacheTransactionManagerImpl::commit() { } TXCommitMessagePtr commit = - std::static_pointer_cast<GF_UNWRAP_SP(TXCommitMessagePtr)>( + std::static_pointer_cast<TXCommitMessage>( reply.getValue()); txCleaner.clean(); commit->apply(m_cache); @@ -307,7 +307,7 @@ GfErrType CacheTransactionManagerImpl::rollback(TXState* txState, /* if(err == GF_NOERR && callListener) { // TXCommitMessagePtr commit = - std::static_pointer_cast<GF_UNWRAP_SP(TXCommitMessagePtr)>(reply.getValue()); + std::static_pointer_cast<TXCommitMessage>(reply.getValue()); noteRollbackSuccess(txState, nullptr); } */ @@ -632,7 +632,7 @@ TransactionEvent(txState->getTransactionId(), CachePtr(m_cache), events)); m_listeners.end() != iter; iter++) { TransactionListenerPtr listener = -std::static_pointer_cast<GF_UNWRAP_SP(TransactionListenerPtr)>(*iter); +std::static_pointer_cast<TransactionListener>(*iter); listener->afterFailedCommit(event); } } @@ -652,7 +652,7 @@ TransactionEvent(txState->getTransactionId(), CachePtr(m_cache), events)); m_listeners.end() != iter; iter++) { TransactionListenerPtr listener = -std::static_pointer_cast<GF_UNWRAP_SP(TransactionListenerPtr)>(*iter); +std::static_pointer_cast<TransactionListenerPtr>(*iter); listener->afterCommit(event); } } @@ -672,7 +672,7 @@ TransactionEvent(txState->getTransactionId(), CachePtr(m_cache), events)); m_listeners.end() != iter; iter++) { TransactionListenerPtr listener = -std::static_pointer_cast<GF_UNWRAP_SP(TransactionListenerPtr)>(*iter); +std::static_pointer_cast<TransactionListener>(*iter); listener->afterRollback(event); } } http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/CacheTransactionManagerImpl.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheTransactionManagerImpl.hpp b/src/cppcache/src/CacheTransactionManagerImpl.hpp index daba08c..a3b220c 100644 --- a/src/cppcache/src/CacheTransactionManagerImpl.hpp +++ b/src/cppcache/src/CacheTransactionManagerImpl.hpp @@ -60,19 +60,14 @@ class CacheTransactionManagerImpl virtual TransactionIdPtr getTransactionId(); - // virtual void setWriter(TransactionWriterPtr writer); - // virtual TransactionWriterPtr getWriter(); - // virtual void addListener(TransactionListenerPtr aListener); - // virtual void removeListener(TransactionListenerPtr aListener); - - inline static int32_t hasher(const SharedBasePtr& p) { - return static_cast<int32_t>(reinterpret_cast<intptr_t>(p.get())); - } - - inline static bool equal_to(const SharedBasePtr& x, const SharedBasePtr& y) { - return x.get() == y.get(); - } +// inline static int32_t hasher(const SharedBasePtr& p) { +// return static_cast<int32_t>(reinterpret_cast<intptr_t>(p.get())); +// } +// +// inline static bool equal_to(const SharedBasePtr& x, const SharedBasePtr& y) { +// return x.get() == y.get(); +// } TXState* getSuspendedTx(int32_t txId); protected: @@ -81,14 +76,7 @@ class CacheTransactionManagerImpl private: Cache* m_cache; - // TransactionListenerPtr m_listener; - - // void noteCommitFailure(TXState* txState, const TXCommitMessagePtr& - // commitMessage); - // void noteCommitSuccess(TXState* txState, const TXCommitMessagePtr& - // commitMessage); - // void noteRollbackSuccess(TXState* txState, const TXCommitMessagePtr& - // commitMessage); + void resumeTxUsingTxState(TXState* txState, bool cancelExpiryTask = true); GfErrType rollback(TXState* txState, bool callListener); void addSuspendedTx(int32_t txId, TXState* txState); http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/CacheXmlCreation.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheXmlCreation.cpp b/src/cppcache/src/CacheXmlCreation.cpp index c273aca..c140d24 100644 --- a/src/cppcache/src/CacheXmlCreation.cpp +++ b/src/cppcache/src/CacheXmlCreation.cpp @@ -58,9 +58,7 @@ void CacheXmlCreation::setPdxReadSerialized(bool val) { } CacheXmlCreation::CacheXmlCreation() - /* adongre - * CID 28926: Uninitialized pointer field (UNINIT_CTOR) - */ + : m_cache((Cache*)0) { m_pdxIgnoreUnreadFields = false; m_readPdxSerialized = false; http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/CacheXmlParser.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheXmlParser.cpp b/src/cppcache/src/CacheXmlParser.cpp index 24659c3..552a0e1 100644 --- a/src/cppcache/src/CacheXmlParser.cpp +++ b/src/cppcache/src/CacheXmlParser.cpp @@ -517,9 +517,7 @@ void CacheXmlParser::endPdx() {} void CacheXmlParser::startLocator(const xmlChar** atts) { int attrsCount = 0; if (!atts) { - /* adongre - * CID 28741: Parse warning (PW.EXPR_HAS_NO_EFFECT)expression has no effect - */ + std::string s = "XML:No attributes provided for <locator>. " "A locator requires a host and port"; @@ -556,9 +554,7 @@ void CacheXmlParser::startLocator(const xmlChar** atts) { void CacheXmlParser::startServer(const xmlChar** atts) { int attrsCount = 0; if (!atts) { - /* adongre - * CID 28742: Parse warning (PW.EXPR_HAS_NO_EFFECT)expression has no effect - */ + std::string s = "XML:No attributes provided for <server>. A server requires a host and " "port"; @@ -1137,9 +1133,7 @@ void CacheXmlParser::startPersistenceManager(const xmlChar** atts) { i++; size_t len = strlen((char*)atts[i]) + 1; libraryName = new char[len]; - /* adongre - * CID 28824: Dereference before null check (REVERSE_INULL) - */ + if (libraryName == nullptr) { std::string s = "Memory allocation fails"; throw CacheXmlException(s.c_str()); @@ -1158,9 +1152,7 @@ void CacheXmlParser::startPersistenceManager(const xmlChar** atts) { i++; size_t len = strlen((char*)atts[i]) + 1; libraryFunctionName = new char[len]; - /* adongre - * CID 28823: Dereference before null check (REVERSE_INULL) - */ + if (libraryFunctionName == nullptr) { std::string s = "Memory allocation fails"; throw CacheXmlException(s.c_str()); http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/CacheableObjectPartList.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheableObjectPartList.hpp b/src/cppcache/src/CacheableObjectPartList.hpp index 61592e6..cbc241b 100644 --- a/src/cppcache/src/CacheableObjectPartList.hpp +++ b/src/cppcache/src/CacheableObjectPartList.hpp @@ -141,7 +141,7 @@ class CacheableObjectPartList : public Cacheable { virtual uint32_t objectSize() const; }; -typedef SharedPtr<CacheableObjectPartList> CacheableObjectPartListPtr; +typedef std::shared_ptr<CacheableObjectPartList> CacheableObjectPartListPtr; } // namespace client } // namespace geode } // namespace apache http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/CacheableToken.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheableToken.hpp b/src/cppcache/src/CacheableToken.hpp index b071a80..d4a2720 100644 --- a/src/cppcache/src/CacheableToken.hpp +++ b/src/cppcache/src/CacheableToken.hpp @@ -28,7 +28,7 @@ namespace geode { namespace client { class CPPCACHE_EXPORT CacheableToken; -typedef SharedPtr<CacheableToken> CacheableTokenPtr; +typedef std::shared_ptr<CacheableToken> CacheableTokenPtr; /** Implement a non-mutable int64_t wrapper that can serve as a distributable * key object for cacheing as well as being a 64 bit value. */ http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/CachedDeserializableHelper.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CachedDeserializableHelper.hpp b/src/cppcache/src/CachedDeserializableHelper.hpp index 799fcca..8a96705 100644 --- a/src/cppcache/src/CachedDeserializableHelper.hpp +++ b/src/cppcache/src/CachedDeserializableHelper.hpp @@ -97,7 +97,8 @@ class CachedDeserializableHelper : public Cacheable, int32_t classId() const { return 0; } }; -typedef SharedPtr<CachedDeserializableHelper> CachedDeserializableHelperPtr; +typedef std::shared_ptr<CachedDeserializableHelper> + CachedDeserializableHelperPtr; } // namespace client } // namespace geode } // namespace apache http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/ClientConnectionResponse.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/ClientConnectionResponse.hpp b/src/cppcache/src/ClientConnectionResponse.hpp index 425cdaf..0dd11fb 100644 --- a/src/cppcache/src/ClientConnectionResponse.hpp +++ b/src/cppcache/src/ClientConnectionResponse.hpp @@ -21,7 +21,7 @@ */ #include "ServerLocationResponse.hpp" #include "ServerLocation.hpp" -#include <geode/SharedPtr.hpp> +#include <memory> namespace apache { namespace geode { namespace client { @@ -47,7 +47,7 @@ class ClientConnectionResponse : public ServerLocationResponse { bool m_serverFound; ServerLocation m_server; }; -typedef SharedPtr<ClientConnectionResponse> ClientConnectionResponsePtr; +typedef std::shared_ptr<ClientConnectionResponse> ClientConnectionResponsePtr; } // namespace client } // namespace geode } // namespace apache http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/ClientMetadata.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/ClientMetadata.hpp b/src/cppcache/src/ClientMetadata.hpp index dd4b4d4..37a025e 100644 --- a/src/cppcache/src/ClientMetadata.hpp +++ b/src/cppcache/src/ClientMetadata.hpp @@ -39,14 +39,14 @@ namespace client { class ThinClientPoolDM; class ClientMetadata; -typedef SharedPtr<ClientMetadata> ClientMetadataPtr; +typedef std::shared_ptr<ClientMetadata> ClientMetadataPtr; typedef std::vector<BucketServerLocationPtr> BucketServerLocationsType; // typedef std::map<int,BucketServerLocationsType > // BucketServerLocationsListType; typedef std::vector<BucketServerLocationsType> BucketServerLocationsListType; typedef std::map<std::string, std::vector<int> > FixedMapType; -class CPPCACHE_EXPORT ClientMetadata : public SharedBase, public NonAssignable { +class CPPCACHE_EXPORT ClientMetadata : public NonAssignable { private: void setPartitionNames(); CacheableHashSetPtr m_partitionNames; http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/ClientMetadataService.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/ClientMetadataService.hpp b/src/cppcache/src/ClientMetadataService.hpp index 3827a79..77da244 100644 --- a/src/cppcache/src/ClientMetadataService.hpp +++ b/src/cppcache/src/ClientMetadataService.hpp @@ -27,7 +27,7 @@ #include <ace/Task.h> #include <geode/utils.hpp> -#include <geode/SharedPtr.hpp> +#include <memory> #include <geode/CacheableKey.hpp> #include <geode/Cacheable.hpp> #include <geode/Region.hpp> @@ -200,9 +200,8 @@ class ClientMetadataService : public ACE_Task_Base, const ClientMetadataPtr& metadata, const BucketSet& bucketSet, bool optimizeForWrite); - ClientMetadataService::ServerToBucketsMapPtr - pruneNodes(const ClientMetadataPtr& metadata, - const BucketSet& buckets); + ClientMetadataService::ServerToBucketsMapPtr pruneNodes( + const ClientMetadataPtr& metadata, const BucketSet& buckets); private: // const PartitionResolverPtr& getResolver(const RegionPtr& region, const http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/ClientProxyMembershipID.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/ClientProxyMembershipID.cpp b/src/cppcache/src/ClientProxyMembershipID.cpp index 2b438dc..41f0f6e 100644 --- a/src/cppcache/src/ClientProxyMembershipID.cpp +++ b/src/cppcache/src/ClientProxyMembershipID.cpp @@ -209,16 +209,7 @@ void ClientProxyMembershipID::initObjectVars( uint32_t len; char* buf = (char*)m_memID.getBuffer(&len); m_memIDStr.append(buf, len); - /* adongre - Coverity II - * CID 29206: Calling risky function (SECURE_CODING)[VERY RISKY]. Using - * "sprintf" can cause a - * buffer overflow when done incorrectly. Because sprintf() assumes an - * arbitrarily long string, - * callers must be careful not to overflow the actual space of the - * destination. - * Use snprintf() instead, or correct precision specifiers. - * Fix : using ACE_OS::snprintf - */ + char PID[15] = {0}; char Synch_Counter[15] = {0}; // ACE_OS::snprintf(PID, 15, "%d",vPID); http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/ClientProxyMembershipID.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/ClientProxyMembershipID.hpp b/src/cppcache/src/ClientProxyMembershipID.hpp index a61e86e..d7a29c9 100644 --- a/src/cppcache/src/ClientProxyMembershipID.hpp +++ b/src/cppcache/src/ClientProxyMembershipID.hpp @@ -31,7 +31,7 @@ namespace apache { namespace geode { namespace client { class ClientProxyMembershipID; -typedef SharedPtr<ClientProxyMembershipID> ClientProxyMembershipIDPtr; +typedef std::shared_ptr<ClientProxyMembershipID> ClientProxyMembershipIDPtr; class ClientProxyMembershipID : public DSMemberForVersionStamp { public: http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/CqService.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CqService.hpp b/src/cppcache/src/CqService.hpp index 5873df5..554abc7 100644 --- a/src/cppcache/src/CqService.hpp +++ b/src/cppcache/src/CqService.hpp @@ -59,22 +59,8 @@ namespace client { * */ -/* adongre - * CID 28727: Other violation (MISSING_COPY) - * Class "apache::geode::client::CqService" owns resources that are managed in - * its - * constructor and destructor but has no user-written copy constructor. - * - * CID 28713: Other violation (MISSING_ASSIGN) - * Class "apache::geode::client::CqService" owns resources that are managed in - * its constructor - * and destructor but has no user-written assignment operator. - * - * FIX : Make the class NonCopyable - */ class CPPCACHE_EXPORT CqService - : public SharedBase, - private NonCopyable, + : private NonCopyable, private NonAssignable, public std::enable_shared_from_this<CqService> { private: @@ -265,7 +251,7 @@ class CPPCACHE_EXPORT CqService const bool connected); }; -typedef SharedPtr<CqService> CqServicePtr; +typedef std::shared_ptr<CqService> CqServicePtr; } // namespace client } // namespace geode } // namespace apache http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/DSMemberForVersionStamp.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/DSMemberForVersionStamp.hpp b/src/cppcache/src/DSMemberForVersionStamp.hpp index 4019095..4fbfb5e 100644 --- a/src/cppcache/src/DSMemberForVersionStamp.hpp +++ b/src/cppcache/src/DSMemberForVersionStamp.hpp @@ -28,7 +28,7 @@ namespace apache { namespace geode { namespace client { class DSMemberForVersionStamp; -typedef SharedPtr<DSMemberForVersionStamp> DSMemberForVersionStampPtr; +typedef std::shared_ptr<DSMemberForVersionStamp> DSMemberForVersionStampPtr; class DSMemberForVersionStamp : public CacheableKey { public: http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/DistributedSystem.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/DistributedSystem.cpp b/src/cppcache/src/DistributedSystem.cpp index 04a5dd1..965bfa5 100644 --- a/src/cppcache/src/DistributedSystem.cpp +++ b/src/cppcache/src/DistributedSystem.cpp @@ -222,10 +222,6 @@ DistributedSystemPtr DistributedSystem::connect( const char* ld_libpath = ACE_OS::getenv("LD_LIBRARY_PATH"); LOGCONFIG("Current library path: %s", ld_libpath == nullptr ? "nullptr" : ld_libpath); -#else - if (Utils::s_setNewAndDelete) { - LOGCONFIG("Operators new and delete have been set."); - } #endif // Log the Geode system properties g_sysProps->logSettings(); http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/DistributedSystemImpl.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/DistributedSystemImpl.hpp b/src/cppcache/src/DistributedSystemImpl.hpp index 42311e3..404c151 100644 --- a/src/cppcache/src/DistributedSystemImpl.hpp +++ b/src/cppcache/src/DistributedSystemImpl.hpp @@ -21,11 +21,11 @@ */ /** -* @file -*/ + * @file + */ #include <geode/geode_globals.hpp> -#include <geode/SharedPtr.hpp> +#include <memory> #include <geode/geode_types.hpp> #include "ace/Recursive_Thread_Mutex.h" #include "ace/Guard_T.h" @@ -45,22 +45,22 @@ namespace client { class SystemProperties; /** -* @class DistributedSystemImpl DistributedSystemImpl.hpp -* A "connection" to a Geode distributed system. -* The connection will be through a (host, port) pair. -*/ + * @class DistributedSystemImpl DistributedSystemImpl.hpp + * A "connection" to a Geode distributed system. + * The connection will be through a (host, port) pair. + */ class DistributedSystemImpl; -typedef SharedPtr<DistributedSystemImpl> DistributedSystemImplPtr; +typedef std::shared_ptr<DistributedSystemImpl> DistributedSystemImplPtr; -class CPPCACHE_EXPORT DistributedSystemImpl : public SharedBase { +class CPPCACHE_EXPORT DistributedSystemImpl { /** - * @brief public methods - */ + * @brief public methods + */ public: /* - * threadname should have less than 16 bytes - */ + * threadname should have less than 16 bytes + */ static void setThreadName(const char* tn) { #ifdef __linux int idx = 0; @@ -78,12 +78,12 @@ class CPPCACHE_EXPORT DistributedSystemImpl : public SharedBase { #endif } /** - * @brief destructor - */ + * @brief destructor + */ virtual ~DistributedSystemImpl(); /** - */ + */ virtual AuthInitializePtr getAuthLoader(); /** Retrieve the MemberId used to create this Cache. */ @@ -95,8 +95,8 @@ class CPPCACHE_EXPORT DistributedSystemImpl : public SharedBase { DiffieHellman m_dh; /** - * @brief constructors - */ + * @brief constructors + */ DistributedSystemImpl(const char* name, DistributedSystem* implementee); // acquire/release locks @@ -116,9 +116,9 @@ class CPPCACHE_EXPORT DistributedSystemImpl : public SharedBase { static void disconnectInstance(); /** - * The current number of connection instances created using - * connectionOrGetInstance(). - */ + * The current number of connection instances created using + * connectionOrGetInstance(). + */ static int currentInstances(); static void registerCliCallback(int appdomainId, http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/EnumInfo.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/EnumInfo.hpp b/src/cppcache/src/EnumInfo.hpp index 4571f62..cba0677 100644 --- a/src/cppcache/src/EnumInfo.hpp +++ b/src/cppcache/src/EnumInfo.hpp @@ -61,7 +61,7 @@ class CPPCACHE_EXPORT EnumInfo : public CacheableKey { CacheableStringPtr getEnumName() const { return m_enumName; } int32_t getEnumOrdinal() const { return m_ordinal; } }; -typedef SharedPtr<EnumInfo> EnumInfoPtr; +typedef std::shared_ptr<EnumInfo> EnumInfoPtr; } // namespace client } // namespace geode } // namespace apache http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/EventIdMap.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/EventIdMap.hpp b/src/cppcache/src/EventIdMap.hpp index 8b4f9b9..eb40ab5 100644 --- a/src/cppcache/src/EventIdMap.hpp +++ b/src/cppcache/src/EventIdMap.hpp @@ -32,7 +32,7 @@ #include <ace/Guard_T.h> #include <geode/utils.hpp> -#include <geode/SharedPtr.hpp> +#include <memory> #include "EventId.hpp" #include "EventSource.hpp" @@ -44,8 +44,8 @@ namespace client { class EventSequence; class EventIdMap; -typedef SharedPtr<EventSequence> EventSequencePtr; -typedef SharedPtr<EventIdMap> EventIdMapPtr; +typedef std::shared_ptr<EventSequence> EventSequencePtr; +typedef std::shared_ptr<EventIdMap> EventIdMapPtr; typedef std::pair<EventSourcePtr, EventSequencePtr> EventIdMapEntry; typedef std::vector<EventIdMapEntry> EventIdMapEntryList; @@ -60,7 +60,7 @@ typedef ACE_Guard<ACE_Recursive_Thread_Mutex> MapGuard; * provides the operations for duplicate checking and * expiry of idle event IDs from notifications. */ -class CPPCACHE_EXPORT EventIdMap : public SharedBase { +class CPPCACHE_EXPORT EventIdMap { private: typedef std::unordered_map<EventSourcePtr, EventSequencePtr, dereference_hash<EventSourcePtr>, @@ -134,7 +134,7 @@ class CPPCACHE_EXPORT EventIdMap : public SharedBase { * EventSequence is the combination of SequenceNum from EventId, a timestamp and * a flag indicating whether or not it is ACKed */ -class CPPCACHE_EXPORT EventSequence : public SharedBase { +class CPPCACHE_EXPORT EventSequence { int64_t m_seqNum; bool m_acked; ACE_Time_Value m_deadline; // current time plus the expiration delay (age) http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/EventSource.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/EventSource.hpp b/src/cppcache/src/EventSource.hpp index 8a0f7e0..d932c63 100644 --- a/src/cppcache/src/EventSource.hpp +++ b/src/cppcache/src/EventSource.hpp @@ -31,7 +31,7 @@ namespace client { * * EventSource is the combination of MembershipId and ThreadId from the EventId */ -class CPPCACHE_EXPORT EventSource : public SharedBase { +class CPPCACHE_EXPORT EventSource { char *m_srcId; int32_t m_srcIdLen; int64_t m_thrId; @@ -95,7 +95,7 @@ class CPPCACHE_EXPORT EventSource : public SharedBase { }; }; -typedef SharedPtr<EventSource> EventSourcePtr; +typedef std::shared_ptr<EventSource> EventSourcePtr; } // namespace client } // namespace geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/EvictionController.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/EvictionController.hpp b/src/cppcache/src/EvictionController.hpp index 6e1f7b8..6879adc 100644 --- a/src/cppcache/src/EvictionController.hpp +++ b/src/cppcache/src/EvictionController.hpp @@ -27,7 +27,7 @@ #include <ace/Task.h> #include <geode/DataOutput.hpp> #include <geode/Log.hpp> -#include <geode/SharedPtr.hpp> +#include <memory> #include "IntQueue.hpp" #include "EvictionThread.hpp" #include <string> @@ -68,10 +68,9 @@ typedef std::vector<std::string> VectorOfString; class EvictionController; class EvictionThread; class CacheImpl; -typedef SharedPtr<EvictionController> EvictionControllerPtr; +typedef std::shared_ptr<EvictionController> EvictionControllerPtr; -class CPPCACHE_EXPORT EvictionController : public ACE_Task_Base, - public SharedBase { +class CPPCACHE_EXPORT EvictionController : public ACE_Task_Base { public: EvictionController(size_t maxHeapSize, int32_t heapSizeDelta, CacheImpl* cache); http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/ExpMapEntry.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/ExpMapEntry.hpp b/src/cppcache/src/ExpMapEntry.hpp index e0f081b..823ee39 100644 --- a/src/cppcache/src/ExpMapEntry.hpp +++ b/src/cppcache/src/ExpMapEntry.hpp @@ -57,7 +57,7 @@ class CPPCACHE_EXPORT ExpMapEntry : public MapEntryImpl, ExpMapEntry& operator=(const ExpMapEntry&); }; -typedef SharedPtr<ExpMapEntry> ExpMapEntryPtr; +typedef std::shared_ptr<ExpMapEntry> ExpMapEntryPtr; class CPPCACHE_EXPORT VersionedExpMapEntry : public ExpMapEntry, public VersionStamp { @@ -77,7 +77,7 @@ class CPPCACHE_EXPORT VersionedExpMapEntry : public ExpMapEntry, VersionedExpMapEntry& operator=(const VersionedExpMapEntry&); }; -typedef SharedPtr<VersionedExpMapEntry> VersionedExpMapEntryPtr; +typedef std::shared_ptr<VersionedExpMapEntry> VersionedExpMapEntryPtr; class CPPCACHE_EXPORT ExpEntryFactory : public EntryFactory { public: http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/FarSideEntryOp.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/FarSideEntryOp.hpp b/src/cppcache/src/FarSideEntryOp.hpp index b2d163f..043e905 100644 --- a/src/cppcache/src/FarSideEntryOp.hpp +++ b/src/cppcache/src/FarSideEntryOp.hpp @@ -92,7 +92,7 @@ class RegionCommit; _GF_PTR_DEF_(FarSideEntryOp, FarSideEntryOpPtr); -class FarSideEntryOp : public apache::geode::client::SharedBase { +class FarSideEntryOp { public: FarSideEntryOp(RegionCommit* region); virtual ~FarSideEntryOp(); http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/FunctionService.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/FunctionService.cpp b/src/cppcache/src/FunctionService.cpp index 600fa03..c785836 100644 --- a/src/cppcache/src/FunctionService.cpp +++ b/src/cppcache/src/FunctionService.cpp @@ -22,7 +22,6 @@ #include <ProxyCache.hpp> #include <geode/PoolManager.hpp> #include <CacheRegionHelper.hpp> -#include <geode/TypeHelper.hpp> using namespace apache::geode::client; @@ -118,8 +117,7 @@ ExecutionPtr FunctionService::onServerWithCache(const RegionServicePtr& cache) { throw IllegalStateException( "Pool has been close to execute function on server"); } else { - CachePtr realcache = - std::static_pointer_cast<GF_UNWRAP_SP(CachePtr)>(cache); + CachePtr realcache = std::static_pointer_cast<Cache>(cache); return FunctionService::onServer(realcache->m_cacheImpl->getDefaultPool()); } } @@ -134,8 +132,8 @@ ExecutionPtr FunctionService::onServersWithCache( LOGDEBUG("FunctionService::onServers:"); if (pc != nullptr && !cache->isClosed()) { - PoolPtr userAttachedPool = pc->m_userAttributes->getPool(); - PoolPtr pool = PoolManager::find(userAttachedPool->getName()); + auto userAttachedPool = pc->m_userAttributes->getPool(); + auto pool = PoolManager::find(userAttachedPool->getName()); if (pool != nullptr && pool.get() == userAttachedPool.get() && !pool->isDestroyed()) { return std::make_shared<ExecutionImpl>(pool, true, pc); @@ -143,8 +141,7 @@ ExecutionPtr FunctionService::onServersWithCache( throw IllegalStateException( "Pool has been close to execute function on server"); } else { - CachePtr realcache = - std::static_pointer_cast<GF_UNWRAP_SP(CachePtr)>(cache); + auto realcache = std::static_pointer_cast<Cache>(cache); return FunctionService::onServers(realcache->m_cacheImpl->getDefaultPool()); } } http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/GetAllServersResponse.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/GetAllServersResponse.cpp b/src/cppcache/src/GetAllServersResponse.cpp index 17a8452..86aa8d7 100644 --- a/src/cppcache/src/GetAllServersResponse.cpp +++ b/src/cppcache/src/GetAllServersResponse.cpp @@ -22,9 +22,6 @@ void GetAllServersResponse::toData(DataOutput& output) const { int32_t length = static_cast<int32_t>(m_servers.size()); output.writeInt(length); for (int32_t i = 0; i < length; i++) { - // TODO shared_ptr - this is suspicious, in the original all entries were - // wrapped in a SharedPtr resulting in their destruction at the end of this - // function. output.writeObject(&m_servers.at(i)); } } http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/GetAllServersResponse.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/GetAllServersResponse.hpp b/src/cppcache/src/GetAllServersResponse.hpp index 739f9e2..b467eff 100644 --- a/src/cppcache/src/GetAllServersResponse.hpp +++ b/src/cppcache/src/GetAllServersResponse.hpp @@ -50,7 +50,7 @@ class GetAllServersResponse : public Serializable { std::vector<ServerLocation> getServers() { return m_servers; } virtual ~GetAllServersResponse() {} }; -typedef SharedPtr<GetAllServersResponse> GetAllServersResponsePtr; +typedef std::shared_ptr<GetAllServersResponse> GetAllServersResponsePtr; } // namespace client } // namespace geode } // namespace apache http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp b/src/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp index 12d1f6a..5a01dff 100644 --- a/src/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp +++ b/src/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp @@ -173,7 +173,7 @@ void InternalCacheTransactionManager2PCImpl::afterCompletion(int32_t status) { switch (replyCommitAfter.getMessageType()) { case TcrMessage::RESPONSE: { TXCommitMessagePtr commit = - std::static_pointer_cast<GF_UNWRAP_SP(TXCommitMessagePtr)>( + std::static_pointer_cast<TXCommitMessage>( replyCommitAfter.getValue()); if (commit.get() != nullptr) // e.g. when afterCompletion(STATUS_ROLLEDBACK) called http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/LRUExpMapEntry.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/LRUExpMapEntry.hpp b/src/cppcache/src/LRUExpMapEntry.hpp index 9b51455..98271e2 100644 --- a/src/cppcache/src/LRUExpMapEntry.hpp +++ b/src/cppcache/src/LRUExpMapEntry.hpp @@ -61,7 +61,7 @@ class CPPCACHE_EXPORT LRUExpMapEntry : public MapEntryImpl, LRUExpMapEntry& operator=(const LRUExpMapEntry&); }; -typedef SharedPtr<LRUExpMapEntry> LRUExpMapEntryPtr; +typedef std::shared_ptr<LRUExpMapEntry> LRUExpMapEntryPtr; class CPPCACHE_EXPORT VersionedLRUExpMapEntry : public LRUExpMapEntry, public VersionStamp { @@ -82,7 +82,7 @@ class CPPCACHE_EXPORT VersionedLRUExpMapEntry : public LRUExpMapEntry, VersionedLRUExpMapEntry& operator=(const VersionedLRUExpMapEntry&); }; -typedef SharedPtr<VersionedLRUExpMapEntry> VersionedLRUExpMapEntryPtr; +typedef std::shared_ptr<VersionedLRUExpMapEntry> VersionedLRUExpMapEntryPtr; class CPPCACHE_EXPORT LRUExpEntryFactory : public EntryFactory { public: http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/LRUList.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/LRUList.hpp b/src/cppcache/src/LRUList.hpp index 38cc4a9..66e5210 100644 --- a/src/cppcache/src/LRUList.hpp +++ b/src/cppcache/src/LRUList.hpp @@ -21,7 +21,7 @@ */ #include <geode/geode_globals.hpp> -#include <geode/SharedPtr.hpp> +#include <memory> #include "SpinLock.hpp" namespace apache { @@ -83,7 +83,7 @@ class CPPCACHE_EXPORT LRUEntryProperties { template <typename TEntry, typename TCreateEntry> class LRUList { protected: - typedef SharedPtr<TEntry> LRUListEntryPtr; + typedef std::shared_ptr<TEntry> LRUListEntryPtr; /** * @brief The entries in the LRU List are instances of LRUListNode. http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/LRUMapEntry.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/LRUMapEntry.hpp b/src/cppcache/src/LRUMapEntry.hpp index 961a4a5..2ab14d5 100644 --- a/src/cppcache/src/LRUMapEntry.hpp +++ b/src/cppcache/src/LRUMapEntry.hpp @@ -86,7 +86,7 @@ class CPPCACHE_EXPORT LRUMapEntry : public MapEntryImpl, LRUMapEntry& operator=(const LRUMapEntry&); }; -typedef SharedPtr<LRUMapEntry> LRUMapEntryPtr; +typedef std::shared_ptr<LRUMapEntry> LRUMapEntryPtr; class CPPCACHE_EXPORT VersionedLRUMapEntry : public LRUMapEntry, public VersionStamp { @@ -106,7 +106,7 @@ class CPPCACHE_EXPORT VersionedLRUMapEntry : public LRUMapEntry, VersionedLRUMapEntry& operator=(const VersionedLRUMapEntry&); }; -typedef SharedPtr<VersionedLRUMapEntry> VersionedLRUMapEntryPtr; +typedef std::shared_ptr<VersionedLRUMapEntry> VersionedLRUMapEntryPtr; class CPPCACHE_EXPORT LRUEntryFactory : public EntryFactory { public: http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/LocalRegion.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/LocalRegion.hpp b/src/cppcache/src/LocalRegion.hpp index 7be2233..dca7386 100644 --- a/src/cppcache/src/LocalRegion.hpp +++ b/src/cppcache/src/LocalRegion.hpp @@ -119,7 +119,7 @@ typedef std::unordered_map<CacheableKeyPtr, std::pair<CacheablePtr, int> > * separator is used to concatenate all the region names together from the root, * starting with the root's subregions. */ -typedef SharedPtr<LocalRegion> LocalRegionPtr; +typedef std::shared_ptr<LocalRegion> LocalRegionPtr; class CPPCACHE_EXPORT LocalRegion : public RegionInternal { /** http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/LocatorListResponse.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/LocatorListResponse.hpp b/src/cppcache/src/LocatorListResponse.hpp index 093f8c7..8b7b6fa 100644 --- a/src/cppcache/src/LocatorListResponse.hpp +++ b/src/cppcache/src/LocatorListResponse.hpp @@ -37,7 +37,7 @@ class LocatorListResponse : public ServerLocationResponse { LocatorListResponse() : /* adonre * CID 28938: Uninitialized scalar field (UNINIT_CTOR) * - */ + */ m_isBalanced(false) {} // Default constru needed for de-serialization virtual LocatorListResponse* fromData(DataInput& input); virtual int8_t typeId() const; @@ -47,7 +47,7 @@ class LocatorListResponse : public ServerLocationResponse { virtual ~LocatorListResponse() {} // Virtual destructor static Serializable* create(); }; -typedef SharedPtr<LocatorListResponse> LocatorListResponsePtr; +typedef std::shared_ptr<LocatorListResponse> LocatorListResponsePtr; } // namespace client } // namespace geode } // namespace apache http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/MapEntry.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/MapEntry.hpp b/src/cppcache/src/MapEntry.hpp index e177298..23d3b51 100644 --- a/src/cppcache/src/MapEntry.hpp +++ b/src/cppcache/src/MapEntry.hpp @@ -23,7 +23,7 @@ #include <geode/geode_globals.hpp> #include <geode/Cacheable.hpp> #include <geode/CacheableKey.hpp> -#include <geode/SharedPtr.hpp> +#include <memory> #include <geode/ExceptionTypes.hpp> #include "HostAsm.hpp" #include "CacheImpl.hpp" @@ -38,9 +38,9 @@ namespace apache { namespace geode { namespace client { class CPPCACHE_EXPORT MapEntry; -typedef SharedPtr<MapEntry> MapEntryPtr; +typedef std::shared_ptr<MapEntry> MapEntryPtr; class CPPCACHE_EXPORT MapEntryImpl; -typedef SharedPtr<MapEntryImpl> MapEntryImplPtr; +typedef std::shared_ptr<MapEntryImpl> MapEntryImplPtr; class CPPCACHE_EXPORT LRUEntryProperties; @@ -103,7 +103,7 @@ class CPPCACHE_EXPORT ExpEntryProperties { /** * @brief Interface class for region mapped entry value. */ -class CPPCACHE_EXPORT MapEntry : public SharedBase { +class CPPCACHE_EXPORT MapEntry { public: static MapEntryPtr MapEntry_NullPointer; @@ -178,7 +178,7 @@ class CPPCACHE_EXPORT MapEntry : public SharedBase { protected: inline MapEntry() {} - inline explicit MapEntry(bool noInit) : SharedBase(noInit) {} + inline explicit MapEntry(bool noInit) {} }; /** @@ -264,7 +264,7 @@ class CPPCACHE_EXPORT VersionedMapEntryImpl : public MapEntryImpl, VersionedMapEntryImpl& operator=(const VersionedMapEntryImpl&); }; -typedef SharedPtr<VersionedMapEntryImpl> VersionedMapEntryImplPtr; +typedef std::shared_ptr<VersionedMapEntryImpl> VersionedMapEntryImplPtr; class CPPCACHE_EXPORT EntryFactory { public: http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/MapWithLock.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/MapWithLock.hpp b/src/cppcache/src/MapWithLock.hpp index ad31f44..ee53037 100644 --- a/src/cppcache/src/MapWithLock.hpp +++ b/src/cppcache/src/MapWithLock.hpp @@ -35,10 +35,12 @@ namespace apache { namespace geode { namespace client { -typedef std::unordered_map<CacheableKeyPtr, int, CacheableKey::hash, CacheableKey::equal_to> MapOfUpdateCounters; +typedef std::unordered_map<CacheableKeyPtr, int, CacheableKey::hash, + CacheableKey::equal_to> + MapOfUpdateCounters; class Region; -typedef SharedPtr<Region> RegionPtr; +typedef std::shared_ptr<Region> RegionPtr; /** Map type used to hold root regions in the Cache, and subRegions. */ typedef ACE_Hash_Map_Manager_Ex<std::string, RegionPtr, ACE_Hash<std::string>, http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/MemberListForVersionStamp.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/MemberListForVersionStamp.hpp b/src/cppcache/src/MemberListForVersionStamp.hpp index de759fd..d3b07c2 100644 --- a/src/cppcache/src/MemberListForVersionStamp.hpp +++ b/src/cppcache/src/MemberListForVersionStamp.hpp @@ -21,7 +21,7 @@ */ #include <geode/geode_globals.hpp> -#include <geode/SharedPtr.hpp> +#include <memory> #include "DSMemberForVersionStamp.hpp" #include "ace/RW_Thread_Mutex.h" #include "ReadWriteLock.hpp" @@ -41,7 +41,7 @@ struct DistributedMemberWithIntIdentifier { uint16_t m_identifier; }; -class MemberListForVersionStamp : public SharedBase { +class MemberListForVersionStamp { public: MemberListForVersionStamp(); virtual ~MemberListForVersionStamp(); @@ -57,7 +57,7 @@ class MemberListForVersionStamp : public SharedBase { uint32_t m_memberCounter; }; -typedef SharedPtr<MemberListForVersionStamp> MemberListForVersionStampPtr; +typedef std::shared_ptr<MemberListForVersionStamp> MemberListForVersionStampPtr; } // namespace client } // namespace geode } // namespace apache http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/PdxFieldType.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/PdxFieldType.hpp b/src/cppcache/src/PdxFieldType.hpp index 40c50d2..87ec5ed 100644 --- a/src/cppcache/src/PdxFieldType.hpp +++ b/src/cppcache/src/PdxFieldType.hpp @@ -31,7 +31,7 @@ namespace apache { namespace geode { namespace client { class PdxFieldType; -typedef SharedPtr<PdxFieldType> PdxFieldTypePtr; +typedef std::shared_ptr<PdxFieldType> PdxFieldTypePtr; class CPPCACHE_EXPORT PdxFieldType : public Serializable { private: std::string m_fieldName; http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/PdxHelper.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/PdxHelper.cpp b/src/cppcache/src/PdxHelper.cpp index 52fa6d9..80ad913 100644 --- a/src/cppcache/src/PdxHelper.cpp +++ b/src/cppcache/src/PdxHelper.cpp @@ -296,7 +296,7 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput, // read typeId dataInput.readInt(&typeId); - CacheImpl* cacheImpl = PdxHelper::getCacheImpl(); + auto cacheImpl = PdxHelper::getCacheImpl(); if (cacheImpl != nullptr) { cacheImpl->m_cacheStats->incPdxDeSerialization(len + 9); // pdxLen + 1 + 2*4 @@ -313,11 +313,10 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput, // read typeId dataInput.readInt(&typeId); - PdxTypePtr pType = PdxTypeRegistry::getPdxType(typeId); + auto pType = PdxTypeRegistry::getPdxType(typeId); if (pType == nullptr) { - // TODO shared_ptr why redef? - PdxTypePtr pType = std::static_pointer_cast<PdxType>( + auto pType = std::static_pointer_cast<PdxType>( SerializationRegistry::GetPDXTypeById(dataInput.getPoolName(), typeId)); PdxTypeRegistry::addLocalPdxType(pType->getPdxClassName(), pType); @@ -330,7 +329,7 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput, dataInput.advanceCursor(len); - CacheImpl* cacheImpl = PdxHelper::getCacheImpl(); + auto cacheImpl = PdxHelper::getCacheImpl(); if (cacheImpl != nullptr) { cacheImpl->m_cacheStats->incPdxInstanceCreations(); } http://git-wip-us.apache.org/repos/asf/geode-native/blob/b1a9af53/src/cppcache/src/PdxInstanceImpl.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/PdxInstanceImpl.cpp b/src/cppcache/src/PdxInstanceImpl.cpp index eaabfc7..401db41 100644 --- a/src/cppcache/src/PdxInstanceImpl.cpp +++ b/src/cppcache/src/PdxInstanceImpl.cpp @@ -86,12 +86,6 @@ PdxInstanceImpl::PdxInstanceImpl( m_typeId = 0; m_pdxType->InitializeType(); // to generate static position map - - // apache::geode::client::DataOutput* output = - // apache::geode::client::DataOutput::getDataOutput(); - // TODO shared_ptr - what is the purpose of this? - // DataOutput output; - // PdxHelper::serializePdx(output, *this); } PdxInstanceImpl::PdxInstanceImpl() {
