Esempio n. 1
0
        public bool ReadChunk(ref IFrameDataSubset subset, int overrideChunkSize = 0)
        {
            if (_chunkReadIndex >= Left.Length)
            {
                return(false);
            }

            if (overrideChunkSize != 0)
            {
                _chunkReadSize = overrideChunkSize;
            }

            var readSize  = _chunkReadSize;
            var readIndex = _chunkReadIndex;

            if (readIndex + readSize >= Left.Length)
            {
                readSize = Left.Length - readIndex;
            }

            _chunkReadIndex += readSize;

            subset = new FrameDataSubset(Left, Right, readIndex, readSize);
            return(true);
        }
Esempio n. 2
0
        public void ASubsetCannotExtendPastTheBoundsOfTheParentData()
        {
            var left = new float[100];
            var fds = new FrameDataSubset(left, left, 99, 1);
            Assert.Equal(1, fds.Length);

            Assert.Throws(typeof(ArgumentException), () => fds = new FrameDataSubset(left, left, 99, 2));
        }
Esempio n. 3
0
        public void AFrameDataSubsetRepresentsAViewIntoAFrameBuffer()
        {
            var left = new float[100];
            var right = new float[100];
            for (var i = 0; i < 100; ++i)
            {
                left[i] = i;
                right[i] = 99 - i;
            }

            var fds = new FrameDataSubset(left, right, 0, 50);

            Assert.Equal(50, fds.Length);
            Assert.Equal(49, fds.Left.Max());
            Assert.Equal(99, fds.Right.Max());

            fds = new FrameDataSubset(left, right, 50, 50);
            Assert.Equal(50, fds.Length);
            Assert.Equal(99, fds.Left.Max());
            Assert.Equal(49, fds.Right.Max());
        }
Esempio n. 4
0
        public bool ReadChunk(ref IFrameDataSubset subset, int overrideChunkSize = 0)
        {
            if (_chunkReadIndex >= Left.Length) return false;

            if (overrideChunkSize != 0)
            {
                _chunkReadSize = overrideChunkSize;
            }

            var readSize = _chunkReadSize;
            var readIndex = _chunkReadIndex;

            if (readIndex + readSize >= Left.Length)
            {
                readSize = Left.Length - readIndex;
            }

            _chunkReadIndex += readSize;

            subset = new FrameDataSubset(Left, Right, readIndex, readSize);
            return true;
        }