Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Object"/> class.
        /// </summary>
        /// <param name="ptr">native pointer</param>
        /// <param name="deleter">optional deleter</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="ptr"/> is null</exception>
        protected Object(IntPtr ptr, Deleter deleter)
        {
            if (ptr == IntPtr.Zero)
            {
                throw new ArgumentNullException(nameof(ptr));
            }

            m_instance = new DeleterHandle(ptr, deleter);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomProcessingBlock"/> class.
        /// </summary>
        /// <param name="cb">Processing function to be applied to every frame entering the block</param>
        public CustomProcessingBlock(FrameProcessorCallback cb)
        {
            frameProcessorCallbackHandle = GCHandle.Alloc(cb, GCHandleType.Normal);
            IntPtr cbPtr = GCHandle.ToIntPtr(frameProcessorCallbackHandle);
            object error;
            var    pb = NativeMethods.rs2_create_processing_block_fptr(fpc, cbPtr, out error);

            m_instance = new Base.DeleterHandle(pb, NativeMethods.rs2_delete_processing_block);
            Options    = new OptionsList(m_instance.Handle);
        }