You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/01/23 19:17:04 UTC
[12/50] [abbrv] geode git commit: GEODE-2316: Rename namespace
gemfire to apache::geode::client.
http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/PdxManagedCacheableKey.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKey.cpp b/src/clicache/src/impl/PdxManagedCacheableKey.cpp
index 9a288d0..b8b6110 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKey.cpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKey.cpp
@@ -28,269 +28,275 @@
#include "SafeConvert.hpp"
using namespace System;
-namespace gemfire
+namespace apache
{
- void PdxManagedCacheableKey::toData( gemfire::DataOutput& output ) const
+ namespace geode
{
- try {
- uint32 pos = (int)output.getBufferLength();
- GemStone::GemFire::Cache::Generic::DataOutput mg_output( &output, true );
- GemStone::GemFire::Cache::Generic::Internal::PdxHelper::SerializePdx(%mg_output, m_managedptr);
- //m_managedptr->ToData( %mg_output );
- //this will move the cursor in c++ layer
- mg_output.WriteBytesToUMDataOutput();
- PdxManagedCacheableKey* tmp = const_cast<PdxManagedCacheableKey*>(this);
- tmp->m_objectSize = (int)(output.getBufferLength() - pos);
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- }
-
- Serializable* PdxManagedCacheableKey::fromData( gemfire::DataInput& input )
- {
- try {
- int pos = input.getBytesRead();
- GemStone::GemFire::Cache::Generic::DataInput mg_input (&input, true);
- //m_managedptr = m_managedptr->FromData( %mg_input );
- GemStone::GemFire::Cache::Generic::IPdxSerializable^ tmp= GemStone::GemFire::Cache::Generic::Internal::PdxHelper::DeserializePdx(%mg_input, false);
- m_managedptr = tmp;
- m_managedDeltaptr = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(tmp);
+ namespace client
+ {
+ void PdxManagedCacheableKey::toData(apache::geode::client::DataOutput& output) const
+ {
+ try {
+ uint32 pos = (int)output.getBufferLength();
+ GemStone::GemFire::Cache::Generic::DataOutput mg_output(&output, true);
+ GemStone::GemFire::Cache::Generic::Internal::PdxHelper::SerializePdx(%mg_output, m_managedptr);
+ //m_managedptr->ToData( %mg_output );
+ //this will move the cursor in c++ layer
+ mg_output.WriteBytesToUMDataOutput();
+ PdxManagedCacheableKey* tmp = const_cast<PdxManagedCacheableKey*>(this);
+ tmp->m_objectSize = (int)(output.getBufferLength() - pos);
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ }
- //this will move the cursor in c++ layer
- input.advanceCursor(mg_input.BytesReadInternally);
- m_objectSize = input.getBytesRead() - pos;
- // m_hashcode = m_managedptr->GetHashCode();
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return this;
- }
+ Serializable* PdxManagedCacheableKey::fromData(apache::geode::client::DataInput& input)
+ {
+ try {
+ int pos = input.getBytesRead();
+ GemStone::GemFire::Cache::Generic::DataInput mg_input(&input, true);
+ //m_managedptr = m_managedptr->FromData( %mg_input );
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^ tmp = GemStone::GemFire::Cache::Generic::Internal::PdxHelper::DeserializePdx(%mg_input, false);
+ m_managedptr = tmp;
+ m_managedDeltaptr = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(tmp);
- uint32_t PdxManagedCacheableKey::objectSize( ) const
- {
- try {
- return m_objectSize;
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return 0;
- }
+ //this will move the cursor in c++ layer
+ input.advanceCursor(mg_input.BytesReadInternally);
+ m_objectSize = input.getBytesRead() - pos;
+ // m_hashcode = m_managedptr->GetHashCode();
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return this;
+ }
- int32_t PdxManagedCacheableKey::classId() const
- {
- /*uint32_t classId;
- try {
- classId = m_managedptr->ClassId;
- }
- catch (Com::Vmware::Cache::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::GemFireException::ThrowNative(ex);
- }*/
- //return (m_classId >= 0x80000000 ? 0 : m_classId);
- return 0;
- }
+ uint32_t PdxManagedCacheableKey::objectSize() const
+ {
+ try {
+ return m_objectSize;
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return 0;
+ }
- int8_t PdxManagedCacheableKey::typeId() const
- {
- /*if (m_classId >= 0x80000000) {
- return (int8_t)((m_classId - 0x80000000) % 0x20000000);
- }
- else if (m_classId <= 0x7F) {
- return (int8_t)GemfireTypeIdsImpl::CacheableUserData;
- }
- else if (m_classId <= 0x7FFF) {
- return (int8_t)GemfireTypeIdsImpl::CacheableUserData2;
- }
- else {
- return (int8_t)GemfireTypeIdsImpl::CacheableUserData4;
- }*/
- return (int8_t)GemfireTypeIdsImpl::PDX;
- }
+ int32_t PdxManagedCacheableKey::classId() const
+ {
+ /*uint32_t classId;
+ try {
+ classId = m_managedptr->ClassId;
+ }
+ catch (Com::Vmware::Cache::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::GemFireException::ThrowNative(ex);
+ }*/
+ //return (m_classId >= 0x80000000 ? 0 : m_classId);
+ return 0;
+ }
- int8_t PdxManagedCacheableKey::DSFID() const
- {
- // convention that [0x8000000, 0xa0000000) is for FixedIDDefault,
- // [0xa000000, 0xc0000000) is for FixedIDByte,
- // [0xc0000000, 0xe0000000) is for FixedIDShort
- // and [0xe0000000, 0xffffffff] is for FixedIDInt
- // Note: depends on fact that FixedIDByte is 1, FixedIDShort is 2
- // and FixedIDInt is 3; if this changes then correct this accordingly
- //if (m_classId >= 0x80000000) {
- // return (int8_t)((m_classId - 0x80000000) / 0x20000000);
- //}
- return 0;
- }
+ int8_t PdxManagedCacheableKey::typeId() const
+ {
+ /*if (m_classId >= 0x80000000) {
+ return (int8_t)((m_classId - 0x80000000) % 0x20000000);
+ }
+ else if (m_classId <= 0x7F) {
+ return (int8_t)GemfireTypeIdsImpl::CacheableUserData;
+ }
+ else if (m_classId <= 0x7FFF) {
+ return (int8_t)GemfireTypeIdsImpl::CacheableUserData2;
+ }
+ else {
+ return (int8_t)GemfireTypeIdsImpl::CacheableUserData4;
+ }*/
+ return (int8_t)GemfireTypeIdsImpl::PDX;
+ }
- gemfire::CacheableStringPtr PdxManagedCacheableKey::toString( ) const
- {
- try {
- gemfire::CacheableStringPtr cStr;
- GemStone::GemFire::Cache::Generic::CacheableString::GetCacheableString(
- m_managedptr->ToString( ), cStr );
- return cStr;
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return NULLPTR;
- }
+ int8_t PdxManagedCacheableKey::DSFID() const
+ {
+ // convention that [0x8000000, 0xa0000000) is for FixedIDDefault,
+ // [0xa000000, 0xc0000000) is for FixedIDByte,
+ // [0xc0000000, 0xe0000000) is for FixedIDShort
+ // and [0xe0000000, 0xffffffff] is for FixedIDInt
+ // Note: depends on fact that FixedIDByte is 1, FixedIDShort is 2
+ // and FixedIDInt is 3; if this changes then correct this accordingly
+ //if (m_classId >= 0x80000000) {
+ // return (int8_t)((m_classId - 0x80000000) / 0x20000000);
+ //}
+ return 0;
+ }
- bool PdxManagedCacheableKey::operator ==(const gemfire::CacheableKey& other) const
- {
- try {
- // now checking classId(), typeId(), DSFID() etc. will be much more
- // expensive than just a dynamic_cast
- const PdxManagedCacheableKey* p_other =
- dynamic_cast<const PdxManagedCacheableKey*>(&other);
- if (p_other != NULL) {
- return ((GemStone::GemFire::Cache::Generic::IPdxSerializable^)m_managedptr)->Equals((p_other->ptr()));
+ apache::geode::client::CacheableStringPtr PdxManagedCacheableKey::toString() const
+ {
+ try {
+ apache::geode::client::CacheableStringPtr cStr;
+ GemStone::GemFire::Cache::Generic::CacheableString::GetCacheableString(
+ m_managedptr->ToString(), cStr);
+ return cStr;
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return NULLPTR;
}
- return false;
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return false;
- }
- bool PdxManagedCacheableKey::operator ==(const PdxManagedCacheableKey& other) const
- {
- try {
- return ((GemStone::GemFire::Cache::Generic::IPdxSerializable^)m_managedptr)->Equals((other.ptr()));
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return false;
- }
+ bool PdxManagedCacheableKey::operator ==(const apache::geode::client::CacheableKey& other) const
+ {
+ try {
+ // now checking classId(), typeId(), DSFID() etc. will be much more
+ // expensive than just a dynamic_cast
+ const PdxManagedCacheableKey* p_other =
+ dynamic_cast<const PdxManagedCacheableKey*>(&other);
+ if (p_other != NULL) {
+ return ((GemStone::GemFire::Cache::Generic::IPdxSerializable^)m_managedptr)->Equals((p_other->ptr()));
+ }
+ return false;
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return false;
+ }
- uint32_t PdxManagedCacheableKey::hashcode( ) const
- {
- if (m_hashcode != 0)
- return m_hashcode;
- try {
- PdxManagedCacheableKey* tmp = const_cast<PdxManagedCacheableKey*>(this);
- tmp->m_hashcode = (
- (GemStone::GemFire::Cache::Generic::IPdxSerializable^)tmp->m_managedptr)
- ->GetHashCode( );
- return m_hashcode;
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return 0;
- }
+ bool PdxManagedCacheableKey::operator ==(const PdxManagedCacheableKey& other) const
+ {
+ try {
+ return ((GemStone::GemFire::Cache::Generic::IPdxSerializable^)m_managedptr)->Equals((other.ptr()));
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return false;
+ }
- size_t PdxManagedCacheableKey::logString( char* buffer, size_t maxLength ) const
- {
- try {
- if ( maxLength > 0 ) {
- String^ logstr = m_managedptr->GetType( )->Name + '(' +
- m_managedptr->ToString( ) + ')';
- GemStone::GemFire::Cache::Generic::ManagedString mg_str( logstr );
- return snprintf( buffer, maxLength, "%s", mg_str.CharPtr );
+ uint32_t PdxManagedCacheableKey::hashcode() const
+ {
+ if (m_hashcode != 0)
+ return m_hashcode;
+ try {
+ PdxManagedCacheableKey* tmp = const_cast<PdxManagedCacheableKey*>(this);
+ tmp->m_hashcode = (
+ (GemStone::GemFire::Cache::Generic::IPdxSerializable^)tmp->m_managedptr)
+ ->GetHashCode();
+ return m_hashcode;
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return 0;
}
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return 0;
- }
- bool PdxManagedCacheableKey::hasDelta()
- {
- if(m_managedDeltaptr)
- {
- return m_managedDeltaptr->HasDelta();
- }
- return false;
- }
+ size_t PdxManagedCacheableKey::logString(char* buffer, size_t maxLength) const
+ {
+ try {
+ if (maxLength > 0) {
+ String^ logstr = m_managedptr->GetType()->Name + '(' +
+ m_managedptr->ToString() + ')';
+ GemStone::GemFire::Cache::Generic::ManagedString mg_str(logstr);
+ return snprintf(buffer, maxLength, "%s", mg_str.CharPtr);
+ }
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return 0;
+ }
- void PdxManagedCacheableKey::toDelta( DataOutput& output) const
- {
- try {
- GemStone::GemFire::Cache::Generic::DataOutput mg_output( &output, true );
- m_managedDeltaptr->ToDelta( %mg_output );
- //this will move the cursor in c++ layer
- mg_output.WriteBytesToUMDataOutput();
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- }
+ bool PdxManagedCacheableKey::hasDelta()
+ {
+ if (m_managedDeltaptr)
+ {
+ return m_managedDeltaptr->HasDelta();
+ }
+ return false;
+ }
- void PdxManagedCacheableKey::fromDelta( DataInput& input )
- {
- try {
- GemStone::GemFire::Cache::Generic::DataInput mg_input( &input, true );
- m_managedDeltaptr->FromDelta( %mg_input );
+ void PdxManagedCacheableKey::toDelta(DataOutput& output) const
+ {
+ try {
+ GemStone::GemFire::Cache::Generic::DataOutput mg_output(&output, true);
+ m_managedDeltaptr->ToDelta(%mg_output);
+ //this will move the cursor in c++ layer
+ mg_output.WriteBytesToUMDataOutput();
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ }
- //this will move the cursor in c++ layer
- input.advanceCursor(mg_input.BytesReadInternally);
+ void PdxManagedCacheableKey::fromDelta(DataInput& input)
+ {
+ try {
+ GemStone::GemFire::Cache::Generic::DataInput mg_input(&input, true);
+ m_managedDeltaptr->FromDelta(%mg_input);
- m_hashcode = m_managedptr->GetHashCode();
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- }
+ //this will move the cursor in c++ layer
+ input.advanceCursor(mg_input.BytesReadInternally);
- DeltaPtr PdxManagedCacheableKey::clone()
- {
- try {
- ICloneable^ cloneable = dynamic_cast< ICloneable^ >( (
- GemStone::GemFire::Cache::Generic::IGFDelta^ ) m_managedDeltaptr );
- if ( cloneable ) {
- GemStone::GemFire::Cache::Generic::IPdxSerializable^ Mclone =
- dynamic_cast< GemStone::GemFire::Cache::Generic::IPdxSerializable^ >( cloneable->Clone( ) );
- return DeltaPtr( static_cast< PdxManagedCacheableKey* >(
- SafeGenericM2UMConvert( Mclone ) ) );
+ m_hashcode = m_managedptr->GetHashCode();
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
}
- else {
- return Delta::clone( );
+
+ DeltaPtr PdxManagedCacheableKey::clone()
+ {
+ try {
+ ICloneable^ cloneable = dynamic_cast<ICloneable^>((
+ GemStone::GemFire::Cache::Generic::IGFDelta^) m_managedDeltaptr);
+ if (cloneable) {
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^ Mclone =
+ dynamic_cast<GemStone::GemFire::Cache::Generic::IPdxSerializable^>(cloneable->Clone());
+ return DeltaPtr(static_cast<PdxManagedCacheableKey*>(
+ SafeGenericM2UMConvert(Mclone)));
+ }
+ else {
+ return Delta::clone();
+ }
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return NULLPTR;
}
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return NULLPTR;
- }
-}
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/PdxManagedCacheableKey.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKey.hpp b/src/clicache/src/impl/PdxManagedCacheableKey.hpp
index 65688e2..13d7575 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKey.hpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKey.hpp
@@ -25,7 +25,7 @@
#include <gfcpp/Delta.hpp>
#include "../IGFDelta.hpp"
using namespace System;
-using namespace gemfire;
+using namespace apache::geode::client;
namespace GemStone
{
namespace GemFire
@@ -40,148 +40,154 @@ namespace GemStone
}
}
-namespace gemfire
+namespace apache
{
- /// <summary>
- /// Wraps the managed <see cref="Com.Vmware.Cache.IPdxSerializable" />
- /// object and implements the native <c>gemfire::CacheableKey</c> interface.
- /// </summary>
- class PdxManagedCacheableKey
- : public gemfire::CacheableKey, public gemfire::Delta
+ namespace geode
{
- private :
- int m_hashcode;
- int m_objectSize;
- public:
-
- inline PdxManagedCacheableKey()
- : m_managedptr( nullptr ), m_hashcode(0), m_objectSize(0), m_managedDeltaptr(nullptr)
- {
-
- }
-
- inline PdxManagedCacheableKey(
- GemStone::GemFire::Cache::Generic::IPdxSerializable^ managedptr, int hashcode )
- : m_managedptr( managedptr ),m_objectSize(0) {
- m_hashcode = hashcode;
- m_managedDeltaptr = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(managedptr);
- }
- /// <summary>
- /// Constructor to initialize with the provided managed object.
- /// </summary>
- /// <param name="managedptr">
- /// The managed object.
- /// </param>
- inline PdxManagedCacheableKey(
- GemStone::GemFire::Cache::Generic::IPdxSerializable^ managedptr )
- : m_managedptr( managedptr ),m_objectSize(0) {
- m_hashcode = 0;//it can be zero while initializing the object
- m_managedDeltaptr = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(managedptr);
- }
-
- /// <summary>
- /// serialize this object
- /// </summary>
- virtual void toData( gemfire::DataOutput& output ) const;
-
- /// <summary>
- /// deserialize this object, typical implementation should return
- /// the 'this' pointer.
- /// </summary>
- virtual gemfire::Serializable* fromData( gemfire::DataInput& input );
-
- virtual void toDelta( gemfire::DataOutput& output) const;
-
- virtual void fromDelta( gemfire::DataInput& input );
-
- virtual bool hasDelta();
-
- virtual gemfire::DeltaPtr clone();
-
- /// <summary>
- /// return the size of this object in bytes
- /// </summary>
- virtual uint32_t objectSize() const;
-
- /// <summary>
- /// return the classId of the instance being serialized.
- /// This is used by deserialization to determine what instance
- /// type to create and deserialize into.
- /// </summary>
- virtual int32_t classId( ) const;
-
- /// <summary>
- /// return the typeId of the instance being serialized.
- /// This is used by deserialization to determine what instance
- /// type to create and deserialize into.
- /// </summary>
- virtual int8_t typeId( ) const;
-
- /// <summary>
- /// return the Data Serialization Fixed ID type.
- /// This is used to determine what instance type to create
- /// and deserialize into.
- ///
- /// Note that this should not be overridden by custom implementations
- /// and is reserved only for builtin types.
- /// </summary>
- virtual int8_t DSFID() const;
-
- /// <summary>
- /// Display this object as 'string', which depends on the implementation in
- /// the managed class
- /// </summary>
- virtual gemfire::CacheableStringPtr toString( ) const;
-
- /// <summary>
- /// return true if this key matches other CacheableKey
- /// </summary>
- virtual bool operator == ( const CacheableKey& other ) const;
- /// <summary>
- /// return true if this key matches other ManagedCacheableKey
- /// </summary>
- virtual bool operator == ( const PdxManagedCacheableKey& other ) const;
-
- /// <summary>
- /// return the hashcode for this key.
- /// </summary>
- virtual uint32_t hashcode( ) const;
-
- /// <summary>
- /// Copy the string form of a key into a char* buffer for logging purposes.
- /// implementations should only generate a string as long as maxLength chars,
- /// and return the number of chars written. buffer is expected to be large
- /// enough to hold at least maxLength chars.
- /// The default implementation renders the classname and instance address.
- /// </summary>
- virtual size_t logString( char* buffer, size_t maxLength ) const;
-
- /// <summary>
- /// Returns the wrapped managed object reference.
- /// </summary>
- inline GemStone::GemFire::Cache::Generic::IPdxSerializable^ ptr( ) const
+ namespace client
{
- return m_managedptr;
- }
-
-
- static Serializable* CreateDeserializable()
- {
- return new PdxManagedCacheableKey();
- }
- private:
-
- /// <summary>
- /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
- /// Note: not using auto_gcroot since it will result in 'Dispose' of the IGFSerializable
- /// to be called which is not what is desired when this object is destroyed. Normally this
- /// managed object may be created by the user and will be handled automatically by the GC.
- /// </summary>
- gcroot<GemStone::GemFire::Cache::Generic::IPdxSerializable^> m_managedptr;
- gcroot<GemStone::GemFire::Cache::Generic::IGFDelta^> m_managedDeltaptr;
-
- // Disable the copy and assignment constructors
- PdxManagedCacheableKey( const PdxManagedCacheableKey& );
- PdxManagedCacheableKey& operator = ( const PdxManagedCacheableKey& );
- };
-}
+ /// <summary>
+ /// Wraps the managed <see cref="Com.Vmware.Cache.IPdxSerializable" />
+ /// object and implements the native <c>apache::geode::client::CacheableKey</c> interface.
+ /// </summary>
+ class PdxManagedCacheableKey
+ : public apache::geode::client::CacheableKey, public apache::geode::client::Delta
+ {
+ private:
+ int m_hashcode;
+ int m_objectSize;
+ public:
+
+ inline PdxManagedCacheableKey()
+ : m_managedptr(nullptr), m_hashcode(0), m_objectSize(0), m_managedDeltaptr(nullptr)
+ {
+
+ }
+
+ inline PdxManagedCacheableKey(
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^ managedptr, int hashcode)
+ : m_managedptr(managedptr), m_objectSize(0) {
+ m_hashcode = hashcode;
+ m_managedDeltaptr = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(managedptr);
+ }
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="managedptr">
+ /// The managed object.
+ /// </param>
+ inline PdxManagedCacheableKey(
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^ managedptr)
+ : m_managedptr(managedptr), m_objectSize(0) {
+ m_hashcode = 0;//it can be zero while initializing the object
+ m_managedDeltaptr = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(managedptr);
+ }
+
+ /// <summary>
+ /// serialize this object
+ /// </summary>
+ virtual void toData(apache::geode::client::DataOutput& output) const;
+
+ /// <summary>
+ /// deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ virtual apache::geode::client::Serializable* fromData(apache::geode::client::DataInput& input);
+
+ virtual void toDelta(apache::geode::client::DataOutput& output) const;
+
+ virtual void fromDelta(apache::geode::client::DataInput& input);
+
+ virtual bool hasDelta();
+
+ virtual apache::geode::client::DeltaPtr clone();
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual uint32_t objectSize() const;
+
+ /// <summary>
+ /// return the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ virtual int32_t classId() const;
+
+ /// <summary>
+ /// return the typeId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ virtual int8_t typeId() const;
+
+ /// <summary>
+ /// return the Data Serialization Fixed ID type.
+ /// This is used to determine what instance type to create
+ /// and deserialize into.
+ ///
+ /// Note that this should not be overridden by custom implementations
+ /// and is reserved only for builtin types.
+ /// </summary>
+ virtual int8_t DSFID() const;
+
+ /// <summary>
+ /// Display this object as 'string', which depends on the implementation in
+ /// the managed class
+ /// </summary>
+ virtual apache::geode::client::CacheableStringPtr toString() const;
+
+ /// <summary>
+ /// return true if this key matches other CacheableKey
+ /// </summary>
+ virtual bool operator == (const CacheableKey& other) const;
+ /// <summary>
+ /// return true if this key matches other ManagedCacheableKey
+ /// </summary>
+ virtual bool operator == (const PdxManagedCacheableKey& other) const;
+
+ /// <summary>
+ /// return the hashcode for this key.
+ /// </summary>
+ virtual uint32_t hashcode() const;
+
+ /// <summary>
+ /// Copy the string form of a key into a char* buffer for logging purposes.
+ /// implementations should only generate a string as long as maxLength chars,
+ /// and return the number of chars written. buffer is expected to be large
+ /// enough to hold at least maxLength chars.
+ /// The default implementation renders the classname and instance address.
+ /// </summary>
+ virtual size_t logString(char* buffer, size_t maxLength) const;
+
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline GemStone::GemFire::Cache::Generic::IPdxSerializable^ ptr() const
+ {
+ return m_managedptr;
+ }
+
+
+ static Serializable* CreateDeserializable()
+ {
+ return new PdxManagedCacheableKey();
+ }
+ private:
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the IGFSerializable
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<GemStone::GemFire::Cache::Generic::IPdxSerializable^> m_managedptr;
+ gcroot<GemStone::GemFire::Cache::Generic::IGFDelta^> m_managedDeltaptr;
+
+ // Disable the copy and assignment constructors
+ PdxManagedCacheableKey(const PdxManagedCacheableKey&);
+ PdxManagedCacheableKey& operator = (const PdxManagedCacheableKey&);
+ };
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
index 7673f43..e45a3a2 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
@@ -28,339 +28,345 @@
using namespace System;
-namespace gemfire
+namespace apache
{
- void PdxManagedCacheableKeyBytes::toData( gemfire::DataOutput& output ) const
+ namespace geode
{
- // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId );
- try {
- //TODO: I think this should work as it is
- output.writeBytesOnly(m_bytes, m_size);
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- }
-
- gemfire::Serializable* PdxManagedCacheableKeyBytes::fromData( gemfire::DataInput& input )
- {
- try {
-
- //GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromData: classid " + m_classId);
- GemStone::GemFire::Cache::Generic::DataInput mg_input( &input, true );
- const uint8_t* objStartPos = input.currentBufferPosition();
-
- GemStone::GemFire::Cache::Generic::IPdxSerializable^ obj = GemStone::GemFire::Cache::Generic::Internal::PdxHelper::DeserializePdx(%mg_input, false);
-
- //GemStone::GemFire::Cache::Generic::IGFSerializable^ obj = GemStone::GemFire::Cache::Generic::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
- //obj->FromData(%mg_input);
-
- input.advanceCursor(mg_input.BytesReadInternally);
-
- m_hashCode = obj->GetHashCode();
-
- const uint8_t* objEndPos = input.currentBufferPosition();
-
- //m_size = mg_input.BytesRead;
- m_size = (uint32_t)(objEndPos - objStartPos);
- // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromData: objectSize = " + m_size + " m_hashCode = " + m_hashCode);
- m_bytes = input.getBufferCopyFrom(objStartPos, m_size);
-
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return this;
- }
-
- uint32_t PdxManagedCacheableKeyBytes::objectSize( ) const
- {
- try {
- //return m_managedptr->ObjectSize;
- return m_size;
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return 0;
- }
-
- int32_t PdxManagedCacheableKeyBytes::classId() const
- {
- //uint32_t classId;
- //try {
- // //classId = m_managedptr->ClassId;
- // classId = m_classId;
- //}
- //catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- // ex->ThrowNative();
- //}
- //catch (System::Exception^ ex) {
- // GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- //}
- //return (classId >= 0x80000000 ? 0 : classId);
- return 0;
- }
-
- int8_t PdxManagedCacheableKeyBytes::typeId() const
- {
- //try {
- // //uint32_t classId = m_managedptr->ClassId;
- // uint32_t classId = m_classId;
- // if (classId >= 0x80000000) {
- // return (int8_t)((classId - 0x80000000) % 0x20000000);
- // }
- // else if (classId <= 0x7F) {
- // return (int8_t)gemfire::GemfireTypeIdsImpl::CacheableUserData;
- // }
- // else if (classId <= 0x7FFF) {
- // return (int8_t)gemfire::GemfireTypeIdsImpl::CacheableUserData2;
- // }
- // else {
- // return (int8_t)gemfire::GemfireTypeIdsImpl::CacheableUserData4;
- // }
- //}
- //catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- // ex->ThrowNative();
- //}
- //catch (System::Exception^ ex) {
- // GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- //}
- return (int8_t)GemfireTypeIdsImpl::PDX;
- }
-
- int8_t PdxManagedCacheableKeyBytes::DSFID() const
- {
- // convention that [0x8000000, 0xa0000000) is for FixedIDDefault,
- // [0xa000000, 0xc0000000) is for FixedIDByte,
- // [0xc0000000, 0xe0000000) is for FixedIDShort
- // and [0xe0000000, 0xffffffff] is for FixedIDInt
- // Note: depends on fact that FixedIDByte is 1, FixedIDShort is 2
- // and FixedIDInt is 3; if this changes then correct this accordingly
- //uint32_t classId = m_managedptr->ClassId;
- /* uint32_t classId = m_classId;
- if (classId >= 0x80000000) {
- return (int8_t)((classId - 0x80000000) / 0x20000000);
- }*/
- return 0;
- }
-
- gemfire::CacheableStringPtr PdxManagedCacheableKeyBytes::toString( ) const
- {
- try {
- GemStone::GemFire::Cache::Generic::IPdxSerializable^ manageObject = getManagedObject();
- if(manageObject != nullptr)
+ namespace client
+ {
+ void PdxManagedCacheableKeyBytes::toData(apache::geode::client::DataOutput& output) const
{
- gemfire::CacheableStringPtr cStr;
- GemStone::GemFire::Cache::Generic::CacheableString::GetCacheableString(
- manageObject->ToString(), cStr );
- return cStr;
+ // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId );
+ try {
+ //TODO: I think this should work as it is
+ output.writeBytesOnly(m_bytes, m_size);
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
}
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return NULLPTR;
- }
-
- bool PdxManagedCacheableKeyBytes::operator ==(const gemfire::CacheableKey& other) const
- {
- try {
- // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal");
- // now checking classId(), typeId(), DSFID() etc. will be much more
- // expensive than just a dynamic_cast
- const PdxManagedCacheableKeyBytes* p_other =
- dynamic_cast<const PdxManagedCacheableKeyBytes*>(&other);
- if (p_other != NULL) {
- gemfire::DataInput di(m_bytes, m_size);
- GemStone::GemFire::Cache::Generic::DataInput mg_input(&di, true);
- /* GemStone::GemFire::Cache::Generic::IGFSerializable^ obj =
- GemStone::GemFire::Cache::Generic::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
- obj->FromData(%mg_input);*/
- GemStone::GemFire::Cache::Generic::IPdxSerializable^ obj = getManagedObject();
- bool ret = obj->Equals(p_other->ptr());
- // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal return VAL = " + ret);
- return ret;
+
+ apache::geode::client::Serializable* PdxManagedCacheableKeyBytes::fromData(apache::geode::client::DataInput& input)
+ {
+ try {
+
+ //GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromData: classid " + m_classId);
+ GemStone::GemFire::Cache::Generic::DataInput mg_input(&input, true);
+ const uint8_t* objStartPos = input.currentBufferPosition();
+
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^ obj = GemStone::GemFire::Cache::Generic::Internal::PdxHelper::DeserializePdx(%mg_input, false);
+
+ //GemStone::GemFire::Cache::Generic::IGFSerializable^ obj = GemStone::GemFire::Cache::Generic::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
+ //obj->FromData(%mg_input);
+
+ input.advanceCursor(mg_input.BytesReadInternally);
+
+ m_hashCode = obj->GetHashCode();
+
+ const uint8_t* objEndPos = input.currentBufferPosition();
+
+ //m_size = mg_input.BytesRead;
+ m_size = (uint32_t)(objEndPos - objStartPos);
+ // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromData: objectSize = " + m_size + " m_hashCode = " + m_hashCode);
+ m_bytes = input.getBufferCopyFrom(objStartPos, m_size);
+
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return this;
}
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal returns false");
- return false;
- }
-
- bool PdxManagedCacheableKeyBytes::operator ==(const PdxManagedCacheableKeyBytes& other) const
- {
- try {
- //GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal. ");
- gemfire::DataInput di(m_bytes, m_size);
- GemStone::GemFire::Cache::Generic::DataInput mg_input(&di, true);
- /*GemStone::GemFire::Cache::Generic::IGFSerializable^ obj =
- GemStone::GemFire::Cache::Generic::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
- obj->FromData(%mg_input);*/
- GemStone::GemFire::Cache::Generic::IPdxSerializable^ obj = getManagedObject();
- bool ret = obj->Equals(other.ptr());
- // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal return VAL = " + ret);
- return ret;
- //return obj->Equals(other.ptr());
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal return false");
- return false;
- }
-
- uint32_t PdxManagedCacheableKeyBytes::hashcode( ) const
- {
- return m_hashCode;
- }
- size_t PdxManagedCacheableKeyBytes::logString( char* buffer, size_t maxLength ) const
- {
- try {
- GemStone::GemFire::Cache::Generic::IPdxSerializable^ manageObject = getManagedObject();
- if(manageObject != nullptr)
+ uint32_t PdxManagedCacheableKeyBytes::objectSize() const
{
- if ( maxLength > 0 ) {
- String^ logstr = manageObject->GetType( )->Name + '(' +
- manageObject->ToString( ) + ')';
- GemStone::GemFire::Cache::Generic::ManagedString mg_str( logstr );
- return snprintf( buffer, maxLength, "%s", mg_str.CharPtr );
+ try {
+ //return m_managedptr->ObjectSize;
+ return m_size;
}
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return 0;
}
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return 0;
- }
-
- GemStone::GemFire::Cache::Generic::IPdxSerializable^
- PdxManagedCacheableKeyBytes::getManagedObject() const
- {
- // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::getManagedObject " + m_size);
+ int32_t PdxManagedCacheableKeyBytes::classId() const
+ {
+ //uint32_t classId;
+ //try {
+ // //classId = m_managedptr->ClassId;
+ // classId = m_classId;
+ //}
+ //catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ // ex->ThrowNative();
+ //}
+ //catch (System::Exception^ ex) {
+ // GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ //}
+ //return (classId >= 0x80000000 ? 0 : classId);
+ return 0;
+ }
- gemfire::DataInput dinp(m_bytes, m_size);
- GemStone::GemFire::Cache::Generic::DataInput mg_dinp(&dinp, true);
- /*TypeFactoryMethodGeneric^ creationMethod =
- GemStone::GemFire::Cache::Generic::Serializable::GetTypeFactoryMethodGeneric(m_classId);
- GemStone::GemFire::Cache::Generic::IGFSerializable^ newObj = creationMethod();
- return newObj->FromData(%mg_dinp);*/
- return GemStone::GemFire::Cache::Generic::Internal::PdxHelper::DeserializePdx(%mg_dinp, false);
- }
+ int8_t PdxManagedCacheableKeyBytes::typeId() const
+ {
+ //try {
+ // //uint32_t classId = m_managedptr->ClassId;
+ // uint32_t classId = m_classId;
+ // if (classId >= 0x80000000) {
+ // return (int8_t)((classId - 0x80000000) % 0x20000000);
+ // }
+ // else if (classId <= 0x7F) {
+ // return (int8_t)apache::geode::client::GemfireTypeIdsImpl::CacheableUserData;
+ // }
+ // else if (classId <= 0x7FFF) {
+ // return (int8_t)apache::geode::client::GemfireTypeIdsImpl::CacheableUserData2;
+ // }
+ // else {
+ // return (int8_t)apache::geode::client::GemfireTypeIdsImpl::CacheableUserData4;
+ // }
+ //}
+ //catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ // ex->ThrowNative();
+ //}
+ //catch (System::Exception^ ex) {
+ // GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ //}
+ return (int8_t)GemfireTypeIdsImpl::PDX;
+ }
- bool PdxManagedCacheableKeyBytes::hasDelta()
- {
- /* GemStone::GemFire::Cache::Generic::IGFDelta^ deltaObj = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(this->getManagedObject());
+ int8_t PdxManagedCacheableKeyBytes::DSFID() const
+ {
+ // convention that [0x8000000, 0xa0000000) is for FixedIDDefault,
+ // [0xa000000, 0xc0000000) is for FixedIDByte,
+ // [0xc0000000, 0xe0000000) is for FixedIDShort
+ // and [0xe0000000, 0xffffffff] is for FixedIDInt
+ // Note: depends on fact that FixedIDByte is 1, FixedIDShort is 2
+ // and FixedIDInt is 3; if this changes then correct this accordingly
+ //uint32_t classId = m_managedptr->ClassId;
+ /* uint32_t classId = m_classId;
+ if (classId >= 0x80000000) {
+ return (int8_t)((classId - 0x80000000) / 0x20000000);
+ }*/
+ return 0;
+ }
- if(deltaObj)
- return deltaObj->HasDelta();*/
- return m_hasDelta;
- }
+ apache::geode::client::CacheableStringPtr PdxManagedCacheableKeyBytes::toString() const
+ {
+ try {
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^ manageObject = getManagedObject();
+ if (manageObject != nullptr)
+ {
+ apache::geode::client::CacheableStringPtr cStr;
+ GemStone::GemFire::Cache::Generic::CacheableString::GetCacheableString(
+ manageObject->ToString(), cStr);
+ return cStr;
+ }
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return NULLPTR;
+ }
- void PdxManagedCacheableKeyBytes::toDelta( DataOutput& output) const
- {
- try {
- GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
- GemStone::GemFire::Cache::Generic::IGFDelta^ deltaObj = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(this->getManagedObject());
- GemStone::GemFire::Cache::Generic::DataOutput mg_output( &output, true );
- deltaObj->ToDelta( %mg_output );
- mg_output.WriteBytesToUMDataOutput();
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- }
-
- void PdxManagedCacheableKeyBytes::fromDelta( DataInput& input )
- {
- try {
- GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta:");
- GemStone::GemFire::Cache::Generic::IGFDelta^ deltaObj = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(this->getManagedObject());
- GemStone::GemFire::Cache::Generic::DataInput mg_input( &input, true );
- deltaObj->FromDelta( %mg_input );
-
- GemStone::GemFire::Cache::Generic::IPdxSerializable^ managedptr =
- dynamic_cast <GemStone::GemFire::Cache::Generic::IPdxSerializable^> ( deltaObj );
- // if(managedptr != nullptr)
+ bool PdxManagedCacheableKeyBytes::operator ==(const apache::geode::client::CacheableKey& other) const
{
- GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
- //GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta: classid " + managedptr->ClassId + " : " + managedptr->ToString());
- gemfire::DataOutput dataOut;
- GemStone::GemFire::Cache::Generic::DataOutput mg_output( &dataOut, true);
- //managedptr->ToData( %mg_output );
- GemStone::GemFire::Cache::Generic::Internal::PdxHelper::SerializePdx(%mg_output, managedptr);
- //m_managedptr->ToData( %mg_output );
- //this will move the cursor in c++ layer
- mg_output.WriteBytesToUMDataOutput();
-
- //move cursor
- // dataOut.advanceCursor(mg_output.BufferLength);
-
- GF_SAFE_DELETE(m_bytes);
- m_bytes = dataOut.getBufferCopy();
- m_size = dataOut.getBufferLength();
- GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta objectSize = " + m_size + " m_hashCode = " + m_hashCode);
- m_hashCode = managedptr->GetHashCode();
+ try {
+ // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal");
+ // now checking classId(), typeId(), DSFID() etc. will be much more
+ // expensive than just a dynamic_cast
+ const PdxManagedCacheableKeyBytes* p_other =
+ dynamic_cast<const PdxManagedCacheableKeyBytes*>(&other);
+ if (p_other != NULL) {
+ apache::geode::client::DataInput di(m_bytes, m_size);
+ GemStone::GemFire::Cache::Generic::DataInput mg_input(&di, true);
+ /* GemStone::GemFire::Cache::Generic::IGFSerializable^ obj =
+ GemStone::GemFire::Cache::Generic::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
+ obj->FromData(%mg_input);*/
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^ obj = getManagedObject();
+ bool ret = obj->Equals(p_other->ptr());
+ // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal return VAL = " + ret);
+ return ret;
+ }
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal returns false");
+ return false;
}
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- }
-
- DeltaPtr PdxManagedCacheableKeyBytes::clone()
- {
- try {
- GemStone::GemFire::Cache::Generic::IGFDelta^ deltaObj = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(this->getManagedObject());
- ICloneable^ cloneable = dynamic_cast< ICloneable^ >( ( GemStone::GemFire::Cache::Generic::IGFDelta^ ) deltaObj );
- if ( cloneable ) {
- GemStone::GemFire::Cache::Generic::IPdxSerializable^ Mclone =
- dynamic_cast< GemStone::GemFire::Cache::Generic::IPdxSerializable^ >( cloneable->Clone( ) );
- return DeltaPtr( static_cast< PdxManagedCacheableKeyBytes* >(
- SafeGenericM2UMConvert( Mclone ) ) );
+
+ bool PdxManagedCacheableKeyBytes::operator ==(const PdxManagedCacheableKeyBytes& other) const
+ {
+ try {
+ //GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal. ");
+ apache::geode::client::DataInput di(m_bytes, m_size);
+ GemStone::GemFire::Cache::Generic::DataInput mg_input(&di, true);
+ /*GemStone::GemFire::Cache::Generic::IGFSerializable^ obj =
+ GemStone::GemFire::Cache::Generic::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
+ obj->FromData(%mg_input);*/
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^ obj = getManagedObject();
+ bool ret = obj->Equals(other.ptr());
+ // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal return VAL = " + ret);
+ return ret;
+ //return obj->Equals(other.ptr());
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::equal return false");
+ return false;
}
- else {
- return Delta::clone( );
+
+ uint32_t PdxManagedCacheableKeyBytes::hashcode() const
+ {
+ return m_hashCode;
+ }
+
+ size_t PdxManagedCacheableKeyBytes::logString(char* buffer, size_t maxLength) const
+ {
+ try {
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^ manageObject = getManagedObject();
+ if (manageObject != nullptr)
+ {
+ if (maxLength > 0) {
+ String^ logstr = manageObject->GetType()->Name + '(' +
+ manageObject->ToString() + ')';
+ GemStone::GemFire::Cache::Generic::ManagedString mg_str(logstr);
+ return snprintf(buffer, maxLength, "%s", mg_str.CharPtr);
+ }
+ }
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return 0;
+ }
+
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^
+ PdxManagedCacheableKeyBytes::getManagedObject() const
+ {
+
+ // GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::getManagedObject " + m_size);
+
+ apache::geode::client::DataInput dinp(m_bytes, m_size);
+ GemStone::GemFire::Cache::Generic::DataInput mg_dinp(&dinp, true);
+ /*TypeFactoryMethodGeneric^ creationMethod =
+ GemStone::GemFire::Cache::Generic::Serializable::GetTypeFactoryMethodGeneric(m_classId);
+ GemStone::GemFire::Cache::Generic::IGFSerializable^ newObj = creationMethod();
+ return newObj->FromData(%mg_dinp);*/
+ return GemStone::GemFire::Cache::Generic::Internal::PdxHelper::DeserializePdx(%mg_dinp, false);
+ }
+
+ bool PdxManagedCacheableKeyBytes::hasDelta()
+ {
+ /* GemStone::GemFire::Cache::Generic::IGFDelta^ deltaObj = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(this->getManagedObject());
+
+ if(deltaObj)
+ return deltaObj->HasDelta();*/
+ return m_hasDelta;
}
- }
- catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
- }
- return NULLPTR;
- }
-
-}
+
+ void PdxManagedCacheableKeyBytes::toDelta(DataOutput& output) const
+ {
+ try {
+ GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+ GemStone::GemFire::Cache::Generic::IGFDelta^ deltaObj = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(this->getManagedObject());
+ GemStone::GemFire::Cache::Generic::DataOutput mg_output(&output, true);
+ deltaObj->ToDelta(%mg_output);
+ mg_output.WriteBytesToUMDataOutput();
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ }
+
+ void PdxManagedCacheableKeyBytes::fromDelta(DataInput& input)
+ {
+ try {
+ GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta:");
+ GemStone::GemFire::Cache::Generic::IGFDelta^ deltaObj = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(this->getManagedObject());
+ GemStone::GemFire::Cache::Generic::DataInput mg_input(&input, true);
+ deltaObj->FromDelta(%mg_input);
+
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^ managedptr =
+ dynamic_cast <GemStone::GemFire::Cache::Generic::IPdxSerializable^> (deltaObj);
+ // if(managedptr != nullptr)
+ {
+ GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+ //GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta: classid " + managedptr->ClassId + " : " + managedptr->ToString());
+ apache::geode::client::DataOutput dataOut;
+ GemStone::GemFire::Cache::Generic::DataOutput mg_output(&dataOut, true);
+ //managedptr->ToData( %mg_output );
+ GemStone::GemFire::Cache::Generic::Internal::PdxHelper::SerializePdx(%mg_output, managedptr);
+ //m_managedptr->ToData( %mg_output );
+ //this will move the cursor in c++ layer
+ mg_output.WriteBytesToUMDataOutput();
+
+ //move cursor
+ // dataOut.advanceCursor(mg_output.BufferLength);
+
+ GF_SAFE_DELETE(m_bytes);
+ m_bytes = dataOut.getBufferCopy();
+ m_size = dataOut.getBufferLength();
+ GemStone::GemFire::Cache::Generic::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta objectSize = " + m_size + " m_hashCode = " + m_hashCode);
+ m_hashCode = managedptr->GetHashCode();
+ }
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ }
+
+ DeltaPtr PdxManagedCacheableKeyBytes::clone()
+ {
+ try {
+ GemStone::GemFire::Cache::Generic::IGFDelta^ deltaObj = dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^>(this->getManagedObject());
+ ICloneable^ cloneable = dynamic_cast<ICloneable^>((GemStone::GemFire::Cache::Generic::IGFDelta^) deltaObj);
+ if (cloneable) {
+ GemStone::GemFire::Cache::Generic::IPdxSerializable^ Mclone =
+ dynamic_cast<GemStone::GemFire::Cache::Generic::IPdxSerializable^>(cloneable->Clone());
+ return DeltaPtr(static_cast<PdxManagedCacheableKeyBytes*>(
+ SafeGenericM2UMConvert(Mclone)));
+ }
+ else {
+ return Delta::clone();
+ }
+ }
+ catch (GemStone::GemFire::Cache::Generic::GemFireException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GemStone::GemFire::Cache::Generic::GemFireException::ThrowNative(ex);
+ }
+ return NULLPTR;
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
index d89ddd2..d14537e 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
@@ -39,15 +39,19 @@ namespace GemStone
}
}
-namespace gemfire
+namespace apache
{
+ namespace geode
+ {
+ namespace client
+ {
/// <summary>
/// Wraps the managed <see cref="GemStone.GemFire.Cache.IGFSerializable" />
- /// object and implements the native <c>gemfire::CacheableKey</c> interface.
+ /// object and implements the native <c>apache::geode::client::CacheableKey</c> interface.
/// </summary>
class PdxManagedCacheableKeyBytes
- : public gemfire::CacheableKey, public Delta
+ : public apache::geode::client::CacheableKey, public Delta
{
public:
@@ -76,7 +80,7 @@ namespace gemfire
{
if(storeBytes)//if value is from app
{
- gemfire::DataOutput dataOut;
+ apache::geode::client::DataOutput dataOut;
GemStone::GemFire::Cache::Generic::DataOutput mg_output( &dataOut, true);
GemStone::GemFire::Cache::Generic::Internal::PdxHelper::SerializePdx(%mg_output, managedptr);
// managedptr->ToData( %mg_output );
@@ -107,21 +111,21 @@ namespace gemfire
/// <summary>
/// serialize this object
/// </summary>
- virtual void toData( gemfire::DataOutput& output ) const;
+ virtual void toData( apache::geode::client::DataOutput& output ) const;
/// <summary>
/// deserialize this object, typical implementation should return
/// the 'this' pointer.
/// </summary>
- virtual gemfire::Serializable* fromData( gemfire::DataInput& input );
+ virtual apache::geode::client::Serializable* fromData( apache::geode::client::DataInput& input );
- virtual void toDelta( gemfire::DataOutput& output) const;
+ virtual void toDelta( apache::geode::client::DataOutput& output) const;
- virtual void fromDelta( gemfire::DataInput& input );
+ virtual void fromDelta( apache::geode::client::DataInput& input );
virtual bool hasDelta();
- virtual gemfire::DeltaPtr clone();
+ virtual apache::geode::client::DeltaPtr clone();
/// <summary>
/// return the size of this object in bytes
@@ -156,12 +160,12 @@ namespace gemfire
/// Display this object as 'string', which depends on the implementation in
/// the managed class
/// </summary>
- virtual gemfire::CacheableStringPtr toString( ) const;
+ virtual apache::geode::client::CacheableStringPtr toString( ) const;
/// <summary>
/// return true if this key matches other CacheableKey
/// </summary>
- virtual bool operator == ( const gemfire::CacheableKey& other ) const;
+ virtual bool operator == ( const apache::geode::client::CacheableKey& other ) const;
/// <summary>
/// return true if this key matches other ManagedCacheableKeyBytes
/// </summary>
@@ -225,4 +229,7 @@ namespace gemfire
PdxManagedCacheableKeyBytes& operator = ( const PdxManagedCacheableKeyBytes& );
};
-}
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+
http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp b/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
index b9846e9..04d2a17 100644
--- a/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
+++ b/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
@@ -283,8 +283,8 @@ namespace GemStone
void PdxReaderWithTypeCollector::ReadCollection( String^ fieldName, System::Collections::IList^ obj)
{
- checkType(fieldName, gemfire::GemfireTypeIds::CacheableArrayList, "Collection");
- m_newPdxType->AddVariableLengthTypeField(fieldName, /*obj->GetType()->FullName*/"Collection", gemfire::GemfireTypeIds::CacheableArrayList);
+ checkType(fieldName, apache::geode::client::GemfireTypeIds::CacheableArrayList, "Collection");
+ m_newPdxType->AddVariableLengthTypeField(fieldName, /*obj->GetType()->FullName*/"Collection", apache::geode::client::GemfireTypeIds::CacheableArrayList);
int position = m_pdxType->GetFieldPosition(fieldName, m_offsetsBuffer, m_offsetSize, m_serializedLength);
if(position != -1)
{
http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp b/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
index 0a539a4..d89a31d 100644
--- a/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
+++ b/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
@@ -217,7 +217,7 @@ namespace GemStone
IPdxWriter^ PdxWriterWithTypeCollector::WriteCollection( String^ fieldName, System::Collections::IList^ obj)
{
- m_pdxType->AddVariableLengthTypeField(fieldName, /*obj->GetType()->FullName*/"Collection", gemfire::GemfireTypeIds::CacheableArrayList);
+ m_pdxType->AddVariableLengthTypeField(fieldName, /*obj->GetType()->FullName*/"Collection", apache::geode::client::GemfireTypeIds::CacheableArrayList);
PdxLocalWriter::WriteCollection(fieldName, obj);
return this;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/ResultCollectorProxy.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ResultCollectorProxy.hpp b/src/clicache/src/impl/ResultCollectorProxy.hpp
index d6c63e2..6f2d5c3 100644
--- a/src/clicache/src/impl/ResultCollectorProxy.hpp
+++ b/src/clicache/src/impl/ResultCollectorProxy.hpp
@@ -53,7 +53,7 @@ namespace GemStone
virtual void AddResult( Object^ rs )
{
- //gemfire::CacheablePtr nativeptr(rs);
+ //apache::geode::client::CacheablePtr nativeptr(rs);
//TResult grs = Serializable::GetManagedValueGeneric<TResult>( nativeptr);
m_rscoll->AddResult(safe_cast<TResult>(rs));
}
http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/SafeConvert.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/SafeConvert.hpp b/src/clicache/src/impl/SafeConvert.hpp
index 6298b6c..ed0bfdd 100644
--- a/src/clicache/src/impl/SafeConvert.hpp
+++ b/src/clicache/src/impl/SafeConvert.hpp
@@ -55,25 +55,25 @@ namespace GemStone
};
/// <summary>
- /// Helper function to convert native <c>gemfire::Serializable</c> object
+ /// Helper function to convert native <c>apache::geode::client::Serializable</c> object
/// to managed <see cref="IGFSerializable" /> object.
/// </summary>
inline static GemStone::GemFire::Cache::Generic::IGFSerializable^
- SafeUMSerializableConvertGeneric( gemfire::Serializable* obj )
+ SafeUMSerializableConvertGeneric( apache::geode::client::Serializable* obj )
{
if (obj == nullptr) return nullptr;
- gemfire::ManagedCacheableKeyGeneric* mg_obj = nullptr;
- gemfire::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;
+ apache::geode::client::ManagedCacheableKeyGeneric* mg_obj = nullptr;
+ apache::geode::client::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- mg_obj = dynamic_cast<gemfire::ManagedCacheableKeyGeneric*>( obj );
+ mg_obj = dynamic_cast<apache::geode::client::ManagedCacheableKeyGeneric*>( obj );
else
- mg_bytesObj = dynamic_cast<gemfire::ManagedCacheableKeyBytesGeneric*>( obj );
+ mg_bytesObj = dynamic_cast<apache::geode::client::ManagedCacheableKeyBytesGeneric*>( obj );
- gemfire::ManagedCacheableDeltaGeneric* mg_obj_delta = nullptr;
- gemfire::ManagedCacheableDeltaBytesGeneric* mg_bytesObj_delta = nullptr;
+ apache::geode::client::ManagedCacheableDeltaGeneric* mg_obj_delta = nullptr;
+ apache::geode::client::ManagedCacheableDeltaBytesGeneric* mg_bytesObj_delta = nullptr;
if (mg_obj != nullptr)
{
@@ -86,9 +86,9 @@ namespace GemStone
else
{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- mg_obj_delta = dynamic_cast<gemfire::ManagedCacheableDeltaGeneric*>( obj );
+ mg_obj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaGeneric*>( obj );
else
- mg_bytesObj_delta = dynamic_cast<gemfire::ManagedCacheableDeltaBytesGeneric*>( obj );
+ mg_bytesObj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaBytesGeneric*>( obj );
if( mg_obj_delta != nullptr )
{
@@ -102,8 +102,8 @@ namespace GemStone
{
if ( obj->typeId( ) == 0 ) {
//Special case for UserFunctionExecutionException which is not registered.
- gemfire::UserFunctionExecutionException* mg_UFEEobj = nullptr;
- mg_UFEEobj = dynamic_cast<gemfire::UserFunctionExecutionException*>( obj );
+ apache::geode::client::UserFunctionExecutionException* mg_UFEEobj = nullptr;
+ mg_UFEEobj = dynamic_cast<apache::geode::client::UserFunctionExecutionException*>( obj );
if (mg_UFEEobj != nullptr)
{
return gcnew UserFunctionExecutionException(mg_UFEEobj);
@@ -128,7 +128,7 @@ namespace GemStone
/// <remarks>
/// <para>
/// Consider the scenario that we have both native objects of class
- /// <c>gemfire::Serializable</c> and managed objects of class
+ /// <c>apache::geode::client::Serializable</c> and managed objects of class
/// <see cref="IGFSerializable" /> in a Region.
/// </para><para>
/// The former would be passed wrapped inside the
@@ -150,8 +150,8 @@ namespace GemStone
inline static NativeType* SafeM2UMConvertGeneric( ManagedType^ mg_obj )
{
/*
- *return SafeM2UMConvertGeneric<IGFSerializable, gemfire::ManagedCacheableKey,
- gemfire::Serializable, Serializable>( mg_obj );
+ *return SafeM2UMConvertGeneric<IGFSerializable, apache::geode::client::ManagedCacheableKey,
+ apache::geode::client::Serializable, Serializable>( mg_obj );
*/
//TODO: need to look this further for all types
if (mg_obj == nullptr) return NULL;
@@ -169,15 +169,15 @@ namespace GemStone
dynamic_cast<GemStone::GemFire::Cache::Generic::IGFDelta^> (mg_obj);
if(sDelta != nullptr){
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new gemfire::ManagedCacheableDeltaGeneric( sDelta);
+ return new apache::geode::client::ManagedCacheableDeltaGeneric( sDelta);
else
- return new gemfire::ManagedCacheableDeltaBytesGeneric( sDelta, true);
+ return new apache::geode::client::ManagedCacheableDeltaBytesGeneric( sDelta, true);
}
else{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
return new ManagedWrapper(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
else
- return new gemfire::ManagedCacheableKeyBytesGeneric( mg_obj, true);
+ return new apache::geode::client::ManagedCacheableKeyBytesGeneric( mg_obj, true);
}
}
//if (mg_obj == nullptr) return NULL;
@@ -191,21 +191,21 @@ namespace GemStone
}
generic<class TValue>
- inline static TValue SafeGenericUMSerializableConvert( gemfire::Serializable* obj )
+ inline static TValue SafeGenericUMSerializableConvert( apache::geode::client::Serializable* obj )
{
if (obj == nullptr) return TValue();
- gemfire::ManagedCacheableKeyGeneric* mg_obj = nullptr;
- gemfire::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;
+ apache::geode::client::ManagedCacheableKeyGeneric* mg_obj = nullptr;
+ apache::geode::client::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- mg_obj = dynamic_cast<gemfire::ManagedCacheableKeyGeneric*>( obj );
+ mg_obj = dynamic_cast<apache::geode::client::ManagedCacheableKeyGeneric*>( obj );
else
- mg_bytesObj = dynamic_cast<gemfire::ManagedCacheableKeyBytesGeneric*>( obj );
+ mg_bytesObj = dynamic_cast<apache::geode::client::ManagedCacheableKeyBytesGeneric*>( obj );
- gemfire::ManagedCacheableDeltaGeneric* mg_obj_delta = nullptr;
- gemfire::ManagedCacheableDeltaBytesGeneric* mg_bytesObj_delta = nullptr;
+ apache::geode::client::ManagedCacheableDeltaGeneric* mg_obj_delta = nullptr;
+ apache::geode::client::ManagedCacheableDeltaBytesGeneric* mg_bytesObj_delta = nullptr;
if (mg_obj != nullptr)
{
@@ -218,9 +218,9 @@ namespace GemStone
else
{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- mg_obj_delta = dynamic_cast<gemfire::ManagedCacheableDeltaGeneric*>( obj );
+ mg_obj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaGeneric*>( obj );
else
- mg_bytesObj_delta = dynamic_cast<gemfire::ManagedCacheableDeltaBytesGeneric*>( obj );
+ mg_bytesObj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaBytesGeneric*>( obj );
if( mg_obj_delta != nullptr )
{
@@ -233,8 +233,8 @@ namespace GemStone
else
{
if ( obj->typeId( ) == 0 ) {
- gemfire::UserFunctionExecutionException* mg_UFEEobj = nullptr;
- mg_UFEEobj = dynamic_cast<gemfire::UserFunctionExecutionException*>( obj );
+ apache::geode::client::UserFunctionExecutionException* mg_UFEEobj = nullptr;
+ mg_UFEEobj = dynamic_cast<apache::geode::client::UserFunctionExecutionException*>( obj );
if (mg_UFEEobj != nullptr)
{
return safe_cast<TValue> (gcnew UserFunctionExecutionException(mg_UFEEobj));
@@ -254,20 +254,20 @@ namespace GemStone
/// <summary>
/// Helper function to convert managed <see cref="IGFSerializable" />
- /// object to native <c>gemfire::Serializable</c> object using
+ /// object to native <c>apache::geode::client::Serializable</c> object using
/// <c>SafeM2UMConvert</c>.
/// </summary>
- inline static gemfire::Serializable* SafeMSerializableConvertGeneric(
+ inline static apache::geode::client::Serializable* SafeMSerializableConvertGeneric(
GemStone::GemFire::Cache::Generic::IGFSerializable^ mg_obj )
{
//it is called for cacheables types only
return SafeM2UMConvertGeneric<GemStone::GemFire::Cache::Generic::IGFSerializable,
- gemfire::ManagedCacheableKeyGeneric, gemfire::Serializable,
+ apache::geode::client::ManagedCacheableKeyGeneric, apache::geode::client::Serializable,
GemStone::GemFire::Cache::Generic::Serializable>( mg_obj );
}
generic<class TValue>
- inline static gemfire::Cacheable* SafeGenericM2UMConvert( TValue mg_val )
+ inline static apache::geode::client::Cacheable* SafeGenericM2UMConvert( TValue mg_val )
{
if (mg_val == nullptr) return NULL;
@@ -289,9 +289,9 @@ namespace GemStone
{
//TODO:: probably need to do for appdomain
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new gemfire::PdxManagedCacheableKey(pdxType);
+ return new apache::geode::client::PdxManagedCacheableKey(pdxType);
else
- return new gemfire::PdxManagedCacheableKeyBytes(pdxType, true);
+ return new apache::geode::client::PdxManagedCacheableKeyBytes(pdxType, true);
}
GemStone::GemFire::Cache::Generic::IGFDelta^ sDelta =
@@ -299,9 +299,9 @@ namespace GemStone
if(sDelta != nullptr)
{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new gemfire::ManagedCacheableDeltaGeneric( sDelta);
+ return new apache::geode::client::ManagedCacheableDeltaGeneric( sDelta);
else
- return new gemfire::ManagedCacheableDeltaBytesGeneric( sDelta, true);
+ return new apache::geode::client::ManagedCacheableDeltaBytesGeneric( sDelta, true);
}
else
{
@@ -311,11 +311,11 @@ namespace GemStone
{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
{
- return new gemfire::ManagedCacheableKeyGeneric( tmpIGFS );
+ return new apache::geode::client::ManagedCacheableKeyGeneric( tmpIGFS );
}
else
{
- return new gemfire::ManagedCacheableKeyBytesGeneric( tmpIGFS, true);
+ return new apache::geode::client::ManagedCacheableKeyBytesGeneric( tmpIGFS, true);
}
}
@@ -323,30 +323,30 @@ namespace GemStone
{
//TODO:: probably need to do for appdomain
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new gemfire::PdxManagedCacheableKey(gcnew PdxWrapper(mg_obj));
+ return new apache::geode::client::PdxManagedCacheableKey(gcnew PdxWrapper(mg_obj));
else
- return new gemfire::PdxManagedCacheableKeyBytes(gcnew PdxWrapper(mg_obj), true);
+ return new apache::geode::client::PdxManagedCacheableKeyBytes(gcnew PdxWrapper(mg_obj), true);
}
throw gcnew GemStone::GemFire::Cache::Generic::IllegalStateException(String::Format("Unable to map object type {0}. Possible Object type may not be registered or PdxSerializer is not registered. ", mg_obj->GetType()));
}
}
generic<class TValue>
- inline static gemfire::Cacheable* SafeGenericMSerializableConvert( TValue mg_obj )
+ inline static apache::geode::client::Cacheable* SafeGenericMSerializableConvert( TValue mg_obj )
{
return SafeGenericM2UMConvert<TValue>( mg_obj );
}
- inline static IPdxSerializable^ SafeUMSerializablePDXConvert( gemfire::Serializable* obj )
+ inline static IPdxSerializable^ SafeUMSerializablePDXConvert( apache::geode::client::Serializable* obj )
{
- gemfire::PdxManagedCacheableKey* mg_obj = nullptr;
+ apache::geode::client::PdxManagedCacheableKey* mg_obj = nullptr;
- mg_obj = dynamic_cast<gemfire::PdxManagedCacheableKey*>( obj );
+ mg_obj = dynamic_cast<apache::geode::client::PdxManagedCacheableKey*>( obj );
if(mg_obj != nullptr)
return mg_obj->ptr();
- gemfire::PdxManagedCacheableKeyBytes* mg_bytes = dynamic_cast<gemfire::PdxManagedCacheableKeyBytes*>( obj );
+ apache::geode::client::PdxManagedCacheableKeyBytes* mg_bytes = dynamic_cast<apache::geode::client::PdxManagedCacheableKeyBytes*>( obj );
if(mg_bytes != nullptr)
return mg_bytes->ptr();
@@ -355,21 +355,21 @@ namespace GemStone
}
/// <summary>
- /// Helper function to convert native <c>gemfire::CacheableKey</c> object
+ /// Helper function to convert native <c>apache::geode::client::CacheableKey</c> object
/// to managed <see cref="ICacheableKey" /> object.
/// </summary>
generic<class TKey>
- inline static Generic::ICacheableKey^ SafeGenericUMKeyConvert( gemfire::CacheableKey* obj )
+ inline static Generic::ICacheableKey^ SafeGenericUMKeyConvert( apache::geode::client::CacheableKey* obj )
{
//All cacheables will be ManagedCacheableKey only
if (obj == nullptr) return nullptr;
- gemfire::ManagedCacheableKeyGeneric* mg_obj = nullptr;
- gemfire::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;
+ apache::geode::client::ManagedCacheableKeyGeneric* mg_obj = nullptr;
+ apache::geode::client::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;
if (!SafeConvertClassGeneric::isAppDomainEnabled)
- mg_obj = dynamic_cast<gemfire::ManagedCacheableKeyGeneric*>( obj );
+ mg_obj = dynamic_cast<apache::geode::client::ManagedCacheableKeyGeneric*>( obj );
else
- mg_bytesObj = dynamic_cast<gemfire::ManagedCacheableKeyBytesGeneric*>( obj );
+ mg_bytesObj = dynamic_cast<apache::geode::client::ManagedCacheableKeyBytesGeneric*>( obj );
if (mg_obj != nullptr)
{
@@ -392,10 +392,10 @@ namespace GemStone
}
generic <class TKey>
- inline static gemfire::CacheableKey* SafeGenericMKeyConvert( TKey mg_obj )
+ inline static apache::geode::client::CacheableKey* SafeGenericMKeyConvert( TKey mg_obj )
{
if (mg_obj == nullptr) return NULL;
- gemfire::CacheableKey* obj = GemStone::GemFire::Cache::Generic::Serializable::GetUnmanagedValueGeneric<TKey>( mg_obj ).ptr();
+ apache::geode::client::CacheableKey* obj = GemStone::GemFire::Cache::Generic::Serializable::GetUnmanagedValueGeneric<TKey>( mg_obj ).ptr();
if (obj != nullptr)
{
return obj;
@@ -403,9 +403,9 @@ namespace GemStone
else
{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new gemfire::ManagedCacheableKeyGeneric( SafeUMSerializableConvertGeneric(obj) );
+ return new apache::geode::client::ManagedCacheableKeyGeneric( SafeUMSerializableConvertGeneric(obj) );
else
- return new gemfire::ManagedCacheableKeyBytesGeneric( SafeUMSerializableConvertGeneric(obj), true );
+ return new apache::geode::client::ManagedCacheableKeyBytesGeneric( SafeUMSerializableConvertGeneric(obj), true );
}
}
@@ -414,24 +414,24 @@ namespace GemStone
{
if (mg_obj == nullptr) return NULL;
//for cacheables types
- //return new gemfire::ManagedCacheableKey(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
+ //return new apache::geode::client::ManagedCacheableKey(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new gemfire::ManagedCacheableKeyGeneric( mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId );
+ return new apache::geode::client::ManagedCacheableKeyGeneric( mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId );
else
- return new gemfire::ManagedCacheableKeyBytesGeneric( mg_obj, true );
+ return new apache::geode::client::ManagedCacheableKeyBytesGeneric( mg_obj, true );
}
}
- template<typename NativeType> //where NativeType : gemfire::SharedPtr<NativeType>
- //generic<typename ManagedType> where ManagedType : Internal::SBWrap<gemfire::RegionAttributes>
+ template<typename NativeType> //where NativeType : apache::geode::client::SharedPtr<NativeType>
+ //generic<typename ManagedType> where ManagedType : Internal::SBWrap<apache::geode::client::RegionAttributes>
inline static NativeType* GetNativePtrFromSBWrap( GemStone::GemFire::Cache::Generic::Internal::SBWrap<NativeType>^ mg_obj )
{
return (mg_obj != nullptr ? mg_obj->_NativePtr : NULL);
}
- template<typename NativeType> //where NativeType : gemfire::SharedPtr<NativeType>
- //generic<typename ManagedType> where ManagedType : Internal::SBWrap<gemfire::RegionAttributes>
+ template<typename NativeType> //where NativeType : apache::geode::client::SharedPtr<NativeType>
+ //generic<typename ManagedType> where ManagedType : Internal::SBWrap<apache::geode::client::RegionAttributes>
inline static NativeType* GetNativePtrFromSBWrapGeneric( GemStone::GemFire::Cache::Generic::Internal::SBWrap<NativeType>^ mg_obj )
{
return (mg_obj != nullptr ? mg_obj->_NativePtr : NULL);
http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/TransactionListener.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/TransactionListener.hpp b/src/clicache/src/impl/TransactionListener.hpp
index 8759199..ace2e61 100644
--- a/src/clicache/src/impl/TransactionListener.hpp
+++ b/src/clicache/src/impl/TransactionListener.hpp
@@ -54,20 +54,20 @@ namespace GemStone
virtual void AfterCommit(GemStone::GemFire::Cache::TransactionEvent^ event) override
{
- GemStone::GemFire::Cache::Generic::TransactionEvent<TKey, TValue> gevent(GetNativePtr<gemfire::TransactionEvent>(event));
+ GemStone::GemFire::Cache::Generic::TransactionEvent<TKey, TValue> gevent(GetNativePtr<apache::geode::client::TransactionEvent>(event));
m_listener->AfterCommit(%gevent);
}
virtual void AfterFailedCommit(GemStone::GemFire::Cache::TransactionEvent^ event) override
{
- GemStone::GemFire::Cache::Generic::TransactionEvent<TKey, TValue> gevent(GetNativePtr<gemfire::TransactionEvent>(event));
+ GemStone::GemFire::Cache::Generic::TransactionEvent<TKey, TValue> gevent(GetNativePtr<apache::geode::client::TransactionEvent>(event));
m_listener->AfterFailedCommit(%gevent);
}
virtual void AfterRollback(GemStone::GemFire::Cache::TransactionEvent^ event) override
{
- GemStone::GemFire::Cache::Generic::TransactionEvent<TKey, TValue> gevent(GetNativePtr<gemfire::TransactionEvent>(event));
+ GemStone::GemFire::Cache::Generic::TransactionEvent<TKey, TValue> gevent(GetNativePtr<apache::geode::client::TransactionEvent>(event));
m_listener->AfterRollback(%gevent);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/e4fd74fb/src/clicache/src/impl/TransactionWriter.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/TransactionWriter.hpp b/src/clicache/src/impl/TransactionWriter.hpp
index 78efbe7..74eb1a2 100644
--- a/src/clicache/src/impl/TransactionWriter.hpp
+++ b/src/clicache/src/impl/TransactionWriter.hpp
@@ -54,7 +54,7 @@ namespace GemStone
virtual void BeforeCommit(GemStone::GemFire::Cache::TransactionEvent^ te) override
{
- GemStone::GemFire::Cache::Generic::TransactionEvent<TKey, TValue> gevent(GetNativePtr<gemfire::TransactionEvent>(te));
+ GemStone::GemFire::Cache::Generic::TransactionEvent<TKey, TValue> gevent(GetNativePtr<apache::geode::client::TransactionEvent>(te));
m_writer->BeforeCommit(%gevent);
}