Class UnitedMemoryLinksBase<TLinkAddress>

Namespace
Platform.Data.Doublets.Memory.United.Generic
Assembly
Platform.Data.Doublets.dll

Represents the united memory links base.

public abstract class UnitedMemoryLinksBase<TLinkAddress> : DisposableBase, IDisposable, IDisposable, ILinks<TLinkAddress>, ILinks<TLinkAddress, LinksConstants<TLinkAddress>> where TLinkAddress : IUnsignedNumber<TLinkAddress>, IComparisonOperators<TLinkAddress, TLinkAddress, bool>

Type Parameters

TLinkAddress
Inheritance
DisposableBase
UnitedMemoryLinksBase<TLinkAddress>
Implements
IDisposable
ILinks<TLinkAddress>
ILinks<TLinkAddress, LinksConstants<TLinkAddress>>
Derived
Inherited Members
DisposableBase.Dispose()
DisposableBase.Destruct()
DisposableBase.IsDisposed
DisposableBase.ObjectName
DisposableBase.AllowMultipleDisposeAttempts
Extension Methods

Constructors

UnitedMemoryLinksBase(IResizableDirectMemory, long)

Initializes a new UnitedMemoryLinksBase<TLinkAddress> instance.

protected UnitedMemoryLinksBase(IResizableDirectMemory memory, long memoryReservationStep)

Parameters

memory IResizableDirectMemory

A memory.

memoryReservationStep long

A memory reservation step.

UnitedMemoryLinksBase(IResizableDirectMemory, long, LinksConstants<TLinkAddress>)

Initializes a new UnitedMemoryLinksBase<TLinkAddress> instance.

protected UnitedMemoryLinksBase(IResizableDirectMemory memory, long memoryReservationStep, LinksConstants<TLinkAddress> constants)

Parameters

memory IResizableDirectMemory

A memory.

memoryReservationStep long

A memory reservation step.

constants LinksConstants<TLinkAddress>

A constants.

Fields

DefaultLinksSizeStep

The link size in bytes.

public static readonly long DefaultLinksSizeStep

Field Value

long

LinkHeaderSizeInBytes

The size in bytes.

public static readonly long LinkHeaderSizeInBytes

Field Value

long

LinkSizeInBytes

Возвращает размер одной связи в байтах.

public static readonly long LinkSizeInBytes

Field Value

long

Remarks

Используется только во вне класса, не рекомедуется использовать внутри. Так как во вне не обязательно будет доступен unsafe С#.

SourcesTreeMethods

The sources tree methods.

protected ILinksTreeMethods<TLinkAddress>? SourcesTreeMethods

Field Value

ILinksTreeMethods<TLinkAddress>

TargetsTreeMethods

The targets tree methods.

protected ILinksTreeMethods<TLinkAddress>? TargetsTreeMethods

Field Value

ILinksTreeMethods<TLinkAddress>

UnusedLinksListMethods

The unused links list methods.

protected ILinksListMethods<TLinkAddress>? UnusedLinksListMethods

Field Value

ILinksListMethods<TLinkAddress>

_constants

Gets the constants value.

protected readonly LinksConstants<TLinkAddress> _constants

Field Value

LinksConstants<TLinkAddress>

_memory

The memory.

protected readonly IResizableDirectMemory _memory

Field Value

IResizableDirectMemory

_memoryReservationStep

The memory reservation step.

protected readonly long _memoryReservationStep

Field Value

long

Properties

AllowMultipleDisposeCalls

Gets the allow multiple dispose calls value.

protected override bool AllowMultipleDisposeCalls { get; }

Property Value

bool

Constants

Gets the configured constants for the store.

public virtual LinksConstants<TLinkAddress> Constants { get; }

Property Value

LinksConstants<TLinkAddress>

Total

Возвращает общее число связей находящихся в хранилище.

protected virtual TLinkAddress Total { get; }

Property Value

TLinkAddress

Methods

Add(TLinkAddress, TLinkAddress)

Adds the first.

protected virtual TLinkAddress Add(TLinkAddress first, TLinkAddress second)

Parameters

first TLinkAddress

The first.

second TLinkAddress

The second.

Returns

TLinkAddress

The link

AreEqual(TLinkAddress, TLinkAddress)

Determines whether this instance are equal.

protected virtual bool AreEqual(TLinkAddress first, TLinkAddress second)

Parameters

first TLinkAddress

The first.

second TLinkAddress

The second.

Returns

bool

The bool

Count(IList<TLinkAddress>?)

Counts the substitution.

public virtual TLinkAddress Count(IList<TLinkAddress>? restriction)

Parameters

restriction IList<TLinkAddress>

The query restriction. Null or an empty list means all links.

Returns

TLinkAddress

The link

Exceptions

NotSupportedException

Other restriction sizes and methods are not supported.

Create(IList<TLinkAddress>?, WriteHandler<TLinkAddress>?)

Creates a link and invokes the optional callback.

public virtual TLinkAddress Create(IList<TLinkAddress>? substitution, WriteHandler<TLinkAddress>? handler)

Parameters

substitution IList<TLinkAddress>
handler WriteHandler<TLinkAddress>

Returns

TLinkAddress

Remarks

TODO: Возможно нужно будет заполнение нулями, если внешнее API ими не заполняет пространство

Delete(IList<TLinkAddress>?, WriteHandler<TLinkAddress>?)

Deletes a live link whose endpoints have already been reset. The caller owns these preconditions.

public virtual TLinkAddress Delete(IList<TLinkAddress>? restriction, WriteHandler<TLinkAddress>? handler)

Parameters

restriction IList<TLinkAddress>

The restriction containing the index of the link to delete.

handler WriteHandler<TLinkAddress>

Optional callback; null continues without invoking a callback.

Returns

TLinkAddress

Dispose(bool, bool)

Disposes the manual.

protected override void Dispose(bool manual, bool wasDisposed)

Parameters

manual bool

The manual.

wasDisposed bool

The was disposed.

Each(IList<TLinkAddress>?, ReadHandler<TLinkAddress>?)

Eaches the handler.

public virtual TLinkAddress Each(IList<TLinkAddress>? restriction, ReadHandler<TLinkAddress>? handler)

Parameters

restriction IList<TLinkAddress>

The query restriction. Null or an empty list means all links.

handler ReadHandler<TLinkAddress>

The handler.

Returns

TLinkAddress

The link

Exceptions

NotSupportedException

Other restriction sizes and methods are not supported.

Exists(TLinkAddress)

Determines whether this instance exists.

protected virtual bool Exists(TLinkAddress link)

Parameters

link TLinkAddress

The link.

Returns

bool

The bool

GetHeaderReference()

Gets the header reference.

protected abstract ref LinksHeader<TLinkAddress> GetHeaderReference()

Returns

LinksHeader<TLinkAddress>

A ref links header of t link

GetLinkReference(TLinkAddress)

Gets the link reference using the specified link index.

protected abstract ref RawLink<TLinkAddress> GetLinkReference(TLinkAddress linkIndex)

Parameters

linkIndex TLinkAddress

The link index.

Returns

RawLink<TLinkAddress>

A ref raw link of t link

GetLinkStruct(TLinkAddress)

Gets the link struct using the specified link index.

public IList<TLinkAddress> GetLinkStruct(TLinkAddress linkIndex)

Parameters

linkIndex TLinkAddress

The link index.

Returns

IList<TLinkAddress>

A list of t link

GetOne()

Gets the one.

protected virtual TLinkAddress GetOne()

Returns

TLinkAddress

The link

GetZero()

Gets the zero.

protected virtual TLinkAddress GetZero()

Returns

TLinkAddress

The link

GreaterOrEqualThan(TLinkAddress, TLinkAddress)

Determines whether this instance greater or equal than.

protected virtual bool GreaterOrEqualThan(TLinkAddress first, TLinkAddress second)

Parameters

first TLinkAddress

The first.

second TLinkAddress

The second.

Returns

bool

The bool

GreaterThan(TLinkAddress, TLinkAddress)

Determines whether this instance greater than.

protected virtual bool GreaterThan(TLinkAddress first, TLinkAddress second)

Parameters

first TLinkAddress

The first.

second TLinkAddress

The second.

Returns

bool

The bool

Init(IResizableDirectMemory, long)

Inits the memory.

protected virtual void Init(IResizableDirectMemory memory, long memoryReservationStep)

Parameters

memory IResizableDirectMemory

The memory.

memoryReservationStep long

The memory reservation step.

InitializeMemory(IResizableDirectMemory, long, Action)

Initializes memory using a concrete pointer initializer during construction.

protected void InitializeMemory(IResizableDirectMemory memory, long memoryReservationStep, Action setPointers)

Parameters

memory IResizableDirectMemory
memoryReservationStep long
setPointers Action

Determines whether this instance is unused link.

protected virtual bool IsUnusedLink(TLinkAddress linkIndex)

Parameters

linkIndex TLinkAddress

The link index.

Returns

bool

The bool

LessOrEqualThan(TLinkAddress, TLinkAddress)

Determines whether this instance less or equal than.

protected virtual bool LessOrEqualThan(TLinkAddress first, TLinkAddress second)

Parameters

first TLinkAddress

The first.

second TLinkAddress

The second.

Returns

bool

The bool

LessThan(TLinkAddress, TLinkAddress)

Determines whether this instance less than.

protected virtual bool LessThan(TLinkAddress first, TLinkAddress second)

Parameters

first TLinkAddress

The first.

second TLinkAddress

The second.

Returns

bool

The bool

ResetPointers()

Resets the pointers.

protected virtual void ResetPointers()

SetPointers(IResizableDirectMemory)

protected abstract void SetPointers(IResizableDirectMemory memory)

Parameters

memory IResizableDirectMemory

Remarks

TODO: Возможно это должно быть событием, вызываемым из IMemory, в том случае, если адрес реально поменялся

Указатель this.links может быть в том же месте, так как 0-я связь не используется и имеет такой же размер как Header, поэтому header размещается в том же месте, что и 0-я связь

Subtract(TLinkAddress, TLinkAddress)

Subtracts the first.

protected virtual TLinkAddress Subtract(TLinkAddress first, TLinkAddress second)

Parameters

first TLinkAddress

The first.

second TLinkAddress

The second.

Returns

TLinkAddress

The link

Update(IList<TLinkAddress>?, IList<TLinkAddress>?, WriteHandler<TLinkAddress>?)

Updates the link that matches the restriction.

public virtual TLinkAddress Update(IList<TLinkAddress>? restriction, IList<TLinkAddress>? substitution, WriteHandler<TLinkAddress>? handler)

Parameters

restriction IList<TLinkAddress>
substitution IList<TLinkAddress>
handler WriteHandler<TLinkAddress>

Returns

TLinkAddress

Remarks

The caller must supply a live internal address and valid endpoint/index state. This raw operation does not validate existence. Select an outer LinksInnerReferenceExistenceValidator or a per-call EnsureLinkExists check before resolver work when missing internal addresses must be rejected. TODO: Возможно можно перемещать значения, если указан индекс, но значение существует в другом месте (но не в менеджере памяти, а в логике Links)

See Also

DisposableBase
ILinks<TLinkAddress>