public SwiftIteratorProtocolProxy(IIteratorProtocol <T> proxiedType) { this.proxiedType = proxiedType; SwiftObject = IteratorProtocolPinvokes.NewIteratorProtocol(StructMarshal.Marshaler.Metatypeof(typeof(T))); SwiftCore.Retain(SwiftObject); SwiftObjectRegistry.Registry.Add(this); }
protected virtual void DisposeUnmanagedResources() { if (IsCSObjectProxy) { SwiftCore.Release(SwiftObject); } else { StructMarshal.Marshaler.ReleaseNominalData(ProxiedMetatype, SwiftData); } }
public unsafe static object Unbox(ISwiftExistentialContainer container) { Type targetType; if (!SwiftTypeRegistry.Registry.TryGetValue(container.ObjectMetadata, out targetType)) { throw new SwiftRuntimeException($"Unable to unbox swift type {container.ObjectMetadata.TypeName}."); } byte *anyPtr = stackalloc byte [container.SizeOf]; var anyIntPtr = new IntPtr(anyPtr); CopyTo(container, anyIntPtr); byte *resultPtr = stackalloc byte [(int)SwiftCore.StrideOf(container.ObjectMetadata)]; var resultIntPtr = new IntPtr(resultPtr); AnyPinvokes.FromAny(resultIntPtr, anyIntPtr, container.ObjectMetadata); return(StructMarshal.Marshaler.ToNet(resultIntPtr, targetType)); }
protected virtual void DisposeUnmanagedResources() { SwiftCore.Release(SwiftObject); }
XamTrivialSwiftObject(IntPtr p, SwiftObjectRegistry registry) { SwiftObject = p; SwiftCore.Retain(p); registry.Add(this); }
public XamTrivialSwiftObject() { SwiftObject = NativeMethodsForXamTrivialSwiftObject.PIctor(NativeMethodsForXamTrivialSwiftObject.PImeta()); SwiftCore.Retain(SwiftObject); SwiftObjectRegistry.Registry.Add(this); }
void DisposeUnmanagedResources() { SwiftCore.Release(SwiftObject); }
SwiftAnyObject(IntPtr ptr, SwiftObjectRegistry registry) { SwiftObject = ptr; SwiftCore.Retain(ptr); registry.Add(this); }
SwiftIteratorProtocolProxy(IntPtr ptr, SwiftObjectRegistry registry) { SwiftObject = ptr; SwiftCore.Retain(ptr); registry.Add(this); }