Class DistinctMetadataTableBuffer<TRow>
- Namespace
- AsmResolver.DotNet.Builder.Metadata
- Assembly
- AsmResolver.DotNet.dll
Decorates a metadata table buffer with a filter that removes all duplicated rows from the buffer.
public class DistinctMetadataTableBuffer<TRow> : IMetadataTableBuffer<TRow>, IMetadataTableBuffer where TRow : struct, IMetadataRow
Type Parameters
TRowThe type of rows to store.
- Inheritance
-
DistinctMetadataTableBuffer<TRow>
- Implements
-
IMetadataTableBuffer<TRow>
- Inherited Members
Constructors
DistinctMetadataTableBuffer(IMetadataTableBuffer<TRow>)
Creates a new distinct metadata table buffer decorator.
public DistinctMetadataTableBuffer(IMetadataTableBuffer<TRow> underlyingBuffer)
Parameters
underlyingBufferIMetadataTableBuffer<TRow>The underlying table buffer.
Properties
Count
Gets the number of rows that were added to the buffer.
public int Count { get; }
Property Value
this[uint]
Gets or sets a row in the metadata table.
public TRow this[uint rid] { get; set; }
Parameters
riduintThe identifier of the metadata row.
Property Value
- TRow
Methods
Add(in TRow)
Adds a row to the metadata table.
public MetadataToken Add(in TRow row)
Parameters
rowTRowThe row to add.
Returns
- MetadataToken
The metadata token that this row was assigned to.
Add(in TRow, bool)
Adds a row to the metadata table buffer.
public MetadataToken Add(in TRow row, bool allowDuplicates)
Parameters
rowTRowThe row to add.
allowDuplicatesbooltrueif the row is always to be added to the end of the buffer,falseif a duplicated row is supposed to be removed and the token of the original should be returned instead.
Returns
- MetadataToken
The metadata token that this row was assigned to.
Clear()
Clears the table buffer.
public void Clear()
EnsureCapacity(int)
Ensures the capacity of the table buffer is at least the provided amount of elements.
public void EnsureCapacity(int capacity)
Parameters
capacityintThe number of elements to store.
FlushToTable()
Submits all rows to the underlying table stream.
public void FlushToTable()
GetRowRef(uint)
Gets or sets a reference to a row in the metadata table.
public ref TRow GetRowRef(uint rid)
Parameters
riduintThe identifier of the metadata row.
Returns
- TRow
Insert(uint, in TRow)
Inserts a row into the metadata table at the provided row identifier.
public MetadataToken Insert(uint rid, in TRow row)
Parameters
riduintThe row identifier.
rowTRowThe row to add.
Returns
- MetadataToken
The metadata token that this row was assigned to.
Insert(uint, in TRow, bool)
Inserts a row into the metadata table at the provided row identifier.
public MetadataToken Insert(uint rid, in TRow row, bool allowDuplicates)
Parameters
riduintThe row identifier.
rowTRowThe row to add.
allowDuplicatesbooltrueif the row is always to be added to the end of the buffer,falseif a duplicated row is supposed to be removed and the token of the original should be returned instead.
Returns
- MetadataToken
The metadata token that this row was assigned to.