Skip to content

Hold a grid cell MEOS passes by value in a class of its own - #64

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:objectgen/cell-value-classes
Nov 12, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:objectgen/cell-value-classes

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

The function and object layers are generated from the MEOS-API catalog
of MobilityDB c5174b8af1, whose object model gives H3Index, Quadbin and
S2Cell a class marked byValue (MEOS-API #273), with cType the typedef
MEOS passes the cell as (H3Index, Quadbin, S2CellId, each a uint64_t).
The tree also carries what MobilityDB master changed since 78ebe3b7fe,
the commit it was generated from, in 37 files.

tools/objectgen.py reads byValue and cType from the catalog and nothing
else. Such a class is a readonly record struct holding the scalar of its
cType, equal where the scalars are equal, with explicit conversions from
and to that scalar (#value_head, beside #held_struct_file, which declares
a struct of values a record struct). Model.class_for_value answers the
class for any slot whose typedef is that cType, as class_for_ctype
answers it for a pointer, and the class stays out of wrap_root and of the
hierarchy its model parent heads, since a C# value type has no base
class. A method of the class receives the value it holds; every
parameter, return, out-parameter (#value_out_reader, beside
#wrapped_out_reader), counted array and answered array the catalog types
with the cType is the class: TH3Index.StartValue answers an H3Index,
Geo.ToQuadbinCell a Quadbin, TGeomPoint.S2cellSplit an S2Cell[]. The
portable readers and writers come from the catalog's typeEncodings as
for every other class, so each cell has AsText, FromText, AsWKB,
FromWKB, AsHexWKB and FromHexWKB, and ToString is its text.

PortableIoTests reads and writes the three cells through each format,
and OutParameterTests and CatalogValueTypeTests read the cells a
temporal cell, a cell set and a geometry answer as their classes.

Why: the catalog names the cells as classes, and the layer projected
them as pointer handles no call ever made, with every member static over
a ulong, no AsText and no ToString, and a WrapH3Index, WrapQuadbin and
WrapS2Cell in MEOSFactory reading a pointer MEOS never answers.

Witness: over the catalog with the cell classes the generators before
and after the change emit 155 classes each, and 5259 and 5262 methods,
the three more being the cells' AsText; the 24 files they differ in
differ in the cell classes, in the cells taken and answered elsewhere and
in the three removed MEOSFactory wrappers alone, and the gap ledger is
the same. Over the catalog without them the two generators write the
same tree, and the changed generator run twice writes the same tree.
dotnet build reports 0 warnings and 0 errors, and dotnet test passes 103
of 103, none skipped, against libmeos built from MobilityDB c5174b8af1,
the floor CI holds the count to being 103;
Quadbin 48427fffffffffff writes 01470000FFFFFFFFFF7F4248 as hex WKB,
S2Cell 47c3c444c writes 01550000000000C044C4C347, and H3Index
8a2a1072b59ffff reads back from each format as itself.

The function and object layers are generated from the MEOS-API catalog
of MobilityDB c5174b8af1, whose object model gives H3Index, Quadbin and
S2Cell a class marked byValue (MEOS-API #273), with cType the typedef
MEOS passes the cell as (H3Index, Quadbin, S2CellId, each a uint64_t).
The tree also carries what MobilityDB master changed since 78ebe3b7fe,
the commit it was generated from, in 37 files.

tools/objectgen.py reads byValue and cType from the catalog and nothing
else. Such a class is a readonly record struct holding the scalar of its
cType, equal where the scalars are equal, with explicit conversions from
and to that scalar (#value_head, beside #held_struct_file, which declares
a struct of values a record struct). Model.class_for_value answers the
class for any slot whose typedef is that cType, as class_for_ctype
answers it for a pointer, and the class stays out of wrap_root and of the
hierarchy its model parent heads, since a C# value type has no base
class. A method of the class receives the value it holds; every
parameter, return, out-parameter (#value_out_reader, beside
#wrapped_out_reader), counted array and answered array the catalog types
with the cType is the class: TH3Index.StartValue answers an H3Index,
Geo.ToQuadbinCell a Quadbin, TGeomPoint.S2cellSplit an S2Cell[]. The
portable readers and writers come from the catalog's typeEncodings as
for every other class, so each cell has AsText, FromText, AsWKB,
FromWKB, AsHexWKB and FromHexWKB, and ToString is its text.

PortableIoTests reads and writes the three cells through each format,
and OutParameterTests and CatalogValueTypeTests read the cells a
temporal cell, a cell set and a geometry answer as their classes.

Why: the catalog names the cells as classes, and the layer projected
them as pointer handles no call ever made, with every member static over
a ulong, no AsText and no ToString, and a WrapH3Index, WrapQuadbin and
WrapS2Cell in MEOSFactory reading a pointer MEOS never answers.

Witness: over the catalog with the cell classes the generators before
and after the change emit 155 classes each, and 5259 and 5262 methods,
the three more being the cells' AsText; the 24 files they differ in
differ in the cell classes, in the cells taken and answered elsewhere and
in the three removed MEOSFactory wrappers alone, and the gap ledger is
the same. Over the catalog without them the two generators write the
same tree, and the changed generator run twice writes the same tree.
dotnet build reports 0 warnings and 0 errors, and dotnet test passes 103
of 103, none skipped, against libmeos built from MobilityDB c5174b8af1,
the floor CI holds the count to being 103;
Quadbin 48427fffffffffff writes 01470000FFFFFFFFFF7F4248 as hex WKB,
S2Cell 47c3c444c writes 01550000000000C044C4C347, and H3Index
8a2a1072b59ffff reads back from each format as itself.
@estebanzimanyi
estebanzimanyi merged commit 5386271 into MobilityDB:main Nov 12, 2026
1 check passed
@estebanzimanyi
estebanzimanyi deleted the objectgen/cell-value-classes branch November 12, 2026 16:37
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