http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticDescriptor.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/StatisticDescriptor.cpp b/src/clicache/src/StatisticDescriptor.cpp index 0731102..6e0075c 100644 --- a/src/clicache/src/StatisticDescriptor.cpp +++ b/src/clicache/src/StatisticDescriptor.cpp @@ -16,8 +16,6 @@ */ - -//#include "geode_includes.hpp" #include "StatisticDescriptor.hpp" #include "impl/ManagedString.hpp" @@ -31,34 +29,34 @@ namespace Apache System::Int32 StatisticDescriptor::ID::get( ) { - return NativePtr->getId(); + return m_nativeptr->getId(); } String^ StatisticDescriptor::Name::get( ) { - return ManagedString::Get( NativePtr->getName() ); + return ManagedString::Get( m_nativeptr->getName() ); } String^ StatisticDescriptor::Description::get( ) { - return ManagedString::Get( NativePtr->getDescription() ); + return ManagedString::Get( m_nativeptr->getDescription() ); } int8_t StatisticDescriptor::IsCounter::get( ) { - return NativePtr->isCounter(); + return m_nativeptr->isCounter(); } int8_t StatisticDescriptor::IsLargerBetter::get( ) { - return NativePtr->isLargerBetter(); + return m_nativeptr->isLargerBetter(); } - String^ StatisticDescriptor::Unit::get( ) + String^ StatisticDescriptor::Unit::get() { - return ManagedString::Get( NativePtr->getUnit() ); + return ManagedString::Get(m_nativeptr->getUnit()); + } } // namespace Client } // namespace Geode } // namespace Apache - } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticDescriptor.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/StatisticDescriptor.hpp b/src/clicache/src/StatisticDescriptor.hpp index fdd06cf..6715045 100644 --- a/src/clicache/src/StatisticDescriptor.hpp +++ b/src/clicache/src/StatisticDescriptor.hpp @@ -20,8 +20,11 @@ #pragma once #include "geode_defs.hpp" -#include "impl/NativeWrapper.hpp" +#include "begin_native.hpp" #include <geode/statistics/StatisticDescriptor.hpp> +#include "end_native.hpp" + +using namespace System; namespace Apache { @@ -43,7 +46,6 @@ namespace Apache /// StatisticDescriptors are naturally ordered by their name. /// </para> public ref class StatisticDescriptor sealed - : public Internal::UMWrap<apache::geode::statistics::StatisticDescriptor> { public: /// <summary> @@ -110,8 +112,13 @@ namespace Apache inline static StatisticDescriptor^ Create( apache::geode::statistics::StatisticDescriptor* nativeptr) { - return (nativeptr != nullptr ? - gcnew StatisticDescriptor(nativeptr) : nullptr); + return __nullptr == nativeptr ? nullptr : + gcnew StatisticDescriptor( nativeptr ); + } + + apache::geode::statistics::StatisticDescriptor* GetNative() + { + return m_nativeptr; } private: @@ -120,7 +127,11 @@ namespace Apache /// </summary> /// <param name="nativeptr">The native object pointer</param> inline StatisticDescriptor(apache::geode::statistics::StatisticDescriptor* nativeptr) - : UMWrap(nativeptr, false) { } + : m_nativeptr( nativeptr ) + { + } + + apache::geode::statistics::StatisticDescriptor* m_nativeptr; }; } // namespace Client } // namespace Geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Statistics.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/Statistics.cpp b/src/clicache/src/Statistics.cpp index ce00f17..e042873 100644 --- a/src/clicache/src/Statistics.cpp +++ b/src/clicache/src/Statistics.cpp @@ -37,7 +37,7 @@ namespace Apache void Statistics::Close() { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - NativePtr->close(); + m_nativeptr->close(); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -45,7 +45,7 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->nameToId(mg_name.CharPtr); + return m_nativeptr->nameToId(mg_name.CharPtr); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -53,46 +53,46 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return StatisticDescriptor::Create(NativePtr->nameToDescriptor(mg_name.CharPtr)); + return StatisticDescriptor::Create(m_nativeptr->nameToDescriptor(mg_name.CharPtr)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } System::Int64 Statistics::UniqueId::get( ) { - return NativePtr->getUniqueId(); + return m_nativeptr->getUniqueId(); } StatisticsType^ Statistics::Type::get( ) { - return StatisticsType::Create(NativePtr->getType()); + return StatisticsType::Create(m_nativeptr->getType()); } String^ Statistics::TextId::get() { - return ManagedString::Get(NativePtr->getTextId()); + return ManagedString::Get(m_nativeptr->getTextId()); } System::Int64 Statistics::NumericId::get() { - return NativePtr->getNumericId(); + return m_nativeptr->getNumericId(); } bool Statistics::IsAtomic::get() { - return NativePtr->isAtomic(); + return m_nativeptr->isAtomic(); } bool Statistics::IsShared::get() { - return NativePtr->isShared(); + return m_nativeptr->isShared(); } bool Statistics::IsClosed::get() { - return NativePtr->isClosed(); + return m_nativeptr->isClosed(); } void Statistics::SetInt(System::Int32 id, System::Int32 value) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - NativePtr->setInt(id, value); + m_nativeptr->setInt(id, value); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -100,28 +100,28 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - NativePtr->setInt((char*)mg_name.CharPtr, value); + m_nativeptr->setInt((char*)mg_name.CharPtr, value); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } void Statistics::SetInt(StatisticDescriptor^ descriptor, System::Int32 value) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - NativePtr->setInt(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor),value); + m_nativeptr->setInt(descriptor->GetNative(), value); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } void Statistics::SetLong(System::Int32 id, System::Int64 value) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - NativePtr->setLong(id, value); + m_nativeptr->setLong(id, value); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } void Statistics::SetLong(StatisticDescriptor^ descriptor, System::Int64 value) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - NativePtr->setLong(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor),value); + m_nativeptr->setLong(descriptor->GetNative(), value); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -129,14 +129,14 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - NativePtr->setLong((char*)mg_name.CharPtr, value); + m_nativeptr->setLong((char*)mg_name.CharPtr, value); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } void Statistics::SetDouble(System::Int32 id, double value) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - NativePtr->setDouble(id, value); + m_nativeptr->setDouble(id, value); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -144,28 +144,28 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - NativePtr->setDouble((char*)mg_name.CharPtr, value); + m_nativeptr->setDouble((char*)mg_name.CharPtr, value); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } void Statistics::SetDouble(StatisticDescriptor^ descriptor, double value) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - NativePtr->setDouble(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor), value); + m_nativeptr->setDouble(descriptor->GetNative(), value); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } System::Int32 Statistics::GetInt(System::Int32 id) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->getInt(id); + return m_nativeptr->getInt(id); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } System::Int32 Statistics::GetInt(StatisticDescriptor^ descriptor) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->getInt(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor)); + return m_nativeptr->getInt(descriptor->GetNative()); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -173,20 +173,20 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->getInt((char*)mg_name.CharPtr); + return m_nativeptr->getInt((char*)mg_name.CharPtr); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } System::Int64 Statistics::GetLong(System::Int32 id) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->getLong(id); + return m_nativeptr->getLong(id); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } System::Int64 Statistics::GetLong(StatisticDescriptor^ descriptor) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->getLong(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor)); + return m_nativeptr->getLong(descriptor->GetNative()); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -194,21 +194,21 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->getLong((char*)mg_name.CharPtr); + return m_nativeptr->getLong((char*)mg_name.CharPtr); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } double Statistics::GetDouble(System::Int32 id) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->getDouble(id); + return m_nativeptr->getDouble(id); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } double Statistics::GetDouble(StatisticDescriptor^ descriptor) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->getDouble(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor)); + return m_nativeptr->getDouble(descriptor->GetNative()); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -216,28 +216,28 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->getDouble((char*)mg_name.CharPtr); + return m_nativeptr->getDouble((char*)mg_name.CharPtr); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } System::Int64 Statistics::GetRawBits(StatisticDescriptor^ descriptor) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->getRawBits(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor)); + return m_nativeptr->getRawBits(descriptor->GetNative()); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } System::Int32 Statistics::IncInt(System::Int32 id, System::Int32 delta) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->incInt(id,delta); + return m_nativeptr->incInt(id,delta); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } System::Int32 Statistics::IncInt(StatisticDescriptor^ descriptor, System::Int32 delta) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->incInt(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor),delta); + return m_nativeptr->incInt(descriptor->GetNative(),delta); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -245,21 +245,21 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->incInt((char*)mg_name.CharPtr,delta); + return m_nativeptr->incInt((char*)mg_name.CharPtr,delta); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } System::Int64 Statistics::IncLong(System::Int32 id, System::Int64 delta) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->incLong(id,delta); + return m_nativeptr->incLong(id,delta); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } System::Int64 Statistics::IncLong(StatisticDescriptor^ descriptor, System::Int64 delta) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->incLong(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor),delta); + return m_nativeptr->incLong(descriptor->GetNative(),delta); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -267,21 +267,21 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->incLong((char*)mg_name.CharPtr,delta); + return m_nativeptr->incLong((char*)mg_name.CharPtr,delta); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } double Statistics::IncDouble(System::Int32 id, double delta) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->incDouble(id,delta); + return m_nativeptr->incDouble(id,delta); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } double Statistics::IncDouble(StatisticDescriptor^ descriptor, double delta) { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->incDouble(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor),delta); + return m_nativeptr->incDouble(descriptor->GetNative(),delta); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -289,7 +289,7 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->incDouble((char*)mg_name.CharPtr,delta); + return m_nativeptr->incDouble((char*)mg_name.CharPtr,delta); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } // namespace Client } // namespace Geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Statistics.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/Statistics.hpp b/src/clicache/src/Statistics.hpp index 74d44b3..0a39bac 100644 --- a/src/clicache/src/Statistics.hpp +++ b/src/clicache/src/Statistics.hpp @@ -20,10 +20,13 @@ #pragma once #include "geode_defs.hpp" -#include "impl/NativeWrapper.hpp" +#include "begin_native.hpp" #include <geode/statistics/Statistics.hpp> #include <geode/statistics/StatisticDescriptor.hpp> #include <geode/statistics/StatisticsType.hpp> +#include "end_native.hpp" + +using namespace System; namespace Apache { @@ -39,13 +42,7 @@ namespace Apache /// An instantiation of an existing <c>StatisticsType</c> object with methods for /// setting, incrementing and getting individual <c>StatisticDescriptor</c> values. /// </summary> - /// <para> - /// The class is purposefully inherited from UMWrapN and not UMWrap as the destructor - /// of the class is protected, and so it is now not called from inside the InternalCleanup - /// method. - /// </para> public ref class Statistics sealed - : public Internal::UMWrapN<apache::geode::statistics::Statistics> { public: @@ -520,8 +517,8 @@ namespace Apache inline static Statistics^ Create( apache::geode::statistics::Statistics* nativeptr ) { - return ( nativeptr != nullptr ? - gcnew Statistics( nativeptr ) : nullptr ); + return __nullptr == nativeptr ? nullptr : + gcnew Statistics( nativeptr ); } private: @@ -530,7 +527,11 @@ namespace Apache /// </summary> /// <param name="nativeptr">The native object pointer</param> inline Statistics( apache::geode::statistics::Statistics* nativeptr ) - : UMWrapN( nativeptr, false ) { } + : m_nativeptr( nativeptr ) + { + } + private: + apache::geode::statistics::Statistics* m_nativeptr; }; } // namespace Client http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticsFactory.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/StatisticsFactory.cpp b/src/clicache/src/StatisticsFactory.cpp index d07e943..dd100e1 100644 --- a/src/clicache/src/StatisticsFactory.cpp +++ b/src/clicache/src/StatisticsFactory.cpp @@ -56,7 +56,7 @@ namespace Apache ManagedString mg_units( units ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return StatisticDescriptor::Create(NativePtr->createIntCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); + return StatisticDescriptor::Create(m_nativeptr->createIntCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -73,7 +73,7 @@ namespace Apache ManagedString mg_units( units ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return StatisticDescriptor::Create(NativePtr->createLongCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); + return StatisticDescriptor::Create(m_nativeptr->createLongCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -90,7 +90,7 @@ namespace Apache ManagedString mg_units( units ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return StatisticDescriptor::Create(NativePtr->createDoubleCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); + return StatisticDescriptor::Create(m_nativeptr->createDoubleCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -108,7 +108,7 @@ namespace Apache ManagedString mg_units( units ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return StatisticDescriptor::Create(NativePtr->createIntGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); + return StatisticDescriptor::Create(m_nativeptr->createIntGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -125,7 +125,7 @@ namespace Apache ManagedString mg_units( units ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return StatisticDescriptor::Create(NativePtr->createLongGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); + return StatisticDescriptor::Create(m_nativeptr->createLongGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -142,7 +142,7 @@ namespace Apache ManagedString mg_units( units ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return StatisticDescriptor::Create(NativePtr->createDoubleGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); + return StatisticDescriptor::Create(m_nativeptr->createDoubleGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -157,9 +157,9 @@ namespace Apache apache::geode::statistics::StatisticDescriptor ** nativedescriptors = new apache::geode::statistics::StatisticDescriptor*[statsLength]; for (System::Int32 index = 0; index < statsLength; index++) { - nativedescriptors[index] = GetNativePtr<apache::geode::statistics::StatisticDescriptor>(stats[index]); + nativedescriptors[index] = stats[index]->GetNative(); } - return StatisticsType::Create(NativePtr->createType(mg_name.CharPtr, mg_description.CharPtr, nativedescriptors, statsLength)); + return StatisticsType::Create(m_nativeptr->createType(mg_name.CharPtr, mg_description.CharPtr, nativedescriptors, statsLength)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -169,7 +169,7 @@ namespace Apache ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return StatisticsType::Create(NativePtr->findType(mg_name.CharPtr)); + return StatisticsType::Create(m_nativeptr->findType(mg_name.CharPtr)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -178,7 +178,7 @@ namespace Apache { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return Statistics::Create(NativePtr->createStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type))); + return Statistics::Create(m_nativeptr->createStatistics(type->GetNative())); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -188,7 +188,7 @@ namespace Apache ManagedString mg_text( textId ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return Statistics::Create(NativePtr->createStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type),(char*)mg_text.CharPtr)); + return Statistics::Create(m_nativeptr->createStatistics(type->GetNative(),(char*)mg_text.CharPtr)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -198,7 +198,7 @@ namespace Apache ManagedString mg_text( textId ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return Statistics::Create(NativePtr->createStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type),(char*)mg_text.CharPtr, numericId)); + return Statistics::Create(m_nativeptr->createStatistics(type->GetNative(),(char*)mg_text.CharPtr, numericId)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -207,7 +207,7 @@ namespace Apache { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return Statistics::Create(NativePtr->createAtomicStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type))); + return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative())); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -217,7 +217,7 @@ namespace Apache ManagedString mg_text( textId ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return Statistics::Create(NativePtr->createAtomicStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type),(char*)mg_text.CharPtr)); + return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative(),(char*)mg_text.CharPtr)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -227,7 +227,7 @@ namespace Apache ManagedString mg_text( textId ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return Statistics::Create(NativePtr->createAtomicStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type),(char*)mg_text.CharPtr, numericId)); + return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative(),(char*)mg_text.CharPtr, numericId)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -235,23 +235,21 @@ namespace Apache { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return Statistics::Create(NativePtr->findFirstStatisticsByType(GetNativePtr<apache::geode::statistics::StatisticsType>(type))); + return Statistics::Create(m_nativeptr->findFirstStatisticsByType(type->GetNative())); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } String^ StatisticsFactory::Name::get( ) { - return ManagedString::Get( NativePtr->getName() ); + return ManagedString::Get( m_nativeptr->getName() ); } - System::Int64 StatisticsFactory::ID::get( ) + System::Int64 StatisticsFactory::ID::get() { - return NativePtr->getId(); + return m_nativeptr->getId(); + } } // namespace Client } // namespace Geode } // namespace Apache - - } //namespace - http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticsFactory.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/StatisticsFactory.hpp b/src/clicache/src/StatisticsFactory.hpp index 341b9a5..7a5d330 100644 --- a/src/clicache/src/StatisticsFactory.hpp +++ b/src/clicache/src/StatisticsFactory.hpp @@ -20,11 +20,14 @@ #pragma once #include "geode_defs.hpp" -#include "impl/NativeWrapper.hpp" +#include "begin_native.hpp" #include <geode/statistics/StatisticsFactory.hpp> #include <geode/statistics/StatisticsType.hpp> #include <geode/statistics/StatisticDescriptor.hpp> #include <geode/statistics/Statistics.hpp> +#include "end_native.hpp" + +using namespace System; namespace Apache { @@ -54,7 +57,6 @@ namespace Apache /// is, exceeds its maximum value). /// </para> public ref class StatisticsFactory sealed - : public Internal::UMWrap<apache::geode::statistics::StatisticsFactory> { protected: StatisticsFactory(){} @@ -248,8 +250,8 @@ namespace Apache inline static StatisticsFactory^ Create( apache::geode::statistics::StatisticsFactory* nativeptr) { - return (nativeptr != nullptr ? - gcnew StatisticsFactory(nativeptr) : nullptr); + return __nullptr == nativeptr ? nullptr : + gcnew StatisticsFactory( nativeptr ); } private: @@ -258,7 +260,11 @@ namespace Apache /// </summary> /// <param name="nativeptr">The native object pointer</param> inline StatisticsFactory(apache::geode::statistics::StatisticsFactory* nativeptr) - : UMWrap(nativeptr, false) { } + : m_nativeptr( nativeptr ) + { + } + + apache::geode::statistics::StatisticsFactory* m_nativeptr; }; } // namespace Client } // namespace Geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticsType.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/StatisticsType.cpp b/src/clicache/src/StatisticsType.cpp index 24722c7..117f7ee 100644 --- a/src/clicache/src/StatisticsType.cpp +++ b/src/clicache/src/StatisticsType.cpp @@ -35,21 +35,21 @@ namespace Apache String^ StatisticsType::Name::get() { - return ManagedString::Get( NativePtr->getName() ); + return ManagedString::Get( m_nativeptr->getName() ); } String^ StatisticsType::Description::get() { - return ManagedString::Get( NativePtr->getDescription() ); + return ManagedString::Get( m_nativeptr->getDescription() ); } array<StatisticDescriptor^>^ StatisticsType::Statistics::get() { _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - apache::geode::statistics::StatisticDescriptor ** nativedescriptors = NativePtr->getStatistics(); - array<StatisticDescriptor^>^ descriptors = gcnew array<StatisticDescriptor^>(NativePtr->getDescriptorsCount()); - for (int item = 0; item < NativePtr->getDescriptorsCount(); item++) + apache::geode::statistics::StatisticDescriptor ** nativedescriptors = m_nativeptr->getStatistics(); + array<StatisticDescriptor^>^ descriptors = gcnew array<StatisticDescriptor^>(m_nativeptr->getDescriptorsCount()); + for (int item = 0; item < m_nativeptr->getDescriptorsCount(); item++) { descriptors[item] = StatisticDescriptor::Create(nativedescriptors[item]); } @@ -62,7 +62,7 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->nameToId(mg_name.CharPtr); + return m_nativeptr->nameToId(mg_name.CharPtr); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } @@ -70,13 +70,13 @@ namespace Apache { ManagedString mg_name( name ); _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return StatisticDescriptor::Create(NativePtr->nameToDescriptor(mg_name.CharPtr)); + return StatisticDescriptor::Create(m_nativeptr->nameToDescriptor(mg_name.CharPtr)); _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } System::Int32 StatisticsType::DescriptorsCount::get() { - return NativePtr->getDescriptorsCount(); + return m_nativeptr->getDescriptorsCount(); } // namespace Client } // namespace Geode } // namespace Apache http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticsType.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/StatisticsType.hpp b/src/clicache/src/StatisticsType.hpp index dce3f65..6644b34 100644 --- a/src/clicache/src/StatisticsType.hpp +++ b/src/clicache/src/StatisticsType.hpp @@ -20,9 +20,12 @@ #pragma once #include "geode_defs.hpp" -#include "impl/NativeWrapper.hpp" +#include "begin_native.hpp" #include <geode/statistics/StatisticsType.hpp> #include <geode/statistics/StatisticDescriptor.hpp> +#include "end_native.hpp" + +using namespace System; namespace Apache { @@ -30,7 +33,6 @@ namespace Apache { namespace Client { - ref class StatisticDescriptor; /// <summary> @@ -41,13 +43,7 @@ namespace Apache /// To get an instance of this interface use an instance of /// <see cref="StatisticsFactory" /> class. /// </para> - /// <para> - /// The class is purposefully inherited from UMWrapN and not UMWrap as the destructor - /// of the class is protected, and so it is now not called from inside the InternalCleanup - /// method. - /// </para> public ref class StatisticsType sealed - : public Internal::UMWrap<apache::geode::statistics::StatisticsType> { public: /// <summary> @@ -119,8 +115,13 @@ namespace Apache inline static StatisticsType^ Create( apache::geode::statistics::StatisticsType* nativeptr ) { - return ( nativeptr != nullptr ? - gcnew StatisticsType( nativeptr ) : nullptr ); + return __nullptr == nativeptr ? nullptr : + gcnew StatisticsType( nativeptr ); + } + + apache::geode::statistics::StatisticsType* GetNative() + { + return m_nativeptr; } private: @@ -129,7 +130,11 @@ namespace Apache /// </summary> /// <param name="nativeptr">The native object pointer</param> inline StatisticsType( apache::geode::statistics::StatisticsType* nativeptr ) - : UMWrap( nativeptr, false ) { } + : m_nativeptr( nativeptr ) + { + } + + apache::geode::statistics::StatisticsType* m_nativeptr; }; } // namespace Client http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Struct.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/Struct.cpp b/src/clicache/src/Struct.cpp index 6613ec0..213703f 100644 --- a/src/clicache/src/Struct.cpp +++ b/src/clicache/src/Struct.cpp @@ -15,8 +15,11 @@ * limitations under the License. */ -//#include "geode_includes.hpp" + //#include "geode_includes.hpp" +#include "begin_native.hpp" #include <geode/Struct.hpp> +#include "end_native.hpp" + #include "Struct.hpp" #include "StructSet.hpp" #include "ExceptionTypes.hpp" @@ -30,50 +33,85 @@ namespace Apache { namespace Client { + namespace native = apache::geode::client; - Object^ Struct::default::get( size_t index ) + Object^ Struct::default::get(size_t index) { - /* return SafeUMSerializableConvertGeneric(static_cast<apache::geode::client::Struct*>( - NativePtr())->operator[](static_cast<System::Int32>(index)).get());*/ - return (Serializable::GetManagedValueGeneric<Object^>(static_cast<apache::geode::client::Struct*>( - NativePtr())->operator[](static_cast<System::Int32>(index)))); + try + { + return (Serializable::GetManagedValueGeneric<Object^>( + static_cast<native::Struct*>(m_nativeptr->get())->operator[](static_cast<System::Int32>(index)))); + } + finally + { + GC::KeepAlive(m_nativeptr); + } } - Object^ Struct::default::get( String^ fieldName ) + Object^ Struct::default::get(String^ fieldName) { - ManagedString mg_fieldName( fieldName ); - /*return SafeUMSerializableConvertGeneric(static_cast<apache::geode::client::Struct*>( - NativePtr())->operator[](mg_fieldName.CharPtr).get());*/ - - return (Serializable::GetManagedValueGeneric</*TResult*/Object^>(static_cast<apache::geode::client::Struct*>( - NativePtr())->operator[](mg_fieldName.CharPtr))); + ManagedString mg_fieldName(fieldName); + try + { + return (Serializable::GetManagedValueGeneric<Object^>( + static_cast<native::Struct*>(m_nativeptr->get())->operator[](mg_fieldName.CharPtr))); + } + finally + { + GC::KeepAlive(m_nativeptr); + } } - StructSet<Object^>^ Struct::Set::get( ) + StructSet<Object^>^ Struct::Set::get() { - return StructSet</*TResult*/Object^>::Create(static_cast<apache::geode::client::Struct*>( - NativePtr())->getStructSet().get()); + try + { + return StructSet</*TResult*/Object^>::Create( + static_cast<native::Struct*>(m_nativeptr->get())->getStructSet()); + } + finally + { + GC::KeepAlive(m_nativeptr); + } } - - bool Struct/*<TResult>*/::HasNext( ) + + bool Struct/*<TResult>*/::HasNext() { - return static_cast<apache::geode::client::Struct*>(NativePtr())->hasNext(); + try + { + return static_cast<native::Struct*>(m_nativeptr->get())->hasNext(); + } + finally + { + GC::KeepAlive(m_nativeptr); + } } - size_t Struct/*<TResult>*/::Length::get( ) + size_t Struct/*<TResult>*/::Length::get() { - return static_cast<apache::geode::client::Struct*>(NativePtr())->length(); + try + { + return static_cast<native::Struct*>(m_nativeptr->get())->length(); + } + finally + { + GC::KeepAlive(m_nativeptr); + } } - Object^ Struct/*<TResult>*/::Next( ) + Object^ Struct/*<TResult>*/::Next() { - /*return SafeUMSerializableConvertGeneric(static_cast<apache::geode::client::Struct*>( - NativePtr())->next().get());*/ - return (Serializable::GetManagedValueGeneric</*TResult*/Object^>(static_cast<apache::geode::client::Struct*>( - NativePtr())->next())); + try + { + return (Serializable::GetManagedValueGeneric<Object^>( + static_cast<native::Struct*>(m_nativeptr->get())->next())); + } + finally + { + GC::KeepAlive(m_nativeptr); + } + } } // namespace Client } // namespace Geode } // namespace Apache - - } //namespace http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Struct.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/Struct.hpp b/src/clicache/src/Struct.hpp index fabb3be..9b43820 100644 --- a/src/clicache/src/Struct.hpp +++ b/src/clicache/src/Struct.hpp @@ -20,7 +20,10 @@ #include "geode_defs.hpp" #include "Serializable.hpp" +#include "begin_native.hpp" #include <geode/Struct.hpp> +#include "end_native.hpp" + using namespace System; @@ -114,18 +117,18 @@ namespace Apache /// Private constructor to wrap a native object pointer /// </summary> /// <param name="nativeptr">The native object pointer</param> - inline Apache::Geode::Client::Struct/*<TResult>*/( ::apache::geode::client::Serializable* nativeptr ) + inline Apache::Geode::Client::Struct/*<TResult>*/( apache::geode::client::SerializablePtr nativeptr ) : Apache::Geode::Client::Serializable( nativeptr ) { } inline Apache::Geode::Client::Struct/*<TResult>*/( ) - : Apache::Geode::Client::Serializable( ::apache::geode::client::Struct::createDeserializable()) { } + : Apache::Geode::Client::Serializable( std::shared_ptr<apache::geode::client::Serializable>(apache::geode::client::Struct::createDeserializable())) { } internal: /// <summary> /// Factory function to register wrapper /// </summary> - inline static Apache::Geode::Client::IGeodeSerializable^ /*Struct^*/ /*<TResult>*/ Create( ::apache::geode::client::Serializable* obj ) + inline static Apache::Geode::Client::IGeodeSerializable^ /*Struct^*/ /*<TResult>*/ Create( ::apache::geode::client::SerializablePtr obj ) { return ( obj != nullptr ? gcnew Apache::Geode::Client::Struct/*<TResult>*/( obj ) : nullptr ); http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StructSet.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/StructSet.cpp b/src/clicache/src/StructSet.cpp index 4810d6b..725ff71 100644 --- a/src/clicache/src/StructSet.cpp +++ b/src/clicache/src/StructSet.cpp @@ -33,33 +33,57 @@ namespace Apache generic<class TResult> bool StructSet<TResult>::IsModifiable::get( ) { - return NativePtr->isModifiable( ); + try + { + return m_nativeptr->get()->isModifiable( ); + } + finally + { + GC::KeepAlive(m_nativeptr); + } } generic<class TResult> System::Int32 StructSet<TResult>::Size::get( ) { - return NativePtr->size( ); + try + { + return m_nativeptr->get()->size( ); + } + finally + { + GC::KeepAlive(m_nativeptr); + } } generic<class TResult> - /*Apache::Geode::Client::IGeodeSerializable^*/ TResult StructSet<TResult>::default::get( size_t index ) + TResult StructSet<TResult>::default::get( size_t index ) { - //return SafeUMSerializableConvertGeneric((NativePtr->operator[](static_cast<System::Int32>(index))).get()); - return Serializable::GetManagedValueGeneric<TResult>((NativePtr->operator[](static_cast<System::Int32>(index)))); + try + { + return Serializable::GetManagedValueGeneric<TResult>((m_nativeptr->get()->operator[](static_cast<System::Int32>(index)))); + } + finally + { + GC::KeepAlive(m_nativeptr); + } } generic<class TResult> SelectResultsIterator<TResult>^ StructSet<TResult>::GetIterator( ) { - apache::geode::client::SelectResultsIterator* nativeptr = - new apache::geode::client::SelectResultsIterator(NativePtr->getIterator()); - return SelectResultsIterator<TResult>::Create( nativeptr ); + try + { + return SelectResultsIterator<TResult>::Create(std::make_unique<apache::geode::client::SelectResultsIterator>(m_nativeptr->get()->getIterator())); + } + finally + { + GC::KeepAlive(m_nativeptr); + } } generic<class TResult> - System::Collections::Generic::IEnumerator</*Apache::Geode::Client::IGeodeSerializable^*/TResult>^ - StructSet<TResult>::GetEnumerator( ) + System::Collections::Generic::IEnumerator<TResult>^ StructSet<TResult>::GetEnumerator( ) { return GetIterator( ); } @@ -77,17 +101,30 @@ namespace Apache _GF_MG_EXCEPTION_TRY2/* due to auto replace */ - return NativePtr->getFieldIndex( mg_fieldName.CharPtr ); + try + { + return m_nativeptr->get()->getFieldIndex( mg_fieldName.CharPtr ); + } + finally + { + GC::KeepAlive(m_nativeptr); + } _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */ } generic<class TResult> - String^ StructSet<TResult>::GetFieldName( size_t index ) + String^ StructSet<TResult>::GetFieldName(size_t index) { - return ManagedString::Get( NativePtr->getFieldName( static_cast<System::Int32> (index) ) ); + try + { + return ManagedString::Get(m_nativeptr->get()->getFieldName(static_cast<System::Int32> (index))); + } + finally + { + GC::KeepAlive(m_nativeptr); + } + } } // namespace Client } // namespace Geode } // namespace Apache - - } //namespace http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StructSet.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/StructSet.hpp b/src/clicache/src/StructSet.hpp index 3ca6de2..ae81b76 100644 --- a/src/clicache/src/StructSet.hpp +++ b/src/clicache/src/StructSet.hpp @@ -18,8 +18,11 @@ #pragma once #include "geode_defs.hpp" +#include "begin_native.hpp" #include <geode/StructSet.hpp> -#include "impl/NativeWrapper.hpp" +#include "end_native.hpp" + +#include "native_shared_ptr.hpp" #include "ICqResults.hpp" @@ -32,6 +35,7 @@ namespace Apache namespace Client { + namespace native = apache::geode::client; interface class IGeodeSerializable; generic<class TResult> @@ -42,7 +46,7 @@ namespace Apache /// </summary> generic<class TResult> public ref class StructSet sealed - : public Internal::SBWrap<apache::geode::client::StructSet>, public ICqResults<TResult> + : public ICqResults<TResult> { public: @@ -138,9 +142,10 @@ namespace Apache /// <returns> /// The managed wrapper object; null if the native pointer is null. /// </returns> - inline static StructSet<TResult>^ Create(apache::geode::client::StructSet* nativeptr) + inline static StructSet<TResult>^ Create(native::StructSetPtr nativeptr) { - return (nativeptr != nullptr ? gcnew StructSet<TResult>(nativeptr) : nullptr); + return __nullptr == nativeptr ? nullptr : + gcnew StructSet<TResult>( nativeptr ); } @@ -153,8 +158,12 @@ namespace Apache /// Private constructor to wrap a native object pointer /// </summary> /// <param name="nativeptr">The native object pointer</param> - inline StructSet(apache::geode::client::StructSet* nativeptr) - : SBWrap(nativeptr) { } + inline StructSet(native::StructSetPtr nativeptr) + { + m_nativeptr = gcnew native_shared_ptr<native::StructSet>(nativeptr); + } + + native_shared_ptr<native::StructSet>^ m_nativeptr; }; } // namespace Client } // namespace Geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/SystemProperties.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/SystemProperties.cpp b/src/clicache/src/SystemProperties.cpp index 3df6b09..8683548 100644 --- a/src/clicache/src/SystemProperties.cpp +++ b/src/clicache/src/SystemProperties.cpp @@ -15,7 +15,6 @@ * limitations under the License. */ -//#include "geode_includes.hpp" #include "SystemProperties.hpp" #include "impl/SafeConvert.hpp" @@ -27,216 +26,193 @@ namespace Apache { namespace Client { - - SystemProperties::SystemProperties( Properties<String^, String^>^ properties ) - { - _GF_MG_EXCEPTION_TRY2 - - SetPtr(new apache::geode::client::SystemProperties(apache::geode::client::PropertiesPtr( - GetNativePtr<apache::geode::client::Properties>(properties))), true); - - _GF_MG_EXCEPTION_CATCH_ALL2 - } - - SystemProperties::SystemProperties( Properties<String^, String^>^ properties, - String^ configFile ) - { - _GF_MG_EXCEPTION_TRY2 - - ManagedString mg_configFile( configFile ); - apache::geode::client::PropertiesPtr propertiesptr( - GetNativePtr<apache::geode::client::Properties>( properties ) ); - SetPtr( new apache::geode::client::SystemProperties( propertiesptr, - mg_configFile.CharPtr ), true ); - - _GF_MG_EXCEPTION_CATCH_ALL2 - } + namespace native = apache::geode::client; void SystemProperties::LogSettings( ) { - NativePtr->logSettings( ); + m_nativeptr->logSettings( ); } System::Int32 SystemProperties::StatisticsSampleInterval::get( ) { - return NativePtr->statisticsSampleInterval( ); + return m_nativeptr->statisticsSampleInterval( ); } bool SystemProperties::StatisticsEnabled::get( ) { - return NativePtr->statisticsEnabled( ); + return m_nativeptr->statisticsEnabled( ); } String^ SystemProperties::StatisticsArchiveFile::get( ) { - return ManagedString::Get( NativePtr->statisticsArchiveFile( ) ); + return ManagedString::Get( m_nativeptr->statisticsArchiveFile( ) ); } String^ SystemProperties::LogFileName::get( ) { - return ManagedString::Get( NativePtr->logFilename( ) ); + return ManagedString::Get( m_nativeptr->logFilename( ) ); } LogLevel SystemProperties::GFLogLevel::get( ) { - return static_cast<LogLevel>( NativePtr->logLevel( ) ); + return static_cast<LogLevel>( m_nativeptr->logLevel( ) ); } bool SystemProperties::HeapLRULimitEnabled::get( ) { - return NativePtr->heapLRULimitEnabled( ); + return m_nativeptr->heapLRULimitEnabled( ); } size_t SystemProperties::HeapLRULimit::get( ) { - return NativePtr->heapLRULimit( ); + return m_nativeptr->heapLRULimit( ); } System::Int32 SystemProperties::HeapLRUDelta::get( ) { - return NativePtr->heapLRUDelta( ); + return m_nativeptr->heapLRUDelta( ); } System::Int32 SystemProperties::MaxSocketBufferSize::get( ) { - return NativePtr->maxSocketBufferSize( ); + return m_nativeptr->maxSocketBufferSize( ); } System::Int32 SystemProperties::PingInterval::get( ) { - return NativePtr->pingInterval( ); + return m_nativeptr->pingInterval( ); } System::Int32 SystemProperties::RedundancyMonitorInterval::get( ) { - return NativePtr->redundancyMonitorInterval( ); + return m_nativeptr->redundancyMonitorInterval( ); } System::Int32 SystemProperties::NotifyAckInterval::get( ) { - return NativePtr->notifyAckInterval( ); + return m_nativeptr->notifyAckInterval( ); } System::Int32 SystemProperties::NotifyDupCheckLife::get( ) { - return NativePtr->notifyDupCheckLife( ); + return m_nativeptr->notifyDupCheckLife( ); } bool SystemProperties::DebugStackTraceEnabled::get( ) { - return NativePtr->debugStackTraceEnabled( ); + return m_nativeptr->debugStackTraceEnabled( ); } bool SystemProperties::CrashDumpEnabled::get( ) { - return NativePtr->crashDumpEnabled(); + return m_nativeptr->crashDumpEnabled(); } bool SystemProperties::AppDomainEnabled::get( ) { - return NativePtr->isAppDomainEnabled(); + return m_nativeptr->isAppDomainEnabled(); } String^ SystemProperties::Name::get( ) { - return ManagedString::Get( NativePtr->name( ) ); + return ManagedString::Get( m_nativeptr->name( ) ); } String^ SystemProperties::CacheXmlFile::get( ) { - return ManagedString::Get( NativePtr->cacheXMLFile( ) ); + return ManagedString::Get( m_nativeptr->cacheXMLFile( ) ); } System::Int32 SystemProperties::LogFileSizeLimit::get( ) { - return NativePtr->logFileSizeLimit( ); + return m_nativeptr->logFileSizeLimit( ); } System::Int32 SystemProperties::LogDiskSpaceLimit::get( ) { - return NativePtr->logDiskSpaceLimit( ); + return m_nativeptr->logDiskSpaceLimit( ); } System::Int32 SystemProperties::StatsFileSizeLimit::get( ) { - return NativePtr->statsFileSizeLimit( ); + return m_nativeptr->statsFileSizeLimit( ); } System::Int32 SystemProperties::StatsDiskSpaceLimit::get( ) { - return NativePtr->statsDiskSpaceLimit( ); + return m_nativeptr->statsDiskSpaceLimit( ); } System::UInt32 SystemProperties::MaxQueueSize::get( ) { - return NativePtr->maxQueueSize( ); + return m_nativeptr->maxQueueSize( ); } bool SystemProperties::SSLEnabled::get( ) { - return NativePtr->sslEnabled(); + return m_nativeptr->sslEnabled(); } String^ SystemProperties::SSLKeyStore::get() { - return ManagedString::Get(NativePtr->sslKeyStore()); + return ManagedString::Get(m_nativeptr->sslKeyStore()); } String^ SystemProperties::SSLTrustStore::get() { - return ManagedString::Get(NativePtr->sslTrustStore()); + return ManagedString::Get(m_nativeptr->sslTrustStore()); } // adongre String^ SystemProperties::SSLKeystorePassword::get() { - return ManagedString::Get(NativePtr->sslKeystorePassword()); + return ManagedString::Get(m_nativeptr->sslKeystorePassword()); } bool SystemProperties::IsSecurityOn::get( ) { - return NativePtr->isSecurityOn( ); + return m_nativeptr->isSecurityOn( ); } Properties<String^, String^>^ SystemProperties::GetSecurityProperties::get( ) { - return Properties<String^, String^>::Create<String^, String^>( NativePtr->getSecurityProperties( ).ptr( ) ); + return Properties<String^, String^>::Create(m_nativeptr->getSecurityProperties()); } String^ SystemProperties::DurableClientId::get( ) { - return ManagedString::Get( NativePtr->durableClientId( ) ); + return ManagedString::Get( m_nativeptr->durableClientId( ) ); } System::UInt32 SystemProperties::DurableTimeout::get( ) { - return NativePtr->durableTimeout( ); + return m_nativeptr->durableTimeout( ); } System::UInt32 SystemProperties::ConnectTimeout::get( ) { - return NativePtr->connectTimeout( ); + return m_nativeptr->connectTimeout( ); } String^ SystemProperties::ConflateEvents::get( ) { - return ManagedString::Get( NativePtr->conflateEvents( ) ); + return ManagedString::Get( m_nativeptr->conflateEvents( ) ); } System::UInt32 SystemProperties::SuspendedTxTimeout::get( ) { - return NativePtr->suspendedTxTimeout( ); + return m_nativeptr->suspendedTxTimeout( ); } bool SystemProperties::ReadTimeoutUnitInMillis::get( ) { - return NativePtr->readTimeoutUnitInMillis( ); + return m_nativeptr->readTimeoutUnitInMillis( ); } bool SystemProperties::OnClientDisconnectClearPdxTypeIds::get( ) { - return NativePtr->onClientDisconnectClearPdxTypeIds( ); + return m_nativeptr->onClientDisconnectClearPdxTypeIds( ); } // namespace Client } // namespace Geode } // namespace Apache http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/SystemProperties.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/SystemProperties.hpp b/src/clicache/src/SystemProperties.hpp index 7a64771..507035b 100644 --- a/src/clicache/src/SystemProperties.hpp +++ b/src/clicache/src/SystemProperties.hpp @@ -18,8 +18,10 @@ #pragma once #include "geode_defs.hpp" +#include "begin_native.hpp" #include <geode/SystemProperties.hpp> -#include "impl/NativeWrapper.hpp" +#include "end_native.hpp" + #include "Log.hpp" #include "Properties.hpp" @@ -31,6 +33,7 @@ namespace Apache { namespace Client { + namespace native = apache::geode::client; /// <summary> /// A class for internal use, that encapsulates the properties that can be @@ -38,34 +41,10 @@ namespace Apache /// or a geode.properties file. /// </summary> public ref class SystemProperties sealed - : public Internal::UMWrap<apache::geode::client::SystemProperties> { public: /// <summary> - /// Constructor. Sets the default (hard-coded) values first, and then overwrites those with - /// any values found in the given properties. - /// </summary> - /// <param name="properties">initialize with the given properties</param> - //generic <class TPropKey, class TPropValue> - SystemProperties(Properties<String^, String^>^ properties); - - /// <summary> - /// Constructor. - /// <ol> - /// <li>Sets the default (hard-coded) values.</li> - /// <li>Overwrites those with any values from <c>systemDefault/geode.properties</c></li> - /// <li>Overwrites those with any values from the given file (if it exists) - /// or the local <c>./geode.properties</c> (if the given file does not exist).</li> - /// <li>Overwrites those with any values found in the given properties.</li> - /// </ol> - /// </summary> - /// <param name="properties">these overwrite any other values already set</param> - /// <param name="configFile">see summary</param> - //generic <class TPropKey, class TPropValue> - SystemProperties(Properties<String^, String^>^ properties, String^ configFile); - - /// <summary> /// Prints all settings to the process log. /// </summary> void LogSettings(); @@ -423,7 +402,7 @@ namespace Apache /// the managed wrapper object, or null if the native pointer is null. /// </returns> inline static SystemProperties^ Create( - apache::geode::client::SystemProperties* nativeptr) + native::SystemProperties* nativeptr) { return (nativeptr != nullptr ? gcnew SystemProperties(nativeptr) : nullptr); @@ -436,8 +415,12 @@ namespace Apache /// Private constructor to wrap a native object pointer /// </summary> /// <param name="nativeptr">The native object pointer</param> - inline SystemProperties(apache::geode::client::SystemProperties* nativeptr) - : UMWrap(nativeptr, false) { } + inline SystemProperties(native::SystemProperties* nativeptr) + : m_nativeptr(nativeptr) + { + } + + native::SystemProperties* m_nativeptr; }; } // namespace Client } // namespace Geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/TransactionEvent.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/TransactionEvent.cpp b/src/clicache/src/TransactionEvent.cpp index e8367e1..d4d694c 100644 --- a/src/clicache/src/TransactionEvent.cpp +++ b/src/clicache/src/TransactionEvent.cpp @@ -43,7 +43,7 @@ namespace Apache NativePtr->getCache( ) ); return Apache::Geode::Client::Cache::Create( - nativeptr.ptr( ) ); + nativeptr.get() ); } generic<class TKey, class TValue> @@ -53,7 +53,7 @@ namespace Apache NativePtr->getTransactionId( ) ); return Apache::Geode::Client::TransactionId::Create( - nativeptr.ptr( ) ); + nativeptr.get() ); } generic<class TKey, class TValue> @@ -67,7 +67,7 @@ namespace Apache for( System::Int32 index = 0; index < vee.size( ); index++ ) { apache::geode::client::EntryEventPtr& nativeptr( vee[ index ] ); - EntryEvent<TKey, TValue> entryEvent( nativeptr.ptr( ) ); + EntryEvent<TKey, TValue> entryEvent( nativeptr.get() ); events[ index ] = (%entryEvent); } return events; http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/TransactionEvent.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/TransactionEvent.hpp b/src/clicache/src/TransactionEvent.hpp index b04bf76..80680c2 100644 --- a/src/clicache/src/TransactionEvent.hpp +++ b/src/clicache/src/TransactionEvent.hpp @@ -20,7 +20,7 @@ #include "geode_defs.hpp" #include <cppcache/TransactionEvent.hpp> -#include "impl/NativeWrapper.hpp" + //#include "TransactionId.hpp" //#include "Cache.hpp" http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/TransactionId.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/TransactionId.hpp b/src/clicache/src/TransactionId.hpp index 628e17f..29ceeb8 100644 --- a/src/clicache/src/TransactionId.hpp +++ b/src/clicache/src/TransactionId.hpp @@ -18,8 +18,11 @@ #pragma once #include "geode_defs.hpp" +#include "begin_native.hpp" #include <geode/TransactionId.hpp> -#include "impl/NativeWrapper.hpp" +#include "end_native.hpp" + + using namespace System; @@ -29,19 +32,24 @@ namespace Apache { namespace Client { + namespace native = apache::geode::client; /// <summary> /// This class encapsulates Id of a transaction. /// </summary> public ref class TransactionId sealed - : public Internal::SBWrap<apache::geode::client::TransactionId> { internal: - inline static TransactionId^ Create( apache::geode::client::TransactionId* nativeptr ) + inline static TransactionId^ Create(native::TransactionIdPtr nativeptr ) + { + return __nullptr == nativeptr ? nullptr : + gcnew TransactionId( nativeptr ); + } + + std::shared_ptr<native::TransactionId> GetNative() { - return ( nativeptr != nullptr ? - gcnew TransactionId( nativeptr ) : nullptr ); + return m_nativeptr->get_shared_ptr(); } private: @@ -50,8 +58,12 @@ namespace Apache /// Private constructor to wrap a native object pointer /// </summary> /// <param name="nativeptr">The native object pointer</param> - inline TransactionId( apache::geode::client::TransactionId* nativeptr ) - : SBWrap( nativeptr ) { } + inline TransactionId( native::TransactionIdPtr nativeptr ) + { + m_nativeptr = gcnew native_shared_ptr<native::TransactionId>(nativeptr); + } + + native_shared_ptr<native::TransactionId>^ m_nativeptr; }; } // namespace Client } // namespace Geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/UserFunctionExecutionException.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/UserFunctionExecutionException.cpp b/src/clicache/src/UserFunctionExecutionException.cpp index 27a1ffe..306919e 100644 --- a/src/clicache/src/UserFunctionExecutionException.cpp +++ b/src/clicache/src/UserFunctionExecutionException.cpp @@ -28,49 +28,69 @@ namespace Apache namespace Client { - // IGeodeSerializable methods - - void UserFunctionExecutionException::ToData( DataOutput^ output ) + // IGeodeSerializable methods + + void UserFunctionExecutionException::ToData(DataOutput^ output) + { + throw gcnew IllegalStateException("UserFunctionExecutionException::ToData is not intended for use."); + } + + IGeodeSerializable^ UserFunctionExecutionException::FromData(DataInput^ input) + { + throw gcnew IllegalStateException("UserFunctionExecutionException::FromData is not intended for use."); + return this; + } + + System::UInt32 UserFunctionExecutionException::ObjectSize::get() + { + _GF_MG_EXCEPTION_TRY2 + throw gcnew IllegalStateException("UserFunctionExecutionException::ObjectSize is not intended for use."); + try { - throw gcnew IllegalStateException("UserFunctionExecutionException::ToData is not intended for use."); + return m_nativeptr->get()->objectSize(); } - - IGeodeSerializable^ UserFunctionExecutionException::FromData( DataInput^ input ) + finally { - throw gcnew IllegalStateException("UserFunctionExecutionException::FromData is not intended for use."); - return this; - } + GC::KeepAlive(m_nativeptr); + } - System::UInt32 UserFunctionExecutionException::ObjectSize::get( ) - { - _GF_MG_EXCEPTION_TRY2 - throw gcnew IllegalStateException("UserFunctionExecutionException::ObjectSize is not intended for use."); - return NativePtr->objectSize( ); + _GF_MG_EXCEPTION_CATCH_ALL2 + } - _GF_MG_EXCEPTION_CATCH_ALL2 - } + String^ UserFunctionExecutionException::Message::get() + { + _GF_MG_EXCEPTION_TRY2 - String^ UserFunctionExecutionException::Message::get() + try { - _GF_MG_EXCEPTION_TRY2 + auto value = m_nativeptr->get()->getMessage(); + return CacheableString::GetString(value.get()); + } + finally + { + GC::KeepAlive(m_nativeptr); + } - apache::geode::client::CacheableStringPtr value = NativePtr->getMessage( ); - return CacheableString::GetString( value.ptr( ) ); + _GF_MG_EXCEPTION_CATCH_ALL2 + } - _GF_MG_EXCEPTION_CATCH_ALL2 - } + String^ UserFunctionExecutionException::Name::get() + { + _GF_MG_EXCEPTION_TRY2 - String^ UserFunctionExecutionException::Name::get() + try { - _GF_MG_EXCEPTION_TRY2 - - apache::geode::client::CacheableStringPtr value = NativePtr->getName( ); - return CacheableString::GetString( value.ptr( ) ); + auto value = m_nativeptr->get()->getName(); + return CacheableString::GetString(value.get()); + } + finally + { + GC::KeepAlive(m_nativeptr); + } - _GF_MG_EXCEPTION_CATCH_ALL2 + _GF_MG_EXCEPTION_CATCH_ALL2 + } } // namespace Client } // namespace Geode } // namespace Apache -} - http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/UserFunctionExecutionException.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/UserFunctionExecutionException.hpp b/src/clicache/src/UserFunctionExecutionException.hpp index 42f752c..dd9e74d 100644 --- a/src/clicache/src/UserFunctionExecutionException.hpp +++ b/src/clicache/src/UserFunctionExecutionException.hpp @@ -19,7 +19,12 @@ #pragma once #include "geode_defs.hpp" -#include "geode/UserFunctionExecutionException.hpp" + +#include "begin_native.hpp" +#include <geode/UserFunctionExecutionException.hpp> +#include "end_native.hpp" + +#include "native_shared_ptr.hpp" #include "IGeodeSerializable.hpp" #include "DataInput.hpp" #include "DataOutput.hpp" @@ -32,12 +37,13 @@ namespace Apache { namespace Client { + namespace native = apache::geode::client; /// <summary> /// UserFunctionExecutionException class is used to encapsulate geode sendException in case of Function execution. /// </summary> public ref class UserFunctionExecutionException sealed - : public Internal::SBWrap<apache::geode::client::UserFunctionExecutionException>, public IGeodeSerializable + : public IGeodeSerializable { public: // IGeodeSerializable members @@ -123,8 +129,12 @@ namespace Apache /// Private constructor to wrap a native object pointer. /// </summary> /// <param name="nativeptr">The native object pointer</param> - inline UserFunctionExecutionException(apache::geode::client::UserFunctionExecutionException* nativeptr) - : SBWrap(nativeptr) { } + inline UserFunctionExecutionException(apache::geode::client::UserFunctionExecutionExceptionPtr nativeptr) + { + m_nativeptr = gcnew native_shared_ptr<native::UserFunctionExecutionException>(nativeptr); + } + + native_shared_ptr<native::UserFunctionExecutionException>^ m_nativeptr; }; } // namespace Client } // namespace Geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Utils.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/Utils.cpp b/src/clicache/src/Utils.cpp index 3fc28df..e293b52 100644 --- a/src/clicache/src/Utils.cpp +++ b/src/clicache/src/Utils.cpp @@ -16,9 +16,10 @@ */ -//#include "geode_includes.hpp" #include "gfcli/Utils.hpp" +#include "begin_native.hpp" #include <Utils.hpp> +#include "end_native.hpp" namespace Apache { http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/begin_native.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/begin_native.hpp b/src/clicache/src/begin_native.hpp new file mode 100644 index 0000000..14d9d47 --- /dev/null +++ b/src/clicache/src/begin_native.hpp @@ -0,0 +1,22 @@ +#if defined(__begin_native__hpp__) +#error Including begin_native.hpp mulitple times without end_native.hpp +#endif +#define __begin_native__hpp__ + +#pragma push_macro("_ALLOW_KEYWORD_MACROS") +#undef _ALLOW_KEYWORD_MACROS +#define _ALLOW_KEYWORD_MACROS + +#pragma push_macro("nullptr") +#undef nullptr +#define nullptr __nullptr + +#pragma warning(push) + +// Disable XML warnings +#pragma warning(disable: 4635) +#pragma warning(disable: 4638) +#pragma warning(disable: 4641) + +// Disable native code generation warning +#pragma warning(disable: 4793) http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/end_native.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/end_native.hpp b/src/clicache/src/end_native.hpp new file mode 100644 index 0000000..1af8380 --- /dev/null +++ b/src/clicache/src/end_native.hpp @@ -0,0 +1,6 @@ +#pragma pop_macro("nullptr") +#pragma pop_macro("_ALLOW_KEYWORD_MACROS") + +#pragma warning(pop) + +#undef __begin_native__hpp__ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/geode_defs.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/geode_defs.hpp b/src/clicache/src/geode_defs.hpp index 6a1c4e3..2424f77 100644 --- a/src/clicache/src/geode_defs.hpp +++ b/src/clicache/src/geode_defs.hpp @@ -39,9 +39,6 @@ /// This namespace contains all the Geode .NET classes and utility classes. /// @namespace Apache::Geode::Client -/// This namespace contains all the Geode .NET API classes and enumerations. - -/// @namespace Apache::Geode::Client /// This namespace contains all the Geode .NET Generics API classes and enumerations. /// @namespace Apache::Geode::Client::Internal http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/AppDomainContext.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/AppDomainContext.hpp b/src/clicache/src/impl/AppDomainContext.hpp index 7c0e185..cd6a00f 100644 --- a/src/clicache/src/impl/AppDomainContext.hpp +++ b/src/clicache/src/impl/AppDomainContext.hpp @@ -19,7 +19,9 @@ #include <functional> #include <vcclr.h> +#include "begin_native.hpp" #include <AppDomainContext.hpp> +#include "end_native.hpp" namespace Apache { http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/AssemblyInfo.cpp.in ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/AssemblyInfo.cpp.in b/src/clicache/src/impl/AssemblyInfo.cpp.in index 6d08fd4..a885a22 100644 --- a/src/clicache/src/impl/AssemblyInfo.cpp.in +++ b/src/clicache/src/impl/AssemblyInfo.cpp.in @@ -43,3 +43,4 @@ using namespace System::Security::Permissions; [assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; [assembly:InternalsVisibleToAttribute("UnitTests@STRONG_NAME_PUBLIC_KEY_ATTRIBUTE@")]; +[assembly:InternalsVisibleToAttribute("cli-unit-tests@STRONG_NAME_PUBLIC_KEY_ATTRIBUTE@")]; http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/AuthenticatedCache.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/AuthenticatedCache.cpp b/src/clicache/src/impl/AuthenticatedCache.cpp index d6c9eae..55b11c4 100644 --- a/src/clicache/src/impl/AuthenticatedCache.cpp +++ b/src/clicache/src/impl/AuthenticatedCache.cpp @@ -36,14 +36,28 @@ namespace Apache bool AuthenticatedCache::IsClosed::get( ) { - return NativePtr->isClosed( ); + try + { + return m_nativeptr->get()->isClosed( ); + } + finally + { + GC::KeepAlive(m_nativeptr); + } } void AuthenticatedCache::Close( ) { _GF_MG_EXCEPTION_TRY2 - NativePtr->close( ); + try + { + m_nativeptr->get()->close( ); + } + finally + { + GC::KeepAlive(m_nativeptr); + } _GF_MG_EXCEPTION_CATCH_ALL2 } @@ -54,11 +68,16 @@ namespace Apache { _GF_MG_EXCEPTION_TRY2 - ManagedString mg_path( path ); - apache::geode::client::RegionPtr& nativeptr( - NativePtr->getRegion( mg_path.CharPtr ) ); - - return Client::Region<TKey, TValue>::Create( nativeptr.ptr( ) ); + try + { + ManagedString mg_path( path ); + auto nativeptr = m_nativeptr->get()->getRegion( mg_path.CharPtr ); + return Client::Region<TKey, TValue>::Create( nativeptr ); + } + finally + { + GC::KeepAlive(m_nativeptr); + } _GF_MG_EXCEPTION_CATCH_ALL2 } @@ -68,7 +87,14 @@ namespace Apache { _GF_MG_EXCEPTION_TRY2 - return Client::QueryService<TKey, TResult>::Create( NativePtr->getQueryService( ).ptr( ) ); + try + { + return Client::QueryService<TKey, TResult>::Create(m_nativeptr->get()->getQueryService( )); + } + finally + { + GC::KeepAlive(m_nativeptr); + } _GF_MG_EXCEPTION_CATCH_ALL2 } @@ -77,23 +103,28 @@ namespace Apache array<IRegion<TKey, TValue>^>^ AuthenticatedCache::RootRegions( ) { apache::geode::client::VectorOfRegion vrr; - NativePtr->rootRegions( vrr ); - array<IRegion<TKey, TValue>^>^ rootRegions = - gcnew array<IRegion<TKey, TValue>^>( vrr.size( ) ); + try + { + m_nativeptr->get()->rootRegions( vrr ); + } + finally + { + GC::KeepAlive(m_nativeptr); + } + auto rootRegions = gcnew array<IRegion<TKey, TValue>^>( vrr.size( ) ); for( System::Int32 index = 0; index < vrr.size( ); index++ ) { - apache::geode::client::RegionPtr& nativeptr( vrr[ index ] ); - rootRegions[ index ] = Client::Region<TKey, TValue>::Create( nativeptr.ptr( ) ); + auto& nativeptr( vrr[ index ] ); + rootRegions[ index ] = Client::Region<TKey, TValue>::Create( nativeptr ); } return rootRegions; } - IPdxInstanceFactory^ AuthenticatedCache::CreatePdxInstanceFactory(String^ className) - { - return gcnew Internal::PdxInstanceFactoryImpl(className);; + IPdxInstanceFactory^ AuthenticatedCache::CreatePdxInstanceFactory(String^ className) + { + return gcnew Internal::PdxInstanceFactoryImpl(className); + } } // namespace Client } // namespace Geode } // namespace Apache - -} http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/AuthenticatedCache.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/AuthenticatedCache.hpp b/src/clicache/src/impl/AuthenticatedCache.hpp index 1f7f7c3..7f0028f 100644 --- a/src/clicache/src/impl/AuthenticatedCache.hpp +++ b/src/clicache/src/impl/AuthenticatedCache.hpp @@ -18,11 +18,13 @@ #pragma once #include "../geode_defs.hpp" +#include "begin_native.hpp" #include <geode/RegionService.hpp> -#include "NativeWrapper.hpp" +#include "end_native.hpp" + +#include "../native_shared_ptr.hpp" #include "../RegionShortcut.hpp" #include "../RegionFactory.hpp" -//#include "../geode_includes.hpp" #include "../IRegionService.hpp" #include "../Region.hpp" @@ -34,12 +36,7 @@ namespace Apache { namespace Client { - - //ref class DistributedSystem; - //ref class Region; - //ref class RegionAttributes; - //ref class QueryService; - //ref class FunctionService; + namespace native = apache::geode::client; /// <summary> /// Provides a distributed cache. @@ -59,7 +56,7 @@ namespace Apache /// </para> /// </remarks> public ref class AuthenticatedCache - : public IRegionService, Internal::SBWrap<apache::geode::client::RegionService> + : public IRegionService { public: @@ -145,10 +142,15 @@ namespace Apache /// <returns> /// The managed wrapper object; null if the native pointer is null. /// </returns> - inline static AuthenticatedCache^ Create( apache::geode::client::RegionService* nativeptr ) + inline static AuthenticatedCache^ Create( native::RegionServicePtr nativeptr ) { - return ( nativeptr != nullptr ? - gcnew AuthenticatedCache( nativeptr ) : nullptr ); + return __nullptr == nativeptr ? nullptr : + gcnew AuthenticatedCache( nativeptr ); + } + + std::shared_ptr<native::RegionService> GetNative() + { + return m_nativeptr->get_shared_ptr(); } private: @@ -157,8 +159,11 @@ namespace Apache /// Private constructor to wrap a native object pointer /// </summary> /// <param name="nativeptr">The native object pointer</param> - inline AuthenticatedCache( apache::geode::client::RegionService* nativeptr ) - : SBWrap( nativeptr ) { } + inline AuthenticatedCache( native::RegionServicePtr nativeptr ) + { + m_nativeptr = gcnew native_shared_ptr<native::RegionService>(nativeptr); + } + native_shared_ptr<native::RegionService>^ m_nativeptr; }; } // namespace Client } // namespace Geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/CacheListener.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/CacheListener.hpp b/src/clicache/src/impl/CacheListener.hpp index ab100b9..d06a34c 100644 --- a/src/clicache/src/impl/CacheListener.hpp +++ b/src/clicache/src/impl/CacheListener.hpp @@ -49,62 +49,60 @@ namespace Apache virtual void AfterUpdate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override { - EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(event)); + EntryEvent<TKey, TValue> gevent(event->GetNative()); m_listener->AfterUpdate(%gevent); } virtual void AfterCreate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override { - EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(event)); + EntryEvent<TKey, TValue> gevent(event->GetNative()); m_listener->AfterCreate(%gevent); } virtual void AfterInvalidate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override { - EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(event)); + EntryEvent<TKey, TValue> gevent(event->GetNative()); m_listener->AfterInvalidate(%gevent); } virtual void AfterDestroy(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override { - EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(event)); + EntryEvent<TKey, TValue> gevent(event->GetNative()); m_listener->AfterDestroy(%gevent); } virtual void AfterRegionLive(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override { - RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(event)); + RegionEvent<TKey, TValue> gevent(event->GetNative()); m_listener->AfterRegionLive(%gevent); } virtual void AfterRegionClear(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override { - RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(event)); + RegionEvent<TKey, TValue> gevent(event->GetNative()); m_listener->AfterRegionClear(%gevent); } virtual void AfterRegionDestroy(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override { - RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(event)); + RegionEvent<TKey, TValue> gevent(event->GetNative()); m_listener->AfterRegionDestroy(%gevent); } virtual void AfterRegionInvalidate(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override { - RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(event)); + RegionEvent<TKey, TValue> gevent(event->GetNative()); m_listener->AfterRegionInvalidate(%gevent); } - virtual void AfterRegionDisconnected(Apache::Geode::Client::IRegion<Object^, Object^>^ event) override + virtual void AfterRegionDisconnected(Apache::Geode::Client::IRegion<Object^, Object^>^ region) override { - Apache::Geode::Client::IRegion<TKey, TValue>^ gevent = Apache::Geode::Client::Region<TKey, TValue>::Create(Apache::Geode::Client::GetNativePtr<apache::geode::client::Region>(reinterpret_cast<Apache::Geode::Client::Region<Object^, Object^>^>(event))); - m_listener->AfterRegionDisconnected(gevent); + m_listener->AfterRegionDisconnected((IRegion<TKey, TValue>^) region); } - virtual void Close(Apache::Geode::Client::IRegion<Object^, Object^>^ event) override + virtual void Close(Apache::Geode::Client::IRegion<Object^, Object^>^ region) override { - Apache::Geode::Client::IRegion<TKey, TValue>^ gevent = Apache::Geode::Client::Region<TKey, TValue>::Create(Apache::Geode::Client::GetNativePtr<apache::geode::client::Region>(reinterpret_cast<Apache::Geode::Client::Region<Object^, Object^>^>(event))); - m_listener->Close(gevent); + m_listener->Close((IRegion<TKey, TValue>^) region); } }; } // namespace Client http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/CacheLoader.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/CacheLoader.hpp b/src/clicache/src/impl/CacheLoader.hpp index 45f1506..9f8a049 100644 --- a/src/clicache/src/impl/CacheLoader.hpp +++ b/src/clicache/src/impl/CacheLoader.hpp @@ -63,7 +63,7 @@ namespace Apache virtual apache::geode::client::CacheablePtr load( const apache::geode::client::RegionPtr& region, const apache::geode::client::CacheableKeyPtr& key, const apache::geode::client::UserDataPtr& helper ) { - IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region.get()); + IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region); TKey gkey = Serializable::GetManagedValueGeneric<TKey>(key); @@ -75,7 +75,7 @@ namespace Apache virtual void close( const apache::geode::client::RegionPtr& region ) { - IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region.get()); + IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region); m_loader->Close(gregion); } }; http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/CacheWriter.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/CacheWriter.hpp b/src/clicache/src/impl/CacheWriter.hpp index c26b03f..e5f238a 100644 --- a/src/clicache/src/impl/CacheWriter.hpp +++ b/src/clicache/src/impl/CacheWriter.hpp @@ -49,38 +49,37 @@ namespace Apache virtual bool BeforeUpdate( Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev ) override { - EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(ev)); + EntryEvent<TKey, TValue> gevent(ev->GetNative()); return m_writer->BeforeUpdate(%gevent); } virtual bool BeforeCreate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev) override { - EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(ev)); + EntryEvent<TKey, TValue> gevent(ev->GetNative()); return m_writer->BeforeCreate(%gevent); } virtual bool BeforeDestroy(Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev) override { - EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(ev)); + EntryEvent<TKey, TValue> gevent(ev->GetNative()); return m_writer->BeforeDestroy(%gevent); } virtual bool BeforeRegionClear( Apache::Geode::Client::RegionEvent<Object^, Object^>^ ev ) override { - RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(ev)); + RegionEvent<TKey, TValue> gevent(ev->GetNative()); return m_writer->BeforeRegionClear(%gevent); } virtual bool BeforeRegionDestroy(Apache::Geode::Client::RegionEvent<Object^, Object^>^ ev) override { - RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(ev)); + RegionEvent<TKey, TValue> gevent(ev->GetNative()); return m_writer->BeforeRegionDestroy(%gevent); } virtual void Close(Apache::Geode::Client::Region<Object^, Object^>^ region) override { - IRegion<TKey, TValue>^ gregion = Apache::Geode::Client::Region<TKey, TValue>::Create(Client::GetNativePtr<apache::geode::client::Region>(region)); - m_writer->Close(gregion); + m_writer->Close((IRegion<TKey, TValue>^) region); } }; } // namespace Client http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/CqListenerProxy.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/CqListenerProxy.hpp b/src/clicache/src/impl/CqListenerProxy.hpp index 3ecf477..86ae462 100644 --- a/src/clicache/src/impl/CqListenerProxy.hpp +++ b/src/clicache/src/impl/CqListenerProxy.hpp @@ -47,14 +47,14 @@ namespace Apache virtual void OnEvent( Apache::Geode::Client::CqEvent<Object^, Object^>^ ev) { //TODO:split---Done - CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev)); + CqEvent<TKey, TResult> gevent(ev->GetNative()); m_listener->OnEvent(%gevent); } virtual void OnError(Apache::Geode::Client::CqEvent<Object^, Object^>^ ev) { //TODO::split--Done - CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev)); + CqEvent<TKey, TResult> gevent(ev->GetNative()); m_listener->OnError(%gevent); } http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/CqStatusListenerProxy.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/CqStatusListenerProxy.hpp b/src/clicache/src/impl/CqStatusListenerProxy.hpp index d2b4004..4ddcb2f 100644 --- a/src/clicache/src/impl/CqStatusListenerProxy.hpp +++ b/src/clicache/src/impl/CqStatusListenerProxy.hpp @@ -44,14 +44,14 @@ namespace Apache virtual void OnEvent(Apache::Geode::Client::CqEvent<Object^, Object^>^ ev) { //TODO:split---Done - CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev)); + CqEvent<TKey, TResult> gevent(ev->GetNative()); m_listener->OnEvent(%gevent); } virtual void OnError( Apache::Geode::Client::CqEvent<Object^, Object^>^ ev) { //TODO::split--Done - CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev)); + CqEvent<TKey, TResult> gevent(ev->GetNative()); m_listener->OnError(%gevent); }