public static PaHostApiInfo GetHostApiInfo(int hostApi) { var ptr = PortAudioInterop.Pa_GetHostApiInfo (hostApi); if (ptr == IntPtr.Zero) ThrowLastError (); using (var cppptr = new CppInstancePtr (ptr)) return Factory.Create<PaHostApiInfo> (cppptr); }
public static PaDeviceInfo GetDeviceInfo(int deviceIndex) { var ptr = PortAudioInterop.Pa_GetDeviceInfo (deviceIndex); if (ptr == IntPtr.Zero) ThrowLastError (); using (var cppptr = new CppInstancePtr (ptr)) return Factory.Create<PaDeviceInfo> (cppptr); }
public void TestFromNativePtr() { IntPtr native = CreateCSimpleSubClass (0); CppInstancePtr cppip = new CppInstancePtr (native); Assert.AreEqual (native, cppip.Native); Assert.IsFalse (cppip.IsManagedAlloc, "#A1"); cppip.Dispose (); DestroyCSimpleSubClass (native); }
public IExtension(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public RTCPInstance(CppInstancePtr native) : base(impl.TypeInfo) { __cxxi_LayoutClass(); Native = native; }
public sp_debug_symbol_s(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public fp_fdbg_ntvarg_s(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public HandleSecurity(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public RTPReceptionStatsDB(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public BasicTaskScheduler(CppInstancePtr native) : base(impl.TypeInfo) { __cxxi_LayoutClass(); Native = native; }
public sp_file_hdr_s(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public IPluginFunction(CppInstancePtr native) : base(impl.TypeInfo) { __cxxi_LayoutClass(); Native = native; }
public IHandleTypeDispatch (CppInstancePtr native) { __cxxi_LayoutClass (); Native = native; }
public OurRtspClient(CppInstancePtr native) : base(native) { }
public static PaHostErrorInfo GetLastHostErrorInfo() { using (var cppptr = new CppInstancePtr (PortAudioInterop.Pa_GetLastHostErrorInfo ())) return Factory.Create<PaHostErrorInfo> (cppptr); }
public ISourcePawnEngine2(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public TypeAccess(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public IPlayerManager(CppInstancePtr native) : base(impl.TypeInfo) { __cxxi_LayoutClass(); Native = native; }
protected RTPReceptionStatsDB() { __cxxi_LayoutClass(); Native = impl.RTPReceptionStatsDB(impl.Alloc(this)); }
public _IO_cookie_io_functions_t(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public __locale_struct(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public GroupEId() { __cxxi_LayoutClass(); Native = impl.GroupEId(impl.Alloc(this)); }
public _IO_marker(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public GroupEId(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public sp_u_fdbg_arraydim_s(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public GroupEId(in_addr groupAddr, ushort portNum, Scope scope, uint numSuccessiveGroupAddrs) { __cxxi_LayoutClass(); Native = impl.GroupEId(impl.Alloc(this), groupAddr, portNum, scope, numSuccessiveGroupAddrs); }
public sp_fdbg_info_s(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public GroupEId(in_addr groupAddr, in_addr sourceFilterAddr, ushort portNum, uint numSuccessiveGroupAddrs) { __cxxi_LayoutClass(); Native = impl.GroupEId(impl.Alloc(this), groupAddr, sourceFilterAddr, portNum, numSuccessiveGroupAddrs); }
public IShareSys(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public MediaSink(CppInstancePtr native) : base(impl.TypeInfo) { __cxxi_LayoutClass(); Native = native; }
public tm(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
public virtual void InitInstance(ref CppInstancePtr instance) { InitInstanceOffset(ref instance, true, 0); }
public RTPTransmissionStatsDB(CppInstancePtr native) { __cxxi_LayoutClass(); Native = native; }
// FIXME: Make this method unsafe.. it would probably be much faster public virtual void InitInstanceOffset(ref CppInstancePtr instance, bool isPrimary, int vtableOffset) { if (this.TypeInfo.HasVTable) { var basePtr = Marshal.ReadIntPtr(instance.Native, vtableOffset); Debug.Assert(basePtr != IntPtr.Zero); var realPtr = this.Pointer; if (basePtr == realPtr) { return; } // If this is the primary class or if this is not a managed alloc // then update the main vtable // This basically means derived classes and non primary base classes if (isPrimary || !instance.IsManagedAlloc) { instance.NativeVTable = basePtr; } else { instance.SetNativeBaseVTable(this.TypeInfo.WrapperType, basePtr); } if (!initialized) { // FIXME: This could probably be a more efficient memcpy int top = type_info.VTableTopPadding; for (int i = 0; i < top; i++) { Marshal.WriteByte(vtPtr, i, Marshal.ReadByte(basePtr, i - top)); } int currentOffset = 0; for (int i = 0; i < EntryCount; i++) { if (Marshal.ReadIntPtr(realPtr, currentOffset) == IntPtr.Zero) { Marshal.WriteIntPtr(realPtr, currentOffset, Marshal.ReadIntPtr(basePtr, currentOffset)); } currentOffset += EntrySize; } // FIXME: This could probably be a more efficient memcpy for (int i = 0; i < type_info.VTableBottomPadding; i++) { Marshal.WriteByte(realPtr, currentOffset + i, Marshal.ReadByte(basePtr, currentOffset + i)); } initialized = true; } Marshal.WriteIntPtr(instance.Native, vtableOffset, realPtr); } // TODO: I should probably be looking up the offsets via the vbtable rather than this if (isPrimary) { int offset = this.TypeInfo.NativeSize; foreach (var vbase in this.TypeInfo.GetVirtualBasesDistinct().Reverse()) { offset -= vbase.NativeSize; vbase.VTable.InitInstanceOffset(ref instance, false, offset); // Put a pointer to this virtual base in our instance so we can find it instance.SetNativeBasePointer(vbase.WrapperType, new IntPtr(instance.Native.ToInt64() + offset)); } } }
public static void Destroy(CppInstancePtr vmtc) { DestroyVirtualMethodTestClass ((IntPtr)vmtc); }
public ISourceMod(CppInstancePtr native) : base(impl.TypeInfo) { __cxxi_LayoutClass(); Native = native; }