Exemple #1
0
        public void GetRow(int row, ref RowHolder rowHolder)
        {
            System.Diagnostics.Debug.Assert(IsPresent(row));

            ushort position = (ushort)(row * this.rowSize + this.dataStartPosition);

            rowHolder.Fill(new Span <byte>(Unsafe.AsPointer(ref this.storage.Span[position]), this.rowSize));
        }
Exemple #2
0
        public void SetRow(int row, RowHolder rowHolder)
        {
            ushort position = (ushort)(row * this.rowSize + this.dataStartPosition);

            fixed(byte *ptr = this.storage.Span)
            {
                BitArray.Set(row, ptr);
                Marshal.Copy(rowHolder.Storage, 0, (IntPtr)(ptr + position), rowHolder.Storage.Length);
            }
        }
Exemple #3
0
 // TODO: This is not performant and it is not natural to pass column type here.
 public IEnumerable <RowHolder> Iterate(ColumnInfo[] columnTypes)
 {
     for (int i = 0; i < this.maxRowCount; i++)
     {
         if (BitArray.IsSet(i, this.storage.Span))
         {
             RowHolder rowHolder = new RowHolder(columnTypes);
             GetRow(i, ref rowHolder);
             yield return(rowHolder);
         }
     }
 }
Exemple #4
0
 public override bool Equals(object obj)
 {
     if (obj is RowHolder)
     {
         RowHolder c = (RowHolder)obj;
         return(Enumerable.SequenceEqual(c.Storage, this.Storage) && Enumerable.SequenceEqual(c.ColumnPosition, this.ColumnPosition));
     }
     else
     {
         return(false);
     }
 }
Exemple #5
0
        public int InsertRow(RowHolder rowHolder)
        {
            fixed(byte *ptr = this.storage.Span)
            {
                int emptyPosition = BitArray.FindUnset(ptr, this.maxRowCount);

                if (emptyPosition == -1)
                {
                    return(-1);
                }

                this.SetRow(emptyPosition, rowHolder);
                this.rowCount++;

                return(emptyPosition);
            }
        }