You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by rv...@apache.org on 2016/05/19 15:14:12 UTC
[05/51] [partial] incubator-geode git commit: Add source for geode
c++ and .net clients
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheTransactionManagerMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheTransactionManagerMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheTransactionManagerMN.hpp
new file mode 100644
index 0000000..175d4f8
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheTransactionManagerMN.hpp
@@ -0,0 +1,262 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "../../gf_defs.hpp"
+#include <cppcache/CacheTransactionManager.hpp>
+#include <cppcache/InternalCacheTransactionManager2PC.hpp>
+#include "TransactionIdMN.hpp"
+//#include "impl/NativeWrapperN.hpp"
+//#include "impl/TransactionWriterMN.hpp"
+//#include "impl/TransactionListenerMN.hpp"
+
+using namespace System;
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache {
+ namespace Generic
+ {
+
+ /// <summary>
+ /// CacheTransactionManager encapsulates the transactions for a cache
+ /// </summary>
+ public ref class CacheTransactionManager sealed
+ : Internal::SBWrap<gemfire::InternalCacheTransactionManager2PC>
+ {
+ public:
+ /// <summary>
+ /// Creates a new transaction and associates it with the current thread.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// Throws exception if the thread is already associated with a transaction
+ /// </exception>
+ void Begin();
+
+ /// <summary>
+ /// Prepare the first message of two-phase-commit transaction associated
+ /// with the current thread.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// if the thread is not associated with a transaction
+ /// </exception>
+ /// <exception cref="CommitConflictException">
+ /// if the commit operation fails due to a write conflict.
+ /// </exception>
+ void Prepare();
+
+ /// <summary>
+ /// Commit the transaction associated with the current thread. If
+ /// the commit operation fails due to a conflict it will destroy
+ /// the transaction state and throw a <c>CommitConflictException</c>.
+ /// If the commit operation succeeds,it returns after the transaction
+ /// state has been merged with committed state. When this method
+ /// completes, the thread is no longer associated with a transaction.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// if the thread is not associated with a transaction
+ /// </exception>
+ /// <exception cref="CommitConflictException">
+ /// if the commit operation fails due to a write conflict.
+ /// </exception>
+ void Commit();
+
+ /// <summary>
+ /// Roll back the transaction associated with the current thread. When
+ /// this method completes, the thread is no longer associated with a
+ /// transaction and the transaction context is destroyed.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// if the thread is not associated with a transaction
+ /// </exception>
+ void Rollback();
+
+ /// <summary>
+ /// Reports the existence of a Transaction for this thread
+ /// </summary>
+ /// <returns>true if a transaction exists, false otherwise</returns>
+ bool Exists();
+
+ /// <summary>
+ /// Suspends the transaction on the current thread. All subsequent operations
+ /// performed by this thread will be non-transactional. The suspended
+ /// transaction can be resumed by calling <see cref="TransactionId"/>
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <returns>the transaction identifier of the suspended transaction or null if
+ /// the thread was not associated with a transaction</returns>
+ GemStone::GemFire::Cache::Generic::TransactionId^ Suspend();
+
+ /// <summary>
+ /// On the current thread, resumes a transaction that was previously suspended
+ /// using <see cref="suspend"/>
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <param name="transactionId">the transaction to resume</param>
+ /// <exception cref="IllegalStateException">if the thread is associated with a transaction or if
+ /// would return false for the given transactionId</exception>
+ /// <see cref="TransactionId"/>
+ void Resume(GemStone::GemFire::Cache::Generic::TransactionId^ transactionId);
+
+ /// <summary>
+ /// This method can be used to determine if a transaction with the given
+ /// transaction identifier is currently suspended locally. This method does not
+ /// check other members for transaction status.
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <param name="transactionId"></param>
+ /// <returns>true if the transaction is in suspended state, false otherwise</returns>
+ /// <see cref="TransactionId"/>
+ bool IsSuspended(GemStone::GemFire::Cache::Generic::TransactionId^ transactionId);
+
+
+ /// <summary>
+ /// On the current thread, resumes a transaction that was previously suspended
+ /// using <see cref="suspend"/>.
+ /// This method is equivalent to
+ /// <code>
+ /// if (isSuspended(txId)) {
+ /// resume(txId);
+ /// }
+ /// </code>
+ /// except that this action is performed atomically
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <param name="transactionId">the transaction to resume</param>
+ /// <returns>true if the transaction was resumed, false otherwise</returns>
+ bool TryResume(GemStone::GemFire::Cache::Generic::TransactionId^ transactionId);
+
+
+ /// <summary>
+ /// On the current thread, resumes a transaction that was previously suspended
+ /// using <see cref="suspend"/>, or waits for the specified timeout interval if
+ /// the transaction has not been suspended. This method will return if:
+ /// <para>
+ /// Another thread suspends the transaction
+ /// </para>
+ /// <para>
+ /// Another thread calls commit/rollback on the transaction
+ /// </para>
+ /// <para>
+ /// This thread has waited for the specified timeout
+ /// </para>
+ /// This method returns immediately if <see cref="TransactionId"/> returns false.
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <param name="transactionId">the transaction to resume</param>
+ /// <param name="waitTimeInMilliSec">the maximum milliseconds to wait </param>
+ /// <returns>true if the transaction was resumed, false otherwise</returns>
+ bool TryResume(GemStone::GemFire::Cache::Generic::TransactionId^ transactionId, int32_t waitTimeInMilliSec);
+
+
+
+ /// <summary>
+ /// Reports the existence of a transaction for the given transactionId. This
+ /// method can be used to determine if a transaction with the given transaction
+ /// identifier is currently in progress locally.
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <param name="transactionId">the given transaction identifier</param>
+ /// <returns>true if the transaction is in progress, false otherwise.</returns>
+ /// <see cref="isSuspended"/>
+ bool Exists(GemStone::GemFire::Cache::Generic::TransactionId^ transactionId);
+
+
+ /// <summary>
+ /// Returns the transaction identifier for the current thread
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <returns>the transaction identifier or null if no transaction exists</returns>
+ property GemStone::GemFire::Cache::Generic::TransactionId^ TransactionId
+ {
+ //TODO::split
+ GemStone::GemFire::Cache::Generic::TransactionId^ get( );
+ }
+
+#ifdef CSTX_COMMENTED
+
+ /// <summary>
+ /// Returns the current transaction writer
+ /// </summary>
+ /// <returns>current transaction writer(<c>ITransactionWriter</c>)</returns>
+ generic<class TKey, class TValue>
+ ITransactionWriter<TKey, TValue>^ GetWriter ();
+
+ /// <summary>
+ /// Set the <c>ITransactionWriter</c> for the cache
+ /// <param name="transactionWriter">transaction writer</param>
+ generic<class TKey, class TValue>
+ void SetWriter (ITransactionWriter<TKey, TValue>^ transactionWriter);
+
+ /// <summary>
+ /// Adds a transaction listener to the end of the list of transaction listeners
+ /// on this cache.
+ /// </summary>
+ /// <param name="aListener">
+ /// the user defined transaction listener to add to the cache
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the parameter is null.
+ /// </exception>
+ generic<class TKey, class TValue>
+ void AddListener(ITransactionListener<TKey, TValue>^ aListener);
+
+ /// <summary>
+ /// Removes a transaction listener from the list of transaction listeners on this cache.
+ /// Does nothing if the specified listener has not been added.
+ /// If the specified listener has been added then the close method of the listener will
+ /// be called.
+ /// </summary>
+ /// <param name="aListener">the transaction listener to remove from the cache.</param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the parameteris null
+ /// </exception>
+ generic<class TKey, class TValue>
+ void RemoveListener(ITransactionListener<TKey, TValue>^ aListener);
+
+#endif
+
+ internal:
+
+ inline static CacheTransactionManager^ Create( gemfire::InternalCacheTransactionManager2PC* nativeptr )
+ {
+ return ( nativeptr != nullptr ?
+ gcnew CacheTransactionManager( nativeptr ) : nullptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheTransactionManager( gemfire::InternalCacheTransactionManager2PC* nativeptr )
+ : SBWrap( nativeptr ) { }
+ };
+
+ }
+ }
+}
+ } //namespace
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheWriterAdapterN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheWriterAdapterN.hpp b/geode-client-native/src/clicache/com/vmware/CacheWriterAdapterN.hpp
new file mode 100644
index 0000000..dd871f3
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheWriterAdapterN.hpp
@@ -0,0 +1,65 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "../../gf_defs.hpp"
+#include "ICacheWriterN.hpp"
+
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+
+ /// <summary>
+ /// Utility class that implements all methods in <c>ICacheWriter</c>
+ /// with empty implementations. Applications can subclass this class
+ /// and only override the methods for the events of interest.
+ /// </summary>
+ generic<class TKey, class TValue>
+ public ref class CacheWriterAdapter
+ : public ICacheWriter<TKey, TValue>
+ {
+ public:
+ virtual bool BeforeUpdate(EntryEvent<TKey, TValue>^ ev)
+ {
+ return true;
+ }
+
+ virtual bool BeforeCreate(EntryEvent<TKey, TValue>^ ev)
+ {
+ return true;
+ }
+
+ virtual bool BeforeDestroy(EntryEvent<TKey, TValue>^ ev)
+ {
+ return true;
+ }
+
+ virtual bool BeforeRegionDestroy(RegionEvent<TKey, TValue>^ ev)
+ {
+ return true;
+ }
+
+ virtual bool BeforeRegionClear(RegionEvent<TKey, TValue>^ ev)
+ {
+ return true;
+ }
+
+ virtual void Close(IRegion<TKey, TValue>^ region)
+ {
+ }
+ };
+
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableArrayListMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableArrayListMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableArrayListMN.hpp
new file mode 100644
index 0000000..736df78
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableArrayListMN.hpp
@@ -0,0 +1,87 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "../../gf_defs.hpp"
+#include "CacheableVectorMN.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ /// <summary>
+ /// A mutable <c>IGFSerializable</c> vector wrapper that can serve as
+ /// a distributable object for caching. This class extends .NET generic
+ /// <c>List</c> class.
+ /// </summary>
+ ref class CacheableArrayList
+ : public CacheableVector
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableArrayList(System::Collections::IList^ list)
+ : CacheableVector(list)
+ { }
+
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableArrayList^ Create()
+ {
+ return gcnew CacheableArrayList(gcnew System::Collections::Generic::List<Object^>());
+ }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableArrayList^ Create(System::Collections::IList^ list)
+ {
+ return gcnew CacheableArrayList(list);
+ }
+
+
+ // Region: IGFSerializable Members
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property uint32_t ClassId
+ {
+ virtual uint32_t get() override
+ {
+ return GemFireClassIds::CacheableArrayList;
+ }
+ }
+
+ // End Region: IGFSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableArrayList(gcnew System::Collections::Generic::List<Object^>());
+ }
+ };
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableBuiltinsMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableBuiltinsMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableBuiltinsMN.hpp
new file mode 100644
index 0000000..6ca8395
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableBuiltinsMN.hpp
@@ -0,0 +1,569 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+
+
+#include "../../gf_defs.hpp"
+#include <cppcache/CacheableBuiltins.hpp>
+#include "CacheableKeyMN.hpp"
+#include "SerializableMN.hpp"
+#include "ExceptionTypesMN.hpp"
+#include "GemFireClassIdsMN.hpp"
+#include "DataOutputMN.hpp"
+#include "DataInputMN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ //namespace Internal
+
+
+ /// <summary>
+ /// An immutable template wrapper for C++ <c>CacheableKey</c>s that can
+ /// serve as a distributable key object for caching.
+ /// </summary>
+ template <typename TNative, typename TManaged, uint32_t TYPEID>
+ ref class CacheableBuiltinKey
+ : public CacheableKey
+ {
+ public:
+ /// <summary>
+ /// Allocates a new instance
+ /// </summary>
+ CacheableBuiltinKey()
+ {
+ gemfire::SharedPtr<TNative>& nativeptr = TNative::create();
+
+ SetSP(nativeptr.ptr());
+ }
+
+ /// <summary>
+ /// Allocates a new instance with the given value.
+ /// </summary>
+ /// <param name="value">the value of the new instance</param>
+ CacheableBuiltinKey(TManaged value)
+ {
+ gemfire::SharedPtr<TNative>& nativeptr = TNative::create(value);
+
+ SetSP(nativeptr.ptr());
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property uint32_t ClassId
+ {
+ virtual uint32_t get() override
+ {
+ return TYPEID;
+ }
+ }
+
+ /// <summary>
+ /// Return a string representation of the object.
+ /// This returns the string for the <c>Value</c> property.
+ /// </summary>
+ virtual String^ ToString() override
+ {
+ return static_cast<TNative*>(NativePtr())->value().ToString();
+ }
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// It invokes the '==' operator of the underlying
+ /// native object.
+ /// </summary>
+ virtual bool Equals(ICacheableKey^ other) override
+ {
+ if (other == nullptr || other->ClassId != TYPEID)
+ {
+ return false;
+ }
+ return static_cast<TNative*>(NativePtr())->operator==(
+ *static_cast<TNative*>(((CacheableKey^)other)->NativePtr()));
+ }
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// It invokes the '==' operator of the underlying
+ /// native object.
+ /// </summary>
+ virtual bool Equals(Object^ obj) override
+ {
+ CacheableBuiltinKey^ otherKey =
+ dynamic_cast<CacheableBuiltinKey^>(obj);
+
+ if (otherKey != nullptr) {
+ return static_cast<TNative*>(NativePtr())->operator==(
+ *static_cast<TNative*>(otherKey->NativePtr()));
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Comparison operator against another value.
+ /// </summary>
+ bool operator == (TManaged other)
+ {
+ return (static_cast<TNative*>(NativePtr())->value() == other);
+ }
+
+ /// <summary>
+ /// Gets the value.
+ /// </summary>
+ property TManaged Value
+ {
+ inline TManaged get()
+ {
+ return static_cast<TNative*>(NativePtr())->value();
+ }
+ }
+
+ protected:
+
+ /// <summary>
+ /// Protected constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableBuiltinKey(gemfire::Serializable* nativeptr)
+ : CacheableKey(nativeptr) { }
+ };
+
+
+ /// <summary>
+ /// An immutable template array wrapper that can serve as a
+ /// distributable object for caching.
+ /// </summary>
+ template <typename TNative, typename TNativePtr, typename TManaged,
+ uint32_t TYPEID>
+ ref class CacheableBuiltinArray
+ : public Serializable
+ {
+ public:
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property uint32_t ClassId
+ {
+ virtual uint32_t get() override
+ {
+ return TYPEID;
+ }
+ }
+
+ virtual void ToData(DataOutput^ output) override
+ {
+ output->WriteObject(m_value);
+ }
+
+ virtual IGFSerializable^ FromData(DataInput^ input) override
+ {
+ input->ReadObject(m_value);
+ return this;
+ }
+
+ virtual property uint32_t ObjectSize
+ {
+ virtual uint32_t get() override
+ {
+ return (uint32_t) (m_value->Length) * sizeof(TManaged);
+ }
+ }
+ /// <summary>
+ /// Returns a copy of the underlying array.
+ /// </summary>
+ property array<TManaged>^ Value
+ {
+ inline array<TManaged>^ get()
+ {
+ return m_value;
+ }
+ }
+
+ /// <summary>
+ /// Returns the size of this array.
+ /// </summary>
+ property int32_t Length
+ {
+ inline int32_t get()
+ {
+ return m_value->Length;
+ }
+ }
+
+ virtual String^ ToString() override
+ {
+ return m_value->ToString();
+ }
+
+ /// <summary>
+ /// Returns the value at the given index.
+ /// </summary>
+ property TManaged GFINDEXER(int32_t)
+ {
+ inline TManaged get(int32_t index)
+ {
+ return m_value[index];
+ }
+ }
+
+
+ protected:
+
+ array<TManaged>^ m_value;
+ /// <summary>
+ /// Protected constructor
+ /// </summary>
+ inline CacheableBuiltinArray()
+ {
+ //TODO:Hitesh
+ //gemfire::Serializable* sp = TNative::createDeserializable();
+ //SetSP(sp);
+ }
+
+ /// <summary>
+ /// Protected constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableBuiltinArray(gemfire::Serializable* nptr)
+ : Serializable(nptr)
+ {
+ //TODO:Hitesh ??
+ // ManagedPtrWrap< gemfire::Serializable,
+ // Internal::SBWrap<gemfire::Serializable> > nptr = nativeptr;
+ TNative* nativeptr = static_cast<TNative*>(nptr);
+ int32_t len = nativeptr->length();
+ if (len > 0)
+ {
+ array<TManaged>^ buffer = gcnew array<TManaged>(len);
+ pin_ptr<TManaged> pin_buffer = &buffer[0];
+
+ memcpy((void*)pin_buffer, nativeptr->value(),
+ len * sizeof(TManaged));
+ m_value = buffer;
+ }
+ }
+
+ /// <summary>
+ /// Allocates a new instance copying from the given array.
+ /// </summary>
+ /// <remarks>
+ /// This method performs no argument checking which is the
+ /// responsibility of the caller.
+ /// </remarks>
+ /// <param name="buffer">the array to copy from</param>
+ CacheableBuiltinArray(array<TManaged>^ buffer)
+ {
+ m_value = buffer;
+ //setting local value as well
+ //m_value = gcnew array<TManaged>(buffer->Length);
+ //System::Array::Copy(buffer, 0, m_value,0, buffer->Length);
+ }
+
+ /// <summary>
+ /// Allocates a new instance copying given length from the
+ /// start of given array.
+ /// </summary>
+ /// <remarks>
+ /// This method performs no argument checking which is the
+ /// responsibility of the caller.
+ /// </remarks>
+ /// <param name="buffer">the array to copy from</param>
+ /// <param name="length">length of array from start to copy</param>
+ CacheableBuiltinArray(array<TManaged>^ buffer, int32_t length)
+ {
+ //TODO:Hitesh
+ if (length > buffer->Length) {
+ length = buffer->Length;
+ }
+ //setting local value as well
+ m_value = gcnew array<TManaged>(length);
+ System::Array::Copy(buffer, 0, m_value,0, length);
+ }
+ };
+
+
+
+
+ //n = native type
+ //m = CacheableInt(managed cacheable)
+ //mt = managed type(bool, int)
+#define _GFCLI_CACHEABLE_KEY_DEF_NEW(n, m, mt) \
+ ref class m : public CacheableBuiltinKey<n, mt, \
+ GemFireClassIds::m> \
+ { \
+ public: \
+ /** <summary>
+ * Allocates a new instance with the given value.
+ * </summary>
+ * <param name="value">the value of the new instance</param>
+ */ \
+ inline m() \
+ : CacheableBuiltinKey() { } \
+ /** <summary>
+ * Allocates a new instance with the given value.
+ * </summary>
+ * <param name="value">the value of the new instance</param>
+ */ \
+ inline m(mt value) \
+ : CacheableBuiltinKey(value) { } \
+ /** <summary>
+ * Static function to create a new instance given value.
+ * </summary>
+ * <param name="value">the value of the new instance</param>
+ */ \
+ inline static m^ Create(mt value) \
+ { \
+ return gcnew m(value); \
+ } \
+ /** <summary>
+ * Explicit conversion operator to contained value type.
+ * </summary>
+ */ \
+ inline static explicit operator mt (m^ value) \
+ { \
+ return value->Value; \
+ } \
+ \
+ /** <summary>
+ * Factory function to register this class.
+ * </summary>
+ */ \
+ static IGFSerializable^ CreateDeserializable() \
+ { \
+ return gcnew m(); \
+ } \
+ \
+ internal: \
+ static IGFSerializable^ Create(gemfire::Serializable* obj) \
+ { \
+ return (obj != nullptr ? gcnew m(obj) : nullptr); \
+ } \
+ \
+ private: \
+ inline m(gemfire::Serializable* nativeptr) \
+ : CacheableBuiltinKey(nativeptr) { } \
+ };
+
+
+#define _GFCLI_CACHEABLE_ARRAY_DEF_NEW(m, mt) \
+ ref class m : public CacheableBuiltinArray< \
+ gemfire::m, gemfire::m##Ptr, mt, GemFireClassIds::m> \
+ { \
+ public: \
+ /** <summary>
+ * Static function to create a new instance copying
+ * from the given array.
+ * </summary>
+ * <remarks>
+ * Providing a null or zero size array will return a null object.
+ * </remarks>
+ * <param name="value">the array to create the new instance</param>
+ */ \
+ inline static m^ Create(array<mt>^ value) \
+ { \
+ return (value != nullptr /*&& value->Length > 0*/ ? \
+ gcnew m(value) : nullptr); \
+ } \
+ /** <summary>
+ * Static function to create a new instance copying
+ * from the given array.
+ * </summary>
+ * <remarks>
+ * Providing a null or zero size array will return a null object.
+ * </remarks>
+ * <param name="value">the array to create the new instance</param>
+ */ \
+ inline static m^ Create(array<mt>^ value, int32_t length) \
+ { \
+ return (value != nullptr && value->Length > 0 ? \
+ gcnew m(value, length) : nullptr); \
+ } \
+ /** <summary>
+ * Explicit conversion operator to contained array type.
+ * </summary>
+ */ \
+ inline static explicit operator array<mt>^ (m^ value) \
+ { \
+ return (value != nullptr ? value->Value : nullptr); \
+ } \
+ \
+ /** <summary>
+ * Factory function to register this class.
+ * </summary>
+ */ \
+ static IGFSerializable^ CreateDeserializable() \
+ { \
+ return gcnew m(); \
+ } \
+ \
+ internal: \
+ static IGFSerializable^ Create(gemfire::Serializable* obj) \
+ { \
+ return (obj != nullptr ? gcnew m(obj) : nullptr); \
+ } \
+ \
+ private: \
+ /** <summary>
+ * Allocates a new instance
+ * </summary>
+ */ \
+ inline m() \
+ : CacheableBuiltinArray() { } \
+ /** <summary>
+ * Allocates a new instance copying from the given array.
+ * </summary>
+ * <remarks>
+ * Providing a null or zero size array will return a null object.
+ * </remarks>
+ * <param name="value">the array to create the new instance</param>
+ */ \
+ inline m(array<mt>^ value) \
+ : CacheableBuiltinArray(value) { } \
+ /** <summary>
+ * Allocates a new instance copying given length from the
+ * start of given array.
+ * </summary>
+ * <remarks>
+ * Providing a null or zero size array will return a null object.
+ * </remarks>
+ * <param name="value">the array to create the new instance</param>
+ */ \
+ inline m(array<mt>^ value, int32_t length) \
+ : CacheableBuiltinArray(value, length) { } \
+ inline m(gemfire::Serializable* nativeptr) \
+ : CacheableBuiltinArray(nativeptr) { } \
+ };
+
+
+ // Built-in CacheableKeys
+
+ /// <summary>
+ /// An immutable wrapper for booleans that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(gemfire::CacheableBoolean,
+ CacheableBoolean, bool);
+
+ /// <summary>
+ /// An immutable wrapper for bytes that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(gemfire::CacheableByte,
+ CacheableByte, Byte);
+
+ /// <summary>
+ /// An immutable wrapper for 16-bit characters that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(gemfire::CacheableWideChar,
+ CacheableCharacter, Char);
+
+ /// <summary>
+ /// An immutable wrapper for doubles that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(gemfire::CacheableDouble,
+ CacheableDouble, Double);
+
+ /// <summary>
+ /// An immutable wrapper for floats that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(gemfire::CacheableFloat,
+ CacheableFloat, Single);
+
+ /// <summary>
+ /// An immutable wrapper for 16-bit integers that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(gemfire::CacheableInt16,
+ CacheableInt16, int16_t);
+
+ /// <summary>
+ /// An immutable wrapper for 32-bit integers that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(gemfire::CacheableInt32,
+ CacheableInt32, int32_t);
+
+ /// <summary>
+ /// An immutable wrapper for 64-bit integers that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(gemfire::CacheableInt64,
+ CacheableInt64, int64_t);
+
+
+ // Built-in Cacheable array types
+
+ /// <summary>
+ /// An immutable wrapper for byte arrays that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableBytes, Byte);
+
+ /// <summary>
+ /// An immutable wrapper for array of doubles that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableDoubleArray, Double);
+
+ /// <summary>
+ /// An immutable wrapper for array of floats that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableFloatArray, Single);
+
+ /// <summary>
+ /// An immutable wrapper for array of 16-bit integers that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableInt16Array, int16_t);
+
+ /// <summary>
+ /// An immutable wrapper for array of 32-bit integers that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableInt32Array, int32_t);
+
+ /// <summary>
+ /// An immutable wrapper for array of 64-bit integers that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableInt64Array, int64_t);
+
+ /// <summary>
+ /// An immutable wrapper for array of booleans that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(BooleanArray, bool);
+
+ /// <summary>
+ /// An immutable wrapper for array of 16-bit characters that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CharArray, Char);
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableDateMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableDateMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableDateMN.cpp
new file mode 100644
index 0000000..a39de2e
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableDateMN.cpp
@@ -0,0 +1,111 @@
+/*=========================================================================
+* Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+*=========================================================================
+*/
+
+
+
+//#include "gf_includesN.hpp"
+#include "CacheableDateMN.hpp"
+#include "DataInputMN.hpp"
+#include "DataOutputMN.hpp"
+#include "LogMN.hpp"
+#include "GemFireClassIdsMN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ CacheableDate::CacheableDate(DateTime dateTime)
+ : m_dateTime(dateTime),m_hashcode(0)
+ {
+
+ // Round off dateTime to the nearest millisecond.
+ int64_t ticksToAdd = m_dateTime.Ticks % TimeSpan::TicksPerMillisecond;
+ ticksToAdd = (ticksToAdd >= (TimeSpan::TicksPerMillisecond / 2) ?
+ (TimeSpan::TicksPerMillisecond - ticksToAdd) : -ticksToAdd);
+ m_dateTime = m_dateTime.AddTicks(ticksToAdd);
+
+ }
+
+ void CacheableDate::ToData(DataOutput^ output)
+ {
+ //put as universal time
+ TimeSpan epochSpan = m_dateTime.ToUniversalTime() - EpochTime;
+ int64_t millisSinceEpoch =
+ epochSpan.Ticks / TimeSpan::TicksPerMillisecond;
+ output->WriteInt64(millisSinceEpoch);
+
+ //Log::Fine("CacheableDate::Todata time " + m_dateTime.Ticks);
+ }
+
+ IGFSerializable^ CacheableDate::FromData(DataInput^ input)
+ {
+ DateTime epochTime = EpochTime;
+ int64_t millisSinceEpoch = input->ReadInt64();
+ m_dateTime = epochTime.AddTicks(
+ millisSinceEpoch * TimeSpan::TicksPerMillisecond);
+ m_dateTime = m_dateTime.ToLocalTime();
+ //Log::Fine("CacheableDate::Fromadata time " + m_dateTime.Ticks);
+ return this;
+ }
+
+ uint32_t CacheableDate::ObjectSize::get()
+ {
+ return (uint32_t)sizeof(DateTime);
+ }
+
+ uint32_t CacheableDate::ClassId::get()
+ {
+ return GemFireClassIds::CacheableDate;
+ }
+
+ String^ CacheableDate::ToString()
+ {
+ return m_dateTime.ToString(
+ System::Globalization::CultureInfo::CurrentCulture);
+ }
+
+ int32_t CacheableDate::GetHashCode()
+ {
+ if (m_hashcode == 0) {
+ TimeSpan epochSpan = m_dateTime - EpochTime;
+ int64_t millitime =
+ epochSpan.Ticks / TimeSpan::TicksPerMillisecond;
+ m_hashcode = (int) millitime ^ (int) ((int64)millitime >> 32);
+ }
+ return m_hashcode;
+ }
+
+ bool CacheableDate::Equals(ICacheableKey^ other)
+ {
+ if (other == nullptr ||
+ other->ClassId != GemFireClassIds::CacheableDate) {
+ return false;
+ }
+ return m_dateTime.Equals(static_cast<CacheableDate^>(
+ other)->m_dateTime);
+ }
+
+ bool CacheableDate::Equals(Object^ obj)
+ {
+ CacheableDate^ otherDate =
+ dynamic_cast<CacheableDate^>(obj);
+
+ if (otherDate != nullptr) {
+ return (m_dateTime == otherDate->m_dateTime);
+ }
+ return false;
+ }
+ }
+ }
+}
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableDateMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableDateMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableDateMN.hpp
new file mode 100644
index 0000000..7c933eb
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableDateMN.hpp
@@ -0,0 +1,167 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+
+
+#include "../../gf_defs.hpp"
+#include "ICacheableKeyN.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ /// <summary>
+ /// An immutable date wrapper that can serve as a distributable
+ /// key object for caching as well as being a string value.
+ /// </summary>
+ ref class CacheableDate
+ : public ICacheableKey
+ {
+ public:
+ /// <summary>
+ /// Allocates a new default instance.
+ /// </summary>
+ inline CacheableDate()
+ { }
+
+ /// <summary>
+ /// Initializes a new instance of the <c>CacheableDate</c> to the
+ /// given <c>System.DateTime</c> value.
+ /// </summary>
+ /// <param name="dateTime">
+ /// A <c>System.DateTime</c> value to initialize this instance.
+ /// </param>
+ CacheableDate(DateTime dateTime);
+
+ /// <summary>
+ /// Static function that returns a new default instance.
+ /// </summary>
+ inline static CacheableDate^ Create()
+ {
+ return gcnew CacheableDate();
+ }
+
+ /// <summary>
+ /// Static function that returns a new instance initialized to the
+ /// given <c>System.DateTime</c> value.
+ /// </summary>
+ inline static CacheableDate^ Create(DateTime dateTime)
+ {
+ return gcnew CacheableDate(dateTime);
+ }
+
+ // Region: IGFSerializable Members
+
+ /// <summary>
+ /// Serializes this object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGFSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property uint32_t ObjectSize
+ {
+ virtual uint32_t get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property uint32_t ClassId
+ {
+ virtual uint32_t get();
+ }
+
+ /// <summary>
+ /// Return a string representation of the object.
+ /// </summary>
+ virtual String^ ToString() override;
+
+ // End Region: IGFSerializable Members
+
+
+ // Region: ICacheableKey Members
+
+ /// <summary>
+ /// Return the hashcode for this key.
+ /// </summary>
+ virtual int32_t GetHashCode() override;
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// </summary>
+ virtual bool Equals(ICacheableKey^ other);
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// </summary>
+ virtual bool Equals(Object^ obj) override;
+
+ // End Region: ICacheableKey Members
+
+ /// <summary>
+ /// Gets the <c>System.DateTime</c> value.
+ /// </summary>
+ property DateTime Value
+ {
+ inline DateTime get()
+ {
+ return m_dateTime;
+ }
+ }
+
+ /// <summary>
+ /// <c>DataTime</c> value since 1/1/1970
+ /// </summary>
+ static initonly DateTime EpochTime = DateTime(1970, 1, 1,
+ 0, 0, 0, DateTimeKind::Utc);
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableDate();
+ }
+
+ private:
+ DateTime m_dateTime;
+ int m_hashcode;
+ };
+ }
+ }
+}
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableFileNameMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableFileNameMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableFileNameMN.cpp
new file mode 100644
index 0000000..2ad65ab
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableFileNameMN.cpp
@@ -0,0 +1,99 @@
+/*=========================================================================
+* Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+*=========================================================================
+*/
+
+
+
+//#include "gf_includesN.hpp"
+#include "CacheableFileNameMN.hpp"
+#include "DataOutputMN.hpp"
+#include "DataInputMN.hpp"
+#include "GemFireClassIdsMN.hpp"
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ void CacheableFileName::ToData(DataOutput^ output)
+ {
+ if (m_str->Length <= 0xFFFF) {
+ output->WriteByte(gemfire::GemfireTypeIds::CacheableString);
+ output->WriteUTF(m_str);
+ }
+ else {
+ output->WriteByte(gemfire::GemfireTypeIds::CacheableStringHuge);
+ output->WriteUTFHuge(m_str);
+ }
+ }
+
+ IGFSerializable^ CacheableFileName::FromData(DataInput^ input)
+ {
+ unsigned char filetype = input->ReadByte();
+ if (filetype == gemfire::GemfireTypeIds::CacheableString) {
+ m_str = input->ReadUTF();
+ }
+ else {
+ m_str = input->ReadUTFHuge();
+ }
+ return this;
+ }
+
+ uint32_t CacheableFileName::ClassId::get()
+ {
+ return GemFireClassIds::CacheableFileName;
+ }
+
+ uint32_t CacheableFileName::ObjectSize::get()
+ {
+ return (uint32_t)(m_str->Length * sizeof(char));
+ }
+
+ int32_t CacheableFileName::GetHashCode()
+ {
+ if (m_str->IsNullOrEmpty(m_str)) {
+ return 0;
+ }
+ if (m_hashcode == 0) {
+ int localHashcode = 0;
+ uint32_t prime = 31;
+
+ pin_ptr<const wchar_t> pin_value = PtrToStringChars( m_str );
+ for (int32_t i = 0; i < m_str->Length; i++) {
+ localHashcode = prime*localHashcode + Char::ToLower(pin_value[i]);
+ }
+ m_hashcode = localHashcode ^ 1234321;
+ }
+ return m_hashcode;
+ }
+
+ bool CacheableFileName::Equals(ICacheableKey^ other)
+ {
+ if (other == nullptr ||
+ other->ClassId != GemFireClassIds::CacheableFileName) {
+ return false;
+ }
+ return (m_str == static_cast<CacheableFileName^>(other)->m_str);
+ }
+
+ bool CacheableFileName::Equals(Object^ obj)
+ {
+ CacheableFileName^ otherFileName =
+ dynamic_cast<CacheableFileName^>(obj);
+
+ if (otherFileName != nullptr) {
+ return (m_str == otherFileName->m_str);
+ }
+ return false;
+ }
+ }
+ }
+}
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableFileNameMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableFileNameMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableFileNameMN.hpp
new file mode 100644
index 0000000..a130b4d
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableFileNameMN.hpp
@@ -0,0 +1,162 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+
+
+#include "../../gf_defs.hpp"
+#include "ICacheableKeyN.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ /// <summary>
+ /// An immutable filename wrapper that can serve as a distributable
+ /// key object for caching as well as being a string value.
+ /// </summary>
+ public ref class CacheableFileName
+ : public ICacheableKey
+ {
+ public:
+ /// <summary>
+ /// Static function to create a new instance from the given string.
+ /// </summary>
+ inline static CacheableFileName^ Create(String^ value)
+ {
+ return (value != nullptr && value->Length > 0 ?
+ gcnew CacheableFileName(value) : nullptr);
+ }
+
+ /// <summary>
+ /// Static function to create a new instance from the
+ /// given character array.
+ /// </summary>
+ inline static CacheableFileName^ Create(array<Char>^ value)
+ {
+ return (value != nullptr && value->Length > 0 ?
+ gcnew CacheableFileName(value) : nullptr);
+ }
+
+ // Region: IGFSerializable Members
+
+ /// <summary>
+ /// Serializes this object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGFSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property uint32_t ObjectSize
+ {
+ virtual uint32_t get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property uint32_t ClassId
+ {
+ virtual uint32_t get();
+ }
+
+ /// <summary>
+ /// Return a string representation of the object.
+ /// This returns the same string as <c>Value</c> property.
+ /// </summary>
+ virtual String^ ToString() override
+ {
+ return m_str;
+ }
+
+ // End Region: IGFSerializable Members
+
+ // Region: ICacheableKey Members
+
+ /// <summary>
+ /// Return the hashcode for this key.
+ /// </summary>
+ virtual int32_t GetHashCode() override;
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// </summary>
+ virtual bool Equals(ICacheableKey^ other);
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// </summary>
+ virtual bool Equals(Object^ obj) override;
+
+ // End Region: ICacheableKey Members
+
+ /// <summary>
+ /// Gets the string value.
+ /// </summary>
+ property String^ Value
+ {
+ inline String^ get()
+ {
+ return m_str;
+ }
+ }
+
+ internal:
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableFileName((String^)nullptr);
+ }
+
+ private:
+ /// <summary>
+ /// Allocates a new instance from the given string.
+ /// </summary>
+ inline CacheableFileName(String^ value)
+ : m_str(value == nullptr ? String::Empty : value),m_hashcode(0) { }
+
+ /// <summary>
+ /// Allocates a new instance copying from the given character array.
+ /// </summary>
+ inline CacheableFileName(array<Char>^ value)
+ : m_str(gcnew String(value)),m_hashcode(0) { }
+
+ String^ m_str;
+ int m_hashcode;
+ };
+ }
+ }
+}
+ } //namespace
+
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableHashMapMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableHashMapMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableHashMapMN.cpp
new file mode 100644
index 0000000..61dd0ad
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableHashMapMN.cpp
@@ -0,0 +1,45 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+//#include "gf_includesN.hpp"
+#include "CacheableHashMapMN.hpp"
+#include "DataOutputMN.hpp"
+#include "DataInputMN.hpp"
+#include "impl/SafeConvertN.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ // Region: IGFSerializable Members
+
+ void Generic::CacheableHashMap::ToData(DataOutput^ output)
+ {
+ output->WriteDictionary((System::Collections::IDictionary^)m_dictionary);
+ }
+
+ IGFSerializable^ Generic::CacheableHashMap::FromData(DataInput^ input)
+ {
+ m_dictionary = input->ReadDictionary();
+ return this;
+ }
+
+ uint32_t Generic::CacheableHashMap::ObjectSize::get()
+ {
+ return ((System::Collections::IDictionary^)m_dictionary)->Count;
+ }
+ // End Region: IGFSerializable Members
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableHashMapMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableHashMapMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableHashMapMN.hpp
new file mode 100644
index 0000000..7e004af
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableHashMapMN.hpp
@@ -0,0 +1,137 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "../../gf_defs.hpp"
+#include "IGFSerializableN.hpp"
+#include "ICacheableKeyN.hpp"
+#include "GemFireClassIdsMN.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ /// <summary>
+ /// A mutable <c>ICacheableKey</c> to <c>IGFSerializable</c> hash map
+ /// that can serve as a distributable object for caching. This class
+ /// extends .NET generic <c>Dictionary</c> class.
+ /// </summary>
+ ref class CacheableHashMap
+ : public IGFSerializable
+ {
+ protected:
+ Object^ m_dictionary;
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableHashMap()
+ { }
+
+ /// <summary>
+ /// Allocates a new instance copying from the given dictionary.
+ /// </summary>
+ /// <param name="dictionary">
+ /// The dictionary whose elements are copied to this HashMap.
+ /// </param>
+ inline CacheableHashMap(Object^ dictionary)
+ {
+ m_dictionary = dictionary;
+ }
+
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableHashMap^ Create()
+ {
+ return gcnew CacheableHashMap();
+ }
+
+ /// <summary>
+ /// Static function to create a new instance copying from the
+ /// given dictionary.
+ /// </summary>
+ inline static CacheableHashMap^ Create(Object^ dictionary)
+ {
+ return gcnew CacheableHashMap(dictionary);
+ }
+
+
+ // Region: IGFSerializable Members
+
+ /// <summary>
+ /// Serializes this object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGFSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property uint32_t ObjectSize
+ {
+ virtual uint32_t get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property uint32_t ClassId
+ {
+ inline virtual uint32_t get()
+ {
+ return GemFireClassIds::CacheableHashMap;
+ }
+ }
+
+ property Object^ Value
+ {
+ Object^ get()
+ {
+ return m_dictionary;
+ }
+ }
+
+ // End Region: IGFSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableHashMap();
+ }
+ };
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableHashSetMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableHashSetMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableHashSetMN.hpp
new file mode 100644
index 0000000..c75863a
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableHashSetMN.hpp
@@ -0,0 +1,594 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+
+
+#pragma once
+
+#include "../../gf_defs.hpp"
+#include <cppcache/CacheableBuiltins.hpp>
+#include "SerializableMN.hpp"
+#include "ExceptionTypesMN.hpp"
+#include "impl/PdxInstanceImpl.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+#pragma managed
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ namespace Internal
+ {
+ /// <summary>
+ /// A mutable <c>ICacheableKey</c> hash set wrapper that can serve as
+ /// a distributable object for caching.
+ /// </summary>
+ template <uint32_t TYPEID, typename HSTYPE>
+ public ref class CacheableHashSetType
+ : public Serializable, public ICollection<Object^>
+ {
+ public:
+
+ virtual void ToData(DataOutput^ output) override
+ {
+ output->WriteArrayLen(this->Count);
+
+ Internal::ManagedPtrWrap< gemfire::Serializable,
+ Internal::SBWrap<gemfire::Serializable> > nptr = NativePtr;
+ HSTYPE* set = static_cast<HSTYPE*>(nptr());
+ for (typename HSTYPE::Iterator iter = set->begin();
+ iter != set->end(); ++iter) {
+ //Generic::ICacheableKey^ key = SafeGenericUMKeyConvert<ICacheableKey^>((*iter).ptr());
+ Object^ key = Serializable::GetManagedValueGeneric<Object^>((*iter));
+ output->WriteObject(key);
+ }
+ }
+
+ virtual IGFSerializable^ FromData(DataInput^ input) override
+ {
+ int len = input->ReadArrayLen();
+ if (len > 0)
+ {
+ for ( int i = 0; i < len; i++)
+ {
+ //Generic::ICacheableKey^ key = dynamic_cast<Generic::ICacheableKey^>(input->ReadObject());
+ Object^ key = (input->ReadObject());
+ this->Add(key);
+ }
+ }
+ return this;
+ }
+
+ virtual property uint32_t ObjectSize
+ {
+ virtual uint32_t get() override
+ {
+ uint32_t size = 0;
+ for each (Object^ key in this) {
+ if ( key != nullptr)
+ //size += key->ObjectSize;
+ //TODO:: how should we do this now
+ size += 1;
+ }
+ return size;
+ }
+ }
+
+ virtual int GetHashCode() override
+ {
+ IEnumerator<Object^>^ ie = GetEnumerator();
+
+ int h = 0;
+ while(ie->MoveNext() == true)
+ {
+ h = h + PdxInstanceImpl::deepArrayHashCode(ie->Current);
+ }
+ return h;
+ }
+
+ virtual bool Equals(Object^ other)override
+ {
+ if(other == nullptr)
+ return false;
+
+ CacheableHashSetType^ otherCHST = dynamic_cast<CacheableHashSetType^>(other);
+
+ if(otherCHST == nullptr)
+ return false;
+
+ if(Count != otherCHST->Count)
+ return false;
+
+ IEnumerator<Object^>^ ie = GetEnumerator();
+
+ while(ie->MoveNext() == true)
+ {
+ if(otherCHST->Contains(ie->Current))
+ return true;
+ else
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Enumerator for <c>CacheableHashSet</c> class.
+ /// </summary>
+ ref class Enumerator sealed
+ : public Internal::UMWrap<typename HSTYPE::Iterator>,
+ public IEnumerator<Object^>
+ {
+ public:
+ // Region: IEnumerator<ICacheableKey^> Members
+
+ /// <summary>
+ /// Gets the element in the collection at the current
+ /// position of the enumerator.
+ /// </summary>
+ /// <returns>
+ /// The element in the collection at the current position
+ /// of the enumerator.
+ /// </returns>
+ property Object^ Current
+ {
+ virtual Object^ get() =
+ IEnumerator<Object^>::Current::get
+ {
+ if (!m_started) {
+ throw gcnew System::InvalidOperationException(
+ "Call MoveNext first.");
+ }
+ //return SafeGenericUMKeyConvert<Generic::ICacheableKey^>((*(*NativePtr())).ptr());
+ return Serializable::GetManagedValueGeneric<Object^>((*(*NativePtr())));
+ }
+ }
+
+ // End Region: IEnumerator<ICacheableKey^> Members
+
+ // Region: IEnumerator Members
+
+ /// <summary>
+ /// Advances the enumerator to the next element of the collection.
+ /// </summary>
+ /// <returns>
+ /// true if the enumerator was successfully advanced to the next
+ /// element; false if the enumerator has passed the end of
+ /// the collection.
+ /// </returns>
+ virtual bool MoveNext()
+ {
+ Internal::ManagedPtrWrap< typename HSTYPE::Iterator,
+ Internal::UMWrap<typename HSTYPE::Iterator> > nptr = NativePtr;
+ bool isEnd = nptr->isEnd();
+ if (!m_started) {
+ m_started = true;
+ }
+ else {
+ if (!isEnd) {
+ (*nptr())++;
+ isEnd = nptr->isEnd();
+ }
+ }
+ GC::KeepAlive(this);
+ return !isEnd;
+ }
+
+ /// <summary>
+ /// Sets the enumerator to its initial position, which is before
+ /// the first element in the collection.
+ /// </summary>
+ virtual void Reset()
+ {
+ NativePtr->reset();
+ m_started = false;
+ }
+
+ // End Region: IEnumerator Members
+
+ internal:
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Enumerator(typename HSTYPE::Iterator* nativeptr,
+ CacheableHashSetType<TYPEID, HSTYPE>^ set)
+ : UMWrap(nativeptr, true), m_set(set) { }
+
+ private:
+ // Region: IEnumerator Members
+
+ /// <summary>
+ /// Gets the current element in the collection.
+ /// </summary>
+ /// <returns>
+ /// The current element in the collection.
+ /// </returns>
+ /// <exception cref="System.InvalidOperationException">
+ /// The enumerator is positioned before the first element of
+ /// the collection or after the last element.
+ /// </exception>
+ property Object^ ICurrent
+ {
+ virtual Object^ get() sealed =
+ System::Collections::IEnumerator::Current::get
+ {
+ return Current;
+ }
+ }
+
+ // End Region: IEnumerator Members
+
+ bool m_started;
+
+ CacheableHashSetType<TYPEID, HSTYPE>^ m_set;
+ };
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property uint32_t ClassId
+ {
+ virtual uint32_t get() override
+ {
+ //return static_cast<HSTYPE*>(NativePtr())->classId() + 0x80000000;
+ return TYPEID;
+ }
+ }
+
+ /// <summary>
+ /// Get the largest possible size of the <c>CacheableHashSet</c>.
+ /// </summary>
+ property int32_t MaxSize
+ {
+ inline int32_t get()
+ {
+ return static_cast<HSTYPE*>(NativePtr())->max_size();
+ }
+ }
+
+ /// <summary>
+ /// True if the <c>CacheableHashSet</c>'s size is 0.
+ /// </summary>
+ property bool IsEmpty
+ {
+ inline bool get()
+ {
+ return static_cast<HSTYPE*>(NativePtr())->empty();
+ }
+ }
+
+ /// <summary>
+ /// Get the number of buckets used by the HashSet.
+ /// </summary>
+ property int32_t BucketCount
+ {
+ inline int32_t get()
+ {
+ return static_cast<HSTYPE*>(NativePtr())->bucket_count();
+ }
+ }
+
+ /// <summary>
+ /// Increases the bucket count to at least <c>size</c> elements.
+ /// </summary>
+ /// <param name="size">The new size of the HashSet.</param>
+ virtual void Resize(int32_t size) sealed
+ {
+ static_cast<HSTYPE*>(NativePtr())->resize(size);
+ }
+
+ /// <summary>
+ /// Swap the contents of this <c>CacheableHashSet</c>
+ /// with the given one.
+ /// </summary>
+ /// <param name="other">
+ /// The other CacheableHashSet to use for swapping.
+ /// </param>
+ virtual void Swap(CacheableHashSetType<TYPEID, HSTYPE>^ other) sealed
+ {
+ if (other != nullptr) {
+ static_cast<HSTYPE*>(NativePtr())->swap(
+ *static_cast<HSTYPE*>(other->NativePtr()));
+ }
+ }
+
+ // Region: ICollection<ICacheableKey^> Members
+
+ /// <summary>
+ /// Adds an item to the <c>CacheableHashSet</c>.
+ /// </summary>
+ /// <param name="item">
+ /// The object to add to the collection.
+ /// </param>
+ virtual void Add(Object^ item)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ gemfire::CacheableKeyPtr nativeptr(Serializable::GetUnmanagedValueGeneric(item));
+ static_cast<HSTYPE*>(NativePtr())->insert(nativeptr);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ /// <summary>
+ /// Removes all items from the <c>CacheableHashSet</c>.
+ /// </summary>
+ virtual void Clear()
+ {
+ static_cast<HSTYPE*>(NativePtr())->clear();
+ }
+
+ /// <summary>
+ /// Determines whether the <c>CacheableHashSet</c> contains
+ /// a specific value.
+ /// </summary>
+ /// <param name="item">
+ /// The object to locate in the <c>CacheableHashSet</c>.
+ /// </param>
+ /// <returns>
+ /// true if item is found in the <c>CacheableHashSet</c>;
+ /// otherwise false.
+ /// </returns>
+ virtual bool Contains(Object^ item)
+ {
+ return static_cast<HSTYPE*>(NativePtr())->contains(
+ gemfire::CacheableKeyPtr(Serializable::GetUnmanagedValueGeneric(item)));
+ }
+
+ /// <summary>
+ /// Copies the elements of the <c>CacheableHashSet</c> to an
+ /// <c>System.Array</c>, starting at a particular
+ /// <c>System.Array</c> index.
+ /// </summary>
+ /// <param name="array">
+ /// The one-dimensional System.Array that is the destination of the
+ /// elements copied from <c>CacheableHashSet</c>. The
+ /// <c>System.Array</c> must have zero-based indexing.
+ /// </param>
+ /// <param name="arrayIndex">
+ /// The zero-based index in array at which copying begins.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// arrayIndex is less than 0 or array is null.
+ /// </exception>
+ /// <exception cref="OutOfRangeException">
+ /// arrayIndex is equal to or greater than the length of array.
+ /// -or-The number of elements in the source <c>CacheableHashSet</c>
+ /// is greater than the available space from arrayIndex to the end
+ /// of the destination array.
+ /// </exception>
+ virtual void CopyTo(array<Object^>^ array, int32_t arrayIndex)
+ {
+ if (array == nullptr || arrayIndex < 0) {
+ throw gcnew IllegalArgumentException("CacheableHashSet.CopyTo():"
+ " array is null or array index is less than zero");
+ }
+ Internal::ManagedPtrWrap< gemfire::Serializable,
+ Internal::SBWrap<gemfire::Serializable> > nptr = NativePtr;
+ HSTYPE* set = static_cast<HSTYPE*>(nptr());
+ int32_t index = arrayIndex;
+
+ if (arrayIndex >= array->Length ||
+ array->Length < (arrayIndex + (int32_t)set->size())) {
+ throw gcnew OutOfRangeException("CacheableHashSet.CopyTo():"
+ " array index is beyond the HashSet or length of given "
+ "array is less than that required to copy all the "
+ "elements from HashSet");
+ }
+ for (typename HSTYPE::Iterator iter = set->begin();
+ iter != set->end(); ++iter, ++index) {
+ array[index] = Serializable::GetManagedValueGeneric<Object^>((*iter));
+ }
+ GC::KeepAlive(this);
+ }
+
+ /// <summary>
+ /// Gets the number of elements contained in the
+ /// <c>CacheableHashSet</c>.
+ /// </summary>
+ virtual property int32_t Count
+ {
+ virtual int32_t get()
+ {
+ return static_cast<HSTYPE*>(NativePtr())->size();
+ }
+ }
+
+ /// <summary>
+ /// Removes the first occurrence of a specific object from the
+ /// <c>CacheableHashSet</c>.
+ /// </summary>
+ /// <param name="item">
+ /// The object to remove from the <c>CacheableHashSet</c>.
+ /// </param>
+ /// <returns>
+ /// true if item was successfully removed from the
+ /// <c>CacheableHashSet</c>; otherwise, false. This method also
+ /// returns false if item is not found in the original
+ /// <c>CacheableHashSet</c>.
+ /// </returns>
+ virtual bool Remove(Object^ item)
+ {
+ return (static_cast<HSTYPE*>(NativePtr())->erase(
+ gemfire::CacheableKeyPtr(Serializable::GetUnmanagedValueGeneric(item))) > 0);
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the collection is read-only.
+ /// </summary>
+ /// <returns>
+ /// always false for <c>CacheableHashSet</c>
+ /// </returns>
+ virtual property bool IsReadOnly
+ {
+ virtual bool get()
+ {
+ return false;
+ }
+ }
+
+ // End Region: ICollection<ICacheableKey^> Members
+
+ // Region: IEnumerable<ICacheableKey^> Members
+
+ /// <summary>
+ /// Returns an enumerator that iterates through the
+ /// <c>CacheableHashSet</c>.
+ /// </summary>
+ /// <returns>
+ /// A <c>System.Collections.Generic.IEnumerator</c> that
+ /// can be used to iterate through the <c>CacheableHashSet</c>.
+ /// </returns>
+ virtual IEnumerator<Object^>^ GetEnumerator()
+ {
+ typename HSTYPE::Iterator* iter = new typename HSTYPE::Iterator(
+ static_cast<HSTYPE*>(NativePtr())->begin());
+
+ return gcnew Enumerator(iter, this);
+ }
+
+ // End Region: IEnumerable<ICacheableKey^> Members
+
+ internal:
+ /// <summary>
+ /// Factory function to register wrapper
+ /// </summary>
+ static IGFSerializable^ Create(gemfire::Serializable* obj)
+ {
+ return (obj != NULL ?
+ gcnew CacheableHashSetType<TYPEID,HSTYPE>(obj) : nullptr);
+ }
+
+ private:
+ // Region: IEnumerable Members
+
+ /// <summary>
+ /// Returns an enumerator that iterates through a collection.
+ /// </summary>
+ /// <returns>
+ /// An <c>System.Collections.IEnumerator</c> object that can be used
+ /// to iterate through the collection.
+ /// </returns>
+ virtual System::Collections::IEnumerator^ GetIEnumerator() sealed =
+ System::Collections::IEnumerable::GetEnumerator
+ {
+ return GetEnumerator();
+ }
+
+ // End Region: IEnumerable Members
+
+ protected:
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableHashSetType<TYPEID, HSTYPE>(gemfire::Serializable* nativeptr)
+ : Serializable(nativeptr) { }
+
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableHashSetType<TYPEID, HSTYPE>()
+ : Serializable(HSTYPE::createDeserializable())
+ { }
+
+ /// <summary>
+ /// Allocates a new empty instance with given initial size.
+ /// </summary>
+ /// <param name="size">The initial size of the HashSet.</param>
+ inline CacheableHashSetType<TYPEID,HSTYPE>(int32_t size)
+ : Serializable(HSTYPE::create(size).ptr())
+ { }
+ };
+ }
+
+#define _GFCLI_CACHEABLEHASHSET_DEF_GENERIC(m, HSTYPE) \
+ public ref class m : public Internal::CacheableHashSetType<GemStone::GemFire::Cache::Generic::GemFireClassIds::m, HSTYPE> \
+ { \
+ public: \
+ /** <summary>
+ * Allocates a new empty instance.
+ * </summary>
+ */ \
+ inline m() \
+ : Internal::CacheableHashSetType<GemStone::GemFire::Cache::Generic::GemFireClassIds::m, HSTYPE>() {} \
+ \
+ /** <summary>
+ * Allocates a new instance with the given size.
+ * </summary>
+ * <param name="size">the intial size of the new instance</param>
+ */ \
+ inline m(int32_t size) \
+ : Internal::CacheableHashSetType<GemStone::GemFire::Cache::Generic::GemFireClassIds::m, HSTYPE>(size) {} \
+ \
+ /** <summary>
+ * Static function to create a new empty instance.
+ * </summary>
+ */ \
+ inline static m^ Create() \
+ { \
+ return gcnew m(); \
+ } \
+ \
+ /** <summary>
+ * Static function to create a new instance with the given size.
+ * </summary>
+ */ \
+ inline static m^ Create(int32_t size) \
+ { \
+ return gcnew m(size); \
+ } \
+ \
+ /* <summary>
+ * Factory function to register this class.
+ * </summary>
+ */ \
+ static IGFSerializable^ CreateDeserializable() \
+ { \
+ return gcnew m(); \
+ } \
+ \
+ internal: \
+ static IGFSerializable^ Create(gemfire::Serializable* obj) \
+ { \
+ return gcnew m(obj); \
+ } \
+ \
+ private: \
+ inline m(gemfire::Serializable* nativeptr) \
+ : Internal::CacheableHashSetType<GemStone::GemFire::Cache::Generic::GemFireClassIds::m, HSTYPE>(nativeptr) { } \
+ };
+
+ /// <summary>
+ /// A mutable <c>ICacheableKey</c> hash set wrapper that can serve as
+ /// a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLEHASHSET_DEF_GENERIC(CacheableHashSet,
+ gemfire::CacheableHashSet);
+
+ /// <summary>
+ /// A mutable <c>ICacheableKey</c> hash set wrapper that can serve as
+ /// a distributable object for caching. This is provided for compability
+ /// with java side though is functionally identical to
+ /// <c>CacheableHashSet</c> i.e. does not provide the linked semantics of
+ /// java <c>LinkedHashSet</c>.
+ /// </summary>
+ _GFCLI_CACHEABLEHASHSET_DEF_GENERIC(CacheableLinkedHashSet,
+ gemfire::CacheableLinkedHashSet);
+ }
+ }
+}
+ } //namespace