// Copyright Epic Games, Inc. All Rights Reserved. //------------------------------------------------------------------------------ // // // This file was automatically generated by SWIG (http://www.swig.org). // Version 4.0.1 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. //------------------------------------------------------------------------------ public class FDatasmithFacadeEndpointObserver : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; internal FDatasmithFacadeEndpointObserver(global::System.IntPtr cPtr, bool cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FDatasmithFacadeEndpointObserver obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } ~FDatasmithFacadeEndpointObserver() { Dispose(false); } public void Dispose() { Dispose(true); global::System.GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { // Disposing of the C# object while the C++ still holds a functions pointer the managed code. Unregister the function ptr. if (OnStateChangeInternal != null) { UnregisterOnStateChangedDelegateInternal(NotifyStateChangedEvent); } lock(this) { if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; DatasmithFacadeCSharpPINVOKE.delete_FDatasmithFacadeEndpointObserver(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } } } public delegate void NotifyStateChangeNativeEvent(global::System.IntPtr NewRawInfoPtr); private NotifyStateChangeNativeEvent NotifyStateChangedEvent; private System.Object ObjectLock = new System.Object(); public class FDatasmithFacadeRawInfoEventArgs : System.EventArgs { public FDatasmithFacadeRawInfo RawInfo; } private System.EventHandler OnStateChangeInternal; public event System.EventHandler OnStateChangedEvent { add { lock (ObjectLock) { bool bNeedsRegistration = OnStateChangeInternal == null; OnStateChangeInternal += value; if (bNeedsRegistration) { RegisterOnStateChangedDelegateInternal(NotifyStateChangedEvent); } } } remove { lock (ObjectLock) { OnStateChangeInternal -= value; if (OnStateChangeInternal == null) { // No need to receive updates if no one is registered to the event UnregisterOnStateChangedDelegateInternal(NotifyStateChangedEvent); } } } } public virtual void OnStateChanged(FDatasmithFacadeRawInfo RawInfo) {} private void NotifyStateChange(global::System.IntPtr NewRawInfoPtr) { // Create C# wrapper around FDatasmithFacadeRawInfo pointer. FDatasmithFacadeRawInfo RawInfo = new FDatasmithFacadeRawInfo(NewRawInfoPtr, true); FDatasmithFacadeRawInfoEventArgs EventArgs = new FDatasmithFacadeRawInfoEventArgs(); EventArgs.RawInfo = RawInfo; OnStateChangeInternal?.Invoke(this, EventArgs); OnStateChanged(RawInfo); } public FDatasmithFacadeEndpointObserver() : this(DatasmithFacadeCSharpPINVOKE.new_FDatasmithFacadeEndpointObserver(), true) { NotifyStateChangedEvent = new NotifyStateChangeNativeEvent(NotifyStateChange); } private void RegisterOnStateChangedDelegateInternal(NotifyStateChangeNativeEvent InOnStateChanged) { DatasmithFacadeCSharpPINVOKE.FDatasmithFacadeEndpointObserver_RegisterOnStateChangedDelegateInternal(swigCPtr, InOnStateChanged); } private void UnregisterOnStateChangedDelegateInternal(NotifyStateChangeNativeEvent InOnStateChanged) { DatasmithFacadeCSharpPINVOKE.FDatasmithFacadeEndpointObserver_UnregisterOnStateChangedDelegateInternal(swigCPtr, InOnStateChanged); } }