Exemple #1
0
        // DO NOT REMOVE maxSize parameter, the parameters are fixed and passed through reflection
        public RetainingMultiReaderBuffer(long initialSize, long maxSize, ICursors cursors)
        {
            Cursors = cursors;

            if ((initialSize & (initialSize - 1)) != 0 || initialSize <= 0)
            {
                throw new ArgumentException("initialSize must be a power of 2 that is > 0");
            }

            // We don't care about the maximum size
            Buffer = new T[initialSize];
        }
Exemple #2
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="initialSize">TBD</param>
        /// <param name="maxSize">TBD</param>
        /// <param name="cursors">TBD</param>
        /// <exception cref="ArgumentException">TBD</exception>
        public ResizableMultiReaderRingBuffer(long initialSize, long maxSize, ICursors cursors)
        {
            Cursors = cursors;
            if ((initialSize & (initialSize - 1)) != 0 || initialSize <= 0 || initialSize > maxSize)
            {
                throw new ArgumentException("initialSize must be a power of 2 that is > 0 and <= maxSize");
            }


            if ((maxSize & (maxSize - 1)) != 0 || maxSize <= 0 || maxSize > int.MaxValue / 2)
            {
                throw new ArgumentException("maxSize must be a power of 2 that is > 0 and < Int.MaxValue/2");
            }

            _array      = new T[initialSize];
            _maxSizeBit = BitOperations.TrailingZeroCount(maxSize);
        }
Exemple #3
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="initialSize">TBD</param>
        /// <param name="maxSize">TBD</param>
        /// <param name="cursors">TBD</param>
        /// <exception cref="ArgumentException">TBD</exception>
        public ResizableMultiReaderRingBuffer(int initialSize, int maxSize, ICursors cursors)
        {
            Cursors = cursors;
            if ((initialSize & (initialSize - 1)) != 0 || initialSize <= 0 || initialSize > maxSize)
            {
                throw new ArgumentException("initialSize must be a power of 2 that is > 0 and <= maxSize");
            }


            if ((maxSize & (maxSize - 1)) != 0 || maxSize <= 0 || maxSize > int.MaxValue / 2)
            {
                throw new ArgumentException("maxSize must be a power of 2 that is > 0 and < Int.MaxValue/2");
            }

            _array      = new object[initialSize];
            _maxSizeBit = maxSize.NumberOfTrailingZeros();
        }
Exemple #4
0
 public TestBuffer(int initialSize, int maxSize, ICursors cursors) : base(initialSize, maxSize, cursors)
 {
     UnderlyingCursors = cursors;
 }
Exemple #5
0
 public DistinctRetainingMultiReaderBuffer(long initialSize, long maxSize, ICursors cursors) : base(initialSize, maxSize, cursors)
 {
 }