Skip to content

Generate a C# enum for every enum the catalog carries - #19

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:gen/catalog-enums
Sep 2, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:gen/catalog-enums

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

MEOS states thirteen enums beside the error codes — interpType, MeosType,
tempSubtype, IndexSearchOp, SPTreeKind, MeosOper, spatialRel,
SkipListType, nullHandleType, MeosPixType, COMPRESSIONS, ENDIANS,
PC_FILTERTYPE — and the catalog carries each with its members and their
values. objectgen.py projects them into MEOS.NET/Enums/, one file each, so
a caller names a MEOS constant where the C API takes an int and the values
come from MEOS rather than from a transcription.

The names are the ones MEOS gives: the type is its catalog name with an
upper-case first letter (interpType reads InterpType, MeosType and
ENDIANS stand), and a member is its constant PascalCased (INTERP_NONE
reads InterpNone, T_TFLOAT reads TTfloat). The generator refuses an enum
whose members would collide into one C# name.

Four tests hold the values to MEOS itself: meostype_name,
interptype_name and tempsubtype_name name back what the member names, and
interptype_from_string reads a name back as its member. A value that drifted
from MEOS names something else, or nothing.

Two files in the library are written by hand, both of them the runtime
substrate: the MEOS session lifecycle, and the error check every wrapper makes
after a call. Everything else under MEOS.NET/ is a projection of the
catalog.

MEOS states thirteen enums beside the error codes — `interpType`, `MeosType`,
`tempSubtype`, `IndexSearchOp`, `SPTreeKind`, `MeosOper`, `spatialRel`,
`SkipListType`, `nullHandleType`, `MeosPixType`, `COMPRESSIONS`, `ENDIANS`,
`PC_FILTERTYPE` — and the catalog carries each with its members and their
values. `objectgen.py` projects them into `MEOS.NET/Enums/`, one file each, so
a caller names a MEOS constant where the C API takes an int and the values
come from MEOS rather than from a transcription.

The names are the ones MEOS gives: the type is its catalog name with an
upper-case first letter (`interpType` reads `InterpType`, `MeosType` and
`ENDIANS` stand), and a member is its constant PascalCased (`INTERP_NONE`
reads `InterpNone`, `T_TFLOAT` reads `TTfloat`). The generator refuses an enum
whose members would collide into one C# name.

Four tests hold the values to MEOS itself: `meostype_name`,
`interptype_name` and `tempsubtype_name` name back what the member names, and
`interptype_from_string` reads a name back as its member. A value that drifted
from MEOS names something else, or nothing.

Two files in the library are written by hand, both of them the runtime
substrate: the MEOS session lifecycle, and the error check every wrapper makes
after a call. Everything else under `MEOS.NET/` is a projection of the
catalog.
@estebanzimanyi
estebanzimanyi merged commit 92221cd into MobilityDB:main Sep 2, 2026
1 check passed
@estebanzimanyi
estebanzimanyi deleted the gen/catalog-enums branch September 2, 2026 20:53
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