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(UnsortedMetadataTableBuffer<TRow>)
Creates a new distinct metadata table buffer decorator.
public DistinctMetadataTableBuffer(UnsortedMetadataTableBuffer<TRow> underlyingBuffer)
Parameters
underlyingBufferUnsortedMetadataTableBuffer<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
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
TryAdd(in TRow, bool, out MetadataToken)
Adds a row to the metadata table buffer.
public bool TryAdd(in TRow row, bool allowDuplicates, out MetadataToken token)
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.tokenMetadataTokenWhen the method returns
true, contains the new metadata token the row was assigned to. When the method returnsfalse, contains the previous metadata token an equivalent row was assigned to.
Returns
- bool
trueif the row was inserted into the table,falseotherwise.
TryInsert(uint, in TRow, bool, out MetadataToken)
Inserts a row into the metadata table at the provided row identifier.
public bool TryInsert(uint rid, in TRow row, bool allowDuplicates, out MetadataToken token)
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.tokenMetadataTokenWhen the method returns
true, contains the new metadata token the row was assigned to. When the method returnsfalse, contains the previous metadata token an equivalent row was assigned to.
Returns
- bool
trueif the row was inserted into the table,falseotherwise.