Table of Contents

Class InitStickConvex

Namespace
Hi.Cbtr
Assembly
HiCbtr.dll

One share of a native stick convex (init_stick_convex_t, built by hi-key from an apt_t, or imported by core from the cloud licence server's signed token, see TryCreate(IGetGeneralApt, out string)). The native object is shared: the profile that built it holds one share as its cache (AptProfile.GetInitStickConvex), and every consumer that takes it for a subtraction holds another (TryShare(), kept on its GeomBoolCache). Dispose() gives this share back; the native object is freed by the last share given back, so a profile that clears its cache while a step is subtracting with the convex frees nothing until that step is done. A share that was given back answers Zero and mints nothing. Should no share be reachable any more, the finalizer frees the native object (never while a share is held: a held share keeps it reachable).

public class InitStickConvex : IDisposable
Inheritance
InitStickConvex
Implements
Inherited Members
Extension Methods

Constructors

InitStickConvex(IGetGeneralApt)

Builds the native stick convex of src through hi-key; this instance is its first share.

public InitStickConvex(IGetGeneralApt src)

Parameters

src IGetGeneralApt

The source object that provides general APT information.

Properties

CloudTokenProvider

Internal Use Only. The cloud licence client's token provider, asked by TryCreate(IGetGeneralApt, out string) for the signed stick-convex token of a shape: set together with the lease source by CloudLeaseClient.StartAsync in the cloud package, null in Sentinel mode, where TryCreate(IGetGeneralApt, out string) builds through hi-key as the constructor does. Asked once per TryCreate(IGetGeneralApt, out string) call, twice when a cached token fails natively; it answers (a token, or why there is none). Should it throw all the same, TryCreate(IGetGeneralApt, out string) answers null with the exception as the problem: never a faulted machining step.

public static Func<GeneralApt, CloudStickConvexToken> CloudTokenProvider { get; set; }

Property Value

Func<GeneralApt, CloudStickConvexToken>

InitStickConvexPtr

The native pointer, for as long as this share is held; Zero once the share was given back (other shares may still keep the native object alive, but this holder no longer does, so it may not hand the pointer to native code).

public nint InitStickConvexPtr { get; }

Property Value

nint

ShareCount

Shares outstanding on the native object, this one included while it is held; 0 once the native object is freed. Internal Use Only: read by the facts that pin the sharing.

public int ShareCount { get; }

Property Value

int

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

Gives this share back, once; a repeated call does nothing. disposing is always true (no finalizer).

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

TryCreate(IGetGeneralApt, out string)

The stick convex of src as a first share (the caller's), or null with problem saying why. Sentinel mode (CloudTokenProvider null): hi-key builds it, as InitStickConvex(IGetGeneralApt) does, and problem is null. Cloud mode: the provider answers the shape's signed token (or why there is none: offline, no valid lease, the server refused the shape), and core verifies and imports it (stick_convex__new_by_token: the pinned key, this device's mid, the shape key, the geometry buffer). A token core refuses is reported to the provider (ReportImportStatus, which evicts a cached file); when that token came from the cache the provider is asked once more (it then fetches from the server) and the second answer decides. hi-key is never called in cloud mode. A provider or a report that throws is caught and named in problem: the shell thread at a tool change and the play path call this, where a failure of the cloud client is a shape without a convex, never a faulted machining step.

public static InitStickConvex TryCreate(IGetGeneralApt src, out string problem)

Parameters

src IGetGeneralApt

The source object that provides general APT information.

problem string

Why there is no stick convex: the provider's reason, or core's refusal in words (-11 “the licence server uses a newer shape format; update HiNC”, -6 “the cached shape belonged to another device”, -10 “cache key mismatch”, any other code "shape token rejected (code N)"); null when an instance is returned.

Returns

InitStickConvex

A share the caller owns, or null

TryShare()

Another share of the same native object, which its holder gives back with Dispose(); null when this share was already given back (or the native object is gone). Internal Use Only: the share AptProfile.GetInitStickConvex hands a consumer is minted here off the profile's own share.

public InitStickConvex TryShare()

Returns

InitStickConvex