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);
 }
Example #3
0
 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);
 }
Example #4
0
 public IExtension(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #5
0
 public RTCPInstance(CppInstancePtr native)
     : base(impl.TypeInfo)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #6
0
 public sp_debug_symbol_s(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #7
0
 public fp_fdbg_ntvarg_s(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #8
0
 public HandleSecurity(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #9
0
 public RTPReceptionStatsDB(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #10
0
 public BasicTaskScheduler(CppInstancePtr native)
     : base(impl.TypeInfo)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #11
0
 public sp_file_hdr_s(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #12
0
 public IPluginFunction(CppInstancePtr native)
     : base(impl.TypeInfo)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
		public IHandleTypeDispatch (CppInstancePtr native)
		{
			__cxxi_LayoutClass ();
			Native = native;
		}
Example #14
0
 public OurRtspClient(CppInstancePtr native)
     : base(native)
 {
 }
 public static PaHostErrorInfo GetLastHostErrorInfo()
 {
     using (var cppptr = new CppInstancePtr (PortAudioInterop.Pa_GetLastHostErrorInfo ()))
         return Factory.Create<PaHostErrorInfo> (cppptr);
 }
Example #16
0
 public ISourcePawnEngine2(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #17
0
 public TypeAccess(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #18
0
 public IPlayerManager(CppInstancePtr native)
     : base(impl.TypeInfo)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #19
0
 protected RTPReceptionStatsDB()
 {
     __cxxi_LayoutClass();
     Native = impl.RTPReceptionStatsDB(impl.Alloc(this));
 }
Example #20
0
 public _IO_cookie_io_functions_t(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #21
0
 public __locale_struct(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #22
0
 public GroupEId()
 {
     __cxxi_LayoutClass();
     Native = impl.GroupEId(impl.Alloc(this));
 }
Example #23
0
 public _IO_marker(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #24
0
 public GroupEId(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
 public sp_u_fdbg_arraydim_s(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #26
0
 public GroupEId(in_addr groupAddr, ushort portNum, Scope scope, uint numSuccessiveGroupAddrs)
 {
     __cxxi_LayoutClass();
     Native = impl.GroupEId(impl.Alloc(this), groupAddr, portNum, scope, numSuccessiveGroupAddrs);
 }
Example #27
0
 public sp_fdbg_info_s(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #28
0
 public GroupEId(in_addr groupAddr, in_addr sourceFilterAddr, ushort portNum, uint numSuccessiveGroupAddrs)
 {
     __cxxi_LayoutClass();
     Native = impl.GroupEId(impl.Alloc(this), groupAddr, sourceFilterAddr, portNum, numSuccessiveGroupAddrs);
 }
Example #29
0
 public IShareSys(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #30
0
 public MediaSink(CppInstancePtr native)
     : base(impl.TypeInfo)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #31
0
 public tm(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #32
0
 public virtual void InitInstance(ref CppInstancePtr instance)
 {
     InitInstanceOffset(ref instance, true, 0);
 }
Example #33
0
 public RTPTransmissionStatsDB(CppInstancePtr native)
 {
     __cxxi_LayoutClass();
     Native = native;
 }
Example #34
0
        // 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);
 }
Example #36
0
 public ISourceMod(CppInstancePtr native)
     : base(impl.TypeInfo)
 {
     __cxxi_LayoutClass();
     Native = native;
 }