Esempio n. 1
0
 public ClipByConstantPipe(ClipByConstantStreamable <TKey, TPayload> stream, IStreamObserver <TKey, TPayload> observer, long limit)
     : base(stream, observer)
 {
     this.limit         = limit;
     this.pool          = MemoryManager.GetMemoryPool <TKey, TPayload>(stream.Properties.IsColumnar);
     this.errorMessages = stream.ErrorMessages;
     this.pool.Get(out this.output);
     this.output.Allocate();
 }
Esempio n. 2
0
        /// <summary>
        /// Generate a batch class definition to be used as a ClipByConstant pipe.
        /// Compile the definition, dynamically load the assembly containing it, and return the Type representing the
        /// ClipByConstant pipe class.
        /// </summary>
        /// <typeparam name="TKey">The key type for both sides.</typeparam>
        /// <typeparam name="TPayload">The payload type.</typeparam>
        /// <returns>
        /// A type that is defined to be a subtype of UnaryPipe&lt;<typeparamref name="TKey"/>,<typeparamref name="TPayload"/>, <typeparamref name="TPayload"/>&gt;.
        /// </returns>
        internal static Tuple <Type, string> Generate <TKey, TPayload>(ClipByConstantStreamable <TKey, TPayload> stream)
        {
            Contract.Requires(stream != null);
            Contract.Ensures(Contract.Result <Tuple <Type, string> >() == null || typeof(UnaryPipe <TKey, TPayload, TPayload>).GetTypeInfo().IsAssignableFrom(Contract.Result <Tuple <Type, string> >().Item1));

#if CODEGEN_TIMING
            Stopwatch sw = new Stopwatch();
            sw.Start();
#endif
            var template = new ClipByConstantTemplate(
                string.Format("ClipByConstant_{0}", ClipByConstantSequenceNumber++),
                typeof(TKey), typeof(TPayload));

            return(template.Generate <TKey, TPayload>(typeof(IStreamable <,>)));
        }