GemStone::GemFire::Cache::Generic::DelegateWrapperGeneric Class Reference


Detailed Description

Template class to wrap a managed TypeFactoryMethod delegate that returns an IGFSerializable object. It contains a method that converts the managed object gotten by invoking the delegate to the native gemfire::Serializable object (using the provided wrapper class constructor).

This class is to enable interopibility between the managed and unmanaged worlds when registering types. In the managed world a user would register a managed type by providing a factory delegate returning an object of that type. However, the native implementation requires a factory function that returns an object implementing gemfire::Serializable. Normally this would not be possible since we require to dynamically generate a new function for a given delegate.

Fortunately in the managed world the delegates contain an implicit 'this' pointer. Thus we can have a universal delegate that contains the given managed delegate (in the 'this' pointer) and returns the native gemfire::Serializable object. Additionally marshalling services provide Marshal.GetFunctionPointerForDelegate which gives a function pointer for a delegate which completes the conversion.

Public Member Functions

 DelegateWrapperGeneric (TypeFactoryMethodGeneric^ typeDelegate)
gemfire::Serializable * NativeDelegateGeneric ()


Constructor & Destructor Documentation

GemStone::GemFire::Cache::Generic::DelegateWrapperGeneric::DelegateWrapperGeneric ( TypeFactoryMethodGeneric^   typeDelegate  )  [inline]

Constructor to wrap the given managed delegate.


Member Function Documentation

gemfire::Serializable* GemStone::GemFire::Cache::Generic::DelegateWrapperGeneric::NativeDelegateGeneric (  )  [inline]

Returns the native gemfire::Serializable object by invoking the managed delegate provided in the constructor.

Returns:
Native gemfire::Serializable object after invoking the managed delegate and wrapping inside a ManagedCacheableKey object.


GemFire C++ Cache .NET API Documentation