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:11 UTC
[04/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/CacheableHashTableMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableHashTableMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableHashTableMN.hpp
new file mode 100644
index 0000000..e717c73
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableHashTableMN.hpp
@@ -0,0 +1,108 @@
+/*=========================================================================
+ * 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 "CacheableHashMapMN.hpp"
+#include "DataInputMN.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 table
+ /// that can serve as a distributable object for caching. This class
+ /// extends .NET generic <c>Dictionary</c> class.
+ /// </summary>
+ ref class CacheableHashTable
+ : public CacheableHashMap
+ {
+ public:
+
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableHashTable()
+ : CacheableHashMap()
+ { }
+
+ /// <summary>
+ /// Allocates a new instance copying from the given dictionary.
+ /// </summary>
+ /// <param name="dictionary">
+ /// The dictionary whose elements are copied to this HashTable.
+ /// </param>
+ inline CacheableHashTable(Object^ dictionary)
+ : CacheableHashMap(dictionary)
+ { }
+
+ /// <summary>
+ /// Allocates a new empty instance with given initial size.
+ /// </summary>
+ /// <param name="capacity">
+ /// The initial capacity of the HashTable.
+ /// </param>
+ inline CacheableHashTable(int32_t capacity)
+ : CacheableHashMap(capacity)
+ { }
+
+
+ // 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::CacheableHashTable;
+ }
+ }
+
+ // End Region: IGFSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableHashTable();
+ }
+
+ virtual IGFSerializable^ FromData(DataInput^ input) override
+ {
+ m_dictionary = input->ReadHashtable();
+ return this;
+ }
+ internal:
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ Create(Object^ hashtable)
+ {
+ return gcnew CacheableHashTable(hashtable);
+ }
+ };
+
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableIdentityHashMapMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableIdentityHashMapMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableIdentityHashMapMN.hpp
new file mode 100644
index 0000000..d3aa3b1
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableIdentityHashMapMN.hpp
@@ -0,0 +1,118 @@
+/*=========================================================================
+ * 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 "CacheableHashMapMN.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. This class is meant
+ /// as a means to interoperate with java server side
+ /// <c>IdentityHashMap</c> class objects but is intentionally not
+ /// intended to provide <c>java.util.IdentityHashMap</c> semantics.
+ /// </summary>
+ ref class CacheableIdentityHashMap
+ : public CacheableHashMap
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableIdentityHashMap()
+ : 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 CacheableIdentityHashMap(Object^ dictionary)
+ : CacheableHashMap(dictionary)
+ { }
+
+ /// <summary>
+ /// Allocates a new empty instance with given initial size.
+ /// </summary>
+ /// <param name="capacity">
+ /// The initial capacity of the HashMap.
+ /// </param>
+ inline CacheableIdentityHashMap(int32_t capacity)
+ : CacheableHashMap(capacity)
+ { }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableIdentityHashMap^ Create()
+ {
+ return gcnew CacheableIdentityHashMap();
+ }
+
+ /// <summary>
+ /// Static function to create a new instance copying from the
+ /// given dictionary.
+ /// </summary>
+ inline static CacheableIdentityHashMap^ Create(
+ Object^ dictionary)
+ {
+ return gcnew CacheableIdentityHashMap(dictionary);
+ }
+
+ /// <summary>
+ /// Static function to create a new instance with given initial size.
+ /// </summary>
+ inline static CacheableIdentityHashMap^ Create(int32_t capacity)
+ {
+ return gcnew CacheableIdentityHashMap(capacity);
+ }
+
+ // 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::CacheableIdentityHashMap;
+ }
+ }
+
+ // End Region: IGFSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableIdentityHashMap();
+ }
+ };
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableKeyMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableKeyMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableKeyMN.cpp
new file mode 100644
index 0000000..176b148
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableKeyMN.cpp
@@ -0,0 +1,108 @@
+/*=========================================================================
+ * 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 "CacheableKeyMN.hpp"
+#include "CacheableStringMN.hpp"
+#include "CacheableBuiltinsMN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ // generic<class TKey>
+ int32_t CacheableKey::GetHashCode()
+ {
+ return static_cast<gemfire::CacheableKey*>(NativePtr())->hashcode();
+ }
+
+ // generic<class TKey>
+ bool CacheableKey::Equals(Generic::ICacheableKey^ other)
+ {
+ if (other == nullptr || other->ClassId != ClassId) {
+ return false;
+ }
+ return static_cast<gemfire::CacheableKey*>(NativePtr())->operator==(
+ *static_cast<gemfire::CacheableKey*>(
+ ((Generic::CacheableKey^)other)->NativePtr()));
+ }
+
+ //generic<class TKey>
+ bool CacheableKey::Equals(Object^ obj)
+ {
+ CacheableKey^ otherKey =
+ dynamic_cast<CacheableKey^>(obj);
+
+ if (otherKey != nullptr) {
+ return static_cast<gemfire::CacheableKey*>(NativePtr())->operator==(
+ *static_cast<gemfire::CacheableKey*>(otherKey->NativePtr()));
+ }
+ return false;
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (Byte value)
+ {
+ return (CacheableKey^) CacheableByte::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (bool value)
+ {
+ return (CacheableKey^) CacheableBoolean::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (Char value)
+ {
+ return (CacheableKey^) CacheableCharacter::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (Double value)
+ {
+ return (CacheableKey^) CacheableDouble::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (Single value)
+ {
+ return (CacheableKey^) CacheableFloat::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (int16_t value)
+ {
+ return (CacheableKey^) CacheableInt16::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (int32_t value)
+ {
+ return (CacheableKey^) CacheableInt32::Create(value);
+ }
+
+ // generic<class TKey>
+ CacheableKey::operator CacheableKey^ (int64_t value)
+ {
+ return (CacheableKey^) CacheableInt64::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (String^ value)
+ {
+ return dynamic_cast<CacheableKey^>(CacheableString::Create(value));
+ }
+ }
+ }
+}
+} //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableKeyMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableKeyMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableKeyMN.hpp
new file mode 100644
index 0000000..f6c6042
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableKeyMN.hpp
@@ -0,0 +1,129 @@
+/*=========================================================================
+ * 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/CacheableKey.hpp>
+//#include "impl/NativeWrapperN.hpp"
+#include "SerializableMN.hpp"
+#include "ICacheableKeyN.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ /// <summary>
+ /// This class wraps the native C++ <c>gemfire::Serializable</c> objects
+ /// as managed <see cref="../../IGFSerializable" /> objects.
+ /// </summary>
+ public ref class CacheableKey
+ : public Serializable, public ICacheableKey
+ {
+ public:
+ /// <summary>
+ /// Return the hashcode for this key.
+ /// It gets the hash code by calling the <c>hashcode()</c> function
+ /// of the underlying <c>gemfire::CacheableKey</c> object.
+ /// </summary>
+ virtual int32_t GetHashCode() override;
+
+ /// <summary>
+ /// Return true if this key matches other object. It invokes the '=='
+ /// operator of the underlying <c>gemfire::CacheableKey</c> object.
+ /// </summary>
+ virtual bool Equals(ICacheableKey^ other);
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// It invokes the '==' operator if the underlying object is a
+ /// <c>gemfire::CacheableKey</c>, else returns
+ /// <c>System.Object.Equals()</c>
+ /// </summary>
+ virtual bool Equals(Object^ obj) override;
+
+ // Static conversion functions from primitive types.
+
+ /// <summary>
+ /// Implicit conversion operator from a boolean
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (bool value);
+
+ /// <summary>
+ /// Implicit conversion operator from a byte
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (Byte value);
+
+ /// <summary>
+ /// Implicit conversion operator from a double
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (Double value);
+
+ /// <summary>
+ /// Implicit conversion operator from a float
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (Single value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 16-bit integer
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (int16_t value);
+
+ /// <summary>
+ /// Implicit conversion operator from a character
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (Char value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 32-bit integer
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (int32_t value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 64-bit integer
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (int64_t value);
+
+ /// <summary>
+ /// Implicit conversion operator from a string
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (String^ value);
+
+ internal:
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ inline CacheableKey()
+ : Generic::Serializable() { }
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableKey(gemfire::Serializable* nativeptr)
+ : Generic::Serializable(nativeptr) { }
+ };
+ }
+ }
+}
+} //namespace
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableLinkedListMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableLinkedListMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableLinkedListMN.hpp
new file mode 100644
index 0000000..d56cc8a
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableLinkedListMN.hpp
@@ -0,0 +1,142 @@
+/*=========================================================================
+ * 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 CacheableLinkedList
+ : public IGFSerializable
+ {
+ System::Collections::Generic::LinkedList<Object^>^ m_linkedList;
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableLinkedList(System::Collections::Generic::LinkedList<Object^>^ list)
+ {
+ m_linkedList = list;
+ }
+
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableLinkedList^ Create()
+ {
+ return gcnew CacheableLinkedList(gcnew System::Collections::Generic::LinkedList<Object^>());
+ }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableLinkedList^ Create(System::Collections::Generic::LinkedList<Object^>^ list)
+ {
+ return gcnew CacheableLinkedList(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()
+ {
+ return GemFireClassIds::CacheableLinkedList;
+ }
+ }
+
+ // Region: IGFSerializable Members
+
+ virtual void ToData(DataOutput^ output)
+ {
+ if(m_linkedList != nullptr)
+ {
+ output->WriteArrayLen(m_linkedList->Count);
+ for each (Object^ obj in m_linkedList) {
+ //TODO::split
+ output->WriteObject(obj);
+ }
+ }
+ else
+ output->WriteByte(0xFF);
+ }
+
+ virtual IGFSerializable^ FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ for( int i = 0; i < len; i++)
+ {
+ m_linkedList->AddLast(input->ReadObject());
+ }
+ return this;
+ }
+
+ /*uint32_t ObjectSize::get()
+ {
+ //TODO::hitesh
+ uint32_t size = static_cast<uint32_t> (sizeof(CacheableVector^));
+ for each (IGFSerializable^ val in this) {
+ if (val != nullptr) {
+ size += val->ObjectSize;
+ }
+ }
+ return m_linkedList->Count;
+ }*/
+
+ virtual property uint32_t ObjectSize
+ {
+ virtual uint32_t get()
+ {
+ return m_linkedList->Count;
+ }
+ }
+
+ virtual property System::Collections::Generic::LinkedList<Object^>^ Value
+ {
+ virtual System::Collections::Generic::LinkedList<Object^>^ get()
+ {
+ return m_linkedList;
+ }
+ }
+ // End Region: IGFSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableLinkedList(gcnew System::Collections::Generic::LinkedList<Object^>());
+ }
+ };
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableObjectArrayMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableObjectArrayMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableObjectArrayMN.cpp
new file mode 100644
index 0000000..6744012
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableObjectArrayMN.cpp
@@ -0,0 +1,114 @@
+/*=========================================================================
+ * 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 <cppcache/impl/GemfireTypeIdsImpl.hpp>
+#include "CacheableObjectArrayMN.hpp"
+#include "DataOutputMN.hpp"
+#include "DataInputMN.hpp"
+#include "ExceptionTypesMN.hpp"
+#include "impl/SafeConvertN.hpp"
+#include "impl/PdxTypeRegistry.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+using namespace GemStone::GemFire::Cache::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ // Region: IGFSerializable Members
+
+ void CacheableObjectArray::ToData(DataOutput^ output)
+ {
+ output->WriteArrayLen((int32_t)Count);
+ output->WriteByte((int8_t)gemfire::GemfireTypeIdsImpl::Class);
+ output->WriteByte((int8_t)gemfire::GemfireTypeIds::CacheableASCIIString);
+ output->WriteUTF("java.lang.Object");
+
+ for each (Object^ obj in this) {
+ //TODO::split
+ output->WriteObject(obj);
+ }
+
+ /*_GF_MG_EXCEPTION_TRY
+
+ gemfire::DataOutput& nativeOutput = *(output->_NativePtr);
+ nativeOutput.writeArrayLen((int32_t)Count);
+ nativeOutput.write((int8_t)gemfire::GemfireTypeIdsImpl::Class);
+ nativeOutput.write((int8_t)gemfire::GemfireTypeIds::CacheableASCIIString);
+ nativeOutput.writeASCII("java.lang.Object");
+ for each (IGFSerializable^ obj in this) {
+ gemfire::SerializablePtr objPtr(SafeMSerializableConvert(obj));
+ nativeOutput.writeObject(objPtr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL*/
+ }
+
+ IGFSerializable^ CacheableObjectArray::FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ if (len >= 0) {
+ //int8_t typeCode;
+ input->ReadByte(); // ignore CLASS typeid
+ input->ReadByte(); // ignore string typeid
+ unsigned short classLen;
+ classLen = input->ReadInt16();
+ input->AdvanceCursor(classLen);
+ //nativeInput.readInt(&classLen);
+ //nativeInput.advanceCursor(classLen);
+ }
+ for (int32_t index = 0; index < len; ++index) {
+ Add(input->ReadObject());
+ }
+ return this;
+ /*_GF_MG_EXCEPTION_TRY
+
+ gemfire::DataInput& nativeInput = *(input->_NativePtr);
+ int32_t len;
+ nativeInput.readArrayLen(&len);
+ if (len >= 0) {
+ int8_t typeCode;
+ nativeInput.read(&typeCode); // ignore CLASS typeid
+ nativeInput.read(&typeCode); // ignore string typeid
+ uint16_t classLen;
+ nativeInput.readInt(&classLen);
+ nativeInput.advanceCursor(classLen);
+ }
+ gemfire::CacheablePtr value;
+ for (int32_t index = 0; index < len; ++index) {
+ nativeInput.readObject(value);
+ Add(SafeUMSerializableConvert(value.ptr()));
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL
+ return this;*/
+ }
+
+ uint32_t CacheableObjectArray::ObjectSize::get()
+ {
+ /* uint32_t size = static_cast<uint32_t> (sizeof(CacheableObjectArray^));
+ for each (IGFSerializable^ val in this) {
+ if (val != nullptr) {
+ size += val->ObjectSize;
+ }
+ }*/
+ return 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/CacheableObjectArrayMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableObjectArrayMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableObjectArrayMN.hpp
new file mode 100644
index 0000000..9889c37
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableObjectArrayMN.hpp
@@ -0,0 +1,145 @@
+/*=========================================================================
+ * 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 "GemFireClassIdsMN.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+
+ /// <summary>
+ /// A mutable <c>IGFSerializable</c> object array wrapper that can serve
+ /// as a distributable object for caching. Though this class provides
+ /// compatibility with java Object[] serialization, it provides the
+ /// semantics of .NET generic <c>List</c> class.
+ /// </summary>
+ public ref class CacheableObjectArray
+ : public List<Object^>, public IGFSerializable
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableObjectArray()
+ : List<Object^>()
+ { }
+
+ /// <summary>
+ /// Allocates a new instance copying from the given collection.
+ /// </summary>
+ /// <param name="collection">
+ /// The collection whose elements are copied to this list.
+ /// </param>
+ inline CacheableObjectArray(IEnumerable<Object^>^ collection)
+ : List<Object^>(collection)
+ { }
+
+ /// <summary>
+ /// Allocates a new empty instance with given initial size.
+ /// </summary>
+ /// <param name="capacity">
+ /// The initial capacity of the vector.
+ /// </param>
+ inline CacheableObjectArray(int32_t capacity)
+ : List<Object^>(capacity)
+ { }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableObjectArray^ Create()
+ {
+ return gcnew CacheableObjectArray();
+ }
+
+ /// <summary>
+ /// Static function to create a new instance copying from the
+ /// given collection.
+ /// </summary>
+ inline static CacheableObjectArray^ Create(
+ IEnumerable<Object^>^ collection)
+ {
+ return gcnew CacheableObjectArray(collection);
+ }
+
+ /// <summary>
+ /// Static function to create a new instance with given initial size.
+ /// </summary>
+ inline static CacheableObjectArray^ Create(int32_t capacity)
+ {
+ return gcnew CacheableObjectArray(capacity);
+ }
+
+ // 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()
+ {
+ return GemFireClassIds::CacheableObjectArray;
+ }
+ }
+
+ // End Region: IGFSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableObjectArray();
+ }
+ };
+
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableObjectN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableObjectN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableObjectN.cpp
new file mode 100644
index 0000000..fdae998
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableObjectN.cpp
@@ -0,0 +1,72 @@
+/*=========================================================================
+ * 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 "CacheableObjectN.hpp"
+#include "DataInputMN.hpp"
+#include "DataOutputMN.hpp"
+#include "impl/GFNullStreamN.hpp"
+#include "impl/GFDataInputStreamN.hpp"
+#include "impl/GFDataOutputStreamN.hpp"
+
+using namespace System;
+using namespace System::IO;
+using namespace System::Runtime::Serialization::Formatters::Binary;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ void CacheableObject::ToData(DataOutput^ output)
+ {
+ if(m_obj != nullptr)
+ {
+ output->AdvanceCursor(4); // placeholder for object size bytes needed while reading back.
+
+ GFDataOutputStream dos(output);
+ BinaryFormatter bf;
+ int64_t checkpoint = dos.Length;
+ bf.Serialize(%dos, m_obj);
+ m_objectSize = (uint32_t) (dos.Length - checkpoint);
+
+ output->RewindCursor(m_objectSize + 4);
+ output->WriteInt32(m_objectSize);
+ output->AdvanceCursor(m_objectSize);
+ }
+ }
+
+ IGFSerializable^ CacheableObject::FromData(DataInput^ input)
+ {
+ int maxSize = input->ReadInt32();
+ GFDataInputStream dis(input, maxSize);
+ uint32_t checkpoint = dis.BytesRead;
+ BinaryFormatter bf;
+ m_obj = bf.Deserialize(%dis);
+ m_objectSize = dis.BytesRead - checkpoint;
+ return this;
+ }
+
+ uint32_t CacheableObject::ObjectSize::get()
+ {
+ if (m_objectSize == 0) {
+ GFNullStream ns;
+ BinaryFormatter bf;
+ bf.Serialize(%ns, m_obj);
+
+ m_objectSize = (uint32_t)sizeof(CacheableObject^) + (uint32_t)ns.Length;
+ }
+ return m_objectSize;
+ }
+ }
+ }
+}
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableObjectN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableObjectN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableObjectN.hpp
new file mode 100644
index 0000000..556b571
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableObjectN.hpp
@@ -0,0 +1,146 @@
+/*=========================================================================
+ * 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 "GemFireClassIdsMN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ /// <summary>
+ /// An mutable generic <see cref="System.Object" /> wrapper that can
+ /// serve as a distributable value for caching.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This class can serialize any class which has either the
+ /// [Serializable] attribute set or implements
+ /// <see cref="System.Runtime.Serialization.ISerializable" /> interface.
+ /// However, for better efficiency the latter should be avoided and the
+ /// user should implement <see cref="../../IGFSerializable" /> instead.
+ /// </para><para>
+ /// The user must keep in mind that the rules that apply to runtime
+ /// serialization would be the rules that apply to this class. For
+ /// the serialization will be carried out by serializing all the
+ /// members (public/private/protected) of the class. Each of the
+ /// contained classes should also have either the [Serializable]
+ /// attribute set or implement <c>ISerializable</c> interface.
+ /// </para>
+ /// </remarks>
+ public ref class CacheableObject
+ : public IGFSerializable
+ {
+ public:
+ /// <summary>
+ /// Static function to create a new instance from the given object.
+ /// </summary>
+ /// <remarks>
+ /// If the given object is null then this method returns null.
+ /// </remarks>
+ inline static CacheableObject^ Create(Object^ value)
+ {
+ return (value != nullptr ? gcnew CacheableObject(value) :
+ nullptr);
+ }
+
+ /// <summary>
+ /// Serializes this <see cref="System.Object" /> using
+ /// <see cref="System.Runtime.Serialization.Formatters.Binary.BinaryFormatter" /> class.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserializes the <see cref="System.Object" /> using
+ /// <see cref="System.Runtime.Serialization.Formatters.Binary.BinaryFormatter" /> class.
+ /// </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::CacheableManagedObject;
+ }
+ }
+
+ /// <summary>
+ /// Gets the object value.
+ /// </summary>
+ /// <remarks>
+ /// The user can modify the object and the changes shall be reflected
+ /// immediately in the local cache. For this change to be propagate to
+ /// other members of the distributed system, the object needs to be
+ /// put into the cache.
+ /// </remarks>
+ property Object^ Value
+ {
+ inline Object^ get()
+ {
+ return m_obj;
+ }
+ }
+
+ virtual String^ ToString() override
+ {
+ return (m_obj == nullptr ? nullptr : m_obj->ToString());
+ }
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableObject(nullptr);
+ }
+
+ internal:
+ /// <summary>
+ /// Allocates a new instance from the given object.
+ /// </summary>
+ inline CacheableObject(Object^ value)
+ : m_obj(value), m_objectSize(0) { }
+
+
+
+ private:
+ Object^ m_obj;
+ uint32_t m_objectSize;
+ };
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableObjectXmlN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableObjectXmlN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableObjectXmlN.cpp
new file mode 100644
index 0000000..8ec060b
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableObjectXmlN.cpp
@@ -0,0 +1,101 @@
+/*=========================================================================
+ * 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 "CacheableObjectXmlN.hpp"
+#include "DataInputMN.hpp"
+#include "DataOutputMN.hpp"
+#include "LogMN.hpp"
+#include "impl/GFNullStreamN.hpp"
+#include "impl/GFDataInputStreamN.hpp"
+#include "impl/GFDataOutputStreamN.hpp"
+
+using namespace System;
+using namespace System::IO;
+using namespace System::Xml::Serialization;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ void CacheableObjectXml::ToData(DataOutput^ output)
+ {
+ if (m_obj == nullptr) {
+ output->WriteByte((Byte)1);
+ }
+ else
+ {
+ output->WriteByte((Byte)0);
+ Type^ objType = m_obj->GetType();
+
+ output->WriteUTF(objType->AssemblyQualifiedName);
+
+ output->AdvanceCursor(4); // placeholder for object size bytes needed while reading back.
+
+ XmlSerializer xs(objType);
+ GFDataOutputStream dos(output);
+ int64_t checkpoint = dos.Length;
+ xs.Serialize(%dos, m_obj);
+ m_objectSize = (uint32_t) (dos.Length - checkpoint);
+
+ output->RewindCursor(m_objectSize + 4);
+ output->WriteInt32(m_objectSize);
+ output->AdvanceCursor(m_objectSize);
+ }
+ }
+
+ IGFSerializable^ CacheableObjectXml::FromData(DataInput^ input)
+ {
+ Byte isNull = input->ReadByte();
+ if (isNull) {
+ m_obj = nullptr;
+ }
+ else {
+ String^ typeName = input->ReadUTF();
+ Type^ objType = Type::GetType(typeName);
+ if (objType == nullptr)
+ {
+ Log::Error("CacheableObjectXml.FromData(): Cannot find type '" +
+ typeName + "'.");
+ m_obj = nullptr;
+ }
+ else {
+ int maxSize = input->ReadInt32();
+ GFDataInputStream dis(input, maxSize);
+ XmlSerializer xs(objType);
+ uint32_t checkpoint = dis.BytesRead;
+ m_obj = xs.Deserialize(%dis);
+ m_objectSize = dis.BytesRead - checkpoint;
+ }
+ }
+ return this;
+ }
+
+ uint32_t CacheableObjectXml::ObjectSize::get()
+ {
+ if (m_objectSize == 0) {
+ if (m_obj != nullptr) {
+ Type^ objType = m_obj->GetType();
+ XmlSerializer xs(objType);
+ GFNullStream ns;
+ xs.Serialize(%ns, m_obj);
+
+ m_objectSize = (uint32_t)sizeof(CacheableObjectXml^) + (uint32_t)ns.Length;
+ }
+ }
+ return m_objectSize;
+ }
+ }
+ }
+}
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableObjectXmlN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableObjectXmlN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableObjectXmlN.hpp
new file mode 100644
index 0000000..47bf408
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableObjectXmlN.hpp
@@ -0,0 +1,147 @@
+/*=========================================================================
+ * 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 "GemFireClassIdsMN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ /// <summary>
+ /// A mutable generic <see cref="System.Object" /> wrapper that can
+ /// serve as a distributable value for caching.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This class can contain any object and uses the
+ /// <see cref="System.Xml.Serialization.XmlSerializer" /> to
+ /// serialize and deserialize the object. So the user must use the
+ /// <c>XmlSerializer</c> attributes to control the serialization/deserialization
+ /// of the object (or implement the <see cref="System.Xml.Serialization.IXmlSerializable" />)
+ /// to change the serialization/deserialization. However, the latter should
+ /// be avoided for efficiency reasons and the user should implement
+ /// <see cref="../../IGFSerializable" /> instead.
+ /// </para><para>
+ /// The user must keep in mind that the rules that apply to <c>XmlSerializer</c>
+ /// would be the rules that apply to this class. For instance the user
+ /// cannot pass objects of class implementing or containing
+ /// <see cref="System.Collections.IDictionary" /> class, must use
+ /// <see cref="System.Xml.Serialization.XmlIncludeAttribute" /> to
+ /// mark user-defined types etc.
+ /// </para>
+ /// </remarks>
+ public ref class CacheableObjectXml
+ : public IGFSerializable
+ {
+ public:
+ /// <summary>
+ /// Static function to create a new instance from the given object.
+ /// </summary>
+ /// <remarks>
+ /// If the given object is null then this method returns null.
+ /// </remarks>
+ inline static CacheableObjectXml^ Create(Object^ value)
+ {
+ return (value != nullptr ? gcnew CacheableObjectXml(value) :
+ nullptr);
+ }
+
+ /// <summary>
+ /// Serializes this <see cref="System.Object" /> using
+ /// <see cref="System.Xml.Serialization.XmlSerializer" /> class.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserializes the <see cref="System.Object" /> using
+ /// <see cref="System.Xml.Serialization.XmlSerializer" /> class.
+ /// </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::CacheableManagedObjectXml;
+ }
+ }
+
+ /// <summary>
+ /// Gets the object value.
+ /// </summary>
+ /// <remarks>
+ /// The user can modify the object and the changes shall be reflected
+ /// immediately in the local cache. For this change to be propagate to
+ /// other members of the distributed system, the object needs to be
+ /// put into the cache.
+ /// </remarks>
+ property Object^ Value
+ {
+ inline Object^ get()
+ {
+ return m_obj;
+ }
+ }
+
+ virtual String^ ToString() override
+ {
+ return (m_obj == nullptr ? nullptr : m_obj->ToString());
+ }
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableObjectXml(nullptr);
+ }
+
+ internal:
+ /// <summary>
+ /// Allocates a new instance from the given object.
+ /// </summary>
+ inline CacheableObjectXml(Object^ value)
+ : m_obj(value), m_objectSize(0) { }
+
+ private:
+ Object^ m_obj;
+ uint32_t m_objectSize;
+ };
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableStackMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableStackMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableStackMN.cpp
new file mode 100644
index 0000000..39efaa6
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableStackMN.cpp
@@ -0,0 +1,82 @@
+/*=========================================================================
+ * 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 "CacheableStackMN.hpp"
+#include "DataOutputMN.hpp"
+#include "DataInputMN.hpp"
+#include <cppcache/impl/GemfireTypeIdsImpl.hpp>
+#include "impl/SafeConvertN.hpp"
+#include "GemFireClassIdsMN.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ // Region: IGFSerializable Members
+
+ void CacheableStack::ToData(DataOutput^ output)
+ {
+ if(m_stack != nullptr)
+ {
+ output->WriteArrayLen((int32_t)m_stack->Count);
+ for each (Object^ obj in m_stack) {
+ output->WriteObject(obj);
+ }
+ }
+ else
+ {
+ output->WriteByte(0xFF);
+ }
+ }
+
+ IGFSerializable^ CacheableStack::FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ if (len > 0)
+ {
+ System::Collections::Generic::Stack<Object^>^ stack = safe_cast<System::Collections::Generic::Stack<Object^>^>(m_stack);
+ for( int i = 0; i < len; i++)
+ {
+ (stack)->Push(input->ReadObject());
+// Push(input->ReadObject());
+ }
+ }
+ return this;
+ }
+
+ uint32_t CacheableStack::ClassId::get()
+ {
+ return GemFireClassIds::CacheableStack;
+ }
+
+ uint32_t CacheableStack::ObjectSize::get()
+ {
+ //TODO:hitesh
+ /*uint32_t size = static_cast<uint32_t> (sizeof(CacheableStack^));
+ for each (IGFSerializable^ val in this) {
+ if (val != nullptr) {
+ size += val->ObjectSize;
+ }
+ }*/
+ return m_stack->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/CacheableStackMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableStackMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableStackMN.hpp
new file mode 100644
index 0000000..9ce3e7d
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableStackMN.hpp
@@ -0,0 +1,120 @@
+/*=========================================================================
+ * 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"
+
+
+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.
+ /// </summary>
+ ref class CacheableStack
+ : public IGFSerializable
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableStack(System::Collections::ICollection^ stack)
+ {
+ m_stack = stack;
+ }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableStack^ Create()
+ {
+ return gcnew CacheableStack(gcnew System::Collections::Generic::Stack<Object^>());
+ }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableStack^ Create(System::Collections::ICollection^ stack)
+ {
+ return gcnew CacheableStack(stack);
+ }
+
+
+
+ // 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();
+ }
+
+ virtual property System::Collections::ICollection^ Value
+ {
+ virtual System::Collections::ICollection^ get()
+ {
+ return m_stack;
+ }
+ }
+ // End Region: IGFSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableStack(gcnew System::Collections::Generic::Stack<Object^>());
+ }
+
+ private:
+ System::Collections::ICollection^ m_stack;
+ };
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableStringArrayMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableStringArrayMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableStringArrayMN.cpp
new file mode 100644
index 0000000..cf2029b
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableStringArrayMN.cpp
@@ -0,0 +1,88 @@
+/*=========================================================================
+ * 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 "CacheableStringArrayMN.hpp"
+#include "CacheableStringMN.hpp"
+#include "DataInputMN.hpp"
+#include "DataOutputMN.hpp"
+#include "ExceptionTypesMN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+
+ CacheableStringArray::CacheableStringArray(array<String^>^ strings)
+ : Serializable()
+ {
+ m_value = strings;
+ }
+
+
+ array<String^>^ CacheableStringArray::GetValues()
+ {
+ return m_value;
+ }
+
+ String^ CacheableStringArray::default::get(int32_t index)
+ {
+ return m_value[index];
+ }
+
+ void CacheableStringArray::ToData(DataOutput^ output)
+ {
+ if (m_value == nullptr)
+ {
+ output->WriteArrayLen(-1);
+ }
+ else
+ {
+ output->WriteArrayLen(m_value->Length);
+ if (m_value->Length > 0)
+ {
+ for(int i = 0; i < m_value->Length; i++)
+ {
+ output->WriteObject(m_value[i]);
+ }
+ GC::KeepAlive(this);
+ }
+ }
+ }
+
+
+ IGFSerializable^ CacheableStringArray::FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ if ( len == -1)
+ {
+ m_value = nullptr;
+ return nullptr;
+ }
+ else
+ {
+ m_value = gcnew array<String^>(len);
+ if (len > 0)
+ {
+ for( int i = 0; i < len; i++)
+ {
+ m_value[i] = dynamic_cast<String^>(input->ReadObject());
+ }
+ }
+ return this;
+ }
+ }
+
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableStringArrayMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableStringArrayMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableStringArrayMN.hpp
new file mode 100644
index 0000000..cfba324
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableStringArrayMN.hpp
@@ -0,0 +1,180 @@
+/*=========================================================================
+ * 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 "GemFireClassIdsMN.hpp"
+#include "CacheableStringMN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ ref class CacheableString;
+
+ /// <summary>
+ /// An immutable wrapper for array of strings that can serve as
+ /// a distributable object for caching.
+ /// </summary>
+ ref class CacheableStringArray
+ : public Serializable
+ {
+ public:
+ /// <summary>
+ /// Static function to create a new instance copying from the given
+ /// string array.
+ /// </summary>
+ /// <remarks>
+ /// If the given array of strings is null or of zero-length then
+ /// this method returns null.
+ /// </remarks>
+ /// <exception cref="IllegalArgumentException">
+ /// If the array contains a string greater than or equal 64K in length.
+ /// </exception>
+ inline static CacheableStringArray^ Create(array<String^>^ strings)
+ {
+ return (strings != nullptr && strings->Length > 0 ?
+ gcnew CacheableStringArray(strings) : nullptr);
+ }
+
+ /// <summary>
+ /// Serializes this managed object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output) override;
+
+ /// <summary>
+ /// Deserializes the managed object -- returns an instance of the
+ /// <c>IGFSerializable</c> class.
+ /// </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) override;
+
+
+ /// <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::CacheableStringArray;
+ }
+ }
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property uint32_t ObjectSize
+ {
+ virtual uint32_t get() override
+ {
+ int size = 0;
+ for( int i = 0; i < m_value->Length; i++ )
+ {
+ size += m_value[i]->Length;
+ }
+ return (uint32_t) (size + sizeof(this));
+ }
+
+ }
+
+ /// <summary>
+ /// Returns a copy of the underlying array of strings.
+ /// </summary>
+ array<String^>^ GetValues();
+
+ /// <summary>
+ /// Returns a copy of the underlying string at the given index.
+ /// </summary>
+ property String^ GFINDEXER(int32_t)
+ {
+ String^ get(int32_t index);
+ }
+
+ /// <summary>
+ /// Gets the length of the array.
+ /// </summary>
+ property int32_t Length
+ {
+ inline int32_t get()
+ {
+ return m_value->Length;
+ }
+ }
+
+ virtual String^ ToString() override
+ {
+ return m_value->ToString();
+ }
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableStringArray();
+ }
+
+ internal:
+ /// <summary>
+ /// Factory function to register wrapper
+ /// </summary>
+ static IGFSerializable^ Create(gemfire::Serializable* obj)
+ {
+ return (obj != nullptr ?
+ gcnew CacheableStringArray(obj) : nullptr);
+ }
+
+ private:
+ array<String^>^ m_value;
+ /// <summary>
+ /// Allocates a new instance copying from the given string array.
+ /// </summary>
+ /// <exception cref="IllegalArgumentException">
+ /// If the array contains a string greater than or equal 64K in length.
+ /// </exception>
+ CacheableStringArray(array<String^>^ strings);
+
+
+ inline CacheableStringArray()
+ : Serializable()
+ {
+ //gemfire::Serializable* sp = gemfire::CacheableStringArray::createDeserializable();
+ //SetSP(sp);
+ }
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableStringArray(gemfire::Serializable* nativeptr)
+ : Serializable(nativeptr) { }
+ };
+ }
+ }
+}
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableStringMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableStringMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableStringMN.cpp
new file mode 100644
index 0000000..6588028
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableStringMN.cpp
@@ -0,0 +1,202 @@
+/*=========================================================================
+* 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 "DataOutputMN.hpp"
+#include "DataInputMN.hpp"
+
+//#include "gf_includesN.hpp"
+#include "CacheableStringMN.hpp"
+#include "ExceptionTypesMN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+
+ void CacheableString::ToData(DataOutput^ output)
+ {
+ if (m_type == GemFireClassIds::CacheableASCIIString ||
+ m_type == GemFireClassIds::CacheableString)
+ {
+ output->WriteUTF(m_value);
+ }
+ else if (m_type == GemFireClassIds::CacheableASCIIStringHuge)
+ {
+ output->WriteASCIIHuge(m_value);
+ }
+ else
+ {
+ output->WriteUTFHuge(m_value);
+ }
+ }
+
+ IGFSerializable^ CacheableString::FromData(DataInput^ input)
+ {
+ if (m_type == GemFireClassIds::CacheableASCIIString ||
+ m_type == GemFireClassIds::CacheableString)
+ {
+ m_value = input->ReadUTF();
+ }
+ else if (m_type == GemFireClassIds::CacheableASCIIStringHuge)
+ {
+ m_value = input->ReadASCIIHuge();
+ }
+ else
+ {
+ m_value = input->ReadUTFHuge();
+ }
+
+ return this;
+ }
+
+
+ inline void CacheableString::GetCacheableString(String^ value,
+ gemfire::CacheableStringPtr& cStr)
+ {
+ size_t len;
+ if (value != nullptr && (len = value->Length) > 0) {
+ pin_ptr<const wchar_t> pin_value = PtrToStringChars(value);
+ cStr = gemfire::CacheableString::create(pin_value, (int32_t)len);
+ }
+ else {
+ cStr = (gemfire::CacheableString*)
+ gemfire::CacheableString::createDeserializable();
+ }
+ }
+
+ inline void CacheableString::GetCacheableString(array<Char>^ value,
+ gemfire::CacheableStringPtr& cStr)
+ {
+ size_t len;
+ if (value != nullptr && (len = value->Length) > 0) {
+ pin_ptr<const Char> pin_value = &value[0];
+ cStr = gemfire::CacheableString::create(
+ (const wchar_t*)pin_value, (int32_t)len);
+ }
+ else {
+ cStr = (gemfire::CacheableString*)
+ gemfire::CacheableString::createDeserializable();
+ }
+ }
+
+ CacheableString::CacheableString(String^ value)
+ : CacheableKey()
+ {
+ if (value == nullptr ) {
+ throw gcnew IllegalArgumentException("CacheableString: null or " +
+ "zero-length string provided to the constructor.");
+ }
+ m_value = value;
+
+ this->SetStringType();
+ }
+
+ CacheableString::CacheableString(array<Char>^ value)
+ : CacheableKey()
+ {
+ if (value == nullptr ) {
+ throw gcnew IllegalArgumentException("CacheableString: null or " +
+ "zero-length character array provided to the constructor.");
+ }
+ m_value = gcnew String(value);
+
+ this->SetStringType();
+ }
+
+ CacheableString::CacheableString(String^ value, bool noParamCheck)
+ : CacheableKey()
+ {
+ m_value = value;
+ this->SetStringType();
+ }
+
+ CacheableString::CacheableString(array<Char>^ value, bool noParamCheck)
+ : CacheableKey()
+ {
+ m_value = gcnew String(value);
+ this->SetStringType();
+ }
+
+ uint32_t CacheableString::ObjectSize::get()
+ {
+ return (m_value->Length * sizeof(char));
+ }
+
+ bool CacheableString::Equals(GemStone::GemFire::Cache::Generic::ICacheableKey^ other)
+ {
+ if (other == nullptr || other->ClassId != ClassId) {
+ return false;
+ }
+
+ CacheableString^ otherStr =
+ dynamic_cast<CacheableString^>(other);
+
+ if (otherStr == nullptr)
+ return false;
+
+ return m_value->Equals(otherStr->Value);//TODO::Hitesh
+ }
+
+ bool CacheableString::Equals(Object^ obj)
+ {
+ CacheableString^ otherStr =
+ dynamic_cast<CacheableString^>(obj);
+
+ if (otherStr != nullptr) {
+ return m_value->Equals(otherStr->Value);
+ }
+ return false;
+ }
+
+ int32_t CacheableString::GetHashCode()
+ {
+ if (String::IsNullOrEmpty(m_value)) {
+ return 0;
+ }
+ //TODO:hitesh need to need java hashcode
+ //return m_value->GetHashCode();
+ if(m_hashcode == 0)
+ {
+ int32_t prime = 31;
+ int32_t localHash = 0;
+ for (int32_t i = 0; i < m_value->Length; i++)
+ localHash = prime*localHash + m_value[i];
+ m_hashcode = localHash;
+ }
+ return m_hashcode;
+ }
+
+ void CacheableString::SetStringType()
+ {
+ int len = DataOutput::getEncodedLength(m_value);
+
+ if (len == m_value->Length)//ASCII string
+ {
+ if (len > 0xFFFF)
+ m_type = GemFireClassIds::CacheableASCIIStringHuge;
+ else
+ m_type = GemFireClassIds::CacheableASCIIString;
+ }
+ else
+ {
+ if (len > 0xFFFF)
+ m_type = GemFireClassIds::CacheableStringHuge;
+ else
+ m_type = GemFireClassIds::CacheableString;
+ }
+ }
+ }
+ }
+}
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableStringMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableStringMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableStringMN.hpp
new file mode 100644
index 0000000..012a8be
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableStringMN.hpp
@@ -0,0 +1,313 @@
+/*=========================================================================
+ * 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/CacheableString.hpp>
+#include "impl/ManagedStringN.hpp"
+#include "CacheableKeyMN.hpp"
+#include "GemFireClassIdsMN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ /// <summary>
+ /// An immutable string wrapper that can serve as a distributable
+ /// key object for caching as well as being a string value.
+ /// </summary>
+ ref class CacheableString
+ : public CacheableKey
+ {
+ public:
+ /// <summary>
+ /// Allocates a new instance copying from the given string.
+ /// </summary>
+ /// <param name="value">the string value of the new instance</param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the provided string is null or has zero length
+ /// </exception>
+ CacheableString(String^ value);
+
+ /// <summary>
+ /// Allocates a new instance copying from the given character array.
+ /// </summary>
+ /// <param name="value">
+ /// the character array value of the new instance
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the provided array is null or has zero length
+ /// </exception>
+ CacheableString(array<Char>^ value);
+
+ /// <summary>
+ /// Static function to create a new instance copying from
+ /// the given string.
+ /// </summary>
+ /// <remarks>
+ /// Providing a null or zero size string will return a null
+ /// <c>CacheableString</c> object.
+ /// </remarks>
+ /// <param name="value">the string value of the new instance</param>
+ inline static CacheableString^ Create(String^ value)
+ {
+ return (value != nullptr ?
+ gcnew CacheableString(value, true) : nullptr);
+ }
+
+ /// <summary>
+ /// Serializes this managed object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output) override;
+
+ /// <summary>
+ /// Deserializes the managed object -- returns an instance of the
+ /// <c>IGFSerializable</c> class.
+ /// </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) override;
+
+ // <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 m_type;
+ }
+ }
+
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property uint32_t ObjectSize
+ {
+ virtual uint32_t get() override;
+ }
+
+ /// <summary>
+ /// Static function to create a new instance copying from
+ /// the given character array.
+ /// </summary>
+ /// <remarks>
+ /// Providing a null or zero size character array will return a null
+ /// <c>CacheableString</c> object.
+ /// </remarks>
+ /// <param name="value">
+ /// the character array value of the new instance
+ /// </param>
+ inline static CacheableString^ Create(array<Char>^ value)
+ {
+ return (value != nullptr && value->Length > 0 ?
+ gcnew CacheableString(value, true) : nullptr);
+ }
+
+ /// <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_value;
+ }
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// It invokes the '==' operator of the underlying
+ /// <c>gemfire::CacheableString</c> object.
+ /// </summary>
+ virtual bool Equals(GemStone::GemFire::Cache::Generic::ICacheableKey^ other) override;
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// It invokes the '==' operator of the underlying
+ /// <c>gemfire::CacheableString</c> object.
+ /// </summary>
+ virtual bool Equals(Object^ obj) override;
+
+ /// <summary>
+ /// Return the hashcode for this key.
+ /// </summary>
+ virtual int32_t GetHashCode() override;
+
+ /// <summary>
+ /// Gets the string value.
+ /// </summary>
+ property String^ Value
+ {
+ inline String^ get()
+ {
+ return m_value;
+ }
+ }
+
+ /// <summary>
+ /// Static function to check whether IsNullOrEmpty.
+ /// </summary>
+ /// <remarks>
+ /// This is similar to the C# string.IsNullOrEmpty method.
+ /// </remarks>
+ /// <param name="value">the CacheableString value to check</param>
+ inline static bool IsNullOrEmpty(CacheableString^ value)
+ {
+ return (value == nullptr || value->Length == 0);
+ }
+
+ /// <summary>
+ /// Implicit conversion operator to underlying <c>System.String</c>.
+ /// </summary>
+ inline static operator String^ (CacheableString^ str)
+ {
+ return (str != nullptr ? CacheableString::GetString(str) : nullptr);
+ }
+
+ /// <summary>
+ /// Gets the length of the underlying C string.
+ /// </summary>
+ property uint32_t Length
+ {
+ inline uint32_t get()
+ {
+ return m_value->Length;
+ }
+ }
+
+ /// <summary>
+ /// True when the underlying C string is a wide-character string.
+ /// </summary>
+ property bool IsWideString
+ {
+ inline bool get()
+ {
+ return true;//TODO:hitesh
+ }
+ }
+
+ internal:
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableString(GemFireClassIds::CacheableASCIIString);
+ }
+
+ static IGFSerializable^ createDeserializableHuge()
+ {
+ return gcnew CacheableString(GemFireClassIds::CacheableASCIIStringHuge);
+ }
+
+ static IGFSerializable^ createUTFDeserializable()
+ {
+ return gcnew CacheableString(GemFireClassIds::CacheableString);
+ }
+
+ static IGFSerializable^ createUTFDeserializableHuge()
+ {
+ return gcnew CacheableString(GemFireClassIds::CacheableStringHuge);
+ }
+ /// <summary>
+ /// Factory function to register wrapper
+ /// </summary>
+ static IGFSerializable^ Create(gemfire::Serializable* obj)
+ {
+ return (obj != nullptr ?
+ gcnew CacheableString(obj) : nullptr);
+ }
+
+ /// <summary>
+ /// Internal function to create a <c>gemfire::CacheableString</c>
+ /// from the given managed string.
+ /// </summary>
+ static void GetCacheableString(String^ value,
+ gemfire::CacheableStringPtr& cStr);
+
+ /// <summary>
+ /// Internal function to create a <c>gemfire::CacheableString</c>
+ /// from the given managed array of characters.
+ /// </summary>
+ static void GetCacheableString(array<Char>^ value,
+ gemfire::CacheableStringPtr& cStr);
+
+ /// <summary>
+ /// Get the <c>System.String</c> from the given
+ /// <c>gemfire::CacheableString</c>
+ /// </summary>
+ inline static String^ GetString(gemfire::CacheableString * cStr)
+ {
+ if (cStr == NULL) {
+ return nullptr;
+ }
+ else if (cStr->isWideString()) {
+ return ManagedString::Get(cStr->asWChar());
+ }
+ else {
+ return ManagedString::Get(cStr->asChar());
+ }
+ }
+
+ inline static String^ GetString(CacheableString^ cStr)
+ {
+ return cStr->Value;
+ }
+
+ CacheableString(uint32_t type): CacheableKey()
+ {
+ m_type = type;
+ }
+
+ private:
+ String^ m_value;
+ uint32_t m_type;
+ int m_hashcode;
+
+ CacheableString(): CacheableKey()
+ {
+ m_type = GemFireClassIds::CacheableASCIIString;
+ }
+
+ void SetStringType();
+ /// <summary>
+ /// Private constructor to create a CacheableString without checking
+ /// for arguments.
+ /// </summary>
+ CacheableString(String^ value, bool noParamCheck);
+
+ /// <summary>
+ /// Private constructor to create a CacheableString without checking
+ /// for arguments.
+ /// </summary>
+ CacheableString(array<Char>^ value, bool noParamCheck);
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableString(gemfire::Serializable* nativeptr)
+ : CacheableKey(nativeptr) { }
+ };
+ }
+ }
+}
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableUndefinedMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableUndefinedMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableUndefinedMN.cpp
new file mode 100644
index 0000000..3ddc35c
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableUndefinedMN.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 "CacheableUndefinedMN.hpp"
+#include "DataOutputMN.hpp"
+#include "DataInputMN.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ // Region: IGFSerializable Members
+
+ void CacheableUndefined::ToData(DataOutput^ output)
+ {
+ }
+
+ IGFSerializable^ CacheableUndefined::FromData(DataInput^ input)
+ {
+ return this;
+ }
+
+ uint32_t CacheableUndefined::ObjectSize::get()
+ {
+ return static_cast<uint32_t> (sizeof(CacheableUndefined^));
+ }
+
+ // End Region: IGFSerializable Members
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableUndefinedMN.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableUndefinedMN.hpp b/geode-client-native/src/clicache/com/vmware/CacheableUndefinedMN.hpp
new file mode 100644
index 0000000..d61d1e5
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableUndefinedMN.hpp
@@ -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.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "../../gf_defs.hpp"
+#include "IGFSerializableN.hpp"
+#include "GemFireClassIdsMN.hpp"
+#include "LogMN.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache { namespace Generic
+ {
+ /// <summary>
+ /// Encapsulate an undefined result.
+ /// </summary>
+ public ref class CacheableUndefined
+ : public IGFSerializable
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableUndefined() { }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableUndefined^ Create()
+ {
+ return gcnew CacheableUndefined();
+ }
+
+ // 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::CacheableUndefined;
+ }
+ }
+
+ // End Region: IGFSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableUndefined();
+ }
+ };
+ }
+ }
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/com/vmware/CacheableVectorMN.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/com/vmware/CacheableVectorMN.cpp b/geode-client-native/src/clicache/com/vmware/CacheableVectorMN.cpp
new file mode 100644
index 0000000..82483f9
--- /dev/null
+++ b/geode-client-native/src/clicache/com/vmware/CacheableVectorMN.cpp
@@ -0,0 +1,70 @@
+/*=========================================================================
+ * 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 "CacheableVectorMN.hpp"
+#include "DataOutputMN.hpp"
+#include "DataInputMN.hpp"
+#include "ExceptionTypesMN.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 CacheableVector::ToData(DataOutput^ output)
+ {
+ if(m_arrayList != nullptr)
+ {
+ output->WriteArrayLen(m_arrayList->Count);
+ for each (Object^ obj in m_arrayList) {
+ //TODO::split
+ output->WriteObject(obj);
+ }
+ }
+ else
+ output->WriteByte(0xFF);
+ }
+
+ IGFSerializable^ CacheableVector::FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ for( int i = 0; i < len; i++)
+ {
+ m_arrayList->Add(input->ReadObject());
+ }
+ return this;
+ }
+
+ uint32_t CacheableVector::ObjectSize::get()
+ {
+ //TODO::hitesh
+ /*uint32_t size = static_cast<uint32_t> (sizeof(CacheableVector^));
+ for each (IGFSerializable^ val in this) {
+ if (val != nullptr) {
+ size += val->ObjectSize;
+ }
+ }*/
+ return m_arrayList->Count;
+ }
+
+ // End Region: IGFSerializable Members
+ }
+ }
+}
+ } //namespace
+