From 5a785ae6c9e1f4365f785a2413b6850e23aae748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Zim=C3=A1nyi?= Date: Wed, 2 Sep 2026 21:52:18 +0200 Subject: [PATCH 1/2] Read a borrowed const char * return without freeing it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Utf8 string marshaller frees the pointer a `char *` return hands back. That is right for a string MEOS mallocs for the caller and fatal for the `const char *` it returns out of a static table: `temporal_interp` answers with an element of `MEOS_INTERPTYPE_NAMES`, and freeing that ends the process — `Test host process crashed : free(): invalid pointer`. The eleven functions whose return is `const char *` — `temporal_interp`, `temporal_subtype`, `temporal_basetype_name`, `meostype_name` and their kin — come back as the pointer itself and are read with `Marshal.PtrToStringUTF8`, which copies and frees nothing. Three tests read an interpolation name: off a linear sequence, off a discrete one, and off two temporal values in turn. They exercise the native library, so the test step takes the LD_LIBRARY_PATH of the prefix the provisioning built, as the smoke step does, and every test class opens a MEOS session of its own: MEOS keeps the timezone its text I/O goes through and the error handler per thread, and the test host runs a test on whichever thread it has free, so a session opened once for the assembly reaches the thread that opened it and no other. --- .github/workflows/ci.yml | 2 + MEOS.NET.Tests/BorrowedStringTests.cs | 39 ++++++++++++++++++++ MEOS.NET.Tests/MeosTest.cs | 21 +++++++++++ MEOS.NET.Tests/TemporalGeometryPointTests.cs | 21 ----------- MEOS.NET/Types/Temporal/Temporal.cs | 10 ++++- tools/codegen.py | 19 ++++++++++ 6 files changed, 90 insertions(+), 22 deletions(-) create mode 100644 MEOS.NET.Tests/BorrowedStringTests.cs create mode 100644 MEOS.NET.Tests/MeosTest.cs delete mode 100644 MEOS.NET.Tests/TemporalGeometryPointTests.cs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 272d669..97021ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,8 @@ jobs: - name: Run tests run: dotnet test MEOS.NET.sln -c Release --no-build + env: + LD_LIBRARY_PATH: ${{ steps.provision.outputs.libmeos-prefix }}/lib - name: Smoke-test the FFI run: dotnet run --project ExampleApp/ExampleApp.csproj -c Release --no-build diff --git a/MEOS.NET.Tests/BorrowedStringTests.cs b/MEOS.NET.Tests/BorrowedStringTests.cs new file mode 100644 index 0000000..edc77ee --- /dev/null +++ b/MEOS.NET.Tests/BorrowedStringTests.cs @@ -0,0 +1,39 @@ +using MEOS.NET.Enums; +using MEOS.NET.Types.Temporal.Number.Float; + +namespace MEOS.NET.Tests +{ + /// + /// The MEOS functions that answer with a `const char *` hand back a pointer + /// into a static table, so the caller reads it and does not free it. Freeing + /// it takes the process down, which is what these read. + /// + [TestClass] + public class BorrowedStringTests : MeosTest + { + [TestMethod] + public void InterpolationOfALinearSequenceIsRead() + { + TemporalFloat temp = TemporalFloat.FromString("[25.0@2024-12-06, 27.0@2024-12-07]"); + + Assert.AreEqual(InterpolationType.Linear, temp.Interpolation()); + } + + [TestMethod] + public void InterpolationOfADiscreteSequenceIsRead() + { + TemporalFloat temp = TemporalFloat.FromString("{25.0@2024-12-06, 27.0@2024-12-07}"); + + Assert.AreEqual(InterpolationType.Discrete, temp.Interpolation()); + } + + [TestMethod] + public void TheSameBorrowedNameIsReadableTwice() + { + TemporalFloat first = TemporalFloat.FromString("[25.0@2024-12-06, 27.0@2024-12-07]"); + TemporalFloat second = TemporalFloat.FromString("[1.0@2024-12-06, 2.0@2024-12-07]"); + + Assert.AreEqual(first.Interpolation(), second.Interpolation()); + } + } +} diff --git a/MEOS.NET.Tests/MeosTest.cs b/MEOS.NET.Tests/MeosTest.cs new file mode 100644 index 0000000..5b25245 --- /dev/null +++ b/MEOS.NET.Tests/MeosTest.cs @@ -0,0 +1,21 @@ +using MEOS.NET.Lifecycle; + +namespace MEOS.NET.Tests +{ + /// + /// The base every test class derives from, so each test runs against an open + /// MEOS session. + /// + /// MEOS keeps its session state — the timezone its text I/O reads and writes + /// through, and the error handler — per thread, and the test host runs a test + /// on whichever thread it has free. A session opened once for the assembly + /// therefore reaches the thread that opened it and no other: elsewhere a + /// timestamp is read in the machine's own timezone rather than the suite's, + /// and an error raised there reaches no handler at all. + /// + public abstract class MeosTest + { + [TestInitialize] + public void OpenMeosSession() => MEOSLifecycle.Initialize("UTC"); + } +} diff --git a/MEOS.NET.Tests/TemporalGeometryPointTests.cs b/MEOS.NET.Tests/TemporalGeometryPointTests.cs deleted file mode 100644 index a9bedc2..0000000 --- a/MEOS.NET.Tests/TemporalGeometryPointTests.cs +++ /dev/null @@ -1,21 +0,0 @@ -using MEOS.NET.Lifecycle; -using MEOS.NET.Types.General; - -namespace MEOS.NET.Tests -{ - [TestClass] - public class TemporalGeometryPointTests - { - [ClassInitialize] - public static void InitializeTests(TestContext context) - { - MEOSLifecycle.Initialize("UTC"); - } - - [ClassCleanup] - public static void ClassCleanup() - { - MEOSLifecycle.Terminate(); - } - } -} \ No newline at end of file diff --git a/MEOS.NET/Types/Temporal/Temporal.cs b/MEOS.NET/Types/Temporal/Temporal.cs index 99ca69c..3925903 100644 --- a/MEOS.NET/Types/Temporal/Temporal.cs +++ b/MEOS.NET/Types/Temporal/Temporal.cs @@ -1,4 +1,6 @@ using MEOS.NET.Enums; +using MEOS.NET.Errors; +using MEOS.NET.Exceptions; using MEOS.NET.Helpers; using MEOS.NET.Internal; using MEOS.NET.Types.General; @@ -123,7 +125,13 @@ public TimestampTzSpan BoundingBox() public InterpolationType Interpolation() { - var interpolationStr = MEOSExposedFunctions.temporal_interp(this._ptr); + // temporal_interp names one of the interpolations MEOS defines, out of + // its own static table, so the name is there for every temporal value. + var interpolationStr = MEOSExposedFunctions.temporal_interp(this._ptr) + ?? throw new MEOSUnspecifiedInternalException( + (int)MEOSErrorCodes.UnspecifiedInternalError, + MEOSErrorCodes.UnspecifiedInternalError, + "MEOS named no interpolation for this temporal value"); return EnumConverter.InterpolationTypeFromString(interpolationStr); } diff --git a/tools/codegen.py b/tools/codegen.py index a6755c1..a4cadf2 100755 --- a/tools/codegen.py +++ b/tools/codegen.py @@ -133,6 +133,17 @@ def is_string_pointer(c_type: str) -> bool: return t in ("char *", "char**", "char *const *", "const char *") +def is_borrowed_string(c_type: str) -> bool: + """A ``const char *`` return the caller does not own. + + The Utf8 string marshaller frees what it is handed back, which is right for + the ``char *`` MEOS mallocs for the caller and fatal for the ``const char *`` + it returns out of a static table — ``interptype_name`` hands back an element + of ``MEOS_INTERPTYPE_NAMES``. A borrowed return comes back as the pointer + itself and is read without a free.""" + return " ".join(c_type.split()).startswith("const char *") + + def csharp_type_for(canonical: str) -> str: """Translate a libclang-canonical C type to a C# type for LibraryImport signatures.""" t = canonical.strip() @@ -155,6 +166,8 @@ def csharp_param_type(c_type: str, canonical: str) -> str: def csharp_return_type(c_type: str, canonical: str) -> str: + if is_borrowed_string(c_type): + return "IntPtr" if is_string_pointer(c_type): return "string" return csharp_type_for(canonical) @@ -472,6 +485,12 @@ def _copy(indent: str) -> list[str]: def _emit_simple_passthrough(f: dict, ext_params: str, ext_args: str, default_rt: str | None = None) -> list[str]: name = f["name"] rt = default_rt or csharp_return_type(f["returnType"]["c"], f["returnType"]["canonical"]) + if default_rt is None and is_borrowed_string(f["returnType"]["c"]): + return [ + f" public static string? {name}({ext_params})", + f" => Marshal.PtrToStringUTF8(" + f"SafeExecution(() => MEOSExternalFunctions.{name}({ext_args})));", + ] if rt == "void": return [ f" public static void {name}({ext_params})", From a6c8d819e824b46c3c65ca9ffaad8ffcd6696db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Zim=C3=A1nyi?= Date: Wed, 2 Sep 2026 22:02:04 +0200 Subject: [PATCH 2/2] Generate the object layer from the catalog's object model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The catalog's `objectModel` is the ecosystem-wide source of truth for the class hierarchy implicit in MEOS: `lattice` carries the temporal tree, `companions` the Box and Collection hierarchies, and `classes..methods` assigns every public MEOS function to the class it is a method of, with its canonical camelCase name. `objectgen.py` projects that model onto C# — 93 classes and 578 methods over the current catalog, one file per class under `MEOS.NET/Types/Generated/` — so the object layer is derived rather than curated, and a family MEOS adds arrives with the next catalog refresh. Inheritance follows the model's own parent edges. A concrete class is the product leaf x subtype — `TFloatSeq`, `TGeomPointInst` — and inherits its leaf, which carries by far the larger surface. Every method delegates to the `MEOSExposedFunctions` wrapper of the function the model assigns it and reads that wrapper's signature from `codegen.py`, so the two generators cannot disagree about a folded out-parameter. A returned MEOS pointer goes through `MEOSFactory`, which reads the discriminator the catalog's own struct layout puts in the value's header — `Temporal.temptype` and `Temporal.subtype`, `Set.settype`, `Span.spantype`, `SpanSet.spansettype` — and hands back the exact class, so `TFloat.In` over an instant answers a `TFloatInst` and over a sequence a `TFloatSeq`. Every temporal struct begins with the Temporal header, so a `TInstant *` or `TSequence *` return is a `Temporal` at the surface whose runtime class is the concrete one; modelling those as classes of their own would spend a concrete class's one base on the template axis instead of its family. The 314 methods the layer does not emit are named with their reason by `--report`, which CI runs: a `GSERIALIZED *` geometry, an `Interval *`, a `Pose *`, a counted array argument, a scalar out-parameter. `T *values, int count` is MEOS's counted-array convention, so wrapping that pointer as one object would hand the callee a single element and a length that lies; those are left to the raw binding, which carries every function either way. Twelve tests read the surface against the library the provisioning builds: the class a text form answers, the instants a sequence holds, the moment a timestamp names, the value extent of a temporal float, the spans a float span set holds and their text, the time domain of a sequence, and the error a malformed text raises. --- .github/workflows/ci.yml | 5 +- MEOS.NET.Tests/GeneratedObjectLayerTests.cs | 140 ++++ MEOS.NET/Types/Generated/BigIntSet.g.cs | 33 + MEOS.NET/Types/Generated/BigIntSpan.g.cs | 45 ++ MEOS.NET/Types/Generated/BigIntSpanSet.g.cs | 33 + MEOS.NET/Types/Generated/Box.g.cs | 15 + MEOS.NET/Types/Generated/CbufferSet.g.cs | 21 + MEOS.NET/Types/Generated/Collection.g.cs | 15 + MEOS.NET/Types/Generated/DateSet.g.cs | 36 + MEOS.NET/Types/Generated/DateSpan.g.cs | 36 + MEOS.NET/Types/Generated/DateSpanSet.g.cs | 45 ++ MEOS.NET/Types/Generated/FloatSet.g.cs | 48 ++ MEOS.NET/Types/Generated/FloatSpan.g.cs | 60 ++ MEOS.NET/Types/Generated/FloatSpanSet.g.cs | 51 ++ MEOS.NET/Types/Generated/GeogSet.g.cs | 18 + MEOS.NET/Types/Generated/GeomSet.g.cs | 18 + MEOS.NET/Types/Generated/IntSet.g.cs | 36 + MEOS.NET/Types/Generated/IntSpan.g.cs | 45 ++ MEOS.NET/Types/Generated/IntSpanSet.g.cs | 36 + MEOS.NET/Types/Generated/MEOSConvert.g.cs | 35 + MEOS.NET/Types/Generated/MEOSFactory.g.cs | 365 ++++++++++ MEOS.NET/Types/Generated/MEOSObject.g.cs | 16 + MEOS.NET/Types/Generated/NpointSet.g.cs | 24 + MEOS.NET/Types/Generated/PoseSet.g.cs | 21 + MEOS.NET/Types/Generated/STBox.g.cs | 105 +++ MEOS.NET/Types/Generated/Set.g.cs | 63 ++ MEOS.NET/Types/Generated/Span.g.cs | 60 ++ MEOS.NET/Types/Generated/SpanSet.g.cs | 75 +++ MEOS.NET/Types/Generated/TAlpha.g.cs | 15 + MEOS.NET/Types/Generated/TBigint.g.cs | 63 ++ MEOS.NET/Types/Generated/TBigintInst.g.cs | 18 + MEOS.NET/Types/Generated/TBigintSeq.g.cs | 21 + MEOS.NET/Types/Generated/TBigintSeqSet.g.cs | 18 + MEOS.NET/Types/Generated/TBool.g.cs | 45 ++ MEOS.NET/Types/Generated/TBoolInst.g.cs | 18 + MEOS.NET/Types/Generated/TBoolSeq.g.cs | 21 + MEOS.NET/Types/Generated/TBoolSeqSet.g.cs | 18 + MEOS.NET/Types/Generated/TBox.g.cs | 78 +++ MEOS.NET/Types/Generated/TCbuffer.g.cs | 45 ++ MEOS.NET/Types/Generated/TCbufferInst.g.cs | 15 + MEOS.NET/Types/Generated/TCbufferSeq.g.cs | 15 + MEOS.NET/Types/Generated/TCbufferSeqSet.g.cs | 15 + MEOS.NET/Types/Generated/TFloat.g.cs | 93 +++ MEOS.NET/Types/Generated/TFloatInst.g.cs | 18 + MEOS.NET/Types/Generated/TFloatSeq.g.cs | 21 + MEOS.NET/Types/Generated/TFloatSeqSet.g.cs | 18 + MEOS.NET/Types/Generated/TGeo.g.cs | 24 + MEOS.NET/Types/Generated/TGeogPoint.g.cs | 30 + MEOS.NET/Types/Generated/TGeogPointInst.g.cs | 15 + MEOS.NET/Types/Generated/TGeogPointSeq.g.cs | 15 + .../Types/Generated/TGeogPointSeqSet.g.cs | 15 + MEOS.NET/Types/Generated/TGeography.g.cs | 27 + MEOS.NET/Types/Generated/TGeographyInst.g.cs | 15 + MEOS.NET/Types/Generated/TGeographySeq.g.cs | 15 + .../Types/Generated/TGeographySeqSet.g.cs | 15 + MEOS.NET/Types/Generated/TGeomPoint.g.cs | 30 + MEOS.NET/Types/Generated/TGeomPointInst.g.cs | 15 + MEOS.NET/Types/Generated/TGeomPointSeq.g.cs | 15 + .../Types/Generated/TGeomPointSeqSet.g.cs | 15 + MEOS.NET/Types/Generated/TGeometry.g.cs | 30 + MEOS.NET/Types/Generated/TGeometryInst.g.cs | 15 + MEOS.NET/Types/Generated/TGeometrySeq.g.cs | 15 + MEOS.NET/Types/Generated/TGeometrySeqSet.g.cs | 15 + MEOS.NET/Types/Generated/TInstant.g.cs | 15 + MEOS.NET/Types/Generated/TInt.g.cs | 63 ++ MEOS.NET/Types/Generated/TIntInst.g.cs | 18 + MEOS.NET/Types/Generated/TIntSeq.g.cs | 21 + MEOS.NET/Types/Generated/TIntSeqSet.g.cs | 18 + MEOS.NET/Types/Generated/TJsonb.g.cs | 39 ++ MEOS.NET/Types/Generated/TJsonbInst.g.cs | 15 + MEOS.NET/Types/Generated/TJsonbSeq.g.cs | 15 + MEOS.NET/Types/Generated/TJsonbSeqSet.g.cs | 15 + MEOS.NET/Types/Generated/TNpoint.g.cs | 54 ++ MEOS.NET/Types/Generated/TNpointInst.g.cs | 15 + MEOS.NET/Types/Generated/TNpointSeq.g.cs | 15 + MEOS.NET/Types/Generated/TNpointSeqSet.g.cs | 15 + MEOS.NET/Types/Generated/TNumber.g.cs | 60 ++ MEOS.NET/Types/Generated/TPoint.g.cs | 51 ++ MEOS.NET/Types/Generated/TPose.g.cs | 75 +++ MEOS.NET/Types/Generated/TPoseInst.g.cs | 15 + MEOS.NET/Types/Generated/TPoseSeq.g.cs | 15 + MEOS.NET/Types/Generated/TPoseSeqSet.g.cs | 15 + MEOS.NET/Types/Generated/TRGeometry.g.cs | 183 +++++ MEOS.NET/Types/Generated/TRGeometryInst.g.cs | 15 + MEOS.NET/Types/Generated/TRGeometrySeq.g.cs | 15 + .../Types/Generated/TRGeometrySeqSet.g.cs | 15 + MEOS.NET/Types/Generated/TSequence.g.cs | 15 + MEOS.NET/Types/Generated/TSequenceSet.g.cs | 15 + MEOS.NET/Types/Generated/TSpatial.g.cs | 39 ++ MEOS.NET/Types/Generated/TText.g.cs | 36 + MEOS.NET/Types/Generated/TTextInst.g.cs | 15 + MEOS.NET/Types/Generated/TTextSeq.g.cs | 15 + MEOS.NET/Types/Generated/TTextSeqSet.g.cs | 15 + MEOS.NET/Types/Generated/Temporal.g.cs | 240 +++++++ MEOS.NET/Types/Generated/TextSet.g.cs | 30 + MEOS.NET/Types/Generated/TsTzSet.g.cs | 36 + MEOS.NET/Types/Generated/TsTzSpan.g.cs | 36 + MEOS.NET/Types/Generated/TsTzSpanSet.g.cs | 45 ++ tools/README.md | 36 +- tools/codegen.py | 22 + tools/objectgen.py | 632 ++++++++++++++++++ tools/refresh.conf | 1 + 102 files changed, 4378 insertions(+), 3 deletions(-) create mode 100644 MEOS.NET.Tests/GeneratedObjectLayerTests.cs create mode 100644 MEOS.NET/Types/Generated/BigIntSet.g.cs create mode 100644 MEOS.NET/Types/Generated/BigIntSpan.g.cs create mode 100644 MEOS.NET/Types/Generated/BigIntSpanSet.g.cs create mode 100644 MEOS.NET/Types/Generated/Box.g.cs create mode 100644 MEOS.NET/Types/Generated/CbufferSet.g.cs create mode 100644 MEOS.NET/Types/Generated/Collection.g.cs create mode 100644 MEOS.NET/Types/Generated/DateSet.g.cs create mode 100644 MEOS.NET/Types/Generated/DateSpan.g.cs create mode 100644 MEOS.NET/Types/Generated/DateSpanSet.g.cs create mode 100644 MEOS.NET/Types/Generated/FloatSet.g.cs create mode 100644 MEOS.NET/Types/Generated/FloatSpan.g.cs create mode 100644 MEOS.NET/Types/Generated/FloatSpanSet.g.cs create mode 100644 MEOS.NET/Types/Generated/GeogSet.g.cs create mode 100644 MEOS.NET/Types/Generated/GeomSet.g.cs create mode 100644 MEOS.NET/Types/Generated/IntSet.g.cs create mode 100644 MEOS.NET/Types/Generated/IntSpan.g.cs create mode 100644 MEOS.NET/Types/Generated/IntSpanSet.g.cs create mode 100644 MEOS.NET/Types/Generated/MEOSConvert.g.cs create mode 100644 MEOS.NET/Types/Generated/MEOSFactory.g.cs create mode 100644 MEOS.NET/Types/Generated/MEOSObject.g.cs create mode 100644 MEOS.NET/Types/Generated/NpointSet.g.cs create mode 100644 MEOS.NET/Types/Generated/PoseSet.g.cs create mode 100644 MEOS.NET/Types/Generated/STBox.g.cs create mode 100644 MEOS.NET/Types/Generated/Set.g.cs create mode 100644 MEOS.NET/Types/Generated/Span.g.cs create mode 100644 MEOS.NET/Types/Generated/SpanSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TAlpha.g.cs create mode 100644 MEOS.NET/Types/Generated/TBigint.g.cs create mode 100644 MEOS.NET/Types/Generated/TBigintInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TBigintSeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TBigintSeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TBool.g.cs create mode 100644 MEOS.NET/Types/Generated/TBoolInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TBoolSeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TBoolSeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TBox.g.cs create mode 100644 MEOS.NET/Types/Generated/TCbuffer.g.cs create mode 100644 MEOS.NET/Types/Generated/TCbufferInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TCbufferSeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TCbufferSeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TFloat.g.cs create mode 100644 MEOS.NET/Types/Generated/TFloatInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TFloatSeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TFloatSeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeo.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeogPoint.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeogPointInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeogPointSeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeogPointSeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeography.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeographyInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeographySeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeographySeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeomPoint.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeomPointInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeomPointSeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeomPointSeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeometry.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeometryInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeometrySeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TGeometrySeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TInstant.g.cs create mode 100644 MEOS.NET/Types/Generated/TInt.g.cs create mode 100644 MEOS.NET/Types/Generated/TIntInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TIntSeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TIntSeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TJsonb.g.cs create mode 100644 MEOS.NET/Types/Generated/TJsonbInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TJsonbSeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TJsonbSeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TNpoint.g.cs create mode 100644 MEOS.NET/Types/Generated/TNpointInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TNpointSeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TNpointSeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TNumber.g.cs create mode 100644 MEOS.NET/Types/Generated/TPoint.g.cs create mode 100644 MEOS.NET/Types/Generated/TPose.g.cs create mode 100644 MEOS.NET/Types/Generated/TPoseInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TPoseSeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TPoseSeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TRGeometry.g.cs create mode 100644 MEOS.NET/Types/Generated/TRGeometryInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TRGeometrySeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TRGeometrySeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TSequence.g.cs create mode 100644 MEOS.NET/Types/Generated/TSequenceSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TSpatial.g.cs create mode 100644 MEOS.NET/Types/Generated/TText.g.cs create mode 100644 MEOS.NET/Types/Generated/TTextInst.g.cs create mode 100644 MEOS.NET/Types/Generated/TTextSeq.g.cs create mode 100644 MEOS.NET/Types/Generated/TTextSeqSet.g.cs create mode 100644 MEOS.NET/Types/Generated/Temporal.g.cs create mode 100644 MEOS.NET/Types/Generated/TextSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TsTzSet.g.cs create mode 100644 MEOS.NET/Types/Generated/TsTzSpan.g.cs create mode 100644 MEOS.NET/Types/Generated/TsTzSpanSet.g.cs create mode 100644 tools/objectgen.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97021ad..bb9a30d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,8 +30,11 @@ jobs: - name: Regenerate bindings run: python3 tools/codegen.py "${{ steps.provision.outputs.catalog-path }}" + - name: Regenerate the object layer + run: python3 tools/objectgen.py "${{ steps.provision.outputs.catalog-path }}" --report + - name: Report binding drift - run: git --no-pager diff --stat -- MEOS.NET/Internal || true + run: git --no-pager diff --stat -- MEOS.NET/Internal MEOS.NET/Types/Generated || true - name: Build solution run: dotnet build MEOS.NET.sln -c Release diff --git a/MEOS.NET.Tests/GeneratedObjectLayerTests.cs b/MEOS.NET.Tests/GeneratedObjectLayerTests.cs new file mode 100644 index 0000000..ba75bac --- /dev/null +++ b/MEOS.NET.Tests/GeneratedObjectLayerTests.cs @@ -0,0 +1,140 @@ +using MEOS.NET.Exceptions; +using MEOS.NET.Types.Generated; + +namespace MEOS.NET.Tests +{ + /// + /// The object layer generated from the catalog's object model: that a MEOS + /// pointer arrives wrapped in the class its own header names, that the values + /// crossing the boundary are the values MEOS holds, and that a MEOS error + /// reaches the caller as an exception rather than a null. + /// + [TestClass] + public class GeneratedObjectLayerTests : MeosTest + { + private const string Instant = "25.0@2024-12-06"; + private const string Sequence = "[25.0@2024-12-06, 27.0@2024-12-07]"; + private const string SpanSetText = "{[8, 10], [11, 12]}"; + + [TestMethod] + public void InstantTextGivesTheConcreteInstantClass() + { + Temporal? temp = TFloat.In(Instant); + + Assert.IsInstanceOfType(temp, typeof(TFloatInst)); + } + + [TestMethod] + public void SequenceTextGivesTheConcreteSequenceClass() + { + Temporal? temp = TFloat.In(Sequence); + + Assert.IsInstanceOfType(temp, typeof(TFloatSeq)); + } + + [TestMethod] + public void SequenceHoldsItsTwoInstants() + { + Temporal temp = TFloat.In(Sequence)!; + + Assert.AreEqual(2, temp.NumInstants()); + Assert.AreEqual("Linear", temp.Interp()); + } + + [TestMethod] + public void StartTimestamptzIsTheMomentTheTextNames() + { + Temporal temp = TFloat.In(Sequence)!; + + Assert.AreEqual(new DateTime(2024, 12, 6, 0, 0, 0, DateTimeKind.Utc), + temp.StartTimestamptz().ToUniversalTime()); + } + + [TestMethod] + public void RestrictingToAnInstantGivesThatInstant() + { + Temporal temp = TFloat.In(Sequence)!; + DateTime start = temp.StartTimestamptz(); + + Temporal? at = temp.AtTimestamptz(start); + + Assert.IsInstanceOfType(at, typeof(TFloatInst)); + Assert.AreEqual(1, at!.NumInstants()); + } + + [TestMethod] + public void ValueSpanOfTheSequenceIsItsFloatExtent() + { + TNumber temp = (TNumber)TFloat.In(Sequence)!; + + Span span = temp.ToSpan()!; + + Assert.IsInstanceOfType(span, typeof(FloatSpan)); + Assert.AreEqual(25.0, ((FloatSpan)span).Lower()); + Assert.AreEqual(27.0, ((FloatSpan)span).Upper()); + } + + [TestMethod] + public void SpanSetTextGivesTheConcreteFloatSpanSet() + { + SpanSet? spanset = FloatSpanSet.In(SpanSetText); + + Assert.IsInstanceOfType(spanset, typeof(FloatSpanSet)); + Assert.AreEqual(2, spanset!.NumSpans()); + } + + [TestMethod] + public void EachSpanOfTheSetIsTheSpanTheTextNames() + { + SpanSet spanset = FloatSpanSet.In(SpanSetText)!; + + Span?[] spans = spanset.Spanarr(); + + Assert.AreEqual(2, spans.Length); + Assert.AreEqual(8.0, ((FloatSpan)spans[0]!).Lower()); + Assert.AreEqual(10.0, ((FloatSpan)spans[0]!).Upper()); + Assert.AreEqual(11.0, ((FloatSpan)spans[1]!).Lower()); + Assert.AreEqual(12.0, ((FloatSpan)spans[1]!).Upper()); + } + + [TestMethod] + public void SpanTextIsWhatTheSpanHolds() + { + SpanSet spanset = FloatSpanSet.In(SpanSetText)!; + + Assert.AreEqual("[8, 10]", ((FloatSpan)spanset.StartSpan()!).Out(15)); + Assert.AreEqual("[11, 12]", ((FloatSpan)spanset.EndSpan()!).Out(15)); + } + + [TestMethod] + public void TimeDomainOfTheSequenceIsATstzSpanSet() + { + Temporal temp = TFloat.In(Sequence)!; + + SpanSet time = temp.Time()!; + + Assert.IsInstanceOfType(time, typeof(TsTzSpanSet)); + Assert.AreEqual(1, time.NumSpans()); + } + + [TestMethod] + public void MakingAnInstantFromAValueAndAMomentReadsBack() + { + DateTime moment = new DateTime(2024, 12, 6, 9, 30, 0, DateTimeKind.Utc); + + Temporal instant = TFloatInst.Make(25.0, moment)!; + + Assert.IsInstanceOfType(instant, typeof(TFloatInst)); + Assert.AreEqual(moment, instant.StartTimestamptz().ToUniversalTime()); + } + + [TestMethod] + public void MalformedTextRaisesTheMeosError() + { + MEOSException raised = Assert.ThrowsException( + () => TFloat.In("e" + Instant)); + + StringAssert.Contains(raised.Message, "e25.0"); + } + } +} diff --git a/MEOS.NET/Types/Generated/BigIntSet.g.cs b/MEOS.NET/Types/Generated/BigIntSet.g.cs new file mode 100644 index 0000000..5da6c84 --- /dev/null +++ b/MEOS.NET/Types/Generated/BigIntSet.g.cs @@ -0,0 +1,33 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The BigIntSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class BigIntSet : Set + { + internal BigIntSet(IntPtr ptr) : base(ptr) { } + + public long EndValue() + => MEOSExposedFunctions.bigintset_end_value(this.Ptr); + + public string Out() + => MEOSExposedFunctions.bigintset_out(this.Ptr); + + public Set? ShiftScale(long shift, long width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSet(MEOSExposedFunctions.bigintset_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public long StartValue() + => MEOSExposedFunctions.bigintset_start_value(this.Ptr); + + public long[] Values() + => MEOSExposedFunctions.bigintset_values(this.Ptr); + + public static Set? In(string str) + => MEOSFactory.WrapSet(MEOSExposedFunctions.bigintset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/BigIntSpan.g.cs b/MEOS.NET/Types/Generated/BigIntSpan.g.cs new file mode 100644 index 0000000..4bcc02e --- /dev/null +++ b/MEOS.NET/Types/Generated/BigIntSpan.g.cs @@ -0,0 +1,45 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The BigIntSpan class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class BigIntSpan : Span + { + internal BigIntSpan(IntPtr ptr) : base(ptr) { } + + public Span? Expand(long value) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.bigintspan_expand(this.Ptr, value)); + + public long Lower() + => MEOSExposedFunctions.bigintspan_lower(this.Ptr); + + public string Out() + => MEOSExposedFunctions.bigintspan_out(this.Ptr); + + public Span? ShiftScale(long shift, long width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.bigintspan_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public Span? ToFloatspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.bigintspan_to_floatspan(this.Ptr)); + + public Span? ToIntspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.bigintspan_to_intspan(this.Ptr)); + + public long Upper() + => MEOSExposedFunctions.bigintspan_upper(this.Ptr); + + public long Width() + => MEOSExposedFunctions.bigintspan_width(this.Ptr); + + public static Span? In(string str) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.bigintspan_in(str)); + + public static Span? Make(long lower, long upper, bool lower_inc, bool upper_inc) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.bigintspan_make(lower, upper, lower_inc, upper_inc)); + + } +} diff --git a/MEOS.NET/Types/Generated/BigIntSpanSet.g.cs b/MEOS.NET/Types/Generated/BigIntSpanSet.g.cs new file mode 100644 index 0000000..025e6c1 --- /dev/null +++ b/MEOS.NET/Types/Generated/BigIntSpanSet.g.cs @@ -0,0 +1,33 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The BigIntSpanSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class BigIntSpanSet : SpanSet + { + internal BigIntSpanSet(IntPtr ptr) : base(ptr) { } + + public long Lower() + => MEOSExposedFunctions.bigintspanset_lower(this.Ptr); + + public string Out() + => MEOSExposedFunctions.bigintspanset_out(this.Ptr); + + public SpanSet? ShiftScale(long shift, long width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.bigintspanset_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public long Upper() + => MEOSExposedFunctions.bigintspanset_upper(this.Ptr); + + public long Width(bool boundspan) + => MEOSExposedFunctions.bigintspanset_width(this.Ptr, boundspan); + + public static SpanSet? In(string str) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.bigintspanset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/Box.g.cs b/MEOS.NET/Types/Generated/Box.g.cs new file mode 100644 index 0000000..94f6ee2 --- /dev/null +++ b/MEOS.NET/Types/Generated/Box.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// Bounding-box family. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Box : MEOSObject + { + internal Box(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/CbufferSet.g.cs b/MEOS.NET/Types/Generated/CbufferSet.g.cs new file mode 100644 index 0000000..bdb21a5 --- /dev/null +++ b/MEOS.NET/Types/Generated/CbufferSet.g.cs @@ -0,0 +1,21 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The CbufferSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class CbufferSet : Set + { + internal CbufferSet(IntPtr ptr) : base(ptr) { } + + public string Out(int maxdd) + => MEOSExposedFunctions.cbufferset_out(this.Ptr, maxdd); + + public static Set? In(string str) + => MEOSFactory.WrapSet(MEOSExposedFunctions.cbufferset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/Collection.g.cs b/MEOS.NET/Types/Generated/Collection.g.cs new file mode 100644 index 0000000..016e44d --- /dev/null +++ b/MEOS.NET/Types/Generated/Collection.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The Collection class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Collection : MEOSObject + { + internal Collection(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/DateSet.g.cs b/MEOS.NET/Types/Generated/DateSet.g.cs new file mode 100644 index 0000000..531ecf6 --- /dev/null +++ b/MEOS.NET/Types/Generated/DateSet.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The DateSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class DateSet : Set + { + internal DateSet(IntPtr ptr) : base(ptr) { } + + public DateOnly EndValue() + => MEOSConvert.ToDateOnly(MEOSExposedFunctions.dateset_end_value(this.Ptr)); + + public string Out() + => MEOSExposedFunctions.dateset_out(this.Ptr); + + public Set? ShiftScale(int shift, int width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSet(MEOSExposedFunctions.dateset_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public DateOnly StartValue() + => MEOSConvert.ToDateOnly(MEOSExposedFunctions.dateset_start_value(this.Ptr)); + + public Set? ToTstzset() + => MEOSFactory.WrapSet(MEOSExposedFunctions.dateset_to_tstzset(this.Ptr)); + + public int[] Values() + => MEOSExposedFunctions.dateset_values(this.Ptr); + + public static Set? In(string str) + => MEOSFactory.WrapSet(MEOSExposedFunctions.dateset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/DateSpan.g.cs b/MEOS.NET/Types/Generated/DateSpan.g.cs new file mode 100644 index 0000000..e1452dc --- /dev/null +++ b/MEOS.NET/Types/Generated/DateSpan.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The DateSpan class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class DateSpan : Span + { + internal DateSpan(IntPtr ptr) : base(ptr) { } + + public DateOnly Lower() + => MEOSConvert.ToDateOnly(MEOSExposedFunctions.datespan_lower(this.Ptr)); + + public string Out() + => MEOSExposedFunctions.datespan_out(this.Ptr); + + public Span? ShiftScale(int shift, int width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.datespan_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public Span? ToTstzspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.datespan_to_tstzspan(this.Ptr)); + + public DateOnly Upper() + => MEOSConvert.ToDateOnly(MEOSExposedFunctions.datespan_upper(this.Ptr)); + + public static Span? In(string str) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.datespan_in(str)); + + public static Span? Make(DateOnly lower, DateOnly upper, bool lower_inc, bool upper_inc) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.datespan_make(MEOSConvert.ToDateADT(lower), MEOSConvert.ToDateADT(upper), lower_inc, upper_inc)); + + } +} diff --git a/MEOS.NET/Types/Generated/DateSpanSet.g.cs b/MEOS.NET/Types/Generated/DateSpanSet.g.cs new file mode 100644 index 0000000..6e5be3e --- /dev/null +++ b/MEOS.NET/Types/Generated/DateSpanSet.g.cs @@ -0,0 +1,45 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The DateSpanSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class DateSpanSet : SpanSet + { + internal DateSpanSet(IntPtr ptr) : base(ptr) { } + + public Set? Dates() + => MEOSFactory.WrapSet(MEOSExposedFunctions.datespanset_dates(this.Ptr)); + + public DateOnly EndDate() + => MEOSConvert.ToDateOnly(MEOSExposedFunctions.datespanset_end_date(this.Ptr)); + + public DateOnly Lower() + => MEOSConvert.ToDateOnly(MEOSExposedFunctions.datespanset_lower(this.Ptr)); + + public int NumDates() + => MEOSExposedFunctions.datespanset_num_dates(this.Ptr); + + public string Out() + => MEOSExposedFunctions.datespanset_out(this.Ptr); + + public SpanSet? ShiftScale(int shift, int width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.datespanset_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public DateOnly StartDate() + => MEOSConvert.ToDateOnly(MEOSExposedFunctions.datespanset_start_date(this.Ptr)); + + public SpanSet? ToTstzspanset() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.datespanset_to_tstzspanset(this.Ptr)); + + public DateOnly Upper() + => MEOSConvert.ToDateOnly(MEOSExposedFunctions.datespanset_upper(this.Ptr)); + + public static SpanSet? In(string str) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.datespanset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/FloatSet.g.cs b/MEOS.NET/Types/Generated/FloatSet.g.cs new file mode 100644 index 0000000..516a8f2 --- /dev/null +++ b/MEOS.NET/Types/Generated/FloatSet.g.cs @@ -0,0 +1,48 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The FloatSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class FloatSet : Set + { + internal FloatSet(IntPtr ptr) : base(ptr) { } + + public Set? Ceil() + => MEOSFactory.WrapSet(MEOSExposedFunctions.floatset_ceil(this.Ptr)); + + public Set? Degrees(bool normalize) + => MEOSFactory.WrapSet(MEOSExposedFunctions.floatset_degrees(this.Ptr, normalize)); + + public double EndValue() + => MEOSExposedFunctions.floatset_end_value(this.Ptr); + + public Set? Floor() + => MEOSFactory.WrapSet(MEOSExposedFunctions.floatset_floor(this.Ptr)); + + public string Out(int maxdd) + => MEOSExposedFunctions.floatset_out(this.Ptr, maxdd); + + public Set? Radians() + => MEOSFactory.WrapSet(MEOSExposedFunctions.floatset_radians(this.Ptr)); + + public Set? ShiftScale(double shift, double width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSet(MEOSExposedFunctions.floatset_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public double StartValue() + => MEOSExposedFunctions.floatset_start_value(this.Ptr); + + public Set? ToIntset() + => MEOSFactory.WrapSet(MEOSExposedFunctions.floatset_to_intset(this.Ptr)); + + public double[] Values() + => MEOSExposedFunctions.floatset_values(this.Ptr); + + public static Set? In(string str) + => MEOSFactory.WrapSet(MEOSExposedFunctions.floatset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/FloatSpan.g.cs b/MEOS.NET/Types/Generated/FloatSpan.g.cs new file mode 100644 index 0000000..baaaaa8 --- /dev/null +++ b/MEOS.NET/Types/Generated/FloatSpan.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The FloatSpan class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class FloatSpan : Span + { + internal FloatSpan(IntPtr ptr) : base(ptr) { } + + public Span? Ceil() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.floatspan_ceil(this.Ptr)); + + public Span? Degrees(bool normalize) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.floatspan_degrees(this.Ptr, normalize)); + + public Span? Expand(double value) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.floatspan_expand(this.Ptr, value)); + + public Span? Floor() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.floatspan_floor(this.Ptr)); + + public double Lower() + => MEOSExposedFunctions.floatspan_lower(this.Ptr); + + public string Out(int maxdd) + => MEOSExposedFunctions.floatspan_out(this.Ptr, maxdd); + + public Span? Radians() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.floatspan_radians(this.Ptr)); + + public Span? Round(int maxdd) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.floatspan_round(this.Ptr, maxdd)); + + public Span? ShiftScale(double shift, double width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.floatspan_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public Span? ToBigintspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.floatspan_to_bigintspan(this.Ptr)); + + public Span? ToIntspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.floatspan_to_intspan(this.Ptr)); + + public double Upper() + => MEOSExposedFunctions.floatspan_upper(this.Ptr); + + public double Width() + => MEOSExposedFunctions.floatspan_width(this.Ptr); + + public static Span? In(string str) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.floatspan_in(str)); + + public static Span? Make(double lower, double upper, bool lower_inc, bool upper_inc) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.floatspan_make(lower, upper, lower_inc, upper_inc)); + + } +} diff --git a/MEOS.NET/Types/Generated/FloatSpanSet.g.cs b/MEOS.NET/Types/Generated/FloatSpanSet.g.cs new file mode 100644 index 0000000..c137e16 --- /dev/null +++ b/MEOS.NET/Types/Generated/FloatSpanSet.g.cs @@ -0,0 +1,51 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The FloatSpanSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class FloatSpanSet : SpanSet + { + internal FloatSpanSet(IntPtr ptr) : base(ptr) { } + + public SpanSet? Ceil() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.floatspanset_ceil(this.Ptr)); + + public SpanSet? Degrees(bool normalize) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.floatspanset_degrees(this.Ptr, normalize)); + + public SpanSet? Floor() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.floatspanset_floor(this.Ptr)); + + public double Lower() + => MEOSExposedFunctions.floatspanset_lower(this.Ptr); + + public string Out(int maxdd) + => MEOSExposedFunctions.floatspanset_out(this.Ptr, maxdd); + + public SpanSet? Radians() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.floatspanset_radians(this.Ptr)); + + public SpanSet? Round(int maxdd) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.floatspanset_round(this.Ptr, maxdd)); + + public SpanSet? ShiftScale(double shift, double width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.floatspanset_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public SpanSet? ToIntspanset() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.floatspanset_to_intspanset(this.Ptr)); + + public double Upper() + => MEOSExposedFunctions.floatspanset_upper(this.Ptr); + + public double Width(bool boundspan) + => MEOSExposedFunctions.floatspanset_width(this.Ptr, boundspan); + + public static SpanSet? In(string str) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.floatspanset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/GeogSet.g.cs b/MEOS.NET/Types/Generated/GeogSet.g.cs new file mode 100644 index 0000000..e9a43ab --- /dev/null +++ b/MEOS.NET/Types/Generated/GeogSet.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The GeogSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class GeogSet : Set + { + internal GeogSet(IntPtr ptr) : base(ptr) { } + + public static Set? In(string str) + => MEOSFactory.WrapSet(MEOSExposedFunctions.geogset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/GeomSet.g.cs b/MEOS.NET/Types/Generated/GeomSet.g.cs new file mode 100644 index 0000000..b470b42 --- /dev/null +++ b/MEOS.NET/Types/Generated/GeomSet.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The GeomSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class GeomSet : Set + { + internal GeomSet(IntPtr ptr) : base(ptr) { } + + public static Set? In(string str) + => MEOSFactory.WrapSet(MEOSExposedFunctions.geomset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/IntSet.g.cs b/MEOS.NET/Types/Generated/IntSet.g.cs new file mode 100644 index 0000000..13bb36e --- /dev/null +++ b/MEOS.NET/Types/Generated/IntSet.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The IntSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class IntSet : Set + { + internal IntSet(IntPtr ptr) : base(ptr) { } + + public int EndValue() + => MEOSExposedFunctions.intset_end_value(this.Ptr); + + public string Out() + => MEOSExposedFunctions.intset_out(this.Ptr); + + public Set? ShiftScale(int shift, int width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSet(MEOSExposedFunctions.intset_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public int StartValue() + => MEOSExposedFunctions.intset_start_value(this.Ptr); + + public Set? ToFloatset() + => MEOSFactory.WrapSet(MEOSExposedFunctions.intset_to_floatset(this.Ptr)); + + public int[] Values() + => MEOSExposedFunctions.intset_values(this.Ptr); + + public static Set? In(string str) + => MEOSFactory.WrapSet(MEOSExposedFunctions.intset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/IntSpan.g.cs b/MEOS.NET/Types/Generated/IntSpan.g.cs new file mode 100644 index 0000000..19d01c4 --- /dev/null +++ b/MEOS.NET/Types/Generated/IntSpan.g.cs @@ -0,0 +1,45 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The IntSpan class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class IntSpan : Span + { + internal IntSpan(IntPtr ptr) : base(ptr) { } + + public Span? Expand(int value) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.intspan_expand(this.Ptr, value)); + + public int Lower() + => MEOSExposedFunctions.intspan_lower(this.Ptr); + + public string Out() + => MEOSExposedFunctions.intspan_out(this.Ptr); + + public Span? ShiftScale(int shift, int width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.intspan_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public Span? ToBigintspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.intspan_to_bigintspan(this.Ptr)); + + public Span? ToFloatspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.intspan_to_floatspan(this.Ptr)); + + public int Upper() + => MEOSExposedFunctions.intspan_upper(this.Ptr); + + public int Width() + => MEOSExposedFunctions.intspan_width(this.Ptr); + + public static Span? In(string str) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.intspan_in(str)); + + public static Span? Make(int lower, int upper, bool lower_inc, bool upper_inc) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.intspan_make(lower, upper, lower_inc, upper_inc)); + + } +} diff --git a/MEOS.NET/Types/Generated/IntSpanSet.g.cs b/MEOS.NET/Types/Generated/IntSpanSet.g.cs new file mode 100644 index 0000000..5471eac --- /dev/null +++ b/MEOS.NET/Types/Generated/IntSpanSet.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The IntSpanSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class IntSpanSet : SpanSet + { + internal IntSpanSet(IntPtr ptr) : base(ptr) { } + + public int Lower() + => MEOSExposedFunctions.intspanset_lower(this.Ptr); + + public string Out() + => MEOSExposedFunctions.intspanset_out(this.Ptr); + + public SpanSet? ShiftScale(int shift, int width, bool hasshift, bool haswidth) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.intspanset_shift_scale(this.Ptr, shift, width, hasshift, haswidth)); + + public SpanSet? ToFloatspanset() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.intspanset_to_floatspanset(this.Ptr)); + + public int Upper() + => MEOSExposedFunctions.intspanset_upper(this.Ptr); + + public int Width(bool boundspan) + => MEOSExposedFunctions.intspanset_width(this.Ptr, boundspan); + + public static SpanSet? In(string str) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.intspanset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/MEOSConvert.g.cs b/MEOS.NET/Types/Generated/MEOSConvert.g.cs new file mode 100644 index 0000000..0ecc2c9 --- /dev/null +++ b/MEOS.NET/Types/Generated/MEOSConvert.g.cs @@ -0,0 +1,35 @@ +#nullable enable + +using System.Globalization; + +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The MEOS scalar time types as .NET values, and back. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + internal static class MEOSConvert + { + /// A MEOS TimestampTz as a DateTime. + internal static DateTime ToDateTime(long timestamptz) + => DateTime.Parse(MEOSExposedFunctions.timestamptz_out(timestamptz), + CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal + | DateTimeStyles.AssumeUniversal); + + /// A DateTime as a MEOS TimestampTz. + internal static long ToTimestampTz(DateTime moment) + => MEOSExposedFunctions.timestamptz_in( + moment.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss.ffffff+00", + CultureInfo.InvariantCulture), -1); + + /// A MEOS DateADT as a DateOnly. + internal static DateOnly ToDateOnly(int date) + => DateOnly.Parse(MEOSExposedFunctions.date_out(date), + CultureInfo.InvariantCulture); + + /// A DateOnly as a MEOS DateADT. + internal static int ToDateADT(DateOnly day) + => MEOSExposedFunctions.date_in( + day.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); + } +} diff --git a/MEOS.NET/Types/Generated/MEOSFactory.g.cs b/MEOS.NET/Types/Generated/MEOSFactory.g.cs new file mode 100644 index 0000000..823438e --- /dev/null +++ b/MEOS.NET/Types/Generated/MEOSFactory.g.cs @@ -0,0 +1,365 @@ +#nullable enable + +using System.Runtime.InteropServices; + +namespace MEOS.NET.Types.Generated +{ + /// + /// Wraps a MEOS pointer in the class the model gives its runtime type. + /// The discriminator is the struct field the catalog records, read at the + /// offset the catalog's own field layout puts it at. + /// + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + internal static class MEOSFactory + { + /// The value at as the Temporal + /// class the model gives its runtime type. + internal static Temporal? WrapTemporal(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + // Temporal.temptype, at byte 4 + return Marshal.ReadByte(ptr, 4) switch + { + 26 => WrapTBoolSubtype(ptr), // T_TBOOL + 33 => WrapTFloatSubtype(ptr), // T_TFLOAT + 35 => WrapTIntSubtype(ptr), // T_TINT + 41 => WrapTTextSubtype(ptr), // T_TTEXT + 46 => WrapTGeomPointSubtype(ptr), // T_TGEOMPOINT + 47 => WrapTGeogPointSubtype(ptr), // T_TGEOGPOINT + 51 => WrapTNpointSubtype(ptr), // T_TNPOINT + 56 => WrapTPoseSubtype(ptr), // T_TPOSE + 59 => WrapTCbufferSubtype(ptr), // T_TCBUFFER + 60 => WrapTGeometrySubtype(ptr), // T_TGEOMETRY + 61 => WrapTGeographySubtype(ptr), // T_TGEOGRAPHY + 62 => WrapTRGeometrySubtype(ptr), // T_TRGEOMETRY + 66 => WrapTJsonbSubtype(ptr), // T_TJSONB + 67 => WrapTBigintSubtype(ptr), // T_TBIGINT + _ => new Temporal(ptr), + }; + } + + /// Every element of a C array of Temporal pointers, wrapped. + internal static Temporal?[] WrapTemporalArray(IntPtr[] ptrs) + { + Temporal?[] wrapped = new Temporal?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapTemporal(ptrs[i]); + } + + return wrapped; + } + + /// The concrete TBigint class for the template subtype + /// at byte 5. + private static TBigint WrapTBigintSubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TBigintInst(ptr), + 2 => new TBigintSeq(ptr), + 3 => new TBigintSeqSet(ptr), + _ => new TBigint(ptr), + }; + + /// The concrete TBool class for the template subtype + /// at byte 5. + private static TBool WrapTBoolSubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TBoolInst(ptr), + 2 => new TBoolSeq(ptr), + 3 => new TBoolSeqSet(ptr), + _ => new TBool(ptr), + }; + + /// The concrete TCbuffer class for the template subtype + /// at byte 5. + private static TCbuffer WrapTCbufferSubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TCbufferInst(ptr), + 2 => new TCbufferSeq(ptr), + 3 => new TCbufferSeqSet(ptr), + _ => new TCbuffer(ptr), + }; + + /// The concrete TFloat class for the template subtype + /// at byte 5. + private static TFloat WrapTFloatSubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TFloatInst(ptr), + 2 => new TFloatSeq(ptr), + 3 => new TFloatSeqSet(ptr), + _ => new TFloat(ptr), + }; + + /// The concrete TGeogPoint class for the template subtype + /// at byte 5. + private static TGeogPoint WrapTGeogPointSubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TGeogPointInst(ptr), + 2 => new TGeogPointSeq(ptr), + 3 => new TGeogPointSeqSet(ptr), + _ => new TGeogPoint(ptr), + }; + + /// The concrete TGeography class for the template subtype + /// at byte 5. + private static TGeography WrapTGeographySubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TGeographyInst(ptr), + 2 => new TGeographySeq(ptr), + 3 => new TGeographySeqSet(ptr), + _ => new TGeography(ptr), + }; + + /// The concrete TGeomPoint class for the template subtype + /// at byte 5. + private static TGeomPoint WrapTGeomPointSubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TGeomPointInst(ptr), + 2 => new TGeomPointSeq(ptr), + 3 => new TGeomPointSeqSet(ptr), + _ => new TGeomPoint(ptr), + }; + + /// The concrete TGeometry class for the template subtype + /// at byte 5. + private static TGeometry WrapTGeometrySubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TGeometryInst(ptr), + 2 => new TGeometrySeq(ptr), + 3 => new TGeometrySeqSet(ptr), + _ => new TGeometry(ptr), + }; + + /// The concrete TInt class for the template subtype + /// at byte 5. + private static TInt WrapTIntSubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TIntInst(ptr), + 2 => new TIntSeq(ptr), + 3 => new TIntSeqSet(ptr), + _ => new TInt(ptr), + }; + + /// The concrete TJsonb class for the template subtype + /// at byte 5. + private static TJsonb WrapTJsonbSubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TJsonbInst(ptr), + 2 => new TJsonbSeq(ptr), + 3 => new TJsonbSeqSet(ptr), + _ => new TJsonb(ptr), + }; + + /// The concrete TNpoint class for the template subtype + /// at byte 5. + private static TNpoint WrapTNpointSubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TNpointInst(ptr), + 2 => new TNpointSeq(ptr), + 3 => new TNpointSeqSet(ptr), + _ => new TNpoint(ptr), + }; + + /// The concrete TPose class for the template subtype + /// at byte 5. + private static TPose WrapTPoseSubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TPoseInst(ptr), + 2 => new TPoseSeq(ptr), + 3 => new TPoseSeqSet(ptr), + _ => new TPose(ptr), + }; + + /// The concrete TRGeometry class for the template subtype + /// at byte 5. + private static TRGeometry WrapTRGeometrySubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TRGeometryInst(ptr), + 2 => new TRGeometrySeq(ptr), + 3 => new TRGeometrySeqSet(ptr), + _ => new TRGeometry(ptr), + }; + + /// The concrete TText class for the template subtype + /// at byte 5. + private static TText WrapTTextSubtype(IntPtr ptr) + => Marshal.ReadByte(ptr, 5) switch + { + 1 => new TTextInst(ptr), + 2 => new TTextSeq(ptr), + 3 => new TTextSeqSet(ptr), + _ => new TText(ptr), + }; + + /// The value at as the Set + /// class the model gives its runtime type. + internal static Set? WrapSet(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + // Set.settype, at byte 4 + return Marshal.ReadByte(ptr, 4) switch + { + 5 => new DateSet(ptr), // T_DATESET + 12 => new FloatSet(ptr), // T_FLOATSET + 18 => new IntSet(ptr), // T_INTSET + 22 => new BigIntSet(ptr), // T_BIGINTSET + 32 => new TextSet(ptr), // T_TEXTSET + 38 => new TsTzSet(ptr), // T_TSTZSET + 43 => new GeomSet(ptr), // T_GEOMSET + 45 => new GeogSet(ptr), // T_GEOGSET + 49 => new NpointSet(ptr), // T_NPOINTSET + 55 => new PoseSet(ptr), // T_POSESET + 58 => new CbufferSet(ptr), // T_CBUFFERSET + _ => new Set(ptr), + }; + } + + /// Every element of a C array of Set pointers, wrapped. + internal static Set?[] WrapSetArray(IntPtr[] ptrs) + { + Set?[] wrapped = new Set?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapSet(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the Span + /// class the model gives its runtime type. + internal static Span? WrapSpan(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + // Span.spantype, at byte 0 + return Marshal.ReadByte(ptr, 0) switch + { + 6 => new DateSpan(ptr), // T_DATESPAN + 13 => new FloatSpan(ptr), // T_FLOATSPAN + 19 => new IntSpan(ptr), // T_INTSPAN + 23 => new BigIntSpan(ptr), // T_BIGINTSPAN + 39 => new TsTzSpan(ptr), // T_TSTZSPAN + _ => new Span(ptr), + }; + } + + /// Every element of a C array of Span pointers, wrapped. + internal static Span?[] WrapSpanArray(IntPtr[] ptrs) + { + Span?[] wrapped = new Span?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapSpan(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the SpanSet + /// class the model gives its runtime type. + internal static SpanSet? WrapSpanSet(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + // SpanSet.spansettype, at byte 4 + return Marshal.ReadByte(ptr, 4) switch + { + 7 => new DateSpanSet(ptr), // T_DATESPANSET + 14 => new FloatSpanSet(ptr), // T_FLOATSPANSET + 20 => new IntSpanSet(ptr), // T_INTSPANSET + 24 => new BigIntSpanSet(ptr), // T_BIGINTSPANSET + 40 => new TsTzSpanSet(ptr), // T_TSTZSPANSET + _ => new SpanSet(ptr), + }; + } + + /// Every element of a C array of SpanSet pointers, wrapped. + internal static SpanSet?[] WrapSpanSetArray(IntPtr[] ptrs) + { + SpanSet?[] wrapped = new SpanSet?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapSpanSet(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the TBox + /// class the model gives its runtime type. + internal static TBox? WrapTBox(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new TBox(ptr); + } + + /// Every element of a C array of TBox pointers, wrapped. + internal static TBox?[] WrapTBoxArray(IntPtr[] ptrs) + { + TBox?[] wrapped = new TBox?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapTBox(ptrs[i]); + } + + return wrapped; + } + + /// The value at as the STBox + /// class the model gives its runtime type. + internal static STBox? WrapSTBox(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new STBox(ptr); + } + + /// Every element of a C array of STBox pointers, wrapped. + internal static STBox?[] WrapSTBoxArray(IntPtr[] ptrs) + { + STBox?[] wrapped = new STBox?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapSTBox(ptrs[i]); + } + + return wrapped; + } + + } +} diff --git a/MEOS.NET/Types/Generated/MEOSObject.g.cs b/MEOS.NET/Types/Generated/MEOSObject.g.cs new file mode 100644 index 0000000..c9dd778 --- /dev/null +++ b/MEOS.NET/Types/Generated/MEOSObject.g.cs @@ -0,0 +1,16 @@ +#nullable enable + +namespace MEOS.NET.Types.Generated +{ + /// + /// A handle on a value MEOS owns. The pointer is what every generated method + /// forwards to the C API; the memory behind it belongs to MEOS. + /// + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public abstract class MEOSObject + { + internal IntPtr Ptr { get; } + + internal MEOSObject(IntPtr ptr) => this.Ptr = ptr; + } +} diff --git a/MEOS.NET/Types/Generated/NpointSet.g.cs b/MEOS.NET/Types/Generated/NpointSet.g.cs new file mode 100644 index 0000000..0111beb --- /dev/null +++ b/MEOS.NET/Types/Generated/NpointSet.g.cs @@ -0,0 +1,24 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The NpointSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class NpointSet : Set + { + internal NpointSet(IntPtr ptr) : base(ptr) { } + + public string Out(int maxdd) + => MEOSExposedFunctions.npointset_out(this.Ptr, maxdd); + + public Set? Routes() + => MEOSFactory.WrapSet(MEOSExposedFunctions.npointset_routes(this.Ptr)); + + public static Set? In(string str) + => MEOSFactory.WrapSet(MEOSExposedFunctions.npointset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/PoseSet.g.cs b/MEOS.NET/Types/Generated/PoseSet.g.cs new file mode 100644 index 0000000..0877721 --- /dev/null +++ b/MEOS.NET/Types/Generated/PoseSet.g.cs @@ -0,0 +1,21 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The PoseSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class PoseSet : Set + { + internal PoseSet(IntPtr ptr) : base(ptr) { } + + public string Out(int maxdd) + => MEOSExposedFunctions.poseset_out(this.Ptr, maxdd); + + public static Set? In(string str) + => MEOSFactory.WrapSet(MEOSExposedFunctions.poseset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/STBox.g.cs b/MEOS.NET/Types/Generated/STBox.g.cs new file mode 100644 index 0000000..9d1f725 --- /dev/null +++ b/MEOS.NET/Types/Generated/STBox.g.cs @@ -0,0 +1,105 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// Space x time box (bbox of TSpatial). + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class STBox : Box + { + internal STBox(IntPtr ptr) : base(ptr) { } + + public double Area(bool spheroid) + => MEOSExposedFunctions.stbox_area(this.Ptr, spheroid); + + public int Cmp(STBox box2) + => MEOSExposedFunctions.stbox_cmp(this.Ptr, box2.Ptr); + + public STBox? Copy() + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.stbox_copy(this.Ptr)); + + public bool Eq(STBox box2) + => MEOSExposedFunctions.stbox_eq(this.Ptr, box2.Ptr); + + public STBox? ExpandSpace(double d) + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.stbox_expand_space(this.Ptr, d)); + + public bool Ge(STBox box2) + => MEOSExposedFunctions.stbox_ge(this.Ptr, box2.Ptr); + + public STBox? GetSpace() + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.stbox_get_space(this.Ptr)); + + public bool Gt(STBox box2) + => MEOSExposedFunctions.stbox_gt(this.Ptr, box2.Ptr); + + public uint Hash() + => MEOSExposedFunctions.stbox_hash(this.Ptr); + + public ulong HashExtended(ulong seed) + => MEOSExposedFunctions.stbox_hash_extended(this.Ptr, seed); + + public bool Hast() + => MEOSExposedFunctions.stbox_hast(this.Ptr); + + public bool Hasx() + => MEOSExposedFunctions.stbox_hasx(this.Ptr); + + public bool Hasz() + => MEOSExposedFunctions.stbox_hasz(this.Ptr); + + public bool Isgeodetic() + => MEOSExposedFunctions.stbox_isgeodetic(this.Ptr); + + public bool Le(STBox box2) + => MEOSExposedFunctions.stbox_le(this.Ptr, box2.Ptr); + + public bool Lt(STBox box2) + => MEOSExposedFunctions.stbox_lt(this.Ptr, box2.Ptr); + + public bool Ne(STBox box2) + => MEOSExposedFunctions.stbox_ne(this.Ptr, box2.Ptr); + + public string Out(int maxdd) + => MEOSExposedFunctions.stbox_out(this.Ptr, maxdd); + + public double Perimeter(bool spheroid) + => MEOSExposedFunctions.stbox_perimeter(this.Ptr, spheroid); + + public STBox? Round(int maxdd) + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.stbox_round(this.Ptr, maxdd)); + + public int SRID() + => MEOSExposedFunctions.stbox_srid(this.Ptr); + + public STBox? SetSRID(int srid) + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.stbox_set_srid(this.Ptr, srid)); + + public double SpatialDistance(STBox box2) + => MEOSExposedFunctions.stbox_spatial_distance(this.Ptr, box2.Ptr); + + public Span? ToTstzspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.stbox_to_tstzspan(this.Ptr)); + + public STBox? Transform(int srid) + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.stbox_transform(this.Ptr, srid)); + + public STBox? TransformPipeline(string pipelinestr, int srid, bool is_forward) + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.stbox_transform_pipeline(this.Ptr, pipelinestr, srid, is_forward)); + + public double Volume() + => MEOSExposedFunctions.stbox_volume(this.Ptr); + + public static STBox? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.stbox_from_hexwkb(hexwkb)); + + public static STBox? In(string str) + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.stbox_in(str)); + + public static STBox? Make(bool hasx, bool hasz, bool geodetic, int srid, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, Span s) + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.stbox_make(hasx, hasz, geodetic, srid, xmin, xmax, ymin, ymax, zmin, zmax, s.Ptr)); + + } +} diff --git a/MEOS.NET/Types/Generated/Set.g.cs b/MEOS.NET/Types/Generated/Set.g.cs new file mode 100644 index 0000000..cb02231 --- /dev/null +++ b/MEOS.NET/Types/Generated/Set.g.cs @@ -0,0 +1,63 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// Unordered set of base values. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Set : Collection + { + internal Set(IntPtr ptr) : base(ptr) { } + + public int Cmp(Set s2) + => MEOSExposedFunctions.set_cmp(this.Ptr, s2.Ptr); + + public Set? Copy() + => MEOSFactory.WrapSet(MEOSExposedFunctions.set_copy(this.Ptr)); + + public bool Eq(Set s2) + => MEOSExposedFunctions.set_eq(this.Ptr, s2.Ptr); + + public bool Ge(Set s2) + => MEOSExposedFunctions.set_ge(this.Ptr, s2.Ptr); + + public bool Gt(Set s2) + => MEOSExposedFunctions.set_gt(this.Ptr, s2.Ptr); + + public uint Hash() + => MEOSExposedFunctions.set_hash(this.Ptr); + + public ulong HashExtended(ulong seed) + => MEOSExposedFunctions.set_hash_extended(this.Ptr, seed); + + public bool Le(Set s2) + => MEOSExposedFunctions.set_le(this.Ptr, s2.Ptr); + + public bool Lt(Set s2) + => MEOSExposedFunctions.set_lt(this.Ptr, s2.Ptr); + + public bool Ne(Set s2) + => MEOSExposedFunctions.set_ne(this.Ptr, s2.Ptr); + + public int NumValues() + => MEOSExposedFunctions.set_num_values(this.Ptr); + + public Set? Round(int maxdd) + => MEOSFactory.WrapSet(MEOSExposedFunctions.set_round(this.Ptr, maxdd)); + + public Span? ToSpan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.set_to_span(this.Ptr)); + + public SpanSet? ToSpanset() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.set_to_spanset(this.Ptr)); + + public TBox? ToTbox() + => MEOSFactory.WrapTBox(MEOSExposedFunctions.set_to_tbox(this.Ptr)); + + public static Set? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapSet(MEOSExposedFunctions.set_from_hexwkb(hexwkb)); + + } +} diff --git a/MEOS.NET/Types/Generated/Span.g.cs b/MEOS.NET/Types/Generated/Span.g.cs new file mode 100644 index 0000000..8448440 --- /dev/null +++ b/MEOS.NET/Types/Generated/Span.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// Contiguous range over an ordered base type. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Span : Collection + { + internal Span(IntPtr ptr) : base(ptr) { } + + public int Cmp(Span s2) + => MEOSExposedFunctions.span_cmp(this.Ptr, s2.Ptr); + + public Span? Copy() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.span_copy(this.Ptr)); + + public bool Eq(Span s2) + => MEOSExposedFunctions.span_eq(this.Ptr, s2.Ptr); + + public bool Ge(Span s2) + => MEOSExposedFunctions.span_ge(this.Ptr, s2.Ptr); + + public bool Gt(Span s2) + => MEOSExposedFunctions.span_gt(this.Ptr, s2.Ptr); + + public uint Hash() + => MEOSExposedFunctions.span_hash(this.Ptr); + + public ulong HashExtended(ulong seed) + => MEOSExposedFunctions.span_hash_extended(this.Ptr, seed); + + public bool Le(Span s2) + => MEOSExposedFunctions.span_le(this.Ptr, s2.Ptr); + + public bool LowerInc() + => MEOSExposedFunctions.span_lower_inc(this.Ptr); + + public bool Lt(Span s2) + => MEOSExposedFunctions.span_lt(this.Ptr, s2.Ptr); + + public bool Ne(Span s2) + => MEOSExposedFunctions.span_ne(this.Ptr, s2.Ptr); + + public SpanSet? ToSpanset() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.span_to_spanset(this.Ptr)); + + public TBox? ToTbox() + => MEOSFactory.WrapTBox(MEOSExposedFunctions.span_to_tbox(this.Ptr)); + + public bool UpperInc() + => MEOSExposedFunctions.span_upper_inc(this.Ptr); + + public static Span? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.span_from_hexwkb(hexwkb)); + + } +} diff --git a/MEOS.NET/Types/Generated/SpanSet.g.cs b/MEOS.NET/Types/Generated/SpanSet.g.cs new file mode 100644 index 0000000..20093ea --- /dev/null +++ b/MEOS.NET/Types/Generated/SpanSet.g.cs @@ -0,0 +1,75 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// Set of disjoint spans. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class SpanSet : Collection + { + internal SpanSet(IntPtr ptr) : base(ptr) { } + + public int Cmp(SpanSet ss2) + => MEOSExposedFunctions.spanset_cmp(this.Ptr, ss2.Ptr); + + public SpanSet? Copy() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.spanset_copy(this.Ptr)); + + public Span? EndSpan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.spanset_end_span(this.Ptr)); + + public bool Eq(SpanSet ss2) + => MEOSExposedFunctions.spanset_eq(this.Ptr, ss2.Ptr); + + public bool Ge(SpanSet ss2) + => MEOSExposedFunctions.spanset_ge(this.Ptr, ss2.Ptr); + + public bool Gt(SpanSet ss2) + => MEOSExposedFunctions.spanset_gt(this.Ptr, ss2.Ptr); + + public uint Hash() + => MEOSExposedFunctions.spanset_hash(this.Ptr); + + public ulong HashExtended(ulong seed) + => MEOSExposedFunctions.spanset_hash_extended(this.Ptr, seed); + + public bool Le(SpanSet ss2) + => MEOSExposedFunctions.spanset_le(this.Ptr, ss2.Ptr); + + public bool LowerInc() + => MEOSExposedFunctions.spanset_lower_inc(this.Ptr); + + public bool Lt(SpanSet ss2) + => MEOSExposedFunctions.spanset_lt(this.Ptr, ss2.Ptr); + + public bool Ne(SpanSet ss2) + => MEOSExposedFunctions.spanset_ne(this.Ptr, ss2.Ptr); + + public int NumSpans() + => MEOSExposedFunctions.spanset_num_spans(this.Ptr); + + public Span? Span() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.spanset_span(this.Ptr)); + + public Span? SpanN(int i) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.spanset_span_n(this.Ptr, i)); + + public Span?[] Spanarr() + => MEOSFactory.WrapSpanArray(MEOSExposedFunctions.spanset_spanarr(this.Ptr)); + + public Span? StartSpan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.spanset_start_span(this.Ptr)); + + public TBox? ToTbox() + => MEOSFactory.WrapTBox(MEOSExposedFunctions.spanset_to_tbox(this.Ptr)); + + public bool UpperInc() + => MEOSExposedFunctions.spanset_upper_inc(this.Ptr); + + public static SpanSet? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.spanset_from_hexwkb(hexwkb)); + + } +} diff --git a/MEOS.NET/Types/Generated/TAlpha.g.cs b/MEOS.NET/Types/Generated/TAlpha.g.cs new file mode 100644 index 0000000..91b500a --- /dev/null +++ b/MEOS.NET/Types/Generated/TAlpha.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// Non-numeric, non-spatial temporal types (step/discrete interpolation only). A real MEOS grouping (talpha_type) with no user-facing class name in PyMEOS — see corrections. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TAlpha : Temporal + { + internal TAlpha(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TBigint.g.cs b/MEOS.NET/Types/Generated/TBigint.g.cs new file mode 100644 index 0000000..c258aea --- /dev/null +++ b/MEOS.NET/Types/Generated/TBigint.g.cs @@ -0,0 +1,63 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TBigint class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TBigint : TNumber + { + internal TBigint(IntPtr ptr) : base(ptr) { } + + public long EndValue() + => MEOSExposedFunctions.tbigint_end_value(this.Ptr); + + public long MaxValue() + => MEOSExposedFunctions.tbigint_max_value(this.Ptr); + + public long MinValue() + => MEOSExposedFunctions.tbigint_min_value(this.Ptr); + + public string Out() + => MEOSExposedFunctions.tbigint_out(this.Ptr); + + public Temporal? ScaleValue(long width) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigint_scale_value(this.Ptr, width)); + + public Temporal? ShiftScaleValue(long shift, long width) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigint_shift_scale_value(this.Ptr, shift, width)); + + public Temporal? ShiftValue(long shift) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigint_shift_value(this.Ptr, shift)); + + public long StartValue() + => MEOSExposedFunctions.tbigint_start_value(this.Ptr); + + public Temporal? ToTfloat() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigint_to_tfloat(this.Ptr)); + + public Temporal? ToTh3index() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigint_to_th3index(this.Ptr)); + + public Temporal? ToTint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigint_to_tint(this.Ptr)); + + public Temporal? ToTquadbin() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigint_to_tquadbin(this.Ptr)); + + public Temporal? ToTs2cell() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigint_to_ts2cell(this.Ptr)); + + public static Temporal? FromBaseTemp(long i, Temporal temp) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigint_from_base_temp(i, temp.Ptr)); + + public static Temporal? FromMFJSON(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigint_from_mfjson(str)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigint_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TBigintInst.g.cs b/MEOS.NET/Types/Generated/TBigintInst.g.cs new file mode 100644 index 0000000..32e7dc6 --- /dev/null +++ b/MEOS.NET/Types/Generated/TBigintInst.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TBigint of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TBigintInst : TBigint + { + internal TBigintInst(IntPtr ptr) : base(ptr) { } + + public static Temporal? Make(long i, DateTime t) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigintinst_make(i, MEOSConvert.ToTimestampTz(t))); + + } +} diff --git a/MEOS.NET/Types/Generated/TBigintSeq.g.cs b/MEOS.NET/Types/Generated/TBigintSeq.g.cs new file mode 100644 index 0000000..ab10c17 --- /dev/null +++ b/MEOS.NET/Types/Generated/TBigintSeq.g.cs @@ -0,0 +1,21 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TBigint of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TBigintSeq : TBigint + { + internal TBigintSeq(IntPtr ptr) : base(ptr) { } + + public static Temporal? FromBaseTstzset(long i, Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigintseq_from_base_tstzset(i, s.Ptr)); + + public static Temporal? FromBaseTstzspan(long i, Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigintseq_from_base_tstzspan(i, s.Ptr)); + + } +} diff --git a/MEOS.NET/Types/Generated/TBigintSeqSet.g.cs b/MEOS.NET/Types/Generated/TBigintSeqSet.g.cs new file mode 100644 index 0000000..1c04598 --- /dev/null +++ b/MEOS.NET/Types/Generated/TBigintSeqSet.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TBigint of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TBigintSeqSet : TBigint + { + internal TBigintSeqSet(IntPtr ptr) : base(ptr) { } + + public static Temporal? FromBaseTstzspanset(long i, SpanSet ss) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbigintseqset_from_base_tstzspanset(i, ss.Ptr)); + + } +} diff --git a/MEOS.NET/Types/Generated/TBool.g.cs b/MEOS.NET/Types/Generated/TBool.g.cs new file mode 100644 index 0000000..1204ed7 --- /dev/null +++ b/MEOS.NET/Types/Generated/TBool.g.cs @@ -0,0 +1,45 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TBool class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TBool : TAlpha + { + internal TBool(IntPtr ptr) : base(ptr) { } + + public Temporal? AtValue(bool b) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbool_at_value(this.Ptr, b)); + + public bool EndValue() + => MEOSExposedFunctions.tbool_end_value(this.Ptr); + + public Temporal? MinusValue(bool b) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbool_minus_value(this.Ptr, b)); + + public string Out() + => MEOSExposedFunctions.tbool_out(this.Ptr); + + public bool StartValue() + => MEOSExposedFunctions.tbool_start_value(this.Ptr); + + public Temporal? ToTint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbool_to_tint(this.Ptr)); + + public SpanSet? WhenTrue() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.tbool_when_true(this.Ptr)); + + public static Temporal? FromBaseTemp(bool b, Temporal temp) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbool_from_base_temp(b, temp.Ptr)); + + public static Temporal? FromMFJSON(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbool_from_mfjson(str)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tbool_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TBoolInst.g.cs b/MEOS.NET/Types/Generated/TBoolInst.g.cs new file mode 100644 index 0000000..d33c2c3 --- /dev/null +++ b/MEOS.NET/Types/Generated/TBoolInst.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TBool of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TBoolInst : TBool + { + internal TBoolInst(IntPtr ptr) : base(ptr) { } + + public static Temporal? Make(bool b, DateTime t) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tboolinst_make(b, MEOSConvert.ToTimestampTz(t))); + + } +} diff --git a/MEOS.NET/Types/Generated/TBoolSeq.g.cs b/MEOS.NET/Types/Generated/TBoolSeq.g.cs new file mode 100644 index 0000000..650e4e2 --- /dev/null +++ b/MEOS.NET/Types/Generated/TBoolSeq.g.cs @@ -0,0 +1,21 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TBool of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TBoolSeq : TBool + { + internal TBoolSeq(IntPtr ptr) : base(ptr) { } + + public static Temporal? FromBaseTstzset(bool b, Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tboolseq_from_base_tstzset(b, s.Ptr)); + + public static Temporal? FromBaseTstzspan(bool b, Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tboolseq_from_base_tstzspan(b, s.Ptr)); + + } +} diff --git a/MEOS.NET/Types/Generated/TBoolSeqSet.g.cs b/MEOS.NET/Types/Generated/TBoolSeqSet.g.cs new file mode 100644 index 0000000..e85c3e6 --- /dev/null +++ b/MEOS.NET/Types/Generated/TBoolSeqSet.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TBool of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TBoolSeqSet : TBool + { + internal TBoolSeqSet(IntPtr ptr) : base(ptr) { } + + public static Temporal? FromBaseTstzspanset(bool b, SpanSet ss) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tboolseqset_from_base_tstzspanset(b, ss.Ptr)); + + } +} diff --git a/MEOS.NET/Types/Generated/TBox.g.cs b/MEOS.NET/Types/Generated/TBox.g.cs new file mode 100644 index 0000000..3a93e6f --- /dev/null +++ b/MEOS.NET/Types/Generated/TBox.g.cs @@ -0,0 +1,78 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// Numeric x time box (bbox of TNumber). + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TBox : Box + { + internal TBox(IntPtr ptr) : base(ptr) { } + + public int Cmp(TBox box2) + => MEOSExposedFunctions.tbox_cmp(this.Ptr, box2.Ptr); + + public TBox? Copy() + => MEOSFactory.WrapTBox(MEOSExposedFunctions.tbox_copy(this.Ptr)); + + public bool Eq(TBox box2) + => MEOSExposedFunctions.tbox_eq(this.Ptr, box2.Ptr); + + public bool Ge(TBox box2) + => MEOSExposedFunctions.tbox_ge(this.Ptr, box2.Ptr); + + public bool Gt(TBox box2) + => MEOSExposedFunctions.tbox_gt(this.Ptr, box2.Ptr); + + public uint Hash() + => MEOSExposedFunctions.tbox_hash(this.Ptr); + + public ulong HashExtended(ulong seed) + => MEOSExposedFunctions.tbox_hash_extended(this.Ptr, seed); + + public bool Hast() + => MEOSExposedFunctions.tbox_hast(this.Ptr); + + public bool Hasx() + => MEOSExposedFunctions.tbox_hasx(this.Ptr); + + public bool Le(TBox box2) + => MEOSExposedFunctions.tbox_le(this.Ptr, box2.Ptr); + + public bool Lt(TBox box2) + => MEOSExposedFunctions.tbox_lt(this.Ptr, box2.Ptr); + + public bool Ne(TBox box2) + => MEOSExposedFunctions.tbox_ne(this.Ptr, box2.Ptr); + + public string Out(int maxdd) + => MEOSExposedFunctions.tbox_out(this.Ptr, maxdd); + + public TBox? Round(int maxdd) + => MEOSFactory.WrapTBox(MEOSExposedFunctions.tbox_round(this.Ptr, maxdd)); + + public Span? ToBigintspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.tbox_to_bigintspan(this.Ptr)); + + public Span? ToFloatspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.tbox_to_floatspan(this.Ptr)); + + public Span? ToIntspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.tbox_to_intspan(this.Ptr)); + + public Span? ToTstzspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.tbox_to_tstzspan(this.Ptr)); + + public static TBox? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapTBox(MEOSExposedFunctions.tbox_from_hexwkb(hexwkb)); + + public static TBox? In(string str) + => MEOSFactory.WrapTBox(MEOSExposedFunctions.tbox_in(str)); + + public static TBox? Make(Span s, Span p) + => MEOSFactory.WrapTBox(MEOSExposedFunctions.tbox_make(s.Ptr, p.Ptr)); + + } +} diff --git a/MEOS.NET/Types/Generated/TCbuffer.g.cs b/MEOS.NET/Types/Generated/TCbuffer.g.cs new file mode 100644 index 0000000..8325fa3 --- /dev/null +++ b/MEOS.NET/Types/Generated/TCbuffer.g.cs @@ -0,0 +1,45 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TCbuffer class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TCbuffer : TSpatial + { + internal TCbuffer(IntPtr ptr) : base(ptr) { } + + public Temporal? AtStbox(STBox box, bool border_inc) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tcbuffer_at_stbox(this.Ptr, box.Ptr, border_inc)); + + public Temporal? Expand(double dist) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tcbuffer_expand(this.Ptr, dist)); + + public Temporal? Make(Temporal tfloat) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tcbuffer_make(this.Ptr, tfloat.Ptr)); + + public Temporal? MinusStbox(STBox box, bool border_inc) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tcbuffer_minus_stbox(this.Ptr, box.Ptr, border_inc)); + + public Set? Points() + => MEOSFactory.WrapSet(MEOSExposedFunctions.tcbuffer_points(this.Ptr)); + + public Set? Radius() + => MEOSFactory.WrapSet(MEOSExposedFunctions.tcbuffer_radius(this.Ptr)); + + public Temporal? ToTfloat() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tcbuffer_to_tfloat(this.Ptr)); + + public Temporal? ToTgeompoint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tcbuffer_to_tgeompoint(this.Ptr)); + + public static Temporal? FromMFJSON(string mfjson) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tcbuffer_from_mfjson(mfjson)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tcbuffer_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TCbufferInst.g.cs b/MEOS.NET/Types/Generated/TCbufferInst.g.cs new file mode 100644 index 0000000..f7f16c3 --- /dev/null +++ b/MEOS.NET/Types/Generated/TCbufferInst.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TCbuffer of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TCbufferInst : TCbuffer + { + internal TCbufferInst(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TCbufferSeq.g.cs b/MEOS.NET/Types/Generated/TCbufferSeq.g.cs new file mode 100644 index 0000000..1fba5e7 --- /dev/null +++ b/MEOS.NET/Types/Generated/TCbufferSeq.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TCbuffer of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TCbufferSeq : TCbuffer + { + internal TCbufferSeq(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TCbufferSeqSet.g.cs b/MEOS.NET/Types/Generated/TCbufferSeqSet.g.cs new file mode 100644 index 0000000..10d76cc --- /dev/null +++ b/MEOS.NET/Types/Generated/TCbufferSeqSet.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TCbuffer of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TCbufferSeqSet : TCbuffer + { + internal TCbufferSeqSet(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TFloat.g.cs b/MEOS.NET/Types/Generated/TFloat.g.cs new file mode 100644 index 0000000..dc7f323 --- /dev/null +++ b/MEOS.NET/Types/Generated/TFloat.g.cs @@ -0,0 +1,93 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TFloat class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TFloat : TNumber + { + internal TFloat(IntPtr ptr) : base(ptr) { } + + public Temporal? AtValue(double d) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_at_value(this.Ptr, d)); + + public Temporal? Ceil() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_ceil(this.Ptr)); + + public Temporal? Cos() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_cos(this.Ptr)); + + public Temporal? Degrees(bool normalize) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_degrees(this.Ptr, normalize)); + + public double EndValue() + => MEOSExposedFunctions.tfloat_end_value(this.Ptr); + + public Temporal? Exp() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_exp(this.Ptr)); + + public Temporal? Floor() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_floor(this.Ptr)); + + public Temporal? Ln() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_ln(this.Ptr)); + + public Temporal? Log10() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_log10(this.Ptr)); + + public double MaxValue() + => MEOSExposedFunctions.tfloat_max_value(this.Ptr); + + public double MinValue() + => MEOSExposedFunctions.tfloat_min_value(this.Ptr); + + public Temporal? MinusValue(double d) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_minus_value(this.Ptr, d)); + + public string Out(int maxdd) + => MEOSExposedFunctions.tfloat_out(this.Ptr, maxdd); + + public Temporal? Radians() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_radians(this.Ptr)); + + public Temporal? ScaleValue(double width) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_scale_value(this.Ptr, width)); + + public Temporal? ShiftScaleValue(double shift, double width) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_shift_scale_value(this.Ptr, shift, width)); + + public Temporal? ShiftValue(double shift) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_shift_value(this.Ptr, shift)); + + public Temporal? Sin() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_sin(this.Ptr)); + + public double StartValue() + => MEOSExposedFunctions.tfloat_start_value(this.Ptr); + + public Temporal? Tan() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_tan(this.Ptr)); + + public Temporal? ToTbigint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_to_tbigint(this.Ptr)); + + public Temporal? ToTint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_to_tint(this.Ptr)); + + public double[] Values() + => MEOSExposedFunctions.tfloat_values(this.Ptr); + + public static Temporal? FromBaseTemp(double d, Temporal temp) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_from_base_temp(d, temp.Ptr)); + + public static Temporal? FromMFJSON(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_from_mfjson(str)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloat_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TFloatInst.g.cs b/MEOS.NET/Types/Generated/TFloatInst.g.cs new file mode 100644 index 0000000..59bba63 --- /dev/null +++ b/MEOS.NET/Types/Generated/TFloatInst.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TFloat of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TFloatInst : TFloat + { + internal TFloatInst(IntPtr ptr) : base(ptr) { } + + public static Temporal? Make(double d, DateTime t) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloatinst_make(d, MEOSConvert.ToTimestampTz(t))); + + } +} diff --git a/MEOS.NET/Types/Generated/TFloatSeq.g.cs b/MEOS.NET/Types/Generated/TFloatSeq.g.cs new file mode 100644 index 0000000..28890ba --- /dev/null +++ b/MEOS.NET/Types/Generated/TFloatSeq.g.cs @@ -0,0 +1,21 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TFloat of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TFloatSeq : TFloat + { + internal TFloatSeq(IntPtr ptr) : base(ptr) { } + + public static Temporal? FromBaseTstzset(double d, Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloatseq_from_base_tstzset(d, s.Ptr)); + + public static Temporal? FromBaseTstzspan(double d, Span s, InterpolationType interp) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloatseq_from_base_tstzspan(d, s.Ptr, (int) interp)); + + } +} diff --git a/MEOS.NET/Types/Generated/TFloatSeqSet.g.cs b/MEOS.NET/Types/Generated/TFloatSeqSet.g.cs new file mode 100644 index 0000000..d544334 --- /dev/null +++ b/MEOS.NET/Types/Generated/TFloatSeqSet.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TFloat of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TFloatSeqSet : TFloat + { + internal TFloatSeqSet(IntPtr ptr) : base(ptr) { } + + public static Temporal? FromBaseTstzspanset(double d, SpanSet ss, InterpolationType interp) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tfloatseqset_from_base_tstzspanset(d, ss.Ptr, (int) interp)); + + } +} diff --git a/MEOS.NET/Types/Generated/TGeo.g.cs b/MEOS.NET/Types/Generated/TGeo.g.cs new file mode 100644 index 0000000..f007991 --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeo.g.cs @@ -0,0 +1,24 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// All PostGIS-derived spatiotemporal types (geometry/geography-based). Authoritative parent per MobilityDB manual Ch.7 Figure 7.1 (= the broad C predicate tgeo_type_all). NOTE: the narrower C predicate tgeo_type() and most tgeo_* functions reject points — class membership (manual) is broader than tgeo_* API applicability; see correction OM-M1. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeo : TSpatial + { + internal TGeo(IntPtr ptr) : base(ptr) { } + + public Temporal? AtStbox(STBox box, bool border_inc) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeo_at_stbox(this.Ptr, box.Ptr, border_inc)); + + public Temporal? Centroid() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeo_centroid(this.Ptr)); + + public Temporal? MinusStbox(STBox box, bool border_inc) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeo_minus_stbox(this.Ptr, box.Ptr, border_inc)); + + } +} diff --git a/MEOS.NET/Types/Generated/TGeogPoint.g.cs b/MEOS.NET/Types/Generated/TGeogPoint.g.cs new file mode 100644 index 0000000..1bc9484 --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeogPoint.g.cs @@ -0,0 +1,30 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TGeogPoint class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeogPoint : TPoint + { + internal TGeogPoint(IntPtr ptr) : base(ptr) { } + + public Temporal? GreatCircleDistance(Temporal b) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeogpoint_great_circle_distance(this.Ptr, b.Ptr)); + + public Temporal? ToTgeography() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeogpoint_to_tgeography(this.Ptr)); + + public Temporal? ToTh3index(int resolution) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeogpoint_to_th3index(this.Ptr, resolution)); + + public static Temporal? FromMFJSON(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeogpoint_from_mfjson(str)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeogpoint_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TGeogPointInst.g.cs b/MEOS.NET/Types/Generated/TGeogPointInst.g.cs new file mode 100644 index 0000000..e667351 --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeogPointInst.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeogPoint of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeogPointInst : TGeogPoint + { + internal TGeogPointInst(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TGeogPointSeq.g.cs b/MEOS.NET/Types/Generated/TGeogPointSeq.g.cs new file mode 100644 index 0000000..befdf37 --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeogPointSeq.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeogPoint of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeogPointSeq : TGeogPoint + { + internal TGeogPointSeq(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TGeogPointSeqSet.g.cs b/MEOS.NET/Types/Generated/TGeogPointSeqSet.g.cs new file mode 100644 index 0000000..a40a9a3 --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeogPointSeqSet.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeogPoint of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeogPointSeqSet : TGeogPoint + { + internal TGeogPointSeqSet(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TGeography.g.cs b/MEOS.NET/Types/Generated/TGeography.g.cs new file mode 100644 index 0000000..5fe4723 --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeography.g.cs @@ -0,0 +1,27 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TGeography class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeography : TGeo + { + internal TGeography(IntPtr ptr) : base(ptr) { } + + public Temporal? ToTgeogpoint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeography_to_tgeogpoint(this.Ptr)); + + public Temporal? ToTgeometry() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeography_to_tgeometry(this.Ptr)); + + public static Temporal? FromMFJSON(string mfjson) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeography_from_mfjson(mfjson)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeography_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TGeographyInst.g.cs b/MEOS.NET/Types/Generated/TGeographyInst.g.cs new file mode 100644 index 0000000..f4b2eee --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeographyInst.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeography of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeographyInst : TGeography + { + internal TGeographyInst(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TGeographySeq.g.cs b/MEOS.NET/Types/Generated/TGeographySeq.g.cs new file mode 100644 index 0000000..5e1daff --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeographySeq.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeography of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeographySeq : TGeography + { + internal TGeographySeq(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TGeographySeqSet.g.cs b/MEOS.NET/Types/Generated/TGeographySeqSet.g.cs new file mode 100644 index 0000000..4d6767a --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeographySeqSet.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeography of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeographySeqSet : TGeography + { + internal TGeographySeqSet(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TGeomPoint.g.cs b/MEOS.NET/Types/Generated/TGeomPoint.g.cs new file mode 100644 index 0000000..e23549b --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeomPoint.g.cs @@ -0,0 +1,30 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TGeomPoint class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeomPoint : TPoint + { + internal TGeomPoint(IntPtr ptr) : base(ptr) { } + + public Temporal? ToTgeometry() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeompoint_to_tgeometry(this.Ptr)); + + public Temporal? ToTh3index(int resolution) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeompoint_to_th3index(this.Ptr, resolution)); + + public Temporal? ToTnpoint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeompoint_to_tnpoint(this.Ptr)); + + public static Temporal? FromMFJSON(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeompoint_from_mfjson(str)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeompoint_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TGeomPointInst.g.cs b/MEOS.NET/Types/Generated/TGeomPointInst.g.cs new file mode 100644 index 0000000..51e1974 --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeomPointInst.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeomPoint of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeomPointInst : TGeomPoint + { + internal TGeomPointInst(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TGeomPointSeq.g.cs b/MEOS.NET/Types/Generated/TGeomPointSeq.g.cs new file mode 100644 index 0000000..0a21daf --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeomPointSeq.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeomPoint of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeomPointSeq : TGeomPoint + { + internal TGeomPointSeq(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TGeomPointSeqSet.g.cs b/MEOS.NET/Types/Generated/TGeomPointSeqSet.g.cs new file mode 100644 index 0000000..19359a1 --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeomPointSeqSet.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeomPoint of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeomPointSeqSet : TGeomPoint + { + internal TGeomPointSeqSet(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TGeometry.g.cs b/MEOS.NET/Types/Generated/TGeometry.g.cs new file mode 100644 index 0000000..69b944f --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeometry.g.cs @@ -0,0 +1,30 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TGeometry class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeometry : TGeo + { + internal TGeometry(IntPtr ptr) : base(ptr) { } + + public Temporal? ToTcbuffer() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeometry_to_tcbuffer(this.Ptr)); + + public Temporal? ToTgeography() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeometry_to_tgeography(this.Ptr)); + + public Temporal? ToTgeompoint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeometry_to_tgeompoint(this.Ptr)); + + public static Temporal? FromMFJSON(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeometry_from_mfjson(str)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tgeometry_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TGeometryInst.g.cs b/MEOS.NET/Types/Generated/TGeometryInst.g.cs new file mode 100644 index 0000000..d94c5a3 --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeometryInst.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeometry of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeometryInst : TGeometry + { + internal TGeometryInst(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TGeometrySeq.g.cs b/MEOS.NET/Types/Generated/TGeometrySeq.g.cs new file mode 100644 index 0000000..392a3e1 --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeometrySeq.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeometry of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeometrySeq : TGeometry + { + internal TGeometrySeq(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TGeometrySeqSet.g.cs b/MEOS.NET/Types/Generated/TGeometrySeqSet.g.cs new file mode 100644 index 0000000..79e0ad7 --- /dev/null +++ b/MEOS.NET/Types/Generated/TGeometrySeqSet.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TGeometry of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TGeometrySeqSet : TGeometry + { + internal TGeometrySeqSet(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TInstant.g.cs b/MEOS.NET/Types/Generated/TInstant.g.cs new file mode 100644 index 0000000..ec45fe1 --- /dev/null +++ b/MEOS.NET/Types/Generated/TInstant.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TInstant class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TInstant : Temporal + { + internal TInstant(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TInt.g.cs b/MEOS.NET/Types/Generated/TInt.g.cs new file mode 100644 index 0000000..9c9ac69 --- /dev/null +++ b/MEOS.NET/Types/Generated/TInt.g.cs @@ -0,0 +1,63 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TInt class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TInt : TNumber + { + internal TInt(IntPtr ptr) : base(ptr) { } + + public Temporal? AtValue(int i) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tint_at_value(this.Ptr, i)); + + public int EndValue() + => MEOSExposedFunctions.tint_end_value(this.Ptr); + + public int MaxValue() + => MEOSExposedFunctions.tint_max_value(this.Ptr); + + public int MinValue() + => MEOSExposedFunctions.tint_min_value(this.Ptr); + + public Temporal? MinusValue(int i) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tint_minus_value(this.Ptr, i)); + + public string Out() + => MEOSExposedFunctions.tint_out(this.Ptr); + + public Temporal? ScaleValue(int width) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tint_scale_value(this.Ptr, width)); + + public Temporal? ShiftScaleValue(int shift, int width) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tint_shift_scale_value(this.Ptr, shift, width)); + + public Temporal? ShiftValue(int shift) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tint_shift_value(this.Ptr, shift)); + + public int StartValue() + => MEOSExposedFunctions.tint_start_value(this.Ptr); + + public Temporal? ToTbigint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tint_to_tbigint(this.Ptr)); + + public Temporal? ToTfloat() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tint_to_tfloat(this.Ptr)); + + public int[] Values() + => MEOSExposedFunctions.tint_values(this.Ptr); + + public static Temporal? FromBaseTemp(int i, Temporal temp) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tint_from_base_temp(i, temp.Ptr)); + + public static Temporal? FromMFJSON(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tint_from_mfjson(str)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tint_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TIntInst.g.cs b/MEOS.NET/Types/Generated/TIntInst.g.cs new file mode 100644 index 0000000..f23458e --- /dev/null +++ b/MEOS.NET/Types/Generated/TIntInst.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TInt of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TIntInst : TInt + { + internal TIntInst(IntPtr ptr) : base(ptr) { } + + public static Temporal? Make(int i, DateTime t) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tintinst_make(i, MEOSConvert.ToTimestampTz(t))); + + } +} diff --git a/MEOS.NET/Types/Generated/TIntSeq.g.cs b/MEOS.NET/Types/Generated/TIntSeq.g.cs new file mode 100644 index 0000000..64102ca --- /dev/null +++ b/MEOS.NET/Types/Generated/TIntSeq.g.cs @@ -0,0 +1,21 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TInt of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TIntSeq : TInt + { + internal TIntSeq(IntPtr ptr) : base(ptr) { } + + public static Temporal? FromBaseTstzset(int i, Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tintseq_from_base_tstzset(i, s.Ptr)); + + public static Temporal? FromBaseTstzspan(int i, Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tintseq_from_base_tstzspan(i, s.Ptr)); + + } +} diff --git a/MEOS.NET/Types/Generated/TIntSeqSet.g.cs b/MEOS.NET/Types/Generated/TIntSeqSet.g.cs new file mode 100644 index 0000000..399f528 --- /dev/null +++ b/MEOS.NET/Types/Generated/TIntSeqSet.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TInt of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TIntSeqSet : TInt + { + internal TIntSeqSet(IntPtr ptr) : base(ptr) { } + + public static Temporal? FromBaseTstzspanset(int i, SpanSet ss) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tintseqset_from_base_tstzspanset(i, ss.Ptr)); + + } +} diff --git a/MEOS.NET/Types/Generated/TJsonb.g.cs b/MEOS.NET/Types/Generated/TJsonb.g.cs new file mode 100644 index 0000000..89873e1 --- /dev/null +++ b/MEOS.NET/Types/Generated/TJsonb.g.cs @@ -0,0 +1,39 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TJsonb class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TJsonb : TAlpha + { + internal TJsonb(IntPtr ptr) : base(ptr) { } + + public Temporal? ArrayLength() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tjsonb_array_length(this.Ptr)); + + public Temporal? DeleteIndex(int idx) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tjsonb_delete_index(this.Ptr, idx)); + + public string Out() + => MEOSExposedFunctions.tjsonb_out(this.Ptr); + + public Temporal? Pretty() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tjsonb_pretty(this.Ptr)); + + public Temporal? StripNulls(bool strip_in_arrays) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tjsonb_strip_nulls(this.Ptr, strip_in_arrays)); + + public Temporal? ToTtext() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tjsonb_to_ttext(this.Ptr)); + + public static Temporal? FromMFJSON(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tjsonb_from_mfjson(str)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tjsonb_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TJsonbInst.g.cs b/MEOS.NET/Types/Generated/TJsonbInst.g.cs new file mode 100644 index 0000000..ccc7cc3 --- /dev/null +++ b/MEOS.NET/Types/Generated/TJsonbInst.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TJsonb of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TJsonbInst : TJsonb + { + internal TJsonbInst(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TJsonbSeq.g.cs b/MEOS.NET/Types/Generated/TJsonbSeq.g.cs new file mode 100644 index 0000000..3dc821d --- /dev/null +++ b/MEOS.NET/Types/Generated/TJsonbSeq.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TJsonb of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TJsonbSeq : TJsonb + { + internal TJsonbSeq(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TJsonbSeqSet.g.cs b/MEOS.NET/Types/Generated/TJsonbSeqSet.g.cs new file mode 100644 index 0000000..51932ac --- /dev/null +++ b/MEOS.NET/Types/Generated/TJsonbSeqSet.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TJsonb of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TJsonbSeqSet : TJsonb + { + internal TJsonbSeqSet(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TNpoint.g.cs b/MEOS.NET/Types/Generated/TNpoint.g.cs new file mode 100644 index 0000000..0ebd8ab --- /dev/null +++ b/MEOS.NET/Types/Generated/TNpoint.g.cs @@ -0,0 +1,54 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TNpoint class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TNpoint : TSpatial + { + internal TNpoint(IntPtr ptr) : base(ptr) { } + + public Temporal? AtNpointset(Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnpoint_at_npointset(this.Ptr, s.Ptr)); + + public Temporal? AtStbox(STBox box, bool border_inc) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnpoint_at_stbox(this.Ptr, box.Ptr, border_inc)); + + public Temporal? CumulativeLength() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnpoint_cumulative_length(this.Ptr)); + + public double Length() + => MEOSExposedFunctions.tnpoint_length(this.Ptr); + + public Temporal? MinusNpointset(Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnpoint_minus_npointset(this.Ptr, s.Ptr)); + + public Temporal? MinusStbox(STBox box, bool border_inc) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnpoint_minus_stbox(this.Ptr, box.Ptr, border_inc)); + + public new string Out(int maxdd) + => MEOSExposedFunctions.tnpoint_out(this.Ptr, maxdd); + + public long Route() + => MEOSExposedFunctions.tnpoint_route(this.Ptr); + + public Set? Routes() + => MEOSFactory.WrapSet(MEOSExposedFunctions.tnpoint_routes(this.Ptr)); + + public Temporal? Speed() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnpoint_speed(this.Ptr)); + + public Temporal? ToTgeompoint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnpoint_to_tgeompoint(this.Ptr)); + + public static Temporal? FromMFJSON(string mfjson) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnpoint_from_mfjson(mfjson)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnpoint_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TNpointInst.g.cs b/MEOS.NET/Types/Generated/TNpointInst.g.cs new file mode 100644 index 0000000..916cf25 --- /dev/null +++ b/MEOS.NET/Types/Generated/TNpointInst.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TNpoint of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TNpointInst : TNpoint + { + internal TNpointInst(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TNpointSeq.g.cs b/MEOS.NET/Types/Generated/TNpointSeq.g.cs new file mode 100644 index 0000000..0909f33 --- /dev/null +++ b/MEOS.NET/Types/Generated/TNpointSeq.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TNpoint of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TNpointSeq : TNpoint + { + internal TNpointSeq(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TNpointSeqSet.g.cs b/MEOS.NET/Types/Generated/TNpointSeqSet.g.cs new file mode 100644 index 0000000..5e131fd --- /dev/null +++ b/MEOS.NET/Types/Generated/TNpointSeqSet.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TNpoint of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TNpointSeqSet : TNpoint + { + internal TNpointSeqSet(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TNumber.g.cs b/MEOS.NET/Types/Generated/TNumber.g.cs new file mode 100644 index 0000000..abd996a --- /dev/null +++ b/MEOS.NET/Types/Generated/TNumber.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// Temporal numbers; supports linear interpolation. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TNumber : Temporal + { + internal TNumber(IntPtr ptr) : base(ptr) { } + + public Temporal? Abs() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnumber_abs(this.Ptr)); + + public Temporal? AngularDifference() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnumber_angular_difference(this.Ptr)); + + public Temporal? AtSpan(Span span) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnumber_at_span(this.Ptr, span.Ptr)); + + public Temporal? AtSpanset(SpanSet ss) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnumber_at_spanset(this.Ptr, ss.Ptr)); + + public Temporal? AtTbox(TBox box) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnumber_at_tbox(this.Ptr, box.Ptr)); + + public Temporal? DeltaValue() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnumber_delta_value(this.Ptr)); + + public double Integral() + => MEOSExposedFunctions.tnumber_integral(this.Ptr); + + public Temporal? MinusSpan(Span span) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnumber_minus_span(this.Ptr, span.Ptr)); + + public Temporal? MinusSpanset(SpanSet ss) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnumber_minus_spanset(this.Ptr, ss.Ptr)); + + public Temporal? MinusTbox(TBox box) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnumber_minus_tbox(this.Ptr, box.Ptr)); + + public Span? ToSpan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.tnumber_to_span(this.Ptr)); + + public TBox? ToTbox() + => MEOSFactory.WrapTBox(MEOSExposedFunctions.tnumber_to_tbox(this.Ptr)); + + public Temporal? Trend() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tnumber_trend(this.Ptr)); + + public double Twavg() + => MEOSExposedFunctions.tnumber_twavg(this.Ptr); + + public SpanSet? Valuespans() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.tnumber_valuespans(this.Ptr)); + + } +} diff --git a/MEOS.NET/Types/Generated/TPoint.g.cs b/MEOS.NET/Types/Generated/TPoint.g.cs new file mode 100644 index 0000000..b1349e2 --- /dev/null +++ b/MEOS.NET/Types/Generated/TPoint.g.cs @@ -0,0 +1,51 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// Temporal points. API-level intermediate (C predicate tpoint_type + the tpoint_* method family); NOT drawn in the manual Figure 7.1 (a conceptual diagram) but required so the tpoint_* methods bind to a class — see correction OM-M6. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TPoint : TGeo + { + internal TPoint(IntPtr ptr) : base(ptr) { } + + public Temporal? AngularDifference() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpoint_angular_difference(this.Ptr)); + + public Temporal? AtElevation(Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpoint_at_elevation(this.Ptr, s.Ptr)); + + public Temporal? Azimuth() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpoint_azimuth(this.Ptr)); + + public Temporal? CumulativeLength() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpoint_cumulative_length(this.Ptr)); + + public Temporal? GetX() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpoint_get_x(this.Ptr)); + + public Temporal? GetY() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpoint_get_y(this.Ptr)); + + public Temporal? GetZ() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpoint_get_z(this.Ptr)); + + public bool IsSimple() + => MEOSExposedFunctions.tpoint_is_simple(this.Ptr); + + public double Length() + => MEOSExposedFunctions.tpoint_length(this.Ptr); + + public Temporal?[] MakeSimple() + => MEOSFactory.WrapTemporalArray(MEOSExposedFunctions.tpoint_make_simple(this.Ptr)); + + public Temporal? MinusElevation(Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpoint_minus_elevation(this.Ptr, s.Ptr)); + + public Temporal? Speed() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpoint_speed(this.Ptr)); + + } +} diff --git a/MEOS.NET/Types/Generated/TPose.g.cs b/MEOS.NET/Types/Generated/TPose.g.cs new file mode 100644 index 0000000..f0c73a9 --- /dev/null +++ b/MEOS.NET/Types/Generated/TPose.g.cs @@ -0,0 +1,75 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TPose class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TPose : TSpatial + { + internal TPose(IntPtr ptr) : base(ptr) { } + + public Temporal? AngularSpeed() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_angular_speed(this.Ptr)); + + public string AsGeopose(int conformance, int precision) + => MEOSExposedFunctions.tpose_as_geopose(this.Ptr, conformance, precision); + + public string AsGeoposeStream(int precision) + => MEOSExposedFunctions.tpose_as_geopose_stream(this.Ptr, precision); + + public string AsGeoposeStreamElement(Temporal inst, int precision) + => MEOSExposedFunctions.tpose_as_geopose_stream_element(this.Ptr, inst.Ptr, precision); + + public Temporal? AtElevation(Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_at_elevation(this.Ptr, s.Ptr)); + + public Temporal? AtStbox(STBox box, bool border_inc) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_at_stbox(this.Ptr, box.Ptr, border_inc)); + + public Temporal? ComposeTpose(Temporal frame) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_compose_tpose(this.Ptr, frame.Ptr)); + + public Temporal? Inverse() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_inverse(this.Ptr)); + + public Temporal? Make(Temporal ttheta) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_make(this.Ptr, ttheta.Ptr)); + + public Temporal? MinusElevation(Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_minus_elevation(this.Ptr, s.Ptr)); + + public Temporal? MinusStbox(STBox box, bool border_inc) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_minus_stbox(this.Ptr, box.Ptr, border_inc)); + + public Temporal? Pitch() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_pitch(this.Ptr)); + + public Set? Points() + => MEOSFactory.WrapSet(MEOSExposedFunctions.tpose_points(this.Ptr)); + + public Temporal? Roll() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_roll(this.Ptr)); + + public Temporal? Speed() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_speed(this.Ptr)); + + public Temporal? ToTpoint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_to_tpoint(this.Ptr)); + + public Temporal? Yaw() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_yaw(this.Ptr)); + + public static Temporal? FromGeopose(string json) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_from_geopose(json)); + + public static Temporal? FromMFJSON(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_from_mfjson(str)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tpose_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TPoseInst.g.cs b/MEOS.NET/Types/Generated/TPoseInst.g.cs new file mode 100644 index 0000000..e75625b --- /dev/null +++ b/MEOS.NET/Types/Generated/TPoseInst.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TPose of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TPoseInst : TPose + { + internal TPoseInst(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TPoseSeq.g.cs b/MEOS.NET/Types/Generated/TPoseSeq.g.cs new file mode 100644 index 0000000..2516399 --- /dev/null +++ b/MEOS.NET/Types/Generated/TPoseSeq.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TPose of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TPoseSeq : TPose + { + internal TPoseSeq(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TPoseSeqSet.g.cs b/MEOS.NET/Types/Generated/TPoseSeqSet.g.cs new file mode 100644 index 0000000..50635c2 --- /dev/null +++ b/MEOS.NET/Types/Generated/TPoseSeqSet.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TPose of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TPoseSeqSet : TPose + { + internal TPoseSeqSet(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TRGeometry.g.cs b/MEOS.NET/Types/Generated/TRGeometry.g.cs new file mode 100644 index 0000000..2c0dc9c --- /dev/null +++ b/MEOS.NET/Types/Generated/TRGeometry.g.cs @@ -0,0 +1,183 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TRGeometry class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TRGeometry : TSpatial + { + internal TRGeometry(IntPtr ptr) : base(ptr) { } + + public new Temporal? AfterTimestamptz(DateTime t, bool strict) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_after_timestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t), strict)); + + public Temporal? AngularSpeed() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_angular_speed(this.Ptr)); + + public new Temporal? AppendTsequence(Temporal seq, bool expand) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_append_tsequence(this.Ptr, seq.Ptr, expand)); + + public new string AsEWKT(int maxdd) + => MEOSExposedFunctions.trgeometry_as_ewkt(this.Ptr, maxdd); + + public new string AsText(int maxdd) + => MEOSExposedFunctions.trgeometry_as_text(this.Ptr, maxdd); + + public new Temporal? AsTinstant() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_as_tinstant(this.Ptr)); + + public Temporal? AsTsequence(string interp_str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_as_tsequence(this.Ptr, interp_str)); + + public Temporal? AsTsequenceset(string interp_str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_as_tsequenceset(this.Ptr, interp_str)); + + public Temporal? AtElevation(Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_at_elevation(this.Ptr, s.Ptr)); + + public Temporal? AtStbox(STBox box, bool border_inc) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_at_stbox(this.Ptr, box.Ptr, border_inc)); + + public new Temporal? AtTimestamptz(DateTime t) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_at_timestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t))); + + public new Temporal? AtTstzset(Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_at_tstzset(this.Ptr, s.Ptr)); + + public new Temporal? AtTstzspan(Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_at_tstzspan(this.Ptr, s.Ptr)); + + public new Temporal? AtTstzspanset(SpanSet ss) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_at_tstzspanset(this.Ptr, ss.Ptr)); + + public new Temporal? AtValues(Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_at_values(this.Ptr, s.Ptr)); + + public new Temporal? BeforeTimestamptz(DateTime t, bool strict) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_before_timestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t), strict)); + + public Temporal? Centroid() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_centroid(this.Ptr)); + + public Temporal? CumulativeLength() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_cumulative_length(this.Ptr)); + + public new Temporal? DeleteTimestamptz(DateTime t, bool connect) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_delete_timestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t), connect)); + + public new Temporal? DeleteTstzset(Set s, bool connect) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_delete_tstzset(this.Ptr, s.Ptr, connect)); + + public new Temporal? DeleteTstzspan(Span s, bool connect) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_delete_tstzspan(this.Ptr, s.Ptr, connect)); + + public new Temporal? DeleteTstzspanset(SpanSet ss, bool connect) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_delete_tstzspanset(this.Ptr, ss.Ptr, connect)); + + public new double DyntimewarpDistance(Temporal temp2) + => MEOSExposedFunctions.trgeometry_dyntimewarp_distance(this.Ptr, temp2.Ptr); + + public new Temporal? EndInstant() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_end_instant(this.Ptr)); + + public new Temporal? EndSequence() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_end_sequence(this.Ptr)); + + public new double FrechetDistance(Temporal temp2) + => MEOSExposedFunctions.trgeometry_frechet_distance(this.Ptr, temp2.Ptr); + + public new double HausdorffDistance(Temporal temp2) + => MEOSExposedFunctions.trgeometry_hausdorff_distance(this.Ptr, temp2.Ptr); + + public new Temporal? InstantN(int n) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_instant_n(this.Ptr, n)); + + public new Temporal?[] Instants() + => MEOSFactory.WrapTemporalArray(MEOSExposedFunctions.trgeometry_instants(this.Ptr)); + + public double Length() + => MEOSExposedFunctions.trgeometry_length(this.Ptr); + + public new Temporal? Merge(Temporal temp2) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_merge(this.Ptr, temp2.Ptr)); + + public Temporal? MinusElevation(Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_minus_elevation(this.Ptr, s.Ptr)); + + public Temporal? MinusStbox(STBox box, bool border_inc) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_minus_stbox(this.Ptr, box.Ptr, border_inc)); + + public new Temporal? MinusTimestamptz(DateTime t) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_minus_timestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t))); + + public new Temporal? MinusTstzset(Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_minus_tstzset(this.Ptr, s.Ptr)); + + public new Temporal? MinusTstzspan(Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_minus_tstzspan(this.Ptr, s.Ptr)); + + public new Temporal? MinusTstzspanset(SpanSet ss) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_minus_tstzspanset(this.Ptr, ss.Ptr)); + + public new Temporal? MinusValues(Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_minus_values(this.Ptr, s.Ptr)); + + public string Out() + => MEOSExposedFunctions.trgeometry_out(this.Ptr); + + public Temporal? Pitch() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_pitch(this.Ptr)); + + public Set? Points() + => MEOSFactory.WrapSet(MEOSExposedFunctions.trgeometry_points(this.Ptr)); + + public Temporal? Roll() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_roll(this.Ptr)); + + public new Temporal? Round(int maxdd) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_round(this.Ptr, maxdd)); + + public new Temporal?[] Segments() + => MEOSFactory.WrapTemporalArray(MEOSExposedFunctions.trgeometry_segments(this.Ptr)); + + public new Temporal? SequenceN(int i) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_sequence_n(this.Ptr, i)); + + public new Temporal?[] Sequences() + => MEOSFactory.WrapTemporalArray(MEOSExposedFunctions.trgeometry_sequences(this.Ptr)); + + public new Temporal? SetInterp(InterpolationType interp) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_set_interp(this.Ptr, (int) interp)); + + public Temporal? Speed() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_speed(this.Ptr)); + + public new Temporal? StartInstant() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_start_instant(this.Ptr)); + + public new Temporal? StartSequence() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_start_sequence(this.Ptr)); + + public Temporal? ToTgeometry() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_to_tgeometry(this.Ptr)); + + public Temporal? ToTgeompoint() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_to_tgeompoint(this.Ptr)); + + public Temporal? ToTpose() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_to_tpose(this.Ptr)); + + public Temporal? Yaw() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_yaw(this.Ptr)); + + public static Temporal? FromMFJSON(string mfjson) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_from_mfjson(mfjson)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.trgeometry_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TRGeometryInst.g.cs b/MEOS.NET/Types/Generated/TRGeometryInst.g.cs new file mode 100644 index 0000000..176af5b --- /dev/null +++ b/MEOS.NET/Types/Generated/TRGeometryInst.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TRGeometry of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TRGeometryInst : TRGeometry + { + internal TRGeometryInst(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TRGeometrySeq.g.cs b/MEOS.NET/Types/Generated/TRGeometrySeq.g.cs new file mode 100644 index 0000000..e588435 --- /dev/null +++ b/MEOS.NET/Types/Generated/TRGeometrySeq.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TRGeometry of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TRGeometrySeq : TRGeometry + { + internal TRGeometrySeq(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TRGeometrySeqSet.g.cs b/MEOS.NET/Types/Generated/TRGeometrySeqSet.g.cs new file mode 100644 index 0000000..8251af4 --- /dev/null +++ b/MEOS.NET/Types/Generated/TRGeometrySeqSet.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TRGeometry of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TRGeometrySeqSet : TRGeometry + { + internal TRGeometrySeqSet(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TSequence.g.cs b/MEOS.NET/Types/Generated/TSequence.g.cs new file mode 100644 index 0000000..ca4c5fd --- /dev/null +++ b/MEOS.NET/Types/Generated/TSequence.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TSequence class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TSequence : Temporal + { + internal TSequence(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TSequenceSet.g.cs b/MEOS.NET/Types/Generated/TSequenceSet.g.cs new file mode 100644 index 0000000..768f56f --- /dev/null +++ b/MEOS.NET/Types/Generated/TSequenceSet.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TSequenceSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TSequenceSet : Temporal + { + internal TSequenceSet(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TSpatial.g.cs b/MEOS.NET/Types/Generated/TSpatial.g.cs new file mode 100644 index 0000000..08f4b4e --- /dev/null +++ b/MEOS.NET/Types/Generated/TSpatial.g.cs @@ -0,0 +1,39 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// Temporal types carrying an STBox spatial bounding box. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TSpatial : Temporal + { + internal TSpatial(IntPtr ptr) : base(ptr) { } + + public string AsEWKT(int maxdd) + => MEOSExposedFunctions.tspatial_as_ewkt(this.Ptr, maxdd); + + public string AsText(int maxdd) + => MEOSExposedFunctions.tspatial_as_text(this.Ptr, maxdd); + + public string Out(int maxdd) + => MEOSExposedFunctions.tspatial_out(this.Ptr, maxdd); + + public int SRID() + => MEOSExposedFunctions.tspatial_srid(this.Ptr); + + public Temporal? SetSRID(int srid) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tspatial_set_srid(this.Ptr, srid)); + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.tspatial_to_stbox(this.Ptr)); + + public Temporal? Transform(int srid) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tspatial_transform(this.Ptr, srid)); + + public Temporal? TransformPipeline(string pipelinestr, int srid, bool is_forward) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.tspatial_transform_pipeline(this.Ptr, pipelinestr, srid, is_forward)); + + } +} diff --git a/MEOS.NET/Types/Generated/TText.g.cs b/MEOS.NET/Types/Generated/TText.g.cs new file mode 100644 index 0000000..9994fd7 --- /dev/null +++ b/MEOS.NET/Types/Generated/TText.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TText class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TText : TAlpha + { + internal TText(IntPtr ptr) : base(ptr) { } + + public Temporal? Initcap() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.ttext_initcap(this.Ptr)); + + public Temporal? Lower() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.ttext_lower(this.Ptr)); + + public string Out() + => MEOSExposedFunctions.ttext_out(this.Ptr); + + public Temporal? ToTjsonb() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.ttext_to_tjsonb(this.Ptr)); + + public Temporal? Upper() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.ttext_upper(this.Ptr)); + + public static Temporal? FromMFJSON(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.ttext_from_mfjson(str)); + + public static Temporal? In(string str) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.ttext_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TTextInst.g.cs b/MEOS.NET/Types/Generated/TTextInst.g.cs new file mode 100644 index 0000000..61955d1 --- /dev/null +++ b/MEOS.NET/Types/Generated/TTextInst.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TText of subtype TInstant. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TTextInst : TText + { + internal TTextInst(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TTextSeq.g.cs b/MEOS.NET/Types/Generated/TTextSeq.g.cs new file mode 100644 index 0000000..422ccb4 --- /dev/null +++ b/MEOS.NET/Types/Generated/TTextSeq.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TText of subtype TSequence. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TTextSeq : TText + { + internal TTextSeq(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/TTextSeqSet.g.cs b/MEOS.NET/Types/Generated/TTextSeqSet.g.cs new file mode 100644 index 0000000..201add8 --- /dev/null +++ b/MEOS.NET/Types/Generated/TTextSeqSet.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// A TText of subtype TSequenceSet. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TTextSeqSet : TText + { + internal TTextSeqSet(IntPtr ptr) : base(ptr) { } + + } +} diff --git a/MEOS.NET/Types/Generated/Temporal.g.cs b/MEOS.NET/Types/Generated/Temporal.g.cs new file mode 100644 index 0000000..41b2c29 --- /dev/null +++ b/MEOS.NET/Types/Generated/Temporal.g.cs @@ -0,0 +1,240 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// Superclass of every temporal type; temporal_* functions are late-bound over `subtype` and `temptype`. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class Temporal : MEOSObject + { + internal Temporal(IntPtr ptr) : base(ptr) { } + + public Temporal? AfterTimestamptz(DateTime t, bool strict) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_after_timestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t), strict)); + + public Temporal? AppendTsequence(Temporal seq, bool expand) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_append_tsequence(this.Ptr, seq.Ptr, expand)); + + public string AsMFJSON(bool with_bbox, int flags, int precision, string srs) + => MEOSExposedFunctions.temporal_as_mfjson(this.Ptr, with_bbox, flags, precision, srs); + + public Temporal? AsTinstant() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_as_tinstant(this.Ptr)); + + public Temporal? AsTsequence(InterpolationType interp) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_as_tsequence(this.Ptr, (int) interp)); + + public Temporal? AsTsequenceset(InterpolationType interp) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_as_tsequenceset(this.Ptr, (int) interp)); + + public Temporal? AtMax() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_at_max(this.Ptr)); + + public Temporal? AtMin() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_at_min(this.Ptr)); + + public Temporal? AtTimestamptz(DateTime t) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_at_timestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t))); + + public Temporal? AtTstzset(Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_at_tstzset(this.Ptr, s.Ptr)); + + public Temporal? AtTstzspan(Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_at_tstzspan(this.Ptr, s.Ptr)); + + public Temporal? AtTstzspanset(SpanSet ss) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_at_tstzspanset(this.Ptr, ss.Ptr)); + + public Temporal? AtValues(Set set) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_at_values(this.Ptr, set.Ptr)); + + public double AverageHausdorffDistance(Temporal temp2) + => MEOSExposedFunctions.temporal_average_hausdorff_distance(this.Ptr, temp2.Ptr); + + public string? BasetypeName() + => MEOSExposedFunctions.temporal_basetype_name(this.Ptr); + + public Temporal? BeforeTimestamptz(DateTime t, bool strict) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_before_timestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t), strict)); + + public int Cmp(Temporal temp2) + => MEOSExposedFunctions.temporal_cmp(this.Ptr, temp2.Ptr); + + public Temporal? Copy() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_copy(this.Ptr)); + + public Temporal? DeleteTimestamptz(DateTime t, bool connect) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_delete_timestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t), connect)); + + public Temporal? DeleteTstzset(Set s, bool connect) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_delete_tstzset(this.Ptr, s.Ptr, connect)); + + public Temporal? DeleteTstzspan(Span s, bool connect) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_delete_tstzspan(this.Ptr, s.Ptr, connect)); + + public Temporal? DeleteTstzspanset(SpanSet ss, bool connect) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_delete_tstzspanset(this.Ptr, ss.Ptr, connect)); + + public Temporal? Derivative() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_derivative(this.Ptr)); + + public double DyntimewarpDistance(Temporal temp2) + => MEOSExposedFunctions.temporal_dyntimewarp_distance(this.Ptr, temp2.Ptr); + + public Temporal? EndInstant() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_end_instant(this.Ptr)); + + public Temporal? EndSequence() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_end_sequence(this.Ptr)); + + public DateTime EndTimestamptz() + => MEOSConvert.ToDateTime(MEOSExposedFunctions.temporal_end_timestamptz(this.Ptr)); + + public bool Eq(Temporal temp2) + => MEOSExposedFunctions.temporal_eq(this.Ptr, temp2.Ptr); + + public Temporal? ExtKalmanFilter(double gate, double q, double variance, bool to_drop) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_ext_kalman_filter(this.Ptr, gate, q, variance, to_drop)); + + public double FrechetDistance(Temporal temp2) + => MEOSExposedFunctions.temporal_frechet_distance(this.Ptr, temp2.Ptr); + + public bool Ge(Temporal temp2) + => MEOSExposedFunctions.temporal_ge(this.Ptr, temp2.Ptr); + + public bool Gt(Temporal temp2) + => MEOSExposedFunctions.temporal_gt(this.Ptr, temp2.Ptr); + + public uint Hash() + => MEOSExposedFunctions.temporal_hash(this.Ptr); + + public ulong HashExtended(ulong seed) + => MEOSExposedFunctions.temporal_hash_extended(this.Ptr, seed); + + public double HausdorffDistance(Temporal temp2) + => MEOSExposedFunctions.temporal_hausdorff_distance(this.Ptr, temp2.Ptr); + + public Temporal? Insert(Temporal temp2, bool connect) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_insert(this.Ptr, temp2.Ptr, connect)); + + public Temporal? InstantN(int n) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_instant_n(this.Ptr, n)); + + public Temporal?[] Instants() + => MEOSFactory.WrapTemporalArray(MEOSExposedFunctions.temporal_instants(this.Ptr)); + + public string? Interp() + => MEOSExposedFunctions.temporal_interp(this.Ptr); + + public double LcssDistance(Temporal temp2, double epsilon) + => MEOSExposedFunctions.temporal_lcss_distance(this.Ptr, temp2.Ptr, epsilon); + + public bool Le(Temporal temp2) + => MEOSExposedFunctions.temporal_le(this.Ptr, temp2.Ptr); + + public bool LowerInc() + => MEOSExposedFunctions.temporal_lower_inc(this.Ptr); + + public bool Lt(Temporal temp2) + => MEOSExposedFunctions.temporal_lt(this.Ptr, temp2.Ptr); + + public Temporal? MaxInstant() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_max_instant(this.Ptr)); + + public Temporal? Merge(Temporal temp2) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_merge(this.Ptr, temp2.Ptr)); + + public Temporal? MinInstant() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_min_instant(this.Ptr)); + + public Temporal? MinusMax() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_minus_max(this.Ptr)); + + public Temporal? MinusMin() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_minus_min(this.Ptr)); + + public Temporal? MinusTimestamptz(DateTime t) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_minus_timestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t))); + + public Temporal? MinusTstzset(Set s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_minus_tstzset(this.Ptr, s.Ptr)); + + public Temporal? MinusTstzspan(Span s) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_minus_tstzspan(this.Ptr, s.Ptr)); + + public Temporal? MinusTstzspanset(SpanSet ss) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_minus_tstzspanset(this.Ptr, ss.Ptr)); + + public Temporal? MinusValues(Set set) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_minus_values(this.Ptr, set.Ptr)); + + public bool Ne(Temporal temp2) + => MEOSExposedFunctions.temporal_ne(this.Ptr, temp2.Ptr); + + public int NumInstants() + => MEOSExposedFunctions.temporal_num_instants(this.Ptr); + + public int NumSequences() + => MEOSExposedFunctions.temporal_num_sequences(this.Ptr); + + public int NumTimestamps() + => MEOSExposedFunctions.temporal_num_timestamps(this.Ptr); + + public Temporal? Round(int maxdd) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_round(this.Ptr, maxdd)); + + public Temporal?[] Segments() + => MEOSFactory.WrapTemporalArray(MEOSExposedFunctions.temporal_segments(this.Ptr)); + + public Temporal? SequenceN(int i) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_sequence_n(this.Ptr, i)); + + public Temporal?[] Sequences() + => MEOSFactory.WrapTemporalArray(MEOSExposedFunctions.temporal_sequences(this.Ptr)); + + public Temporal? SetInterp(InterpolationType interp) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_set_interp(this.Ptr, (int) interp)); + + public Temporal? SimplifyDp(double dist, bool synchronized) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_simplify_dp(this.Ptr, dist, synchronized)); + + public Temporal? SimplifyMaxDist(double dist, bool synchronized) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_simplify_max_dist(this.Ptr, dist, synchronized)); + + public Temporal? SimplifyMinDist(double dist) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_simplify_min_dist(this.Ptr, dist)); + + public Temporal? StartInstant() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_start_instant(this.Ptr)); + + public Temporal? StartSequence() + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_start_sequence(this.Ptr)); + + public DateTime StartTimestamptz() + => MEOSConvert.ToDateTime(MEOSExposedFunctions.temporal_start_timestamptz(this.Ptr)); + + public string? Subtype() + => MEOSExposedFunctions.temporal_subtype(this.Ptr); + + public SpanSet? Time() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.temporal_time(this.Ptr)); + + public long[] Timestamps() + => MEOSExposedFunctions.temporal_timestamps(this.Ptr); + + public Span? ToTstzspan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.temporal_to_tstzspan(this.Ptr)); + + public Temporal? Update(Temporal temp2, bool connect) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_update(this.Ptr, temp2.Ptr, connect)); + + public bool UpperInc() + => MEOSExposedFunctions.temporal_upper_inc(this.Ptr); + + public static Temporal? FromHEXWKB(string hexwkb) + => MEOSFactory.WrapTemporal(MEOSExposedFunctions.temporal_from_hexwkb(hexwkb)); + + } +} diff --git a/MEOS.NET/Types/Generated/TextSet.g.cs b/MEOS.NET/Types/Generated/TextSet.g.cs new file mode 100644 index 0000000..f7321f1 --- /dev/null +++ b/MEOS.NET/Types/Generated/TextSet.g.cs @@ -0,0 +1,30 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TextSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TextSet : Set + { + internal TextSet(IntPtr ptr) : base(ptr) { } + + public Set? Initcap() + => MEOSFactory.WrapSet(MEOSExposedFunctions.textset_initcap(this.Ptr)); + + public Set? Lower() + => MEOSFactory.WrapSet(MEOSExposedFunctions.textset_lower(this.Ptr)); + + public string Out() + => MEOSExposedFunctions.textset_out(this.Ptr); + + public Set? Upper() + => MEOSFactory.WrapSet(MEOSExposedFunctions.textset_upper(this.Ptr)); + + public static Set? In(string str) + => MEOSFactory.WrapSet(MEOSExposedFunctions.textset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TsTzSet.g.cs b/MEOS.NET/Types/Generated/TsTzSet.g.cs new file mode 100644 index 0000000..7f7bb7c --- /dev/null +++ b/MEOS.NET/Types/Generated/TsTzSet.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TsTzSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TsTzSet : Set + { + internal TsTzSet(IntPtr ptr) : base(ptr) { } + + public DateTime EndValue() + => MEOSConvert.ToDateTime(MEOSExposedFunctions.tstzset_end_value(this.Ptr)); + + public string Out() + => MEOSExposedFunctions.tstzset_out(this.Ptr); + + public DateTime StartValue() + => MEOSConvert.ToDateTime(MEOSExposedFunctions.tstzset_start_value(this.Ptr)); + + public Set? ToDateset() + => MEOSFactory.WrapSet(MEOSExposedFunctions.tstzset_to_dateset(this.Ptr)); + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.tstzset_to_stbox(this.Ptr)); + + public long[] Values() + => MEOSExposedFunctions.tstzset_values(this.Ptr); + + public static Set? In(string str) + => MEOSFactory.WrapSet(MEOSExposedFunctions.tstzset_in(str)); + + } +} diff --git a/MEOS.NET/Types/Generated/TsTzSpan.g.cs b/MEOS.NET/Types/Generated/TsTzSpan.g.cs new file mode 100644 index 0000000..6b554ef --- /dev/null +++ b/MEOS.NET/Types/Generated/TsTzSpan.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TsTzSpan class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TsTzSpan : Span + { + internal TsTzSpan(IntPtr ptr) : base(ptr) { } + + public DateTime Lower() + => MEOSConvert.ToDateTime(MEOSExposedFunctions.tstzspan_lower(this.Ptr)); + + public string Out() + => MEOSExposedFunctions.tstzspan_out(this.Ptr); + + public Span? ToDatespan() + => MEOSFactory.WrapSpan(MEOSExposedFunctions.tstzspan_to_datespan(this.Ptr)); + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.tstzspan_to_stbox(this.Ptr)); + + public DateTime Upper() + => MEOSConvert.ToDateTime(MEOSExposedFunctions.tstzspan_upper(this.Ptr)); + + public static Span? In(string str) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.tstzspan_in(str)); + + public static Span? Make(DateTime lower, DateTime upper, bool lower_inc, bool upper_inc) + => MEOSFactory.WrapSpan(MEOSExposedFunctions.tstzspan_make(MEOSConvert.ToTimestampTz(lower), MEOSConvert.ToTimestampTz(upper), lower_inc, upper_inc)); + + } +} diff --git a/MEOS.NET/Types/Generated/TsTzSpanSet.g.cs b/MEOS.NET/Types/Generated/TsTzSpanSet.g.cs new file mode 100644 index 0000000..7c4d0bb --- /dev/null +++ b/MEOS.NET/Types/Generated/TsTzSpanSet.g.cs @@ -0,0 +1,45 @@ +#nullable enable + +using MEOS.NET.Enums; +using MEOS.NET.Internal; + +namespace MEOS.NET.Types.Generated +{ + /// The TsTzSpanSet class of the MEOS object model. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class TsTzSpanSet : SpanSet + { + internal TsTzSpanSet(IntPtr ptr) : base(ptr) { } + + public DateTime EndTimestamptz() + => MEOSConvert.ToDateTime(MEOSExposedFunctions.tstzspanset_end_timestamptz(this.Ptr)); + + public DateTime Lower() + => MEOSConvert.ToDateTime(MEOSExposedFunctions.tstzspanset_lower(this.Ptr)); + + public int NumTimestamps() + => MEOSExposedFunctions.tstzspanset_num_timestamps(this.Ptr); + + public string Out() + => MEOSExposedFunctions.tstzspanset_out(this.Ptr); + + public DateTime StartTimestamptz() + => MEOSConvert.ToDateTime(MEOSExposedFunctions.tstzspanset_start_timestamptz(this.Ptr)); + + public Set? Timestamps() + => MEOSFactory.WrapSet(MEOSExposedFunctions.tstzspanset_timestamps(this.Ptr)); + + public SpanSet? ToDatespanset() + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.tstzspanset_to_datespanset(this.Ptr)); + + public STBox? ToStbox() + => MEOSFactory.WrapSTBox(MEOSExposedFunctions.tstzspanset_to_stbox(this.Ptr)); + + public DateTime Upper() + => MEOSConvert.ToDateTime(MEOSExposedFunctions.tstzspanset_upper(this.Ptr)); + + public static SpanSet? In(string str) + => MEOSFactory.WrapSpanSet(MEOSExposedFunctions.tstzspanset_in(str)); + + } +} diff --git a/tools/README.md b/tools/README.md index da8b136..9d9963b 100644 --- a/tools/README.md +++ b/tools/README.md @@ -4,6 +4,10 @@ `MEOS.NET/Internal/MEOSExposedFunctions.cs` from MobilityDB/MEOS-API's unified `meos-idl.json` catalog. +`objectgen.py` regenerates `MEOS.NET/Types/Generated/*.g.cs` — the object +layer — from the same catalog's `objectModel`, which is the ecosystem-wide +source of truth for the class hierarchy implicit in MEOS. + This replaces the previous regex-based `MEOS.NET.Builder` workflow, which had known parse defects (e.g. `int32_t srid` rendered as `int_t srid`, single-line-only regex, hardcoded developer DllPath). @@ -23,13 +27,17 @@ single-line-only regex, hardcoded developer DllPath). python run.py # emits output/meos-idl.json ``` -2. Run the generator from this repo: +2. Run the generators from this repo: ``` python3 tools/codegen.py /path/to/meos-idl.json + python3 tools/objectgen.py /path/to/meos-idl.json --report ``` The two `.cs` files under `MEOS.NET/Internal/` are overwritten in place -with bindings for every public MEOS function in the catalog. +with bindings for every public MEOS function in the catalog, and +`MEOS.NET/Types/Generated/` is rewritten with one class per object-model +class. `--report` lists, per class, every method the object layer leaves +to the raw binding and why. ## DllPath @@ -42,6 +50,30 @@ generator: python3 tools/codegen.py /path/to/meos-idl.json --dll-path libmeos.so.1 ``` +## The object layer + +One C# class per `objectModel.classes` entry, inheriting along the model's +own parent edges: the temporal lattice under `Temporal`, the `Set`/`Span`/ +`SpanSet` collections under `Collection`, and `TBox`/`STBox` under `Box`. A +concrete class is the product leaf x subtype — `TFloatSeq`, `TGeomPointInst` +— and inherits its leaf, which carries the larger surface. + +Every method delegates to the `MEOSExposedFunctions` wrapper of the function +the model assigns it, reading that wrapper's signature from `codegen.py` so +the two generators cannot disagree about a folded out-parameter. A returned +MEOS pointer goes through `MEOSFactory`, which reads the discriminator the +catalog's own struct layout puts in the value's header — `Temporal.temptype` +and `Temporal.subtype`, `Set.settype`, `Span.spantype`, +`SpanSet.spansettype` — and hands back the exact class. Every temporal +struct starts with the Temporal header, so a `TInstant *` or `TSequence *` +return is a `Temporal` at the surface whose runtime class is the concrete +one. + +A method whose marshalling the layer does not emit — a `GSERIALIZED *` +geometry, an `Interval *`, a counted array argument, a scalar +out-parameter — is reported by `--report` and left to the raw binding, which +carries every function either way. + ## Type mapping Pointer types of any depth map to `IntPtr`. `char *` parameters with diff --git a/tools/codegen.py b/tools/codegen.py index a4cadf2..5cf0c8d 100755 --- a/tools/codegen.py +++ b/tools/codegen.py @@ -238,6 +238,14 @@ def gen_external_functions(funcs: list[dict]) -> str: return "\n".join(lines) + "\n" +# The public signature each exposed wrapper is emitted with, keyed by function +# name: ``(csharp_return_type, [(csharp_param_type, param_name), ...])``. A +# wrapper's signature is decided by the shape folding below rather than by the +# raw C parameter list, so a second generator over the same catalog reads the +# signature from here instead of re-deriving the folding rules and drifting. +SIGNATURES: dict[str, tuple[str, list[tuple[str, str]]]] = {} + + # Element types we know how to Marshal.Copy from a C array pointer back into # a managed C# array. IntPtr is the fallback for wrapped opaque pointers. _MARSHAL_ELEM: dict[str, str] = { @@ -310,6 +318,7 @@ def _emit_outputs_wrapper(f: dict) -> list[str]: # count from the user-facing signature. output_names = {oa["param"] for oa in output_params} sig_params: list[str] = [] + sig_types: list[tuple[str, str]] = [] ext_call_args: list[str] = [] setup: list[str] = [] teardown: list[str] = [] @@ -335,6 +344,7 @@ def _emit_outputs_wrapper(f: dict) -> list[str]: output_locals.append((local, oa, elem, strategy)) continue sig_params.append(f"{ptype} {pname}") + sig_types.append((ptype, pname)) ext_call_args.append(pname) # Compose the return tuple type. @@ -353,6 +363,7 @@ def _emit_outputs_wrapper(f: dict) -> list[str]: user_params = ", ".join(sig_params) ext_args = ", ".join(ext_call_args) + SIGNATURES[name] = (ret_type, sig_types) lines: list[str] = [] lines.append(f" public static {ret_type} {name}({user_params})") @@ -442,6 +453,7 @@ def _copy(indent: str) -> list[str]: return out if length_meta["kind"] == "accessor": + SIGNATURES[name] = (ret_type, _typed_params(f)) accessor = length_meta["func"] arg = csharp_param_name(length_meta["arg"]) lines = [ @@ -464,6 +476,7 @@ def _copy(indent: str) -> list[str]: call_args = ", ".join( "_cnt" if csharp_param_name(p["name"]) == count_name else csharp_param_name(p["name"]) for p in f["params"]) + SIGNATURES[name] = (ret_type, [t for t in _typed_params(f) if t[1] != count_name]) lines = [ f" public static {ret_type} {name}({pub})", " {", @@ -486,11 +499,13 @@ def _emit_simple_passthrough(f: dict, ext_params: str, ext_args: str, default_rt name = f["name"] rt = default_rt or csharp_return_type(f["returnType"]["c"], f["returnType"]["canonical"]) if default_rt is None and is_borrowed_string(f["returnType"]["c"]): + SIGNATURES[name] = ("string?", _typed_params(f)) return [ f" public static string? {name}({ext_params})", f" => Marshal.PtrToStringUTF8(" f"SafeExecution(() => MEOSExternalFunctions.{name}({ext_args})));", ] + SIGNATURES[name] = (rt, _typed_params(f)) if rt == "void": return [ f" public static void {name}({ext_params})", @@ -541,6 +556,13 @@ def gen_exposed_functions(funcs: list[dict]) -> str: return "\n".join(lines) + "\n" +def _typed_params(f: dict) -> list[tuple[str, str]]: + """The wrapper's parameter list as ``(csharp_type, name)`` pairs, in order.""" + return [(csharp_param_type(p["cType"], p["canonical"]), + csharp_param_name(p["name"]) if p["name"] else "arg") + for p in f.get("params", [])] + + def _format_params(f: dict) -> tuple[str, str]: params: list[str] = [] arg_names: list[str] = [] diff --git a/tools/objectgen.py b/tools/objectgen.py new file mode 100644 index 0000000..7fe5fe0 --- /dev/null +++ b/tools/objectgen.py @@ -0,0 +1,632 @@ +#!/usr/bin/env python3 +# BINDING-HEADER-PARSE-OK: this generator reads only the meos-idl.json catalog, +# never a C header; the catalog is the binding's single source of truth. +"""Generate the MEOS.NET object layer from MEOS-API's meos-idl.json. + +The catalog's ``objectModel`` is the ecosystem-wide source of truth for the class +hierarchy implicit in MEOS: ``lattice`` carries the temporal tree, ``companions`` +the Box and Collection hierarchies, and ``classes..methods`` assigns every +public MEOS function to the class it is a method of, with its canonical camelCase +``ooName``. This generator projects that model onto C#: one class per model class, +inheritance from the model's parent edges, and one method per assigned function +delegating to the ``MEOSExposedFunctions`` wrapper that ``codegen.py`` emits for the +same function. + +The wrapper signatures come from ``codegen.SIGNATURES`` rather than from the raw C +parameter list, so the two generators cannot disagree about a folded out-parameter. + +Usage: + python3 tools/objectgen.py path/to/meos-idl.json [--report] + +Writes MEOS.NET/Types/Generated/*.g.cs, replacing that directory's contents. +""" + +from __future__ import annotations + +import argparse +import json +import shutil +import sys +from collections import defaultdict +from pathlib import Path + +import codegen + +GENERATOR_VERSION = "0.1.0" +NAMESPACE = "MEOS.NET.Types.Generated" + +# The C struct a class's instances are pointers to. Every other class resolves to +# one of these through the model's own hierarchy, so this map holds only the roots +# of each hierarchy plus the template subtypes. +ROOT_CTYPE = { + "Temporal": "Temporal", + "TInstant": "TInstant", + "TSequence": "TSequence", + "TSequenceSet": "TSequenceSet", + "Set": "Set", + "Span": "Span", + "SpanSet": "SpanSet", + "TBox": "TBox", + "STBox": "STBox", +} + +# The C structs that carry the Temporal header and are discriminated by its +# ``subtype`` field. +TEMPORAL_STRUCTS = ("Temporal", "TInstant", "TSequence", "TSequenceSet") + +# The template axis: a concrete class is the product ``. +SUBTYPE_SUFFIX = {"TInstant": "Inst", "TSequence": "Seq", "TSequenceSet": "SeqSet"} + +# C types the object layer passes and returns as C# scalars, keyed by the cleaned +# C spelling. Everything else is either a wrapped class pointer or deferred. +PASSTHROUGH_C = { + "bool", "char", "int", "int8", "int8_t", "uint8", "uint8_t", "int16", "int16_t", + "uint16", "uint16_t", "int32", "int32_t", "uint32", "uint32_t", "int64", + "int64_t", "uint64", "uint64_t", "long", "double", "float", "size_t", + "char *", "void", +} + +RESERVED = { + "abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", + "checked", "class", "const", "continue", "decimal", "default", "delegate", + "do", "double", "else", "enum", "event", "explicit", "extern", "false", + "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", + "in", "int", "interface", "internal", "is", "lock", "long", "namespace", + "new", "null", "object", "operator", "out", "override", "params", "private", + "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", + "short", "sizeof", "stackalloc", "static", "string", "struct", "switch", + "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", + "unsafe", "ushort", "using", "virtual", "void", "volatile", "while", +} + + +def clean(c_type: str) -> str: + """The C type without ``const`` and with single spaces.""" + return " ".join(c_type.replace("const ", "").split()) + + +def pascal(oo_name: str) -> str: + return oo_name[:1].upper() + oo_name[1:] + + +def ident(name: str) -> str: + return f"@{name}" if name in RESERVED else name + + +class Model: + """The class hierarchy the catalog defines, indexed for emission.""" + + def __init__(self, idl: dict): + self.idl = idl + self.om = idl["objectModel"] + self.functions = {f["name"]: f for f in idl["functions"]} + self.enum_values = { + e["name"]: {v["name"]: v["value"] for v in e.get("values", [])} + for e in idl["enums"] if e.get("name") + } + self.parent: dict[str, str | None] = {} + self.ctype: dict[str, str] = {} + self.meostype: dict[str, str] = {} # class -> its MeosType constant + self.subtype_of: dict[str, str] = {} # concrete class -> template subtype + self._build() + + def _build(self) -> None: + lattice = self.om["lattice"] + for name, node in lattice.items(): + self.parent[name] = node["parent"] + self.ctype[name] = "Temporal" + temptypes = node.get("temptypes") or [] + if node["kind"] == "leaf" and len(temptypes) == 1: + self.meostype[name] = temptypes[0] + + # The template subtypes are classes of their own, under the root. + for value in self.om["axes"]["subtype"]["values"]: + cls = value.get("class") + if cls: + self.parent[cls] = "Temporal" + self.ctype[cls] = cls + + # A concrete class is ``: it inherits the leaf's family surface + # and its instances are pointers to the template subtype's struct. + for leaf in [n for n, v in lattice.items() if v["kind"] == "leaf"]: + for subtype, suffix in SUBTYPE_SUFFIX.items(): + concrete = leaf + suffix + if concrete in self.om["classes"]: + self.parent[concrete] = leaf + self.ctype[concrete] = subtype + self.subtype_of[concrete] = subtype + + for family in ("Box", "Collection"): + for name, node in self.om["companions"][family]["nodes"].items(): + self.parent[name] = node["parent"] + if node.get("temptype"): + self.meostype[name] = node["temptype"] + for name in self.om["companions"]["Collection"]["nodes"]: + self.ctype[name] = self._collection_ctype(name) + self.ctype["TBox"] = "TBox" + self.ctype["STBox"] = "STBox" + + def _collection_ctype(self, name: str) -> str: + node = self.om["companions"]["Collection"]["nodes"][name] + for a in [name] + list(node["ancestors"]): + if a in ROOT_CTYPE: + return ROOT_CTYPE[a] + return "" + + def classes(self) -> list[str]: + """Every class the model defines, superclass before subclass.""" + ordered: list[str] = [] + + def emit(n: str) -> None: + if n in ordered: + return + p = self.parent.get(n) + if p: + emit(p) + ordered.append(n) + + for n in sorted(self.parent): + emit(n) + return ordered + + def struct_offset(self, struct: str, field: str) -> int: + for s in self.idl["structs"]: + if s["name"] == struct: + for f in s["fields"]: + if f["name"] == field: + return f["offset_bits"] // 8 + raise KeyError(f"{struct}.{field} is not in the catalog") + + def class_for_ctype(self, c_type: str) -> str | None: + """The class a single pointer to this C struct is wrapped in. + + Every temporal struct — TInstant, TSequence, TSequenceSet — begins with the + Temporal header and MEOS discriminates them by the ``subtype`` field, so a + pointer to any of them is a Temporal at the surface and the factory hands + back the concrete class the header names. Modelling them as C# classes of + their own would not: a concrete class is the product leaf x subtype, and C# + single inheritance already spends that class's one base on its leaf family, + which carries by far the larger surface.""" + base = clean(c_type) + if not base.endswith(" *"): + return None + base = base[:-2].strip() + if base in TEMPORAL_STRUCTS: + return "Temporal" + for cls, ct in ROOT_CTYPE.items(): + if ct == base: + return cls + return None + + +class Method: + """One emitted method: its C# signature and the wrapper call behind it.""" + + def __init__(self, name: str, ret: str, params: list[tuple[str, str]], + body: str, static: bool): + self.name = name + self.ret = ret + self.params = params + self.body = body + self.static = static + + +class Generator: + def __init__(self, model: Model): + self.m = model + self.deferred: dict[str, list[str]] = defaultdict(list) + self.class_member_names: dict[str, set[str]] = {} + self.emitted = 0 + + # -- marshalling ------------------------------------------------------ + + def map_return(self, f: dict, wrapper_ret: str) -> tuple[str, str] | None: + """``(csharp_type, expression template)`` for the return, or None to defer. + + The template spells the wrapper call as ``$``. + """ + c = clean(f["returnType"]["c"]) + if wrapper_ret == "void": + return ("void", "$") + if c in ("TimestampTz", "Timestamp"): + return ("DateTime", "MEOSConvert.ToDateTime($)") + if c == "DateADT": + return ("DateOnly", "MEOSConvert.ToDateOnly($)") + if wrapper_ret in ("string", "string?"): + return (wrapper_ret, "$") + if c in PASSTHROUGH_C and wrapper_ret != "IntPtr": + return (wrapper_ret, "$") + cls = self.m.class_for_ctype(c) + if cls and wrapper_ret == "IntPtr": + return (f"{cls}?", f"MEOSFactory.Wrap{ROOT_CTYPE[cls]}($)") + if c.endswith(" **") and wrapper_ret == "IntPtr[]": + elem = self.m.class_for_ctype(c[:-1]) + if elem: + return (f"{elem}?[]", f"MEOSFactory.Wrap{ROOT_CTYPE[elem]}Array($)") + if wrapper_ret in ("long[]", "int[]", "double[]", "byte[]"): + return (wrapper_ret, "$") + return None + + def map_param(self, c_type: str, cs_type: str, name: str) -> tuple[str, str] | None: + """``(csharp_type, argument expression)`` for one parameter, or None.""" + c = clean(c_type) + if c in ("TimestampTz", "Timestamp"): + return ("DateTime", f"MEOSConvert.ToTimestampTz({name})") + if c == "DateADT": + return ("DateOnly", f"MEOSConvert.ToDateADT({name})") + if c == "interpType": + return ("InterpolationType", f"(int) {name}") + if c in PASSTHROUGH_C and cs_type != "IntPtr": + return (cs_type, name) + if cs_type == "string": + return ("string", name) + cls = self.m.class_for_ctype(c) + if cls and cs_type == "IntPtr": + return (cls, f"{name}.Ptr") + return None + + # -- emission --------------------------------------------------------- + + def method_for(self, cls: str, entry: dict) -> Method | None: + oo = entry["ooName"] + fname = entry["function"] + f = self.m.functions.get(fname) + if f is None: + self.deferred[cls].append(f"{oo}: no catalog function {fname}") + return None + signature = codegen.SIGNATURES.get(fname) + if signature is None: + self.deferred[cls].append(f"{oo}: {fname} has no emitted wrapper") + return None + wrapper_ret, wrapper_params = signature + c_by_name = { + (codegen.csharp_param_name(p["name"]) if p["name"] else "arg"): p["cType"] + for p in f.get("params", []) + } + + # `T *values, int count` is MEOS's counted-array convention: the pointer is + # the first element of an array, not one value, so wrapping it as one + # object would hand the callee a single element and a length that lies. + raw = [p["name"] for p in f.get("params", [])] + counted = set() + for i, p in enumerate(f.get("params", [])): + nxt = f["params"][i + 1] if i + 1 < len(f["params"]) else None + if (clean(p["cType"]).endswith("*") and nxt + and nxt["name"] in ("count", "n") + and clean(nxt["cType"]) in ("int", "int32", "int32_t")): + counted.add(codegen.csharp_param_name(p["name"])) + + recv_ctype = self.m.ctype.get(cls) + params = list(wrapper_params) + static = True + args: list[str] = [] + if params and clean(c_by_name.get(params[0][1], "")) == f"{recv_ctype} *": + static = False + args.append("this.Ptr") + params = params[1:] + + ret = self.map_return(f, wrapper_ret) + if ret is None: + self.deferred[cls].append( + f"{oo}: return {clean(f['returnType']['c'])} needs wrapping") + return None + ret_type, ret_expr = ret + if static and ret_type == "void": + self.deferred[cls].append(f"{oo}: neither a receiver nor a value to return") + return None + + sig: list[tuple[str, str]] = [] + for cs_type, pname in params: + if pname in counted: + self.deferred[cls].append( + f"{oo}: argument {pname} is a counted array") + return None + mapped = self.map_param(c_by_name.get(pname, ""), cs_type, pname) + if mapped is None: + self.deferred[cls].append( + f"{oo}: argument {pname} of type " + f"{clean(c_by_name.get(pname, cs_type))} needs marshalling") + return None + sig.append((mapped[0], pname)) + args.append(mapped[1]) + + call = f"MEOSExposedFunctions.{fname}({', '.join(args)})" + return Method(pascal(oo), ret_type, sig, ret_expr.replace("$", call), static) + + def inherited_names(self, cls: str) -> set[tuple]: + names: set[tuple] = set() + p = self.m.parent.get(cls) + while p: + names |= self.class_member_names.get(p, set()) + p = self.m.parent.get(p) + return names + + def emit_class(self, cls: str) -> str: + parent = self.m.parent.get(cls) or "MEOSObject" + entries = [e for e in self.m.om["classes"].get(cls, {}).get("methods", []) + if not e.get("ooExclude")] + methods = [m for m in (self.method_for(cls, e) for e in entries) if m] + methods.sort(key=lambda m: (m.static, m.name)) + self.emitted += len(methods) + + # A method hides a base one only when the signature matches too, so the + # `new` keyword is keyed on the whole signature: on the name alone C# + # answers CS0109 for an overload that hides nothing. + inherited = self.inherited_names(cls) + self.class_member_names[cls] = { + (m.name, tuple(t for t, _ in m.params)) for m in methods} | inherited + + lines = [ + "#nullable enable", + "", + "using MEOS.NET.Enums;", + "using MEOS.NET.Internal;", + "", + f"namespace {NAMESPACE}", + "{", + f" /// {self.doc_for(cls)}", + f' [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "{GENERATOR_VERSION}")]', + f" public class {cls} : {parent}", + " {", + f" internal {cls}(IntPtr ptr) : base(ptr) {{ }}", + "", + ] + for m in methods: + args = ", ".join(f"{t} {ident(n)}" for t, n in m.params) + new = "new " if (m.name, tuple(t for t, _ in m.params)) in inherited else "" + kind = "static " if m.static else "" + lines.append(f" public {new}{kind}{m.ret} {m.name}({args})") + lines.append(f" => {m.body};") + lines.append("") + lines += [" }", "}", ""] + return "\n".join(lines) + + def doc_for(self, cls: str) -> str: + node = self.m.om["lattice"].get(cls) + if node and node.get("doc"): + return node["doc"] + for family in ("Box", "Collection"): + node = self.m.om["companions"][family]["nodes"].get(cls) + if node and node.get("doc"): + return node["doc"] + subtype = self.m.subtype_of.get(cls) + if subtype: + return f"A {self.m.parent[cls]} of subtype {subtype}." + return f"The {cls} class of the MEOS object model." + + # -- files ------------------------------------------------------------ + + def base_file(self) -> str: + return f'''#nullable enable + +namespace {NAMESPACE} +{{ + /// + /// A handle on a value MEOS owns. The pointer is what every generated method + /// forwards to the C API; the memory behind it belongs to MEOS. + /// + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "{GENERATOR_VERSION}")] + public abstract class MEOSObject + {{ + internal IntPtr Ptr {{ get; }} + + internal MEOSObject(IntPtr ptr) => this.Ptr = ptr; + }} +}} +''' + + def convert_file(self) -> str: + """The two MEOS scalar time types in .NET terms. MEOS states a timestamp + and a date through its own text I/O, so the conversion goes through the + same functions the C API reads and writes them with, not through an epoch + arithmetic the binding would have to keep in step.""" + return f'''#nullable enable + +using System.Globalization; + +using MEOS.NET.Internal; + +namespace {NAMESPACE} +{{ + /// The MEOS scalar time types as .NET values, and back. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "{GENERATOR_VERSION}")] + internal static class MEOSConvert + {{ + /// A MEOS TimestampTz as a DateTime. + internal static DateTime ToDateTime(long timestamptz) + => DateTime.Parse(MEOSExposedFunctions.timestamptz_out(timestamptz), + CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal + | DateTimeStyles.AssumeUniversal); + + /// A DateTime as a MEOS TimestampTz. + internal static long ToTimestampTz(DateTime moment) + => MEOSExposedFunctions.timestamptz_in( + moment.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss.ffffff+00", + CultureInfo.InvariantCulture), -1); + + /// A MEOS DateADT as a DateOnly. + internal static DateOnly ToDateOnly(int date) + => DateOnly.Parse(MEOSExposedFunctions.date_out(date), + CultureInfo.InvariantCulture); + + /// A DateOnly as a MEOS DateADT. + internal static int ToDateADT(DateOnly day) + => MEOSExposedFunctions.date_in( + day.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); + }} +}} +''' + + def factory_file(self) -> str: + """The runtime factory: a MEOS value carries its own type in its header, so + a pointer is wrapped in the exact class the model gives that type. Every + temporal struct starts with the Temporal header, so one discriminator + offset serves the whole temporal side.""" + lines = [ + "#nullable enable", + "", + "using System.Runtime.InteropServices;", + "", + f"namespace {NAMESPACE}", + "{", + " /// ", + " /// Wraps a MEOS pointer in the class the model gives its runtime type.", + " /// The discriminator is the struct field the catalog records, read at the", + " /// offset the catalog's own field layout puts it at.", + " /// ", + f' [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "{GENERATOR_VERSION}")]', + " internal static class MEOSFactory", + " {", + ] + temptype_offset = self.m.struct_offset("Temporal", "temptype") + subtype_offset = self.m.struct_offset("Temporal", "subtype") + subtype_values = {v["class"]: v["value"] + for v in self.m.om["axes"]["subtype"]["values"] if v.get("class")} + + # (discriminator field, its byte offset) per root; a root with no + # discriminator is wrapped in the root class itself. + discriminator = { + "Temporal": ("Temporal.temptype", temptype_offset), + "Set": ("Set.settype", self.m.struct_offset("Set", "settype")), + "Span": ("Span.spantype", self.m.struct_offset("Span", "spantype")), + "SpanSet": ("SpanSet.spansettype", + self.m.struct_offset("SpanSet", "spansettype")), + } + # Only the classes a pointer is actually wrapped in: the template subtypes + # are Temporal at the surface (see Model.class_for_ctype). + for root in ("Temporal", "Set", "Span", "SpanSet", "TBox", "STBox"): + lines += self._wrap_method(root, discriminator.get(root), + subtype_offset, subtype_values) + lines += [" }", "}", ""] + return "\n".join(lines) + + def _wrap_method(self, root: str, discriminator, subtype_offset: int, + subtype_values: dict) -> list[str]: + """``Wrap`` and ``WrapArray`` for one root class.""" + lines = [ + f" /// The value at as the {root}", + f" /// class the model gives its runtime type.", + f" internal static {root}? Wrap{root}(IntPtr ptr)", + " {", + " if (ptr == IntPtr.Zero)", + " {", + " return null;", + " }", + "", + ] + if discriminator is None: + lines.append(f" return new {root}(ptr);") + else: + field, offset = discriminator + # The classes this root discriminates into: those whose instances are + # pointers to this root's struct and that carry a MeosType constant. + # For a template subtype the leaf's concrete class is the target. + cases = [] + for cls, temptype in self.m.meostype.items(): + value = self.m.enum_values["MeosType"].get(temptype) + if value is None: + continue + if root == "Temporal": + if self.m.ctype.get(cls) != "Temporal": + continue + # A leaf with concrete product classes is refined by the + # subtype byte; one without is the class itself. + target = None if any(self.m.parent.get(c) == cls + for c in self.m.subtype_of) else cls + cases.append((value, cls, temptype, target)) + elif self.m.ctype.get(cls) == root: + cases.append((value, cls, temptype, cls)) + lines += [ + f" // {field}, at byte {offset}", + f" return Marshal.ReadByte(ptr, {offset}) switch", + " {", + ] + for value, cls, temptype, target in sorted(cases): + call = f"Wrap{cls}Subtype(ptr)" if target is None else f"new {target}(ptr)" + lines.append(f" {value} => {call}, // {temptype}") + lines += [ + f" _ => new {root}(ptr),", + " };", + ] + lines += [ + " }", + "", + f" /// Every element of a C array of {root} pointers, wrapped.", + f" internal static {root}?[] Wrap{root}Array(IntPtr[] ptrs)", + " {", + f" {root}?[] wrapped = new {root}?[ptrs.Length];", + " for (int i = 0; i < ptrs.Length; i++)", + " {", + f" wrapped[i] = Wrap{root}(ptrs[i]);", + " }", + "", + " return wrapped;", + " }", + "", + ] + if root == "Temporal": + for leaf in sorted({self.m.parent[c] for c in self.m.subtype_of}): + lines += [ + f" /// The concrete {leaf} class for the template subtype", + f" /// at byte {subtype_offset}.", + f" private static {leaf} Wrap{leaf}Subtype(IntPtr ptr)", + f" => Marshal.ReadByte(ptr, {subtype_offset}) switch", + " {", + ] + for subtype, suffix in SUBTYPE_SUFFIX.items(): + concrete = leaf + suffix + if concrete in self.m.parent: + lines.append( + f" {subtype_values[subtype]} => new {concrete}(ptr),") + lines += [ + f" _ => new {leaf}(ptr),", + " };", + "", + ] + return lines + + def run(self, out_dir: Path) -> None: + if out_dir.exists(): + shutil.rmtree(out_dir) + out_dir.mkdir(parents=True) + (out_dir / "MEOSObject.g.cs").write_text(self.base_file()) + (out_dir / "MEOSConvert.g.cs").write_text(self.convert_file()) + for cls in self.m.classes(): + (out_dir / f"{cls}.g.cs").write_text(self.emit_class(cls)) + (out_dir / "MEOSFactory.g.cs").write_text(self.factory_file()) + + +def main() -> int: + ap = argparse.ArgumentParser(description=__doc__) + ap.add_argument("idl", metavar="meos-idl.json", help="path to the MEOS-API catalog") + ap.add_argument("--report", action="store_true", + help="print what each class deferred and why") + args = ap.parse_args() + + idl = json.loads(Path(args.idl).read_bytes().decode()) + codegen.configure(idl) + # Populate codegen.SIGNATURES: the object layer calls the wrappers codegen.py + # emits, so it reads their signatures from the same run that decides them. + codegen.gen_exposed_functions(idl["functions"]) + + model = Model(idl) + gen = Generator(model) + repo_root = Path(__file__).resolve().parent.parent + gen.run(repo_root / "MEOS.NET" / "Types" / "Generated") + + classes = model.classes() + total_deferred = sum(len(v) for v in gen.deferred.values()) + print(f"objectgen: {len(classes)} classes, {gen.emitted} methods emitted, " + f"{total_deferred} deferred", file=sys.stderr) + if args.report: + for cls in classes: + reasons = gen.deferred.get(cls, []) + if reasons: + print(f"--- {cls} ({len(reasons)} deferred)", file=sys.stderr) + for r in sorted(reasons): + print(f" {r}", file=sys.stderr) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/refresh.conf b/tools/refresh.conf index 2992964..aa417c3 100644 --- a/tools/refresh.conf +++ b/tools/refresh.conf @@ -9,5 +9,6 @@ BUILD_DIR=. BUILD_LIBMEOS=true CATALOG_DEST= BUILD_CMD='python3 tools/codegen.py "$CATALOG" + python3 tools/objectgen.py "$CATALOG" dotnet build MEOS.NET.sln -c Release [ -n "${SKIP_TESTS:-}" ] || LD_LIBRARY_PATH="$PREFIX/lib" dotnet test MEOS.NET.sln -c Release --no-build'