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:25 UTC
[18/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/CacheableKeyM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableKeyM.hpp b/geode-client-native/src/clicache/CacheableKeyM.hpp
new file mode 100644
index 0000000..9aa4c06
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableKeyM.hpp
@@ -0,0 +1,128 @@
+/*=========================================================================
+ * 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/NativeWrapper.hpp"
+#include "SerializableM.hpp"
+#include "ICacheableKey.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ /// <summary>
+ /// This class wraps the native C++ <c>gemfire::Serializable</c> objects
+ /// as managed <see cref="IGFSerializable" /> objects.
+ /// </summary>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public ref class CacheableKey
+ : public GemStone::GemFire::Cache::Serializable, public GemStone::GemFire::Cache::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(GemStone::GemFire::Cache::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 GemStone::GemFire::Cache::CacheableKey^ (bool value);
+
+ /// <summary>
+ /// Implicit conversion operator from a byte
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator GemStone::GemFire::Cache::CacheableKey^ (Byte value);
+
+ /// <summary>
+ /// Implicit conversion operator from a double
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator GemStone::GemFire::Cache::CacheableKey^ (Double value);
+
+ /// <summary>
+ /// Implicit conversion operator from a float
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator GemStone::GemFire::Cache::CacheableKey^ (Single value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 16-bit integer
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator GemStone::GemFire::Cache::CacheableKey^ (int16_t value);
+
+ /// <summary>
+ /// Implicit conversion operator from a character
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator GemStone::GemFire::Cache::CacheableKey^ (Char value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 32-bit integer
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator GemStone::GemFire::Cache::CacheableKey^ (int32_t value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 64-bit integer
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator GemStone::GemFire::Cache::CacheableKey^ (int64_t value);
+
+ /// <summary>
+ /// Implicit conversion operator from a string
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator GemStone::GemFire::Cache::CacheableKey^ (String^ value);
+
+ internal:
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ inline CacheableKey()
+ : /*GemStone::GemFire::Cache::*/Serializable() { }
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableKey(gemfire::Serializable* nativeptr)
+ : /*GemStone::GemFire::Cache::*/Serializable(nativeptr) { }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableObject.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableObject.cpp b/geode-client-native/src/clicache/CacheableObject.cpp
new file mode 100644
index 0000000..5a89378
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableObject.cpp
@@ -0,0 +1,62 @@
+/*=========================================================================
+ * 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_includes.hpp"
+#include "CacheableObject.hpp"
+#include "DataInputM.hpp"
+#include "DataOutputM.hpp"
+#include "impl/GFNullStream.hpp"
+#include "impl/GFDataInputStream.hpp"
+#include "impl/GFDataOutputStream.hpp"
+
+using namespace System;
+using namespace System::IO;
+using namespace System::Runtime::Serialization::Formatters::Binary;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ void CacheableObject::ToData(DataOutput^ output)
+ {
+ if(m_obj != nullptr)
+ {
+ GFDataOutputStream dos(output);
+ BinaryFormatter bf;
+ int64_t checkpoint = dos.Length;
+ bf.Serialize(%dos, m_obj);
+ m_objectSize = (uint32_t) (dos.Length - checkpoint);
+ }
+ }
+
+ IGFSerializable^ CacheableObject::FromData(DataInput^ input)
+ {
+ GFDataInputStream dis(input);
+ 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;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableObject.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableObject.hpp b/geode-client-native/src/clicache/CacheableObject.hpp
new file mode 100644
index 0000000..6818da5
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableObject.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 "IGFSerializable.hpp"
+#include "GemFireClassIdsM.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ /// <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>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ 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;
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableObjectArrayM.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableObjectArrayM.cpp b/geode-client-native/src/clicache/CacheableObjectArrayM.cpp
new file mode 100644
index 0000000..5a05dc8
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableObjectArrayM.cpp
@@ -0,0 +1,107 @@
+/*=========================================================================
+ * 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_includes.hpp"
+#include "cppcache/impl/GemfireTypeIdsImpl.hpp"
+#include "CacheableObjectArrayM.hpp"
+#include "DataOutputM.hpp"
+#include "DataInputM.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ // 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 (IGFSerializable^ obj in this) {
+ 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 size;
+ }
+
+ // End Region: IGFSerializable Members
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableObjectArrayM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableObjectArrayM.hpp b/geode-client-native/src/clicache/CacheableObjectArrayM.hpp
new file mode 100644
index 0000000..e913dc7
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableObjectArrayM.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 "IGFSerializable.hpp"
+#include "GemFireClassIdsM.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ /// <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>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public ref class CacheableObjectArray
+ : public List<IGFSerializable^>, public IGFSerializable
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableObjectArray()
+ : List<IGFSerializable^>()
+ { }
+
+ /// <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(System::Collections::Generic::IEnumerable<IGFSerializable^>^ collection)
+ : List<IGFSerializable^>(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<IGFSerializable^>(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(
+ System::Collections::Generic::IEnumerable<IGFSerializable^>^ 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();
+ }
+ };
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableObjectXml.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableObjectXml.cpp b/geode-client-native/src/clicache/CacheableObjectXml.cpp
new file mode 100644
index 0000000..5037b58
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableObjectXml.cpp
@@ -0,0 +1,90 @@
+/*=========================================================================
+ * 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_includes.hpp"
+#include "CacheableObjectXml.hpp"
+#include "DataInputM.hpp"
+#include "DataOutputM.hpp"
+#include "LogM.hpp"
+#include "impl/GFNullStream.hpp"
+#include "impl/GFDataInputStream.hpp"
+#include "impl/GFDataOutputStream.hpp"
+
+using namespace System;
+using namespace System::IO;
+using namespace System::Xml::Serialization;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ 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);
+
+ XmlSerializer xs(objType);
+ GFDataOutputStream dos(output);
+ int64_t checkpoint = dos.Length;
+ xs.Serialize(%dos, m_obj);
+ m_objectSize = (uint32_t) (dos.Length - checkpoint);
+ }
+ }
+
+ 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 {
+ GFDataInputStream dis(input);
+ 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;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableObjectXml.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableObjectXml.hpp b/geode-client-native/src/clicache/CacheableObjectXml.hpp
new file mode 100644
index 0000000..6273e22
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableObjectXml.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 "IGFSerializable.hpp"
+#include "GemFireClassIdsM.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ /// <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>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ 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;
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableStackM.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableStackM.cpp b/geode-client-native/src/clicache/CacheableStackM.cpp
new file mode 100644
index 0000000..2edacbd
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableStackM.cpp
@@ -0,0 +1,67 @@
+/*=========================================================================
+ * 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_includes.hpp"
+#include "CacheableStackM.hpp"
+#include "DataOutputM.hpp"
+#include "DataInputM.hpp"
+#include "cppcache/impl/GemfireTypeIdsImpl.hpp"
+#include "GemFireClassIdsM.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ // Region: IGFSerializable Members
+
+ void CacheableStack::ToData(DataOutput^ output)
+ {
+ output->WriteArrayLen((int32_t)Count);
+ for each (IGFSerializable^ obj in this) {
+ output->WriteObject(obj);
+ }
+ }
+
+ IGFSerializable^ CacheableStack::FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ if (len > 0)
+ {
+ for( int i = 0; i < len; i++)
+ {
+ Push(input->ReadObject());
+ }
+ }
+ return this;
+ }
+
+ uint32_t CacheableStack::ClassId::get()
+ {
+ return GemFireClassIds::CacheableStack;
+ }
+
+ uint32_t CacheableStack::ObjectSize::get()
+ {
+ uint32_t size = static_cast<uint32_t> (sizeof(CacheableStack^));
+ for each (IGFSerializable^ val in this) {
+ if (val != nullptr) {
+ size += val->ObjectSize;
+ }
+ }
+ return size;
+ }
+
+ // End Region: IGFSerializable Members
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableStackM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableStackM.hpp b/geode-client-native/src/clicache/CacheableStackM.hpp
new file mode 100644
index 0000000..6d60aff
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableStackM.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 "IGFSerializable.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ /// <summary>
+ /// A mutable <c>IGFSerializable</c> vector wrapper that can serve as
+ /// a distributable object for caching.
+ /// </summary>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public ref class CacheableStack
+ : public Stack<IGFSerializable^>, public IGFSerializable
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableStack()
+ : Stack<IGFSerializable^>()
+ { }
+
+ /// <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 CacheableStack(IEnumerable<IGFSerializable^>^ collection)
+ : Stack<IGFSerializable^>(collection)
+ { }
+
+ /// <summary>
+ /// Allocates a new empty instance with given initial size.
+ /// </summary>
+ /// <param name="capacity">
+ /// The initial capacity of the vector.
+ /// </param>
+ inline CacheableStack(int32_t capacity)
+ : Stack<IGFSerializable^>(capacity)
+ { }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableStack^ Create()
+ {
+ return gcnew CacheableStack();
+ }
+
+ /// <summary>
+ /// Static function to create a new instance copying from the
+ /// given collection.
+ /// </summary>
+ inline static CacheableStack^ Create(
+ IEnumerable<IGFSerializable^>^ collection)
+ {
+ return gcnew CacheableStack(collection);
+ }
+
+ /// <summary>
+ /// Static function to create a new instance with given initial size.
+ /// </summary>
+ inline static CacheableStack^ Create(int32_t capacity)
+ {
+ return gcnew CacheableStack(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();
+ }
+
+ // End Region: IGFSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableStack();
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableStringArrayM.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableStringArrayM.cpp b/geode-client-native/src/clicache/CacheableStringArrayM.cpp
new file mode 100644
index 0000000..c98b88e
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableStringArrayM.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_includes.hpp"
+#include "CacheableStringArrayM.hpp"
+#include "CacheableStringM.hpp"
+#include "cppcache/DataInput.hpp"
+#include "cppcache/DataOutput.hpp"
+#include "GemFireClassIdsM.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ CacheableStringArray::CacheableStringArray(array<String^>^ strings)
+ : GemStone::GemFire::Cache::Serializable()
+ {
+ if (strings != nullptr)
+ {
+ m_value = gcnew array<CacheableString^>(strings->Length);
+
+ for( int i = 0; i< strings->Length; i++)
+ {
+ m_value[i] = CacheableString::Create(strings[i]);
+ }
+ }
+ else
+ m_value = nullptr;
+ }
+
+ CacheableStringArray::CacheableStringArray(
+ array<CacheableString^>^ strings) : GemStone::GemFire::Cache::Serializable()
+ {
+ m_value = strings;
+ }
+
+ array<CacheableString^>^ CacheableStringArray::GetValues()
+ {
+ return m_value;
+ }
+
+ String^ CacheableStringArray::default::get(int32_t index)
+ {
+ return m_value[index]->Value;
+ }
+
+
+ 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]);
+ }
+ }
+ }
+ }
+
+ IGFSerializable^ CacheableStringArray::FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ if ( len == -1)
+ {
+ m_value = nullptr;
+ return nullptr;
+ }
+ else
+ {
+ m_value = gcnew array<CacheableString^>(len);
+ if (len > 0)
+ {
+ for( int i = 0; i < len; i++)
+ {
+ m_value[i] = dynamic_cast<CacheableString^>(input->ReadObject());
+ }
+ }
+ return this;
+ }
+ }
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableStringArrayM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableStringArrayM.hpp b/geode-client-native/src/clicache/CacheableStringArrayM.hpp
new file mode 100644
index 0000000..7b266a9
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableStringArrayM.hpp
@@ -0,0 +1,205 @@
+/*=========================================================================
+ * 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 "SerializableM.hpp"
+#include "CacheableStringM.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ ref class CacheableString;
+
+ /// <summary>
+ /// An immutable wrapper for array of strings that can serve as
+ /// a distributable object for caching.
+ /// </summary>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public 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>
+ /// Static function to create a new instance assigning the given
+ /// <c>CacheableString</c> 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<CacheableString^>^ 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]->ObjectSize;
+ }
+ return size + (int) sizeof(this);
+ }
+
+ }
+
+
+ /// <summary>
+ /// Returns a copy of the underlying array of strings.
+ /// </summary>
+ array<CacheableString^>^ 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<CacheableString^>^ 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);
+
+ /// <summary>
+ /// Allocates a new instance assigning the given
+ /// <c>CacheableString</c> array.
+ /// </summary>
+ /// <exception cref="IllegalArgumentException">
+ /// If the array contains a string greater than or equal 64K in length.
+ /// </exception>
+ CacheableStringArray(array<CacheableString^>^ 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) { }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableStringM.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableStringM.cpp b/geode-client-native/src/clicache/CacheableStringM.cpp
new file mode 100644
index 0000000..8417bd0
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableStringM.cpp
@@ -0,0 +1,229 @@
+/*=========================================================================
+* 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_includes.hpp"
+#include "CacheableStringM.hpp"
+#include "DataInputM.hpp"
+#include "DataOutputM.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ void CacheableString::ToData(DataOutput^ output)
+ {
+ if (m_type == GemFire::Cache::GemFireClassIds::CacheableASCIIString ||
+ m_type == GemFire::Cache::GemFireClassIds::CacheableString)
+ {
+ output->WriteUTF(m_value);
+ }
+ else if (m_type == GemFire::Cache::GemFireClassIds::CacheableASCIIStringHuge)
+ {
+ output->WriteASCIIHuge(m_value);
+ }
+ else
+ {
+ output->WriteUTFHuge(m_value);
+ }
+ }
+
+ IGFSerializable^ CacheableString::FromData(DataInput^ input)
+ {
+ if (m_type == GemFire::Cache::GemFireClassIds::CacheableASCIIString ||
+ m_type == GemFire::Cache::GemFireClassIds::CacheableString)
+ {
+ m_value = input->ReadUTF();
+ }
+ else if (m_type == GemFire::Cache::GemFireClassIds::CacheableASCIIStringHuge)
+ {
+ m_value = input->ReadASCIIHuge();
+ }
+ else
+ {
+ m_value = input->ReadUTFHuge();
+ }
+
+ return this;
+ }
+
+ /*
+ void CacheableString::ToData(DataOutput^ output)
+ {
+ if (m_type == GemFire::Cache::GemFireClassIds::CacheableASCIIString ||
+ m_type == GemFire::Cache::GemFireClassIds::CacheableString)
+ {
+ output->WriteUTF(m_value);
+ }
+ else if (m_type == GemFire::Cache::GemFireClassIds::CacheableASCIIStringHuge)
+ {
+ output->WriteASCIIHuge(m_value);
+ }
+ else
+ {
+ output->WriteUTFHuge(m_value);
+ }
+ }
+
+ IGFSerializable^ CacheableString::FromData(DataInput^ input)
+ {
+ if (m_type == GemFire::Cache::GemFireClassIds::CacheableASCIIString ||
+ m_type == GemFire::Cache::GemFireClassIds::CacheableString)
+ {
+ m_value = input->ReadUTF();
+ }
+ else if (m_type == GemFire::Cache::GemFireClassIds::CacheableASCIIStringHuge)
+ {
+ m_value = input->ReadASCIIHuge();
+ }
+ else
+ {
+ m_value = input->ReadUTFHuge();
+ }
+
+ return this;
+ }
+ */
+
+ inline void CacheableString::GetCacheableString(String^ value,
+ gemfire::CacheableStringPtr& cStr)
+ {
+ int32_t len;
+ if (value != nullptr && (len = value->Length) > 0) {
+ pin_ptr<const wchar_t> pin_value = PtrToStringChars(value);
+ cStr = gemfire::CacheableString::create(pin_value, len);
+ }
+ else {
+ cStr = (gemfire::CacheableString*)
+ gemfire::CacheableString::createDeserializable();
+ }
+ }
+
+ inline void CacheableString::GetCacheableString(array<Char>^ value,
+ gemfire::CacheableStringPtr& cStr)
+ {
+ int32_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, 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();
+ }
+
+ bool CacheableString::Equals(GemStone::GemFire::Cache::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 = GemFire::Cache::GemFireClassIds::CacheableASCIIStringHuge;
+ else
+ m_type = GemFire::Cache::GemFireClassIds::CacheableASCIIString;
+ }
+ else
+ {
+ if (len > 0xFFFF)
+ m_type = GemFire::Cache::GemFireClassIds::CacheableStringHuge;
+ else
+ m_type = GemFire::Cache::GemFireClassIds::CacheableString;
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableStringM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableStringM.hpp b/geode-client-native/src/clicache/CacheableStringM.hpp
new file mode 100644
index 0000000..e6f970b
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableStringM.hpp
@@ -0,0 +1,319 @@
+/*=========================================================================
+ * 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/ManagedString.hpp"
+#include "DataOutputM.hpp"
+#include "CacheableKeyM.hpp"
+#include "LogM.hpp"
+#include "GemFireClassIdsM.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ /// <summary>
+ /// An immutable string wrapper that can serve as a distributable
+ /// key object for caching as well as being a string value.
+ /// </summary>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public 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 GemStone::GemFire::Cache::CacheableString^ Create(String^ value)
+ {
+ return (value != nullptr ?
+ gcnew GemStone::GemFire::Cache::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(GemFire::Cache::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 GemStone::GemFire::Cache::IGFSerializable^ FromData(GemFire::Cache::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
+ {
+ return (uint32_t)(m_value->Length * sizeof(char));
+ }
+ }
+
+
+ /// <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 GemStone::GemFire::Cache::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::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(GemStone::GemFire::Cache::CacheableString^ value)
+ {
+ return (value == nullptr || value->Length == 0);
+ }
+
+ /// <summary>
+ /// Implicit conversion operator to underlying <c>System.String</c>.
+ /// </summary>
+ inline static operator String^ (GemStone::GemFire::Cache::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 GemStone::GemFire::Cache::CacheableString(GemFire::Cache::GemFireClassIds::CacheableASCIIString);
+ }
+
+ static IGFSerializable^ createDeserializableHuge()
+ {
+ return gcnew GemStone::GemFire::Cache::CacheableString(GemFire::Cache::GemFireClassIds::CacheableASCIIStringHuge);
+ }
+
+ static IGFSerializable^ createUTFDeserializable()
+ {
+ return gcnew GemStone::GemFire::Cache::CacheableString(GemFire::Cache::GemFireClassIds::CacheableString);
+ }
+
+ static IGFSerializable^ createUTFDeserializableHuge()
+ {
+ return gcnew GemStone::GemFire::Cache::CacheableString(GemFire::Cache::GemFireClassIds::CacheableStringHuge);
+ }
+
+ /// <summary>
+ /// Factory function to register wrapper
+ /// </summary>
+ static IGFSerializable^ Create(gemfire::Serializable* obj)
+ {
+ return (obj != nullptr ?
+ gcnew GemStone::GemFire::Cache::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;
+ }
+
+ private:
+ String^ m_value;
+ uint32_t m_type;
+ int m_hashcode;
+
+ CacheableString(): CacheableKey()
+ {
+ m_type = GemFire::Cache::GemFireClassIds::CacheableASCIIString;
+ }
+
+ CacheableString(uint32_t type): CacheableKey()
+ {
+ m_type = type;
+ }
+
+ 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) { }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableUndefinedM.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableUndefinedM.cpp b/geode-client-native/src/clicache/CacheableUndefinedM.cpp
new file mode 100644
index 0000000..b095807
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableUndefinedM.cpp
@@ -0,0 +1,42 @@
+/*=========================================================================
+ * 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_includes.hpp"
+#include "CacheableUndefinedM.hpp"
+#include "DataOutputM.hpp"
+#include "DataInputM.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ // 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
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableUndefinedM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableUndefinedM.hpp b/geode-client-native/src/clicache/CacheableUndefinedM.hpp
new file mode 100644
index 0000000..58d7c3d
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableUndefinedM.hpp
@@ -0,0 +1,98 @@
+/*=========================================================================
+ * 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 "IGFSerializable.hpp"
+#include "GemFireClassIdsM.hpp"
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ /// <summary>
+ /// Encapsulate an undefined result.
+ /// </summary>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ 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();
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableVectorM.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableVectorM.cpp b/geode-client-native/src/clicache/CacheableVectorM.cpp
new file mode 100644
index 0000000..74c44ef
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableVectorM.cpp
@@ -0,0 +1,58 @@
+/*=========================================================================
+ * 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_includes.hpp"
+#include "CacheableVectorM.hpp"
+#include "DataOutputM.hpp"
+#include "DataInputM.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ // Region: IGFSerializable Members
+
+ void CacheableVector::ToData(DataOutput^ output)
+ {
+ output->WriteArrayLen(this->Count);
+ for each (IGFSerializable^ obj in this) {
+ output->WriteObject(obj);
+ }
+ }
+
+ IGFSerializable^ CacheableVector::FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ for( int i = 0; i < len; i++)
+ {
+ this->Add(input->ReadObject());
+ }
+ return this;
+ }
+
+ uint32_t CacheableVector::ObjectSize::get()
+ {
+ uint32_t size = static_cast<uint32_t> (sizeof(CacheableVector^));
+ for each (IGFSerializable^ val in this) {
+ if (val != nullptr) {
+ size += val->ObjectSize;
+ }
+ }
+ return size;
+ }
+
+ // End Region: IGFSerializable Members
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CacheableVectorM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CacheableVectorM.hpp b/geode-client-native/src/clicache/CacheableVectorM.hpp
new file mode 100644
index 0000000..6b40229
--- /dev/null
+++ b/geode-client-native/src/clicache/CacheableVectorM.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 "IGFSerializable.hpp"
+#include "GemFireClassIdsM.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ /// <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>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public ref class CacheableVector
+ : public List<IGFSerializable^>, public IGFSerializable
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableVector()
+ : List<IGFSerializable^>()
+ { }
+
+ /// <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 CacheableVector(IEnumerable<IGFSerializable^>^ collection)
+ : List<IGFSerializable^>(collection)
+ { }
+
+ /// <summary>
+ /// Allocates a new empty instance with given initial size.
+ /// </summary>
+ /// <param name="capacity">
+ /// The initial capacity of the vector.
+ /// </param>
+ inline CacheableVector(int32_t capacity)
+ : List<IGFSerializable^>(capacity)
+ { }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableVector^ Create()
+ {
+ return gcnew CacheableVector();
+ }
+
+ /// <summary>
+ /// Static function to create a new instance copying from the
+ /// given collection.
+ /// </summary>
+ inline static CacheableVector^ Create(
+ IEnumerable<IGFSerializable^>^ collection)
+ {
+ return gcnew CacheableVector(collection);
+ }
+
+ /// <summary>
+ /// Static function to create a new instance with given initial size.
+ /// </summary>
+ inline static CacheableVector^ Create(int32_t capacity)
+ {
+ return gcnew CacheableVector(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::CacheableVector;
+ }
+ }
+
+ // End Region: IGFSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGFSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableVector();
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CqAttributesFactoryM.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CqAttributesFactoryM.cpp b/geode-client-native/src/clicache/CqAttributesFactoryM.cpp
new file mode 100644
index 0000000..71a5121
--- /dev/null
+++ b/geode-client-native/src/clicache/CqAttributesFactoryM.cpp
@@ -0,0 +1,52 @@
+/*=========================================================================
+* 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_includes.hpp"
+#include "CqAttributesFactoryM.hpp"
+#include "CqAttributesM.hpp"
+#include "impl/ManagedCqListener.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ void CqAttributesFactory::AddCqListener(ICqListener^ cqListener )
+ {
+ gemfire::CqListenerPtr listenerptr;
+ if ( cqListener != nullptr ) {
+ listenerptr = new gemfire::ManagedCqListener( cqListener );
+ }
+
+ NativePtr->addCqListener( listenerptr );
+ }
+ void CqAttributesFactory::InitCqListeners(array<ICqListener^>^ cqListeners)
+ {
+ gemfire::VectorOfCqListener vrr(cqListeners->GetLength(1));
+
+ for( int i = 0; i < cqListeners->GetLength(1); i++ )
+ {
+ ICqListener^ lister = cqListeners[i];
+ vrr[i] = new gemfire::ManagedCqListener( lister );
+ }
+
+ NativePtr->initCqListeners( vrr );
+ }
+
+ CqAttributes^ CqAttributesFactory::Create( )
+ {
+ return CqAttributes::Create(NativePtr->create().ptr());
+ }
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CqAttributesFactoryM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CqAttributesFactoryM.hpp b/geode-client-native/src/clicache/CqAttributesFactoryM.hpp
new file mode 100644
index 0000000..01408e7
--- /dev/null
+++ b/geode-client-native/src/clicache/CqAttributesFactoryM.hpp
@@ -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.
+ *=========================================================================
+ */
+
+#pragma once
+
+#include "gf_defs.hpp"
+#include "cppcache/CqAttributesFactory.hpp"
+#include "impl/NativeWrapper.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ ref class CqAttributes;
+ interface class ICqListener;
+
+ /// <summary>
+ /// Creates instances of <c>CqAttributes</c>.
+ /// </summary>
+ /// <seealso cref="CqAttributes" />
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public ref class CqAttributesFactory sealed
+ : public Internal::UMWrap<gemfire::CqAttributesFactory>
+ {
+ public:
+
+ /// <summary>
+ /// Creates a new instance of <c>CqAttributesFactory</c> ready
+ /// to create a <c>CqAttributes</c> with default settings.
+ /// </summary>
+ inline CqAttributesFactory( )
+ : UMWrap( new gemfire::CqAttributesFactory( ), true )
+ { }
+ inline CqAttributesFactory(CqAttributes^ cqAttributes )
+ : UMWrap( new gemfire::CqAttributesFactory(gemfire::CqAttributesPtr(GetNativePtr<gemfire::CqAttributes>(cqAttributes ))), true )
+ { }
+
+ // ATTRIBUTES
+
+ /// <summary>
+ /// add a cqListener
+ /// </summary>
+ void AddCqListener(ICqListener^ cqListener);
+
+ /// <summary>
+ /// Initialize with an array of listeners
+ /// </summary>
+ void InitCqListeners( array<ICqListener^>^ cqListeners );
+
+ // FACTORY METHOD
+
+ /// <summary>
+ /// Creates a <c>CqAttributes</c> with the current settings.
+ /// </summary>
+ CqAttributes^ Create( );
+ };
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CqAttributesM.cpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CqAttributesM.cpp b/geode-client-native/src/clicache/CqAttributesM.cpp
new file mode 100644
index 0000000..57505ca
--- /dev/null
+++ b/geode-client-native/src/clicache/CqAttributesM.cpp
@@ -0,0 +1,47 @@
+/*=========================================================================
+ * 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_includes.hpp"
+#include "CqAttributesM.hpp"
+#include "impl/ManagedCqListener.hpp"
+#include "ICqListener.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+ array<ICqListener^>^ CqAttributes::getCqListeners( )
+ {
+ gemfire::VectorOfCqListener vrr;
+ NativePtr->getCqListeners( vrr );
+ array<ICqListener^>^ listners = gcnew array<ICqListener^>( vrr.size( ) );
+
+ for( int32_t index = 0; index < vrr.size( ); index++ )
+ {
+ gemfire::CqListenerPtr& nativeptr( vrr[ index ] );
+ gemfire::ManagedCqListener* mg_listener =
+ dynamic_cast<gemfire::ManagedCqListener*>( nativeptr.ptr( ) );
+ if (mg_listener != nullptr)
+ {
+ listners[ index ] = mg_listener->ptr( );
+ }else
+ {
+ listners[ index ] = nullptr;
+ }
+ }
+ return listners;
+ }
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac967000/geode-client-native/src/clicache/CqAttributesM.hpp
----------------------------------------------------------------------
diff --git a/geode-client-native/src/clicache/CqAttributesM.hpp b/geode-client-native/src/clicache/CqAttributesM.hpp
new file mode 100644
index 0000000..befd090
--- /dev/null
+++ b/geode-client-native/src/clicache/CqAttributesM.hpp
@@ -0,0 +1,73 @@
+/*=========================================================================
+ * 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/CqAttributes.hpp"
+#include "impl/NativeWrapper.hpp"
+
+
+using namespace System;
+
+namespace GemStone
+{
+ namespace GemFire
+ {
+ namespace Cache
+ {
+
+ interface class ICqListener;
+
+ /// <summary>
+ /// Defines attributes for configuring a cq.
+ /// </summary>
+ [Obsolete("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
+ public ref class CqAttributes sealed
+ : public Internal::SBWrap<gemfire::CqAttributes>
+ {
+ public:
+
+ /// <summary>
+ /// get all listeners in this attributes
+ /// </summary>
+ virtual array<ICqListener^>^ getCqListeners();
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static CqAttributes^ Create( gemfire::CqAttributes* nativeptr )
+ {
+ if (nativeptr == nullptr)
+ {
+ return nullptr;
+ }
+ return gcnew CqAttributes( nativeptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CqAttributes( gemfire::CqAttributes* nativeptr )
+ : SBWrap( nativeptr ) { }
+ };
+
+ }
+ }
+}