Skip to content

Carry a MEOS byte buffer and its length as one array - #30

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/byte-buffers-as-arrays
Sep 3, 2026
Merged

Carry a MEOS byte buffer and its length as one array#30
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/byte-buffers-as-arrays

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

MEOS states the length of a buffer it answers through a pointer the caller
supplies, and reads one back as a pointer and a length beside it. To a C#
caller both are one array: AsWKB answers a byte[] of the length MEOS wrote,
FromWKB takes a byte[] and hands MEOS its address and its own length, and
the length out-parameter leaves the signature — every size_t * in the surface
is one of these 28, and nothing else asks for one.

The hex form needs no length either, the string ending where MEOS ends it, so
its buffer is written and dropped. That is why AsHEXWKB takes only the variant
it is given.

The length beside an array argument is spelled count for an array of values
and size for a byte buffer, and both say the same thing, so the counted-array
convention reads either. A scalar element needs no gathering: what is pinned
across the call is the caller's own array. 61 methods reach the object layer
that way — 1232 against 1171, 63 deferred against 105.

Three tests round-trip the forms: a span through its own WKB, a temporal float
through its own, and a span through the hex form, each read back to the value
it started as.

MEOS states the length of a buffer it answers through a pointer the caller
supplies, and reads one back as a pointer and a length beside it. To a C#
caller both are one array: `AsWKB` answers a `byte[]` of the length MEOS wrote,
`FromWKB` takes a `byte[]` and hands MEOS its address and its own length, and
the length out-parameter leaves the signature — every `size_t *` in the surface
is one of these 28, and nothing else asks for one.

The hex form needs no length either, the string ending where MEOS ends it, so
its buffer is written and dropped. That is why `AsHEXWKB` takes only the variant
it is given.

The length beside an array argument is spelled `count` for an array of values
and `size` for a byte buffer, and both say the same thing, so the counted-array
convention reads either. A scalar element needs no gathering: what is pinned
across the call is the caller's own array. 61 methods reach the object layer
that way — 1232 against 1171, 63 deferred against 105.

Three tests round-trip the forms: a span through its own WKB, a temporal float
through its own, and a span through the hex form, each read back to the value
it started as.
@estebanzimanyi
estebanzimanyi merged commit 71ef2dd into MobilityDB:main Sep 3, 2026
1 check passed
@estebanzimanyi
estebanzimanyi deleted the feat/byte-buffers-as-arrays branch September 3, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant