/// <summary> /// Constructor. /// </summary> /// <param name="log">Logger.</param> public UnmanagedCallbacks(ILogger log) { Debug.Assert(log != null); _log = log; var cbs = new UnmanagedCallbackHandlers { target = IntPtr.Zero.ToPointer(), // Target is not used in .Net as we rely on dynamic FP creation. error = CreateFunctionPointer((ErrorCallbackDelegate)Error), loggerLog = CreateFunctionPointer((LoggerLogDelegate)LoggerLog), loggerIsLevelEnabled = CreateFunctionPointer((LoggerIsLevelEnabledDelegate)LoggerIsLevelEnabled), inLongOutLong = CreateFunctionPointer((InLongOutLongDelegate)InLongOutLong), inLongLongObjectOutLong = CreateFunctionPointer((InLongLongLongObjectOutLongDelegate)InLongLongLongObjectOutLong) }; _cbsPtr = Marshal.AllocHGlobal(UU.HandlersSize()); Marshal.StructureToPtr(cbs, _cbsPtr, false); _thisHnd = GCHandle.Alloc(this); InitHandlers(); }
/// <summary> /// constructor. /// </summary> public UnmanagedCallbacks() { var cbs = new UnmanagedCallbackHandlers { target = IntPtr.Zero.ToPointer(), // Target is not used in .Net as we rely on dynamic FP creation. cacheStoreCreate = CreateFunctionPointer((CacheStoreCreateCallbackDelegate)CacheStoreCreate), cacheStoreInvoke = CreateFunctionPointer((CacheStoreInvokeCallbackDelegate)CacheStoreInvoke), cacheStoreDestroy = CreateFunctionPointer((CacheStoreDestroyCallbackDelegate)CacheStoreDestroy), cacheStoreSessionCreate = CreateFunctionPointer((CacheStoreSessionCreateCallbackDelegate)CacheStoreSessionCreate), cacheEntryFilterCreate = CreateFunctionPointer((CacheEntryFilterCreateCallbackDelegate)CacheEntryFilterCreate), cacheEntryFilterApply = CreateFunctionPointer((CacheEntryFilterApplyCallbackDelegate)CacheEntryFilterApply), cacheEntryFilterDestroy = CreateFunctionPointer((CacheEntryFilterDestroyCallbackDelegate)CacheEntryFilterDestroy), cacheInvoke = CreateFunctionPointer((CacheInvokeCallbackDelegate)CacheInvoke), computeTaskMap = CreateFunctionPointer((ComputeTaskMapCallbackDelegate)ComputeTaskMap), computeTaskJobResult = CreateFunctionPointer((ComputeTaskJobResultCallbackDelegate)ComputeTaskJobResult), computeTaskReduce = CreateFunctionPointer((ComputeTaskReduceCallbackDelegate)ComputeTaskReduce), computeTaskComplete = CreateFunctionPointer((ComputeTaskCompleteCallbackDelegate)ComputeTaskComplete), computeJobSerialize = CreateFunctionPointer((ComputeJobSerializeCallbackDelegate)ComputeJobSerialize), computeJobCreate = CreateFunctionPointer((ComputeJobCreateCallbackDelegate)ComputeJobCreate), computeJobExecute = CreateFunctionPointer((ComputeJobExecuteCallbackDelegate)ComputeJobExecute), computeJobCancel = CreateFunctionPointer((ComputeJobCancelCallbackDelegate)ComputeJobCancel), computeJobDestroy = CreateFunctionPointer((ComputeJobDestroyCallbackDelegate)ComputeJobDestroy), continuousQueryListenerApply = CreateFunctionPointer((ContinuousQueryListenerApplyCallbackDelegate)ContinuousQueryListenerApply), continuousQueryFilterCreate = CreateFunctionPointer((ContinuousQueryFilterCreateCallbackDelegate)ContinuousQueryFilterCreate), continuousQueryFilterApply = CreateFunctionPointer((ContinuousQueryFilterApplyCallbackDelegate)ContinuousQueryFilterApply), continuousQueryFilterRelease = CreateFunctionPointer((ContinuousQueryFilterReleaseCallbackDelegate)ContinuousQueryFilterRelease), dataStreamerTopologyUpdate = CreateFunctionPointer((DataStreamerTopologyUpdateCallbackDelegate)DataStreamerTopologyUpdate), dataStreamerStreamReceiverInvoke = CreateFunctionPointer((DataStreamerStreamReceiverInvokeCallbackDelegate)DataStreamerStreamReceiverInvoke), futureByteResult = CreateFunctionPointer((FutureByteResultCallbackDelegate)FutureByteResult), futureBoolResult = CreateFunctionPointer((FutureBoolResultCallbackDelegate)FutureBoolResult), futureShortResult = CreateFunctionPointer((FutureShortResultCallbackDelegate)FutureShortResult), futureCharResult = CreateFunctionPointer((FutureCharResultCallbackDelegate)FutureCharResult), futureIntResult = CreateFunctionPointer((FutureIntResultCallbackDelegate)FutureIntResult), futureFloatResult = CreateFunctionPointer((FutureFloatResultCallbackDelegate)FutureFloatResult), futureLongResult = CreateFunctionPointer((FutureLongResultCallbackDelegate)FutureLongResult), futureDoubleResult = CreateFunctionPointer((FutureDoubleResultCallbackDelegate)FutureDoubleResult), futureObjectResult = CreateFunctionPointer((FutureObjectResultCallbackDelegate)FutureObjectResult), futureNullResult = CreateFunctionPointer((FutureNullResultCallbackDelegate)FutureNullResult), futureError = CreateFunctionPointer((FutureErrorCallbackDelegate)FutureError), lifecycleOnEvent = CreateFunctionPointer((LifecycleOnEventCallbackDelegate)LifecycleOnEvent), memoryReallocate = CreateFunctionPointer((MemoryReallocateCallbackDelegate)MemoryReallocate), nodeInfo = CreateFunctionPointer((NodeInfoCallbackDelegate)NodeInfo), messagingFilterCreate = CreateFunctionPointer((MessagingFilterCreateCallbackDelegate)MessagingFilterCreate), messagingFilterApply = CreateFunctionPointer((MessagingFilterApplyCallbackDelegate)MessagingFilterApply), messagingFilterDestroy = CreateFunctionPointer((MessagingFilterDestroyCallbackDelegate)MessagingFilterDestroy), eventFilterCreate = CreateFunctionPointer((EventFilterCreateCallbackDelegate)EventFilterCreate), eventFilterApply = CreateFunctionPointer((EventFilterApplyCallbackDelegate)EventFilterApply), eventFilterDestroy = CreateFunctionPointer((EventFilterDestroyCallbackDelegate)EventFilterDestroy), serviceInit = CreateFunctionPointer((ServiceInitCallbackDelegate)ServiceInit), serviceExecute = CreateFunctionPointer((ServiceExecuteCallbackDelegate)ServiceExecute), serviceCancel = CreateFunctionPointer((ServiceCancelCallbackDelegate)ServiceCancel), serviceInvokeMethod = CreateFunctionPointer((ServiceInvokeMethodCallbackDelegate)ServiceInvokeMethod), clusterNodeFilterApply = CreateFunctionPointer((СlusterNodeFilterApplyCallbackDelegate)СlusterNodeFilterApply), onStart = CreateFunctionPointer((OnStartCallbackDelegate)OnStart), onStop = CreateFunctionPointer((OnStopCallbackDelegate)OnStop), error = CreateFunctionPointer((ErrorCallbackDelegate)Error), extensionCbInLongOutLong = CreateFunctionPointer((ExtensionCallbackInLongOutLongDelegate)ExtensionCallbackInLongOutLong), extensionCbInLongLongOutLong = CreateFunctionPointer((ExtensionCallbackInLongLongOutLongDelegate)ExtensionCallbackInLongLongOutLong), onClientDisconnected = CreateFunctionPointer((OnClientDisconnectedDelegate)OnClientDisconnected), ocClientReconnected = CreateFunctionPointer((OnClientReconnectedDelegate)OnClientReconnected), }; _cbsPtr = Marshal.AllocHGlobal(UU.HandlersSize()); Marshal.StructureToPtr(cbs, _cbsPtr, false); _thisHnd = GCHandle.Alloc(this); }