Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="size"></param>
 /// <param name="period"></param>
 /// <param name="offset"></param>
 /// <param name="duration"></param>
 public FWindow(long size, long period, long offset, long duration)
 {
     SyncTime = StreamEvent.MinSyncTime;
     Duration = duration;
     Size     = size;
     Period   = period;
     Offset   = offset;
     Length   = (int)(Size / Period);
     _Payload = new FSubWindow <TPayload>(Length);
     _Sync    = new FSubWindow <long>(Length);
     _Other   = new FSubWindow <long>(Length);
     _BV      = new BVFSubWindow(Length);
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="left"></param>
        /// <param name="right"></param>
        /// <param name="joiner"></param>
        public JoinFWindow(FWindowable <TLeft> left, FWindowable <TRight> right, Joiner joiner)
            : base(left, right, left.Size, left.Period, left.Offset, left.Duration)
        {
            Invariant.IsTrue(right.Offset == left.Offset, "Left offset must match to right offset");
            Invariant.IsTrue(right.Period % left.Period == 0, "Right period must be a multiple of left period");
            Invariant.IsTrue(right.Size == left.Size, "Left size must match to right size");
            Invariant.IsTrue(right.Period == right.Duration, "Right: period and duration must be same");
            Invariant.IsTrue(left.Period == left.Duration, "Left: period and duration must be same");

            _joiner = joiner;

            _Payload = new FSubWindow <TResult>(Length);
            _Sync    = Left.Sync as FSubWindow <long>;
            _Other   = Left.Other as FSubWindow <long>;
            _BV      = new BVFSubWindow(Length);
        }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 public void _Copy(BVFSubWindow output)
 {
     unsafe
     {
         fixed(long *ibv = Data)
         fixed(long *obv = output.Data)
         {
             for (int i = 0; i < Length; i++)
             {
                 var ibi = Offset + i;
                 var obi = output.Offset + i;
                 if ((ibv[ibi >> 6] & (1L << (ibi & 0x3f))) == 0)
                 {
                     obv[obi >> 6] &= ~(1L << (obi & 0x3f));
                 }
                 else
                 {
                     obv[obi >> 6] |= (1L << (obi & 0x3f));
                 }
             }
         }
     }
 }