Ejemplo n.º 1
0
        /* Stream Multiplexer */

        /// <summary>
        /// A stream multiplexer chooses the next entry from a set of input
        /// streams based on a defined rule. The multiplexer is accesses like a
        /// regular stream.
        /// </summary>
        /// <param name="session">The session for which the multiplexer should
        ///     be created.</param>
        /// <param name="name">A friendly name for the multiplexer.</param>
        /// <param name="rule">The multiplexing rule, which determines the
        ///     next entry.</param>
        /// <param name="flags">A set of flags to customize multiplexing
        ///     behavior.</param>
        /// <param name="inputStreams">array of streams that should be used as
        ///     input for the multiplexer</param>
        /// <returns>The id the dynamic stream representing the created
        ///     multiplexer. Read entries from the multiplexer by reading
        ///     entries from the stream with the returned id.</returns>
        public static uint StXMultiplexerCreate(uint session, string name,
                                                MultiplexingRule rule, MultiplexerFlags flags, uint[] inputStreams)
        {
            GCHandle ids = new GCHandle();

            try {
                ids = GCHandle.Alloc(inputStreams, GCHandleType.Pinned);
                uint count = (uint)inputStreams.Length;

                return(NativeMethods.StXMultiplexerCreate(session, name,
                                                          rule, flags, ids.AddrOfPinnedObject(), count));
            } finally {
                if (ids.IsAllocated)
                {
                    ids.Free();
                }
            }
        }
Ejemplo n.º 2
0
 public static extern uint StXMultiplexerCreate(uint session,
                                                string name, MultiplexingRule rule, MultiplexerFlags flags,
                                                IntPtr inputStreams, uint count);