You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/08/11 23:52:25 UTC
[09/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Serializable.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Serializable.hpp b/clicache/src/Serializable.hpp
new file mode 100644
index 0000000..6f9e51f
--- /dev/null
+++ b/clicache/src/Serializable.hpp
@@ -0,0 +1,696 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CacheableKey.hpp>
+#include <geode/CacheableBuiltins.hpp>
+#include "end_native.hpp"
+
+#include "IGeodeSerializable.hpp"
+#include "IGeodeDelta.hpp"
+#include "impl/ManagedString.hpp"
+#include "native_shared_ptr.hpp"
+#include "impl/EnumInfo.hpp"
+#include "Log.hpp"
+#include <vcclr.h>
+#include "IPdxTypeMapper.hpp"
+
+using namespace System::Reflection;
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ interface class IPdxSerializable;
+ interface class IPdxSerializer;
+ ref class Cache;
+
+ /// <summary>
+ /// Signature of native function delegates passed to native
+ /// <c>native::Serializable::registerType</c>.
+ /// Such functions should return an empty instance of the type they
+ /// represent. The instance will typically be initialized immediately
+ /// after creation by a call to native
+ /// <c>native::Serializable::fromData</c>.
+ /// </summary>
+ delegate native::Serializable* TypeFactoryNativeMethodGeneric();
+
+ /// <summary>
+ /// Signature of function delegates passed to
+ /// <see cref="Serializable.RegisterType" />. Such functions should
+ /// return an empty instance of the type they represent.
+ /// The delegate shall be stored in the internal <c>DelegateWrapper</c>
+ /// class and an instance will be initialized in the
+ /// <c>DelegateWrapper.NativeDelegate</c> method by a call to
+ /// <see cref="IGeodeSerializable.FromData" />.
+ /// </summary>
+ public delegate Apache::Geode::Client::IGeodeSerializable^ TypeFactoryMethodGeneric();
+ /// <summary>
+ /// Delegate to wrap a native <c>native::Serializable</c> type.
+ /// </summary>
+ /// <remarks>
+ /// This delegate should return an object of type <c>IGeodeSerializable</c>
+ /// given a native object.
+ /// </remarks>
+ delegate Apache::Geode::Client::IGeodeSerializable^ WrapperDelegateGeneric(native::SerializablePtr obj);
+
+ /// <summary>
+ /// Signature of function delegates passed to
+ /// <see cref="Serializable.RegisterPdxType" />. Such functions should
+ /// return an empty instance of the type they represent.
+ /// New instance will be created during de-serialization of Pdx Types
+ /// <see cref="IPdxSerializable" />.
+ /// </summary>
+ public delegate Apache::Geode::Client::IPdxSerializable^ PdxTypeFactoryMethod();
+
+ /// <summary>
+ /// This class wraps the native C++ <c>native::Serializable</c> objects
+ /// as managed <see cref="IGeodeSerializable" /> objects.
+ /// </summary>
+ public ref class Serializable
+ : public Apache::Geode::Client::IGeodeSerializable
+ {
+ public:
+ /// <summary>
+ /// Serializes this native (C++) object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(Apache::Geode::Client::DataOutput^ output);
+
+ /// <summary>
+ /// Deserializes the native (C++) object -- returns an instance of the
+ /// <c>Serializable</c> class with the native object wrapped inside.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual Apache::Geode::Client::IGeodeSerializable^
+ FromData(Apache::Geode::Client::DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 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 System::UInt32 ClassId
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Return a string representation of the object.
+ /// It simply returns the string representation of the underlying
+ /// native object by calling its <c>toString()</c> function.
+ /// </summary>
+ virtual String^ ToString() override;
+
+ // Static conversion function from primitive types string, integer
+ // and byte array.
+
+ /// <summary>
+ /// Implicit conversion operator from a boolean
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (bool value);
+
+ /// <summary>
+ /// Implicit conversion operator from a byte
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (Byte value);
+
+ /// <summary>
+ /// Implicit conversion operator from an array of bytes
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<Byte>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from an boolean array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<bool>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a double
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (Double value);
+
+ /// <summary>
+ /// Implicit conversion operator from a double array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<Double>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a float
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (Single value);
+
+ /// <summary>
+ /// Implicit conversion operator from a float array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<Single>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 16-bit integer
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (System::Int16 value);
+
+ /// <summary>
+ /// Implicit conversion operator from a character
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (Char value);
+
+ /// <summary>
+ /// Implicit conversion operator from a character array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<Char>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 16-bit integer array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<System::Int16>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 32-bit integer
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (System::Int32 value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 32-bit integer array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<System::Int32>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 64-bit integer
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator /*Apache::Geode::Client::*/Serializable^ (System::Int64 value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 64-bit integer array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<System::Int64>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a string
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (String^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a string array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<String^>^ value);
+
+
+ /// <summary>
+ /// Register an instance factory method for a given type.
+ /// This should be used when registering types that implement
+ /// IGeodeSerializable.
+ /// </summary>
+ /// <param name="creationMethod">
+ /// the creation function to register
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the method is null
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// if the typeId has already been registered, or there is an error
+ /// in registering the type; check <c>Utils::LastError</c> for more
+ /// information in the latter case.
+ /// </exception>
+ static void RegisterTypeGeneric(TypeFactoryMethodGeneric^ creationMethod, Cache^ cache);
+
+ /// <summary>
+ /// Set the PDX serializer for the cache. If this serializer is set,
+ /// it will be consulted to see if it can serialize any domain classes which are
+ /// added to the cache in portable data exchange format.
+ /// </summary>
+ static void RegisterPdxSerializer(IPdxSerializer^ pdxSerializer);
+
+ /// <summary>
+ /// Register an instance factory method for a given type.
+ /// This should be used when registering types that implement
+ /// IPdxSerializable.
+ /// </summary>
+ /// <param name="creationMethod">
+ /// the creation function to register
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the method is null
+ /// </exception>
+
+ static void RegisterPdxType(PdxTypeFactoryMethod^ creationMethod);
+
+ /// <summary>
+ /// Register an PdxTypeMapper to map the local types to pdx types
+ /// </summary>
+ /// <param name="pdxTypeMapper">
+ /// Object which implements IPdxTypeMapper interface
+ /// </param>
+
+
+ static void SetPdxTypeMapper(IPdxTypeMapper^ pdxTypeMapper);
+
+ internal:
+
+ static System::Int32 GetPDXIdForType(const char* poolName, IGeodeSerializable^ pdxType, const native::Cache* cache);
+ static IGeodeSerializable^ GetPDXTypeById(const char* poolName, System::Int32 typeId, const native::Cache* cache);
+ static IPdxSerializable^ Serializable::GetPdxType(String^ className);
+ static void RegisterPDXManagedCacheableKey(bool appDomainEnable, Cache^ cache);
+ static bool IsObjectAndPdxSerializerRegistered(String^ className);
+
+ static IPdxSerializer^ GetPdxSerializer();
+ static String^ GetPdxTypeName(String^ localTypeName);
+ static String^ GetLocalTypeName(String^ pdxTypeName);
+ static void Clear();
+
+ static Type^ GetType(String^ className);
+
+ static int GetEnumValue(Internal::EnumInfo^ ei, const native::Cache* cache);
+ static Internal::EnumInfo^ GetEnum(int val, const native::Cache* cache);
+
+ static Dictionary<String^, PdxTypeFactoryMethod^>^ PdxDelegateMap =
+ gcnew Dictionary<String^, PdxTypeFactoryMethod^>();
+
+ static String^ GetString(native::CacheableStringPtr cStr);//native::CacheableString*
+
+ // These are the new static methods to get/put data from c++
+
+ //byte
+ static Byte getByte(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableByte(SByte val);
+
+ //boolean
+ static bool getBoolean(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableBoolean(bool val);
+
+ //widechar
+ static Char getChar(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableWideChar(Char val);
+
+ //double
+ static double getDouble(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableDouble(double val);
+
+ //float
+ static float getFloat(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableFloat(float val);
+
+ //int16
+ static System::Int16 getInt16(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableInt16(int val);
+
+ //int32
+ static System::Int32 getInt32(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableInt32(System::Int32 val);
+
+ //int64
+ static System::Int64 getInt64(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableInt64(System::Int64 val);
+
+ //cacheable ascii string
+ static String^ getASCIIString(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableASCIIString(String^ val);
+
+ static native::CacheableKeyPtr getCacheableASCIIString2(String^ val);
+
+ //cacheable ascii string huge
+ static String^ getASCIIStringHuge(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableASCIIStringHuge(String^ val);
+
+ //cacheable string
+ static String^ getUTFString(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableUTFString(String^ val);
+
+
+ //cacheable string huge
+ static String^ getUTFStringHuge(native::SerializablePtr nativeptr);
+
+
+ static native::CacheableKeyPtr getCacheableUTFStringHuge(String^ val);
+
+
+ static native::CacheableStringPtr GetCacheableString(String^ value);
+
+ static native::CacheableStringPtr GetCacheableString2(String^ value);
+
+ /*
+ static String^ GetString(native::CacheableStringPtr cStr)//native::CacheableString*
+ {
+ if (cStr == nullptr) {
+ return nullptr;
+ }
+ else if (cStr->isWideString()) {
+ return ManagedString::Get(cStr->asWChar());
+ }
+ else {
+ return ManagedString::Get(cStr->asChar());
+ }
+ }
+ */
+
+ static array<Byte>^ getSByteArray(array<SByte>^ sArray);
+
+ static array<System::Int16>^ getInt16Array(array<System::UInt16>^ sArray);
+
+ static array<System::Int32>^ getInt32Array(array<System::UInt32>^ sArray);
+
+ static array<System::Int64>^ getInt64Array(array<System::UInt64>^ sArray);
+
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ inline Apache::Geode::Client::Serializable()
+ :Serializable(__nullptr) { }
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Apache::Geode::Client::Serializable(native::SerializablePtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Serializable>(nativeptr);
+ }
+
+ /// <summary>
+ /// Register an instance factory method for a given type and typeId.
+ /// This should be used when registering types that implement
+ /// IGeodeSerializable.
+ /// </summary>
+ /// <param name="typeId">typeId of the type being registered.</param>
+ /// <param name="creationMethod">
+ /// the creation function to register
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the method is null
+ /// </exception>
+ static void RegisterTypeGeneric(Byte typeId, TypeFactoryMethodGeneric^ creationMethod, Type^ type, Cache^ cache);
+
+
+ /// <summary>
+ /// Unregister the type with the given typeId
+ /// </summary>
+ /// <param name="typeId">typeId of the type to unregister.</param>
+ static void UnregisterTypeGeneric(Byte typeId, Cache^ cache);
+
+ generic<class TValue>
+ static TValue GetManagedValueGeneric(native::SerializablePtr val);
+
+ generic<class TKey>
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key, native::Cache* cache);
+
+ generic<class TKey>
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key, bool isAciiChar, native::Cache* cache);
+
+ generic<class TKey>
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(
+ Type^ managedType, TKey key, native::Cache* cache);
+
+ generic<class TKey>
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(
+ Type^ managedType, TKey key, bool isAsciiChar, native::Cache* cache);
+
+ /// <summary>
+ /// Static map of <c>TypeFactoryMethod</c> delegates created
+ /// for managed <c>TypeFactoryMethod</c> delegates.
+ /// </summary>
+ static Dictionary<System::Type^, Byte>^ ManagedTypeMappingGeneric =
+ gcnew Dictionary<System::Type^, Byte>();
+
+ static Byte GetManagedTypeMappingGeneric (Type^ type)
+ {
+ Byte retVal = 0;
+ ManagedTypeMappingGeneric->TryGetValue(type, retVal);
+ return retVal;
+ }
+
+ /// <summary>
+ /// Static list of <c>TypeFactoryNativeMethod</c> delegates created
+ /// from registered managed <c>TypeFactoryMethod</c> delegates.
+ /// This is so that the underlying managed objects do not get GCed.
+ /// </summary>
+ static List<TypeFactoryNativeMethodGeneric^>^ NativeDelegatesGeneric =
+ gcnew List<TypeFactoryNativeMethodGeneric^>();
+
+ /// <summary>
+ /// Static map of <c>TypeFactoryMethod</c> delegates created
+ /// from registered managed <c>TypeFactoryMethod</c> delegates.
+ /// This is for cross AppDomain object creations.
+ /// </summary>
+ static Dictionary<UInt32, TypeFactoryMethodGeneric^>^ DelegateMapGeneric =
+ gcnew Dictionary<UInt32, TypeFactoryMethodGeneric^>();
+
+ static Dictionary<UInt32, TypeFactoryMethodGeneric^>^ InternalDelegateMapGeneric =
+ gcnew Dictionary<UInt32, TypeFactoryMethodGeneric^>();
+
+ static TypeFactoryMethodGeneric^ GetTypeFactoryMethodGeneric(UInt32 classid)
+ {
+ // Log::Finer("TypeFactoryMethodGeneric type id " + classid + " domainid :" + System::Threading::Thread::GetDomainID() );
+ if(DelegateMapGeneric->ContainsKey(classid) )
+ return DelegateMapGeneric[classid];
+ else
+ return InternalDelegateMapGeneric[classid];//builtin types
+ }
+
+ /// <summary>
+ /// Static map of <c>TypeFactoryNativeMethod</c> delegates created
+ /// for builtin managed <c>TypeFactoryMethod</c> delegates.
+ /// This is so that the underlying managed objects do not get GCed.
+ /// </summary>
+ static Dictionary<Byte, TypeFactoryNativeMethodGeneric^>^ BuiltInDelegatesGeneric =
+ gcnew Dictionary<Byte, TypeFactoryNativeMethodGeneric^>();
+
+ /// <summary>
+ /// Static map of <c>TypeFactoryMethod</c> delegates created
+ /// for managed <c>TypeFactoryMethod</c> delegates.
+ /// </summary>
+ static Dictionary<System::Int64, TypeFactoryMethodGeneric^>^ ManagedDelegatesGeneric =
+ gcnew Dictionary<System::Int64, TypeFactoryMethodGeneric^>();
+
+ /// <summary>
+ /// This is to get manged delegates.
+ /// </summary>
+ static TypeFactoryMethodGeneric^ GetManagedDelegateGeneric(System::Int64 typeId)
+ {
+ TypeFactoryMethodGeneric^ ret = nullptr;
+ ManagedDelegatesGeneric->TryGetValue(typeId, ret);
+ return ret;
+ }
+
+ static IPdxSerializer^ PdxSerializer = nullptr;
+ static IPdxTypeMapper^ PdxTypeMapper = nullptr;
+ static Object^ LockObj = gcnew Object();
+ static Dictionary<String^, String^>^ PdxTypeNameToLocal =
+ gcnew Dictionary<String^, String^>();
+ static Dictionary<String^, String^>^ LocalTypeNameToPdx =
+ gcnew Dictionary<String^, String^>();
+
+
+ static Object^ ClassNameVsTypeLockObj = gcnew Object();
+ static Dictionary<String^, Type^>^ ClassNameVsType =
+ gcnew Dictionary<String^, Type^>();
+
+ delegate Object^ CreateNewObjectDelegate();
+ static CreateNewObjectDelegate^ CreateNewObjectDelegateF(Type^ type);
+
+ delegate Object^ CreateNewObjectArrayDelegate(int len);
+ static CreateNewObjectArrayDelegate^ CreateNewObjectArrayDelegateF(Type^ type);
+
+ static array<Type^>^ singleIntTypeA = gcnew array<Type^>{ Int32::typeid };
+
+ static Type^ createNewObjectDelegateType = Type::GetType("Apache.Geode.Client.Serializable+CreateNewObjectDelegate");
+ static Type^ createNewObjectArrayDelegateType = Type::GetType("Apache.Geode.Client.Serializable+CreateNewObjectArrayDelegate");
+
+ static array<Type^>^ singleIntType = gcnew array<Type^>(1){Int32::typeid};
+
+ static Object^ CreateObject(String^ className);
+ static Object^ GetArrayObject(String^ className, int len);
+ static Type^ getTypeFromRefrencedAssemblies(String^ className, Dictionary<Assembly^, bool>^ referedAssembly, Assembly^ currentAsm);
+
+ static Dictionary<String^, CreateNewObjectDelegate^>^ ClassNameVsCreateNewObjectDelegate =
+ gcnew Dictionary<String^, CreateNewObjectDelegate^>();
+
+ static Dictionary<String^, CreateNewObjectArrayDelegate^>^ ClassNameVsCreateNewObjectArrayDelegate =
+ gcnew Dictionary<String^, CreateNewObjectArrayDelegate^>();
+
+ static Object^ CreateObjectEx(String^ className);
+ static Object^ GetArrayObjectEx(String^ className, int len);
+ /// <summary>
+ /// Static array of managed <c>WrapperDelegate</c> delegates that
+ /// maintains a mapping of built-in native typeIds to their corresponding
+ /// wrapper type delegates.
+ /// </summary>
+ /// <remarks>
+ /// This is as an array to make lookup as fast as possible, taking
+ /// advantage of the fact that the range of wrapped built-in typeIds is
+ /// small. <b>IMPORTANT:</b> If the built-in native typeIds encompass a
+ /// greater range then change <c>WrapperEnd</c> in this accordingly
+ /// or move to using a Dictionary instead.
+ /// </remarks>
+ static array<WrapperDelegateGeneric^>^ NativeWrappersGeneric =
+ gcnew array<WrapperDelegateGeneric^>(WrapperEndGeneric + 1);
+ literal Byte WrapperEndGeneric = 128;
+
+ /// <summary>
+ /// Static method to register a managed wrapper for a native
+ /// <c>native::Serializable</c> type.
+ /// </summary>
+ /// <param name="wrapperMethod">
+ /// A factory delegate of the managed wrapper class that returns the
+ /// managed object given the native object.
+ /// </param>
+ /// <param name="typeId">The typeId of the native type.</param>
+ /// <seealso cref="NativeWrappers" />
+ static void RegisterWrapperGeneric(WrapperDelegateGeneric^ wrapperMethod,
+ Byte typeId, System::Type^ type);
+
+ /// <summary>
+ /// Internal static method to remove managed artifacts created by
+ /// RegisterType and RegisterWrapper methods when
+ /// <see cref="DistributedSystem.Disconnect" /> is called.
+ /// </summary>
+ static void UnregisterNativesGeneric();
+
+ /// <summary>
+ /// Static method to lookup the wrapper delegate for a given typeId.
+ /// </summary>
+ /// <param name="typeId">
+ /// The typeId of the native <c>native::Serializable</c> type.
+ /// </param>
+ /// <returns>
+ /// If a managed wrapper is registered for the given typeId then the
+ /// wrapper delegate is returned, else this returns null.
+ /// </returns>
+ inline static WrapperDelegateGeneric^ GetWrapperGeneric(Byte typeId)
+ {
+ if (typeId >= 0 && typeId <= WrapperEndGeneric) {
+ return NativeWrappersGeneric[typeId];
+ }
+ return nullptr;
+ }
+
+ static Serializable()
+ {
+ PdxTypeMapper = nullptr;
+ //RegisterPDXManagedCacheableKey();
+
+ {
+ Dictionary<Object^, Object^>^ dic = gcnew Dictionary<Object^, Object^>();
+ ManagedTypeMappingGeneric[dic->GetType()] = native::GeodeTypeIds::CacheableHashMap;
+ ManagedTypeMappingGeneric[dic->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableHashMap;
+ }
+
+ {
+ System::Collections::ArrayList^ arr = gcnew System::Collections::ArrayList();
+ ManagedTypeMappingGeneric[arr->GetType()] = native::GeodeTypeIds::CacheableVector;
+ }
+
+ {
+ System::Collections::Generic::LinkedList<Object^>^ linketList = gcnew System::Collections::Generic::LinkedList<Object^>();
+ ManagedTypeMappingGeneric[linketList->GetType()] = native::GeodeTypeIds::CacheableLinkedList;
+ ManagedTypeMappingGeneric[linketList->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableLinkedList;
+ }
+
+ {
+ System::Collections::Generic::IList<Object^>^ iList = gcnew System::Collections::Generic::List<Object^>();
+ ManagedTypeMappingGeneric[iList->GetType()] = native::GeodeTypeIds::CacheableArrayList;
+ ManagedTypeMappingGeneric[iList->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableArrayList;
+ }
+
+ //TODO: Linked list, non generic stack, some other map types and see if more
+
+ {
+ System::Collections::Generic::Stack<Object^>^ stack = gcnew System::Collections::Generic::Stack<Object^>();
+ ManagedTypeMappingGeneric[stack->GetType()] = native::GeodeTypeIds::CacheableStack;
+ ManagedTypeMappingGeneric[stack->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableStack;
+ }
+ {
+ ManagedTypeMappingGeneric[SByte::typeid] = native::GeodeTypeIds::CacheableByte;
+ ManagedTypeMappingGeneric[Boolean::typeid] = native::GeodeTypeIds::CacheableBoolean;
+ ManagedTypeMappingGeneric[Char::typeid] = native::GeodeTypeIds::CacheableWideChar;
+ ManagedTypeMappingGeneric[Double::typeid] = native::GeodeTypeIds::CacheableDouble;
+ ManagedTypeMappingGeneric[String::typeid] = native::GeodeTypeIds::CacheableASCIIString;
+ ManagedTypeMappingGeneric[float::typeid] = native::GeodeTypeIds::CacheableFloat;
+ ManagedTypeMappingGeneric[Int16::typeid] = native::GeodeTypeIds::CacheableInt16;
+ ManagedTypeMappingGeneric[Int32::typeid] = native::GeodeTypeIds::CacheableInt32;
+ ManagedTypeMappingGeneric[Int64::typeid] = native::GeodeTypeIds::CacheableInt64;
+ ManagedTypeMappingGeneric[Type::GetType("System.Byte[]")] = native::GeodeTypeIds::CacheableBytes;
+ ManagedTypeMappingGeneric[Type::GetType("System.Double[]")] = native::GeodeTypeIds::CacheableDoubleArray;
+ ManagedTypeMappingGeneric[Type::GetType("System.Single[]")] = native::GeodeTypeIds::CacheableFloatArray;
+ ManagedTypeMappingGeneric[Type::GetType("System.Int16[]")] = native::GeodeTypeIds::CacheableInt16Array;
+ ManagedTypeMappingGeneric[Type::GetType("System.Int32[]")] = native::GeodeTypeIds::CacheableInt32Array;
+ ManagedTypeMappingGeneric[Type::GetType("System.Int64[]")] = native::GeodeTypeIds::CacheableInt64Array;
+ ManagedTypeMappingGeneric[Type::GetType("System.String[]")] = native::GeodeTypeIds::CacheableStringArray;
+ ManagedTypeMappingGeneric[Type::GetType("System.DateTime")] = native::GeodeTypeIds::CacheableDate;
+ ManagedTypeMappingGeneric[Type::GetType("System.Collections.Hashtable")] = native::GeodeTypeIds::CacheableHashTable;
+ }
+ }
+
+ protected:
+ native_shared_ptr<native::Serializable>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/StatisticDescriptor.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/StatisticDescriptor.cpp b/clicache/src/StatisticDescriptor.cpp
new file mode 100644
index 0000000..6e0075c
--- /dev/null
+++ b/clicache/src/StatisticDescriptor.cpp
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "StatisticDescriptor.hpp"
+#include "impl/ManagedString.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ System::Int32 StatisticDescriptor::ID::get( )
+ {
+ return m_nativeptr->getId();
+ }
+
+ String^ StatisticDescriptor::Name::get( )
+ {
+ return ManagedString::Get( m_nativeptr->getName() );
+ }
+
+ String^ StatisticDescriptor::Description::get( )
+ {
+ return ManagedString::Get( m_nativeptr->getDescription() );
+ }
+
+ int8_t StatisticDescriptor::IsCounter::get( )
+ {
+ return m_nativeptr->isCounter();
+ }
+
+ int8_t StatisticDescriptor::IsLargerBetter::get( )
+ {
+ return m_nativeptr->isLargerBetter();
+ }
+
+ String^ StatisticDescriptor::Unit::get()
+ {
+ return ManagedString::Get(m_nativeptr->getUnit());
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/StatisticDescriptor.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/StatisticDescriptor.hpp b/clicache/src/StatisticDescriptor.hpp
new file mode 100644
index 0000000..6715045
--- /dev/null
+++ b/clicache/src/StatisticDescriptor.hpp
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/statistics/StatisticDescriptor.hpp>
+#include "end_native.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A class that describes an individual statistic whose value is updated by an
+ /// application and may be archived by Geode. These descriptions are gathered
+ /// together in a <see cref="StatisticsType" /> class.
+ /// </summary>
+ /// <para>
+ /// To get an instance of this interface use an instance of
+ /// <see cref="StatisticsFactory" /> class.
+ /// </para>
+ /// <para>
+ /// StatisticDescriptors are naturally ordered by their name.
+ /// </para>
+ public ref class StatisticDescriptor sealed
+ {
+ public:
+ /// <summary>
+ /// Returns the id of this statistic in a <see cref="StatisticsType" /> class.
+ /// The id is initialized when its statistics
+ /// type is created.
+ /// </summary>
+ virtual property System::Int32 ID
+ {
+ virtual System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the name of this statistic
+ /// </summary>
+ virtual property String^ Name
+ {
+ virtual String^ get();
+ }
+
+ /// <summary>
+ /// Returns the description of this statistic
+ /// </summary>
+ virtual property String^ Description
+ {
+ virtual String^ get();
+ }
+
+ /// <summary>
+ /// Returns true if this statistic is a counter; false if its a gauge.
+ /// Counter statistics have values that always increase.
+ /// Gauge statistics have unconstrained values.
+ /// </summary>
+ virtual property int8_t IsCounter
+ {
+ virtual int8_t get();
+ }
+
+ /// <summary>
+ /// Returns true if a larger statistic value indicates better performance.
+ /// </summary>
+ virtual property int8_t IsLargerBetter
+ {
+ virtual int8_t get();
+ }
+
+ /// <summary>
+ /// Returns the unit in which this statistic is measured.
+ /// </summary>
+ virtual property String^ Unit
+ {
+ virtual String^ get();
+ }
+
+ internal:
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class, with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">native object pointer</param>
+ /// <returns>
+ /// the managed wrapper object, or null if the native pointer is null.
+ /// </returns>
+ inline static StatisticDescriptor^ Create(
+ apache::geode::statistics::StatisticDescriptor* nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew StatisticDescriptor( nativeptr );
+ }
+
+ apache::geode::statistics::StatisticDescriptor* GetNative()
+ {
+ return m_nativeptr;
+ }
+
+ private:
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline StatisticDescriptor(apache::geode::statistics::StatisticDescriptor* nativeptr)
+ : m_nativeptr( nativeptr )
+ {
+ }
+
+ apache::geode::statistics::StatisticDescriptor* m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Statistics.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Statistics.cpp b/clicache/src/Statistics.cpp
new file mode 100644
index 0000000..e042873
--- /dev/null
+++ b/clicache/src/Statistics.cpp
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+//#include "geode_includes.hpp"
+#include "Statistics.hpp"
+#include "StatisticDescriptor.hpp"
+#include "StatisticsType.hpp"
+
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ void Statistics::Close()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->close();
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::NameToId(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->nameToId(mg_name.CharPtr);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticDescriptor^ Statistics::NameToDescriptor(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return StatisticDescriptor::Create(m_nativeptr->nameToDescriptor(mg_name.CharPtr));
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::UniqueId::get( )
+ {
+ return m_nativeptr->getUniqueId();
+ }
+
+ StatisticsType^ Statistics::Type::get( )
+ {
+ return StatisticsType::Create(m_nativeptr->getType());
+ }
+
+ String^ Statistics::TextId::get()
+ {
+ return ManagedString::Get(m_nativeptr->getTextId());
+ }
+
+ System::Int64 Statistics::NumericId::get()
+ {
+ return m_nativeptr->getNumericId();
+ }
+ bool Statistics::IsAtomic::get()
+ {
+ return m_nativeptr->isAtomic();
+ }
+ bool Statistics::IsShared::get()
+ {
+ return m_nativeptr->isShared();
+ }
+ bool Statistics::IsClosed::get()
+ {
+ return m_nativeptr->isClosed();
+ }
+
+ void Statistics::SetInt(System::Int32 id, System::Int32 value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setInt(id, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetInt(String^ name, System::Int32 value)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setInt((char*)mg_name.CharPtr, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetInt(StatisticDescriptor^ descriptor, System::Int32 value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setInt(descriptor->GetNative(), value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetLong(System::Int32 id, System::Int64 value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setLong(id, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetLong(StatisticDescriptor^ descriptor, System::Int64 value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setLong(descriptor->GetNative(), value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetLong(String^ name, System::Int64 value)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setLong((char*)mg_name.CharPtr, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetDouble(System::Int32 id, double value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setDouble(id, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetDouble(String^ name, double value)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setDouble((char*)mg_name.CharPtr, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetDouble(StatisticDescriptor^ descriptor, double value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setDouble(descriptor->GetNative(), value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::GetInt(System::Int32 id)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getInt(id);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::GetInt(StatisticDescriptor^ descriptor)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getInt(descriptor->GetNative());
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::GetInt(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getInt((char*)mg_name.CharPtr);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::GetLong(System::Int32 id)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getLong(id);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ System::Int64 Statistics::GetLong(StatisticDescriptor^ descriptor)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getLong(descriptor->GetNative());
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::GetLong(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getLong((char*)mg_name.CharPtr);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::GetDouble(System::Int32 id)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getDouble(id);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::GetDouble(StatisticDescriptor^ descriptor)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getDouble(descriptor->GetNative());
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::GetDouble(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getDouble((char*)mg_name.CharPtr);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::GetRawBits(StatisticDescriptor^ descriptor)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getRawBits(descriptor->GetNative());
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::IncInt(System::Int32 id, System::Int32 delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incInt(id,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::IncInt(StatisticDescriptor^ descriptor, System::Int32 delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incInt(descriptor->GetNative(),delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::IncInt(String^ name, System::Int32 delta)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incInt((char*)mg_name.CharPtr,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::IncLong(System::Int32 id, System::Int64 delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incLong(id,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::IncLong(StatisticDescriptor^ descriptor, System::Int64 delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incLong(descriptor->GetNative(),delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::IncLong(String^ name, System::Int64 delta)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incLong((char*)mg_name.CharPtr,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::IncDouble(System::Int32 id, double delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incDouble(id,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::IncDouble(StatisticDescriptor^ descriptor, double delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incDouble(descriptor->GetNative(),delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::IncDouble(String^ name, double delta)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incDouble((char*)mg_name.CharPtr,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Statistics.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Statistics.hpp b/clicache/src/Statistics.hpp
new file mode 100644
index 0000000..0a39bac
--- /dev/null
+++ b/clicache/src/Statistics.hpp
@@ -0,0 +1,541 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/statistics/Statistics.hpp>
+#include <geode/statistics/StatisticDescriptor.hpp>
+#include <geode/statistics/StatisticsType.hpp>
+#include "end_native.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class StatisticDescriptor;
+ ref class StatisticsType;
+
+ /// <summary>
+ /// An instantiation of an existing <c>StatisticsType</c> object with methods for
+ /// setting, incrementing and getting individual <c>StatisticDescriptor</c> values.
+ /// </summary>
+ public ref class Statistics sealed
+ {
+ public:
+
+ /// <summary>
+ /// Closes these statistics. After statistics have been closed, they
+ /// are no longer archived.
+ /// A value access on a closed statistics always results in zero.
+ /// A value modification on a closed statistics is ignored.
+ /// </summary>
+ virtual void Close();
+
+ /// <summary>
+ /// Returns the id of the statistic with the given name in this
+ /// statistics instance.
+ /// </summary>
+ /// <param name="name">the statistic name</param>
+ /// <returns>the id of the statistic with the given name</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// if no statistic named <c>name</c> exists in this
+ /// statistics instance.
+ /// </exception>
+ /// <see cref="StatisticsType#nameToDescriptor" />
+ virtual System::Int32 NameToId(String^ name);
+
+ /// <summary>
+ /// Returns the descriptor of the statistic with the given name in this
+ /// statistics instance.
+ /// </summary>
+ /// <param name="name">the statistic name</param>
+ /// <returns>the descriptor of the statistic with the given name</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// if no statistic named <c>name</c> exists in this
+ /// statistics instance.
+ /// </exception>
+ /// <see cref="StatisticsType#nameToId" />
+ virtual StatisticDescriptor^ NameToDescriptor(String^ name);
+
+ /// <summary>
+ /// Gets a value that uniquely identifies this statistics.
+ /// </summary>
+ virtual property System::Int64 UniqueId
+ {
+ virtual System::Int64 get( );
+ }
+
+ /// <summary>
+ /// Gets the <see cref="StatisticsType" /> of this instance.
+ /// </summary>
+ virtual property StatisticsType^ Type
+ {
+ virtual StatisticsType^ get( );
+ }
+
+ /// <summary>
+ /// Gets the text associated with this instance that helps identify it.
+ /// </summary>
+ virtual property String^ TextId
+ {
+ virtual String^ get( );
+ }
+
+ /// <summary>
+ /// Gets the number associated with this instance that helps identify it.
+ /// </summary>
+ virtual property System::Int64 NumericId
+ {
+ virtual System::Int64 get( );
+ }
+
+ /// <summary>
+ /// Returns true if modifications are atomic. This means that multiple threads
+ /// can safely modify this instance without additional synchronization.
+ /// </summary>
+ /// <para>
+ /// Returns false if modifications are not atomic. This means that modifications
+ /// to this instance are cheaper but not thread safe.
+ /// </para>
+ /// <para>
+ /// Note that all instances that are <see cref="#isShared" /> shared are also atomic.
+ /// </para>
+ virtual property bool IsAtomic
+ {
+ virtual bool get( );
+ }
+
+ /// <summary>
+ /// Returns true if the data for this instance is stored in shared memory.
+ /// Returns false if the data is store in local memory.
+ /// </summary>
+ /// <para>
+ /// Note that all instances that are <see cref="#isShared" /> shared are also atomic.
+ /// </para>
+ virtual property bool IsShared
+ {
+ virtual bool get( );
+ }
+
+ /// <summary>
+ /// Returns true if the instance has been <see cref="#close" /> closed.
+ /// </summary>
+ virtual property bool IsClosed
+ {
+ virtual bool get( );
+ }
+
+ /// <summary>
+ /// Sets the value of a statistic with the given <c>id</c>
+ /// whose type is <c>int</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual void SetInt(System::Int32 id, System::Int32 value);
+
+ /// <summary>
+ /// Sets the value of a named statistic of type <c>int</c>
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual void SetInt(String^ name, System::Int32 value);
+
+ /// <summary>
+ /// Sets the value of a described statistic of type <c>int</c>
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="#StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual void SetInt(StatisticDescriptor^ descriptor, System::Int32 value);
+
+ /// <summary>
+ /// Sets the value of a statistic with the given <c>id</c>
+ /// whose type is <c>long</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" />. </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual void SetLong(System::Int32 id, System::Int64 value);
+
+ /// <summary>
+ /// Sets the value of a described statistic of type <c>long</c>
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual void SetLong(StatisticDescriptor^ descriptor, System::Int64 value);
+
+ /// <summary>
+ /// Sets the value of a named statistic of type <c>long</c>.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual void SetLong(String^ name, System::Int64 value);
+
+
+ /// <summary>
+ /// Sets the value of a statistic with the given <c>id</c>
+ /// whose type is <c>double</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual void SetDouble(System::Int32 id, double value);
+
+ /// <summary>
+ /// Sets the value of a named statistic of type <c>double</c>
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual void SetDouble(String^ name, double value);
+
+ /// <summary>
+ /// Sets the value of a described statistic of type <c>double</c>
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual void SetDouble(StatisticDescriptor^ descriptor, double value);
+
+ /// <summary>
+ /// Returns the value of the identified statistic of type <c>int</c>.
+ /// whose type is <c>double</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual System::Int32 GetInt(System::Int32 id);
+
+ /// <summary>
+ /// Returns the value of the described statistic of type <code>int</code>.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists with the specified <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual System::Int32 GetInt(StatisticDescriptor^ descriptor);
+
+
+ /// <summary>
+ /// Returns the value of the statistic of type <code>int</code> at
+ /// the given name.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual System::Int32 GetInt(String^ name);
+
+ /// <summary>
+ /// Returns the value of the identified statistic of type <c>long</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual System::Int64 GetLong(System::Int32 id);
+
+
+ /// <summary>
+ /// Returns the value of the described statistic of type <c>long</c>.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists with the specified <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual System::Int64 GetLong(StatisticDescriptor^ descriptor);
+
+
+ /// <summary>
+ /// Returns the value of the statistic of type <c>long</c> at
+ /// the given name.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual System::Int64 GetLong(String^ name);
+
+
+ /// <summary>
+ /// Returns the value of the identified statistic of type <c>double</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual double GetDouble(System::Int32 id);
+
+ /// <summary>
+ /// Returns the value of the described statistic of type <c>double</c>.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists with the specified <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual double GetDouble(StatisticDescriptor^ descriptor);
+
+ /// <summary>
+ /// Returns the value of the statistic of type <c>double</c> at
+ /// the given name.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual double GetDouble(String^ name);
+
+ /// <summary>
+ /// Returns the bits that represent the raw value of the described statistic.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the described statistic does not exist
+ /// </exception>
+ virtual System::Int64 GetRawBits(StatisticDescriptor^ descriptor);
+
+ /// <summary>
+ /// Increments the value of the identified statistic of type <c>int</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <param name="delta">the value of the statistic after it has been incremented</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual System::Int32 IncInt(System::Int32 id, System::Int32 delta);
+
+ /// <summary>
+ /// Increments the value of the described statistic of type <c>int</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual System::Int32 IncInt(StatisticDescriptor^ descriptor, System::Int32 delta);
+
+ /// <summary>
+ /// Increments the value of the statistic of type <c>int</c> with
+ /// the given name by a given amount.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual System::Int32 IncInt(String^ name, System::Int32 delta);
+
+ /// <summary>
+ /// Increments the value of the identified statistic of type <c>long</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <param name="delta">the value of the statistic after it has been incremented</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual System::Int64 IncLong(System::Int32 id, System::Int64 delta);
+
+
+ /// <summary>
+ /// Increments the value of the described statistic of type <c>long</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual System::Int64 IncLong(StatisticDescriptor^ descriptor, System::Int64 delta);
+
+ /// <summary>
+ /// Increments the value of the statistic of type <c>long</c> with
+ /// the given name by a given amount.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual System::Int64 IncLong(String^ name, System::Int64 delta);
+
+
+ /// <summary>
+ /// Increments the value of the identified statistic of type <c>double</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <param name="delta">the value of the statistic after it has been incremented</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual double IncDouble(System::Int32 id, double delta);
+
+ /// <summary>
+ /// Increments the value of the described statistic of type <c>double</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual double IncDouble(StatisticDescriptor^ descriptor, double delta);
+
+ /// <summary>
+ /// Increments the value of the statistic of type <c>double</c> with
+ /// the given name by a given amount.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual double IncDouble(String^ name, double delta);
+
+ internal:
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class, with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">native object pointer</param>
+ /// <returns>
+ /// the managed wrapper object, or null if the native pointer is null.
+ /// </returns>
+ inline static Statistics^ Create(
+ apache::geode::statistics::Statistics* nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Statistics( nativeptr );
+ }
+
+ private:
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Statistics( apache::geode::statistics::Statistics* nativeptr )
+ : m_nativeptr( nativeptr )
+ {
+ }
+ private:
+ apache::geode::statistics::Statistics* m_nativeptr;
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/StatisticsFactory.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/StatisticsFactory.cpp b/clicache/src/StatisticsFactory.cpp
new file mode 100644
index 0000000..79cfc44
--- /dev/null
+++ b/clicache/src/StatisticsFactory.cpp
@@ -0,0 +1,258 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "begin_native.hpp"
+#include "statistics/StatisticsManager.hpp"
+#include "end_native.hpp"
+
+#include "StatisticsFactory.hpp"
+#include "StatisticsType.hpp"
+#include "StatisticDescriptor.hpp"
+#include "Statistics.hpp"
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ // TODO globals - pass in distributed system
+ //StatisticsFactory^ StatisticsFactory::GetExistingInstance(DistributedSystem^ distributedSystem)
+ //{
+ // _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+
+ // return StatisticsFactory::Create(distributedSystem->getStatisticsManager()->getStatisticsFactory());
+
+ // _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ //}
+
+ StatisticDescriptor^ StatisticsFactory::CreateIntCounter( String^ name, String^ description,String^ units )
+ {
+ return CreateIntCounter(name,description,units,true);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateIntCounter(String^ name, String^ description,String^ units, bool largerBetter)
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createIntCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateLongCounter( String^ name, String^ description,String^ units )
+ {
+ return CreateLongCounter(name,description,units,true);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateLongCounter( String^ name, String^ description,String^ units, bool largerBetter )
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createLongCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateDoubleCounter( String^ name, String^ description, String^ units )
+ {
+ return CreateDoubleCounter(name,description,units,true);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateDoubleCounter( String^ name, String^ description, String^ units, bool largerBetter )
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createDoubleCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+
+ StatisticDescriptor^ StatisticsFactory::CreateIntGauge( String^ name, String^ description, String^ units )
+ {
+ return CreateIntGauge(name,description,units,false);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateIntGauge( String^ name, String^ description, String^ units, bool largerBetter )
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createIntGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateLongGauge( String^ name, String^ description, String^ units )
+ {
+ return CreateLongGauge(name,description,units,false);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateLongGauge( String^ name, String^ description, String^ units, bool largerBetter )
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createLongGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateDoubleGauge( String^ name, String^ description, String^ units )
+ {
+ return CreateDoubleGauge(name,description,units,false);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateDoubleGauge( String^ name, String^ description, String^ units, bool largerBetter )
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createDoubleGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticsType^ StatisticsFactory::CreateType( String^ name, String^ description,
+ array<StatisticDescriptor^>^ stats, System::Int32 statsLength)
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ apache::geode::statistics::StatisticDescriptor ** nativedescriptors = new apache::geode::statistics::StatisticDescriptor*[statsLength];
+ for (System::Int32 index = 0; index < statsLength; index++)
+ {
+ nativedescriptors[index] = stats[index]->GetNative();
+ }
+ return StatisticsType::Create(m_nativeptr->createType(mg_name.CharPtr, mg_description.CharPtr, nativedescriptors, statsLength));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticsType^ StatisticsFactory::FindType(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticsType::Create(m_nativeptr->findType(mg_name.CharPtr));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateStatistics(StatisticsType^ type)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createStatistics(type->GetNative()));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateStatistics(StatisticsType^ type, String^ textId)
+ {
+ ManagedString mg_text( textId );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createStatistics(type->GetNative(),(char*)mg_text.CharPtr));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateStatistics(StatisticsType^ type, String^ textId, System::Int64 numericId)
+ {
+ ManagedString mg_text( textId );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createStatistics(type->GetNative(),(char*)mg_text.CharPtr, numericId));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateAtomicStatistics(StatisticsType^ type)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative()));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateAtomicStatistics(StatisticsType^ type, String^ textId)
+ {
+ ManagedString mg_text( textId );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative(),(char*)mg_text.CharPtr));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateAtomicStatistics(StatisticsType^ type, String^ textId, System::Int64 numericId)
+ {
+ ManagedString mg_text( textId );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative(),(char*)mg_text.CharPtr, numericId));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ Statistics^ StatisticsFactory::FindFirstStatisticsByType( StatisticsType^ type )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->findFirstStatisticsByType(type->GetNative()));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ String^ StatisticsFactory::Name::get( )
+ {
+ return ManagedString::Get( m_nativeptr->getName() );
+ }
+
+ System::Int64 StatisticsFactory::ID::get()
+ {
+ return m_nativeptr->getId();
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+