Struct DetectionContext

Namespace
Kuestenlogik.Bowire.Semantics.Detectors
Assembly
Kuestenlogik.Bowire.dll

Addressing context handed to every IBowireFieldDetector invocation: identifies which (service, method, message-type) triple this frame belongs to and carries the decoded JSON payload rooted at the frame body.

public readonly struct DetectionContext : IEquatable<DetectionContext>
Implements
Inherited Members

Remarks

readonly record struct by design — value-equality is unused but the by-value semantics keep the type cheap to construct on the hot path. JsonElement is itself a struct that carries a reference to the shared JsonDocument arena, so passing the whole context by in avoids copying anything beyond a handful of references.

In Phase 2 the stream hook fills MessageType with Wildcard because plugin-side discriminator wiring isn't in place yet. Phase 3 + later phases will plumb the real discriminator value through.

Constructors

DetectionContext(string, string, string, JsonElement)

Addressing context handed to every IBowireFieldDetector invocation: identifies which (service, method, message-type) triple this frame belongs to and carries the decoded JSON payload rooted at the frame body.

public DetectionContext(string ServiceId, string MethodId, string MessageType, JsonElement Frame)

Parameters

ServiceId string

Plugin-defined service identifier — same shape as ServiceId.

MethodId string

Plugin-defined method identifier within ServiceId.

MessageType string

Discriminator value, or Wildcard for single-type methods.

Frame JsonElement

Decoded JSON payload rooted at the frame body. Detectors receive the whole tree so paired-field rules (lat+lon at the same parent) can match naturally.

Remarks

readonly record struct by design — value-equality is unused but the by-value semantics keep the type cheap to construct on the hot path. JsonElement is itself a struct that carries a reference to the shared JsonDocument arena, so passing the whole context by in avoids copying anything beyond a handful of references.

In Phase 2 the stream hook fills MessageType with Wildcard because plugin-side discriminator wiring isn't in place yet. Phase 3 + later phases will plumb the real discriminator value through.

Properties

Frame

Decoded JSON payload rooted at the frame body. Detectors receive the whole tree so paired-field rules (lat+lon at the same parent) can match naturally.

public JsonElement Frame { get; init; }

Property Value

JsonElement

MessageType

Discriminator value, or Wildcard for single-type methods.

public string MessageType { get; init; }

Property Value

string

MethodId

Plugin-defined method identifier within ServiceId.

public string MethodId { get; init; }

Property Value

string

ServiceId

Plugin-defined service identifier — same shape as ServiceId.

public string ServiceId { get; init; }

Property Value

string

Methods

Deconstruct(out string, out string, out string, out JsonElement)

public void Deconstruct(out string ServiceId, out string MethodId, out string MessageType, out JsonElement Frame)

Parameters

ServiceId string
MethodId string
MessageType string
Frame JsonElement

Equals(DetectionContext)

public bool Equals(DetectionContext other)

Parameters

other DetectionContext

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(DetectionContext, DetectionContext)

public static bool operator ==(DetectionContext left, DetectionContext right)

Parameters

left DetectionContext
right DetectionContext

Returns

bool

operator !=(DetectionContext, DetectionContext)

public static bool operator !=(DetectionContext left, DetectionContext right)

Parameters

left DetectionContext
right DetectionContext

Returns

bool