示例#1
0
        public MemoryView(IBufferProtocol @object)
        {
            _buffer        = @object;
            _step          = 1;
            _format        = _buffer.Format;
            _itemsize      = (int)_buffer.ItemSize;
            _matchesBuffer = true;

            var shape = _buffer.GetShape(_start, _end);

            if (shape == null)
            {
                _shape = null;
            }
            _shape = new PythonTuple(shape);
        }
示例#2
0
        public MemoryView([NotNull] IBufferProtocol @object)
        {
            _buffer        = @object;
            _step          = 1;
            _format        = _buffer.Format;
            _isReadOnly    = _buffer.ReadOnly;
            _itemsize      = (int)_buffer.ItemSize;
            _matchesBuffer = true;

            var shape = _buffer.GetShape(_start, _end);

            if (shape != null)
            {
                _shape = new PythonTuple(shape);
            }
            else
            {
                _shape = PythonTuple.MakeTuple(_buffer.ItemCount);
            }
        }