diff --git a/ExampleApp/Program.cs b/ExampleApp/Program.cs
index d525969..ee5a4fa 100644
--- a/ExampleApp/Program.cs
+++ b/ExampleApp/Program.cs
@@ -16,7 +16,11 @@
Console.WriteLine($" always 25.0? : {Meos.AlwaysEqTfloatFloat(tfi.Ptr, 25.0) == 1}\n");
Console.WriteLine("Making one from a value and a moment");
- Temporal made = TFloatInst.Make(26.0, DateTime.UtcNow)!;
+ // A MEOS timestamp holds whole microseconds and a DateTime counts ticks of
+ // 100 ns, so the caller drops the ticks below a microsecond; the cast
+ // refuses a moment that keeps them.
+ DateTime now = DateTime.UtcNow;
+ Temporal made = TFloatInst.Make(26.0, now.AddTicks(-(now.Ticks % 10)))!;
Console.WriteLine($" text : {made}");
Console.WriteLine(" adding 34 to its value");
Temporal sum = MEOSFactory.WrapTemporal(Meos.AddTfloatFloat(made.Ptr, 34.0))!;
diff --git a/GAP-LEDGER.md b/GAP-LEDGER.md
index fc4bc3f..aa71d48 100644
--- a/GAP-LEDGER.md
+++ b/GAP-LEDGER.md
@@ -10,14 +10,14 @@ A kind with no rows is a site the generators watch and that nothing reached in
this run. It prints so that an empty class reads as a measurement rather than
as a class nobody looked at.
-Generated from `meos-idl.json` at MobilityDB `0bc5f54084207e4c0e48d2b55c7f6b9cbb944045` by `tools/codegen.py`
+Generated from `meos-idl.json` at MobilityDB `b49672e5450e50899effb3a22aa5112da9145f80` by `tools/codegen.py`
and `tools/objectgen.py`. Do not edit.
## The flat surface — `tools/codegen.py`
-### parameter nullability — 4344
+### parameter nullability — 4365
`shape.nullable` names the parameters a function accepts NULL for, and the catalog carries no field saying a parameter is required. A pointer parameter named in neither reaches the surface with its contract unstated: the wrapper takes it, and nothing says whether zero is an argument or a fault.
@@ -320,17 +320,22 @@ and `tools/objectgen.py`. Do not edit.
| always_ne_ts2cell_ts2cell | temp1, temp2 |
| always_ne_ttext_text | temp, txt |
| always_overlaps_stbox_tcbuffer | box, temp |
+| always_overlaps_stbox_tcellindex | box, temp |
| always_overlaps_stbox_tgeo | box, temp |
| always_overlaps_stbox_tnpoint | box, temp |
| always_overlaps_stbox_tpose | box, temp |
+| always_overlaps_stbox_tposechain | box, temp |
| always_overlaps_stbox_trgeometry | box, temp |
| always_overlaps_tbox_tnumber | box, temp |
| always_overlaps_tcbuffer_stbox | temp, box |
+| always_overlaps_tcbuffer_tcbuffer | temp1, temp2 |
+| always_overlaps_tcellindex_stbox | temp, box |
| always_overlaps_temporal_temporal | temp1, temp2 |
| always_overlaps_temporal_tstzspan | temp, s |
| always_overlaps_tgeo_stbox | temp, box |
| always_overlaps_tgeo_tgeo | temp1, temp2 |
| always_overlaps_tnpoint_stbox | temp, box |
+| always_overlaps_tnpoint_tnpoint | temp1, temp2 |
| always_overlaps_tnumber_tbox | temp, box |
| always_overlaps_tpcbox_tpcpatch | box, temp |
| always_overlaps_tpcbox_tpcpoint | box, temp |
@@ -338,6 +343,7 @@ and `tools/objectgen.py`. Do not edit.
| always_overlaps_tpcpoint_tpcbox | temp, box |
| always_overlaps_tpose_stbox | temp, box |
| always_overlaps_tpose_tpose | temp1, temp2 |
+| always_overlaps_tposechain_stbox | temp, box |
| always_overlaps_trgeometry_stbox | temp, box |
| always_overlaps_tstzspan_temporal | s, temp |
| araster_value | traj, rast, vspan |
@@ -949,17 +955,22 @@ and `tools/objectgen.py`. Do not edit.
| ever_ne_ts2cell_ts2cell | temp1, temp2 |
| ever_ne_ttext_text | temp, txt |
| ever_overlaps_stbox_tcbuffer | box, temp |
+| ever_overlaps_stbox_tcellindex | box, temp |
| ever_overlaps_stbox_tgeo | box, temp |
| ever_overlaps_stbox_tnpoint | box, temp |
| ever_overlaps_stbox_tpose | box, temp |
+| ever_overlaps_stbox_tposechain | box, temp |
| ever_overlaps_stbox_trgeometry | box, temp |
| ever_overlaps_tbox_tnumber | box, temp |
| ever_overlaps_tcbuffer_stbox | temp, box |
+| ever_overlaps_tcbuffer_tcbuffer | temp1, temp2 |
+| ever_overlaps_tcellindex_stbox | temp, box |
| ever_overlaps_temporal_temporal | temp1, temp2 |
| ever_overlaps_temporal_tstzspan | temp, s |
| ever_overlaps_tgeo_stbox | temp, box |
| ever_overlaps_tgeo_tgeo | temp1, temp2 |
| ever_overlaps_tnpoint_stbox | temp, box |
+| ever_overlaps_tnpoint_tnpoint | temp1, temp2 |
| ever_overlaps_tnumber_tbox | temp, box |
| ever_overlaps_tpcbox_tpcpatch | box, temp |
| ever_overlaps_tpcbox_tpcpoint | box, temp |
@@ -967,6 +978,7 @@ and `tools/objectgen.py`. Do not edit.
| ever_overlaps_tpcpoint_tpcbox | temp, box |
| ever_overlaps_tpose_stbox | temp, box |
| ever_overlaps_tpose_tpose | temp1, temp2 |
+| ever_overlaps_tposechain_stbox | temp, box |
| ever_overlaps_trgeometry_stbox | temp, box |
| ever_overlaps_tstzspan_temporal | s, temp |
| float4_in | num |
@@ -1308,6 +1320,7 @@ and `tools/objectgen.py`. Do not edit.
| interval_part | interv, units |
| interval_scale | interv |
| interval_smaller | interv1, interv2 |
+| interval_to_parts | interv, months, days, us |
| interval_to_time | interv |
| interval_trunc | interv, units |
| intset_end_value | s |
@@ -2838,12 +2851,14 @@ and `tools/objectgen.py`. Do not edit.
| tcbufferseq_from_base_tstzset | cb, s |
| tcbufferseq_from_base_tstzspan | cb, s |
| tcbufferseqset_from_base_tstzspanset | cb, ss |
+| tcellindex_at_stbox | temp, box |
| tcellindex_cell_area | temp |
| tcellindex_cell_to_boundary | temp |
| tcellindex_cell_to_parent | temp |
| tcellindex_cell_to_point | temp |
| tcellindex_get_resolution | temp |
| tcellindex_is_valid_cell | temp |
+| tcellindex_minus_stbox | temp, box |
| tcontains_cbuffer_tcbuffer | cb, temp |
| tcontains_geo_tcbuffer | gs, temp |
| tcontains_geo_tgeo | gs, temp |
@@ -3402,6 +3417,7 @@ and `tools/objectgen.py`. Do not edit.
| time_in | str |
| time_out | size_out |
| time_part | units |
+| time_to_parts | us |
| timestamp_bin | stride |
| timestamp_extract | units |
| timestamp_in | str |
@@ -3445,6 +3461,7 @@ and `tools/objectgen.py`. Do not edit.
| timetz_part | timetz, units |
| timetz_scale | timetz |
| timetz_smaller | timetz1, timetz2 |
+| timetz_to_parts | timetz, us, offset |
| timetz_to_time | timetz |
| timetz_zone | timetz, zone |
| tinstant_after_timestamptz | inst |
@@ -3795,6 +3812,7 @@ and `tools/objectgen.py`. Do not edit.
| tpcbox_zmax | box, result |
| tpcbox_zmin | box, result |
| tpcpatch_at_tpcbox | temp, box |
+| tpcpatch_at_tpcbox_fine | temp, box |
| tpcpatch_at_value | temp, pa |
| tpcpatch_end_npoints | temp |
| tpcpatch_end_value | temp |
@@ -3802,6 +3820,7 @@ and `tools/objectgen.py`. Do not edit.
| tpcpatch_from_mfjson | mfjson |
| tpcpatch_in | str |
| tpcpatch_minus_tpcbox | temp, box |
+| tpcpatch_minus_tpcbox_fine | temp, box |
| tpcpatch_minus_value | temp, pa |
| tpcpatch_npoints | temp |
| tpcpatch_pcid | temp |
@@ -3937,12 +3956,14 @@ and `tools/objectgen.py`. Do not edit.
| tpose_values | temp, count |
| tpose_yaw | temp |
| tposechain_as_geopose | temp, size_out |
+| tposechain_at_stbox | temp, box |
| tposechain_at_value | temp, pc |
| tposechain_end_value | temp |
| tposechain_from_base_temp | pc, temp |
| tposechain_from_geopose | json |
| tposechain_from_mfjson | mfjson |
| tposechain_in | str |
+| tposechain_minus_stbox | temp, box |
| tposechain_minus_value | temp, pc |
| tposechain_num_poses | temp |
| tposechain_rotate | temp |
diff --git a/MEOS.NET.Tests/TimeCastTests.cs b/MEOS.NET.Tests/TimeCastTests.cs
new file mode 100644
index 0000000..3794148
--- /dev/null
+++ b/MEOS.NET.Tests/TimeCastTests.cs
@@ -0,0 +1,68 @@
+using MEOS.NET.Types;
+
+namespace MEOS.NET.Tests
+{
+ ///
+ /// The casts between the time types of .NET and those of MEOS, which convert
+ /// through the MEOS conversions of the counts from the Unix epoch, as the
+ /// round trips of #GeneratedObjectLayerTests reach them: a DateTime of UTC or
+ /// local kind is a timestamptz, one of unspecified kind is a timestamp read in
+ /// the zone of the MEOS session, as MEOS reads a timestamp without an offset,
+ /// and a tick below a microsecond, which no MEOS timestamp holds, is refused.
+ /// The counts are those of the MEOS bindings specification,
+ /// doc/specs/meos-bindings-algebra.md of MobilityDB.
+ ///
+ [TestClass]
+ public class TimeCastTests : MeosTest
+ {
+ private static DateTime StartOf(DateTime moment)
+ => TFloatInst.Make(1.0, moment)!.StartTimestamptz();
+
+ [TestMethod]
+ public void UtcMomentRoundTripsToTheMicrosecond()
+ {
+ DateTime moment = new DateTime(2025, 3, 1, 8, 0, 0, DateTimeKind.Utc)
+ .AddTicks(1234560);
+
+ Assert.AreEqual(moment, StartOf(moment).ToUniversalTime());
+ }
+
+ [TestMethod]
+ public void MomentBelowAMicrosecondIsRefused()
+ {
+ DateTime moment = new DateTime(2025, 3, 1, 8, 0, 0, DateTimeKind.Utc)
+ .AddTicks(1234565);
+
+ Assert.ThrowsException(() => StartOf(moment));
+ }
+
+ [TestMethod]
+ public void UnspecifiedMomentIsReadInTheSessionZone()
+ {
+ DateTime moment = new DateTime(2001, 1, 1, 0, 0, 0, DateTimeKind.Unspecified);
+
+ Assert.AreEqual(new DateTime(2001, 1, 1, 0, 0, 0, DateTimeKind.Utc),
+ StartOf(moment).ToUniversalTime());
+ }
+
+ [TestMethod]
+ public void DateRoundTrips()
+ {
+ DateOnly day = new DateOnly(2025, 3, 1);
+
+ Span span = DateSpan.Make(day, day, true, true)!;
+
+ Assert.AreEqual(day, ((DateSpan)span).Lower());
+ }
+
+ [TestMethod]
+ public void LastDateOfDotNetRoundTrips()
+ {
+ DateOnly day = DateOnly.MaxValue;
+
+ Span span = DateSpan.Make(day, day, true, true)!;
+
+ Assert.AreEqual(day, ((DateSpan)span).Lower());
+ }
+ }
+}
diff --git a/MEOS.NET/Functions/Meos.Native.g.cs b/MEOS.NET/Functions/Meos.Native.g.cs
index 4ef7616..b361fd9 100644
--- a/MEOS.NET/Functions/Meos.Native.g.cs
+++ b/MEOS.NET/Functions/Meos.Native.g.cs
@@ -523,6 +523,9 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "date_to_spanset", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr DateToSpanset(int d);
+ [LibraryImport(DllPath, EntryPoint = "date_to_unix_days", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int DateToUnixDays(int d);
+
[LibraryImport(DllPath, EntryPoint = "dateset_to_tstzset", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr DatesetToTstzset(IntPtr s);
@@ -580,6 +583,13 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "intspanset_to_floatspanset", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr IntspansetToFloatspanset(IntPtr ss);
+ [LibraryImport(DllPath, EntryPoint = "interval_from_parts", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial IntPtr IntervalFromParts(int months, int days, long us);
+
+ [LibraryImport(DllPath, EntryPoint = "interval_to_parts", StringMarshalling = StringMarshalling.Utf8)]
+ [return: MarshalAs(UnmanagedType.U1)]
+ internal static partial bool IntervalToParts(IntPtr interv, IntPtr months, IntPtr days, IntPtr us);
+
[LibraryImport(DllPath, EntryPoint = "set_to_span", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr SetToSpan(IntPtr s);
@@ -592,6 +602,9 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "text_to_set", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TextToSet(IntPtr txt);
+ [LibraryImport(DllPath, EntryPoint = "timestamp_to_unix_us", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial long TimestampToUnixUs(long ts);
+
[LibraryImport(DllPath, EntryPoint = "timestamptz_to_set", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TimestamptzToSet(long t);
@@ -613,6 +626,12 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "tstzspanset_to_datespanset", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TstzspansetToDatespanset(IntPtr ss);
+ [LibraryImport(DllPath, EntryPoint = "unix_days_to_date", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int UnixDaysToDate(int days);
+
+ [LibraryImport(DllPath, EntryPoint = "unix_us_to_timestamp", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial long UnixUsToTimestamp(long us);
+
[LibraryImport(DllPath, EntryPoint = "unix_us_to_timestamptz", StringMarshalling = StringMarshalling.Utf8)]
internal static partial long UnixUsToTimestamptz(long us);
@@ -7462,6 +7481,9 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "always_overlaps_tcbuffer_stbox", StringMarshalling = StringMarshalling.Utf8)]
internal static partial int AlwaysOverlapsTcbufferStbox(IntPtr temp, IntPtr box);
+ [LibraryImport(DllPath, EntryPoint = "always_overlaps_tcbuffer_tcbuffer", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int AlwaysOverlapsTcbufferTcbuffer(IntPtr temp1, IntPtr temp2);
+
[LibraryImport(DllPath, EntryPoint = "ever_eq_cbuffer_tcbuffer", StringMarshalling = StringMarshalling.Utf8)]
internal static partial int EverEqCbufferTcbuffer(IntPtr cb, IntPtr temp);
@@ -7486,6 +7508,9 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "ever_overlaps_tcbuffer_stbox", StringMarshalling = StringMarshalling.Utf8)]
internal static partial int EverOverlapsTcbufferStbox(IntPtr temp, IntPtr box);
+ [LibraryImport(DllPath, EntryPoint = "ever_overlaps_tcbuffer_tcbuffer", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int EverOverlapsTcbufferTcbuffer(IntPtr temp1, IntPtr temp2);
+
[LibraryImport(DllPath, EntryPoint = "teq_cbuffer_tcbuffer", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TeqCbufferTcbuffer(IntPtr cb, IntPtr temp);
@@ -7786,6 +7811,24 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "tcellindex_cell_area", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TcellindexCellArea(IntPtr temp);
+ [LibraryImport(DllPath, EntryPoint = "tcellindex_at_stbox", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial IntPtr TcellindexAtStbox(IntPtr temp, IntPtr box, [MarshalAs(UnmanagedType.U1)] bool border_inc);
+
+ [LibraryImport(DllPath, EntryPoint = "tcellindex_minus_stbox", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial IntPtr TcellindexMinusStbox(IntPtr temp, IntPtr box, [MarshalAs(UnmanagedType.U1)] bool border_inc);
+
+ [LibraryImport(DllPath, EntryPoint = "ever_overlaps_tcellindex_stbox", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int EverOverlapsTcellindexStbox(IntPtr temp, IntPtr box);
+
+ [LibraryImport(DllPath, EntryPoint = "always_overlaps_tcellindex_stbox", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int AlwaysOverlapsTcellindexStbox(IntPtr temp, IntPtr box);
+
+ [LibraryImport(DllPath, EntryPoint = "ever_overlaps_stbox_tcellindex", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int EverOverlapsStboxTcellindex(IntPtr box, IntPtr temp);
+
+ [LibraryImport(DllPath, EntryPoint = "always_overlaps_stbox_tcellindex", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int AlwaysOverlapsStboxTcellindex(IntPtr box, IntPtr temp);
+
[LibraryImport(DllPath, EntryPoint = "h3index_in", StringMarshalling = StringMarshalling.Utf8)]
internal static partial ulong H3indexIn(string str);
@@ -11409,6 +11452,9 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "always_overlaps_tnpoint_stbox", StringMarshalling = StringMarshalling.Utf8)]
internal static partial int AlwaysOverlapsTnpointStbox(IntPtr temp, IntPtr box);
+ [LibraryImport(DllPath, EntryPoint = "always_overlaps_tnpoint_tnpoint", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int AlwaysOverlapsTnpointTnpoint(IntPtr temp1, IntPtr temp2);
+
[LibraryImport(DllPath, EntryPoint = "ever_eq_npoint_tnpoint", StringMarshalling = StringMarshalling.Utf8)]
internal static partial int EverEqNpointTnpoint(IntPtr np, IntPtr temp);
@@ -11433,6 +11479,9 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "ever_overlaps_tnpoint_stbox", StringMarshalling = StringMarshalling.Utf8)]
internal static partial int EverOverlapsTnpointStbox(IntPtr temp, IntPtr box);
+ [LibraryImport(DllPath, EntryPoint = "ever_overlaps_tnpoint_tnpoint", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int EverOverlapsTnpointTnpoint(IntPtr temp1, IntPtr temp2);
+
[LibraryImport(DllPath, EntryPoint = "teq_tnpoint_npoint", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TeqTnpointNpoint(IntPtr temp, IntPtr np);
@@ -12194,6 +12243,12 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "tpcpatch_minus_tpcbox", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TpcpatchMinusTpcbox(IntPtr temp, IntPtr box, [MarshalAs(UnmanagedType.U1)] bool border_inc);
+ [LibraryImport(DllPath, EntryPoint = "tpcpatch_at_tpcbox_fine", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial IntPtr TpcpatchAtTpcboxFine(IntPtr temp, IntPtr box, [MarshalAs(UnmanagedType.U1)] bool border_inc);
+
+ [LibraryImport(DllPath, EntryPoint = "tpcpatch_minus_tpcbox_fine", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial IntPtr TpcpatchMinusTpcboxFine(IntPtr temp, IntPtr box, [MarshalAs(UnmanagedType.U1)] bool border_inc);
+
[LibraryImport(DllPath, EntryPoint = "tpcpatch_pcid", StringMarshalling = StringMarshalling.Utf8)]
internal static partial uint TpcpatchPcid(IntPtr temp);
@@ -13370,9 +13425,15 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "tposechain_translate", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TposechainTranslate(IntPtr temp, double deltax, double deltay, double deltaz);
+ [LibraryImport(DllPath, EntryPoint = "tposechain_at_stbox", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial IntPtr TposechainAtStbox(IntPtr temp, IntPtr box, [MarshalAs(UnmanagedType.U1)] bool border_inc);
+
[LibraryImport(DllPath, EntryPoint = "tposechain_at_value", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TposechainAtValue(IntPtr temp, IntPtr pc);
+ [LibraryImport(DllPath, EntryPoint = "tposechain_minus_stbox", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial IntPtr TposechainMinusStbox(IntPtr temp, IntPtr box, [MarshalAs(UnmanagedType.U1)] bool border_inc);
+
[LibraryImport(DllPath, EntryPoint = "tposechain_minus_value", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TposechainMinusValue(IntPtr temp, IntPtr pc);
@@ -13433,6 +13494,12 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "always_ne_tposechain_tposechain", StringMarshalling = StringMarshalling.Utf8)]
internal static partial int AlwaysNeTposechainTposechain(IntPtr temp1, IntPtr temp2);
+ [LibraryImport(DllPath, EntryPoint = "always_overlaps_stbox_tposechain", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int AlwaysOverlapsStboxTposechain(IntPtr box, IntPtr temp);
+
+ [LibraryImport(DllPath, EntryPoint = "always_overlaps_tposechain_stbox", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int AlwaysOverlapsTposechainStbox(IntPtr temp, IntPtr box);
+
[LibraryImport(DllPath, EntryPoint = "ever_eq_posechain_tposechain", StringMarshalling = StringMarshalling.Utf8)]
internal static partial int EverEqPosechainTposechain(IntPtr posechain, IntPtr temp);
@@ -13451,6 +13518,12 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "ever_ne_tposechain_tposechain", StringMarshalling = StringMarshalling.Utf8)]
internal static partial int EverNeTposechainTposechain(IntPtr temp1, IntPtr temp2);
+ [LibraryImport(DllPath, EntryPoint = "ever_overlaps_stbox_tposechain", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int EverOverlapsStboxTposechain(IntPtr box, IntPtr temp);
+
+ [LibraryImport(DllPath, EntryPoint = "ever_overlaps_tposechain_stbox", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial int EverOverlapsTposechainStbox(IntPtr temp, IntPtr box);
+
[LibraryImport(DllPath, EntryPoint = "teq_posechain_tposechain", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TeqPosechainTposechain(IntPtr posechain, IntPtr temp);
@@ -16261,6 +16334,9 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "time_extract", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TimeExtract(long time, IntPtr units);
+ [LibraryImport(DllPath, EntryPoint = "time_from_parts", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial long TimeFromParts(long us);
+
[LibraryImport(DllPath, EntryPoint = "time_ge", StringMarshalling = StringMarshalling.Utf8)]
[return: MarshalAs(UnmanagedType.U1)]
internal static partial bool TimeGe(long time1, long time2);
@@ -16309,6 +16385,10 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "time_to_interval", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TimeToInterval(long time);
+ [LibraryImport(DllPath, EntryPoint = "time_to_parts", StringMarshalling = StringMarshalling.Utf8)]
+ [return: MarshalAs(UnmanagedType.U1)]
+ internal static partial bool TimeToParts(long time, IntPtr us);
+
[LibraryImport(DllPath, EntryPoint = "time_to_timetz", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TimeToTimetz(long time);
@@ -16372,6 +16452,9 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "timetz_copy", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TimetzCopy(IntPtr timetz);
+ [LibraryImport(DllPath, EntryPoint = "timetz_from_parts", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial IntPtr TimetzFromParts(long us, int offset);
+
[LibraryImport(DllPath, EntryPoint = "timetz_out", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TimetzOut(IntPtr timetz, out nuint size_out);
@@ -16388,6 +16471,10 @@ private static partial class Native
[LibraryImport(DllPath, EntryPoint = "timetz_smaller", StringMarshalling = StringMarshalling.Utf8)]
internal static partial IntPtr TimetzSmaller(IntPtr timetz1, IntPtr timetz2);
+ [LibraryImport(DllPath, EntryPoint = "timetz_to_parts", StringMarshalling = StringMarshalling.Utf8)]
+ [return: MarshalAs(UnmanagedType.U1)]
+ internal static partial bool TimetzToParts(IntPtr timetz, IntPtr us, IntPtr offset);
+
[LibraryImport(DllPath, EntryPoint = "timetz_to_time", StringMarshalling = StringMarshalling.Utf8)]
internal static partial long TimetzToTime(IntPtr timetz);
diff --git a/MEOS.NET/Functions/Meos.meos.g.cs b/MEOS.NET/Functions/Meos.meos.g.cs
index 9ec9d94..a130d8f 100644
--- a/MEOS.NET/Functions/Meos.meos.g.cs
+++ b/MEOS.NET/Functions/Meos.meos.g.cs
@@ -824,6 +824,9 @@ public static IntPtr DateToSpan(int d)
public static IntPtr DateToSpanset(int d)
=> SafeExecution(() => Native.DateToSpanset(d));
+ public static int DateToUnixDays(int d)
+ => SafeExecution(() => Native.DateToUnixDays(d));
+
public static IntPtr DatesetToTstzset(IntPtr s)
=> SafeExecution(() => Native.DatesetToTstzset(s));
@@ -881,6 +884,12 @@ public static IntPtr BigintspanToFloatspan(IntPtr s)
public static IntPtr IntspansetToFloatspanset(IntPtr ss)
=> SafeExecution(() => Native.IntspansetToFloatspanset(ss));
+ public static IntPtr IntervalFromParts(int months, int days, long us)
+ => SafeExecution(() => Native.IntervalFromParts(months, days, us));
+
+ public static bool IntervalToParts(IntPtr interv, IntPtr months, IntPtr days, IntPtr us)
+ => SafeExecution(() => Native.IntervalToParts(interv, months, days, us));
+
public static IntPtr SetToSpan(IntPtr s)
=> SafeExecution(() => Native.SetToSpan(s));
@@ -893,6 +902,9 @@ public static IntPtr SpanToSpanset(IntPtr s)
public static IntPtr TextToSet(IntPtr txt)
=> SafeExecution(() => Native.TextToSet(txt));
+ public static long TimestampToUnixUs(long ts)
+ => SafeExecution(() => Native.TimestampToUnixUs(ts));
+
public static IntPtr TimestamptzToSet(long t)
=> SafeExecution(() => Native.TimestamptzToSet(t));
@@ -914,6 +926,12 @@ public static IntPtr TstzspanToDatespan(IntPtr s)
public static IntPtr TstzspansetToDatespanset(IntPtr ss)
=> SafeExecution(() => Native.TstzspansetToDatespanset(ss));
+ public static int UnixDaysToDate(int days)
+ => SafeExecution(() => Native.UnixDaysToDate(days));
+
+ public static long UnixUsToTimestamp(long us)
+ => SafeExecution(() => Native.UnixUsToTimestamp(us));
+
public static long UnixUsToTimestamptz(long us)
=> SafeExecution(() => Native.UnixUsToTimestamptz(us));
diff --git a/MEOS.NET/Functions/Meos.meos_cbuffer.g.cs b/MEOS.NET/Functions/Meos.meos_cbuffer.g.cs
index d543386..a9b8339 100644
--- a/MEOS.NET/Functions/Meos.meos_cbuffer.g.cs
+++ b/MEOS.NET/Functions/Meos.meos_cbuffer.g.cs
@@ -501,6 +501,9 @@ public static int AlwaysOverlapsStboxTcbuffer(IntPtr box, IntPtr temp)
public static int AlwaysOverlapsTcbufferStbox(IntPtr temp, IntPtr box)
=> SafeExecution(() => Native.AlwaysOverlapsTcbufferStbox(temp, box));
+ public static int AlwaysOverlapsTcbufferTcbuffer(IntPtr temp1, IntPtr temp2)
+ => SafeExecution(() => Native.AlwaysOverlapsTcbufferTcbuffer(temp1, temp2));
+
public static int EverEqCbufferTcbuffer(IntPtr cb, IntPtr temp)
=> SafeExecution(() => Native.EverEqCbufferTcbuffer(cb, temp));
@@ -525,6 +528,9 @@ public static int EverOverlapsStboxTcbuffer(IntPtr box, IntPtr temp)
public static int EverOverlapsTcbufferStbox(IntPtr temp, IntPtr box)
=> SafeExecution(() => Native.EverOverlapsTcbufferStbox(temp, box));
+ public static int EverOverlapsTcbufferTcbuffer(IntPtr temp1, IntPtr temp2)
+ => SafeExecution(() => Native.EverOverlapsTcbufferTcbuffer(temp1, temp2));
+
public static IntPtr TeqCbufferTcbuffer(IntPtr cb, IntPtr temp)
=> SafeExecution(() => Native.TeqCbufferTcbuffer(cb, temp));
diff --git a/MEOS.NET/Functions/Meos.meos_cellindex.g.cs b/MEOS.NET/Functions/Meos.meos_cellindex.g.cs
index 1ab9ebc..442a119 100644
--- a/MEOS.NET/Functions/Meos.meos_cellindex.g.cs
+++ b/MEOS.NET/Functions/Meos.meos_cellindex.g.cs
@@ -27,5 +27,23 @@ public static IntPtr TcellindexCellToBoundary(IntPtr temp)
public static IntPtr TcellindexCellArea(IntPtr temp)
=> SafeExecution(() => Native.TcellindexCellArea(temp));
+ public static IntPtr TcellindexAtStbox(IntPtr temp, IntPtr box, bool border_inc)
+ => SafeExecution(() => Native.TcellindexAtStbox(temp, box, border_inc));
+
+ public static IntPtr TcellindexMinusStbox(IntPtr temp, IntPtr box, bool border_inc)
+ => SafeExecution(() => Native.TcellindexMinusStbox(temp, box, border_inc));
+
+ public static int EverOverlapsTcellindexStbox(IntPtr temp, IntPtr box)
+ => SafeExecution(() => Native.EverOverlapsTcellindexStbox(temp, box));
+
+ public static int AlwaysOverlapsTcellindexStbox(IntPtr temp, IntPtr box)
+ => SafeExecution(() => Native.AlwaysOverlapsTcellindexStbox(temp, box));
+
+ public static int EverOverlapsStboxTcellindex(IntPtr box, IntPtr temp)
+ => SafeExecution(() => Native.EverOverlapsStboxTcellindex(box, temp));
+
+ public static int AlwaysOverlapsStboxTcellindex(IntPtr box, IntPtr temp)
+ => SafeExecution(() => Native.AlwaysOverlapsStboxTcellindex(box, temp));
+
}
}
diff --git a/MEOS.NET/Functions/Meos.meos_npoint.g.cs b/MEOS.NET/Functions/Meos.meos_npoint.g.cs
index 9ef1514..d055179 100644
--- a/MEOS.NET/Functions/Meos.meos_npoint.g.cs
+++ b/MEOS.NET/Functions/Meos.meos_npoint.g.cs
@@ -637,6 +637,9 @@ public static int AlwaysOverlapsStboxTnpoint(IntPtr box, IntPtr temp)
public static int AlwaysOverlapsTnpointStbox(IntPtr temp, IntPtr box)
=> SafeExecution(() => Native.AlwaysOverlapsTnpointStbox(temp, box));
+ public static int AlwaysOverlapsTnpointTnpoint(IntPtr temp1, IntPtr temp2)
+ => SafeExecution(() => Native.AlwaysOverlapsTnpointTnpoint(temp1, temp2));
+
public static int EverEqNpointTnpoint(IntPtr np, IntPtr temp)
=> SafeExecution(() => Native.EverEqNpointTnpoint(np, temp));
@@ -661,6 +664,9 @@ public static int EverOverlapsStboxTnpoint(IntPtr box, IntPtr temp)
public static int EverOverlapsTnpointStbox(IntPtr temp, IntPtr box)
=> SafeExecution(() => Native.EverOverlapsTnpointStbox(temp, box));
+ public static int EverOverlapsTnpointTnpoint(IntPtr temp1, IntPtr temp2)
+ => SafeExecution(() => Native.EverOverlapsTnpointTnpoint(temp1, temp2));
+
public static IntPtr TeqTnpointNpoint(IntPtr temp, IntPtr np)
=> SafeExecution(() => Native.TeqTnpointNpoint(temp, np));
diff --git a/MEOS.NET/Functions/Meos.meos_pointcloud.g.cs b/MEOS.NET/Functions/Meos.meos_pointcloud.g.cs
index b9c9a11..256b277 100644
--- a/MEOS.NET/Functions/Meos.meos_pointcloud.g.cs
+++ b/MEOS.NET/Functions/Meos.meos_pointcloud.g.cs
@@ -845,6 +845,12 @@ public static IntPtr TpcpatchAtTpcbox(IntPtr temp, IntPtr box, bool border_inc)
public static IntPtr TpcpatchMinusTpcbox(IntPtr temp, IntPtr box, bool border_inc)
=> SafeExecution(() => Native.TpcpatchMinusTpcbox(temp, box, border_inc));
+ public static IntPtr TpcpatchAtTpcboxFine(IntPtr temp, IntPtr box, bool border_inc)
+ => SafeExecution(() => Native.TpcpatchAtTpcboxFine(temp, box, border_inc));
+
+ public static IntPtr TpcpatchMinusTpcboxFine(IntPtr temp, IntPtr box, bool border_inc)
+ => SafeExecution(() => Native.TpcpatchMinusTpcboxFine(temp, box, border_inc));
+
public static uint TpcpatchPcid(IntPtr temp)
=> SafeExecution(() => Native.TpcpatchPcid(temp));
diff --git a/MEOS.NET/Functions/Meos.meos_pose.g.cs b/MEOS.NET/Functions/Meos.meos_pose.g.cs
index 001ef55..62f609e 100644
--- a/MEOS.NET/Functions/Meos.meos_pose.g.cs
+++ b/MEOS.NET/Functions/Meos.meos_pose.g.cs
@@ -1178,9 +1178,15 @@ public static IntPtr TposechainRotateZ(IntPtr temp, double angle)
public static IntPtr TposechainTranslate(IntPtr temp, double deltax, double deltay, double deltaz)
=> SafeExecution(() => Native.TposechainTranslate(temp, deltax, deltay, deltaz));
+ public static IntPtr TposechainAtStbox(IntPtr temp, IntPtr box, bool border_inc)
+ => SafeExecution(() => Native.TposechainAtStbox(temp, box, border_inc));
+
public static IntPtr TposechainAtValue(IntPtr temp, IntPtr pc)
=> SafeExecution(() => Native.TposechainAtValue(temp, pc));
+ public static IntPtr TposechainMinusStbox(IntPtr temp, IntPtr box, bool border_inc)
+ => SafeExecution(() => Native.TposechainMinusStbox(temp, box, border_inc));
+
public static IntPtr TposechainMinusValue(IntPtr temp, IntPtr pc)
=> SafeExecution(() => Native.TposechainMinusValue(temp, pc));
@@ -1241,6 +1247,12 @@ public static int AlwaysNeTposechainPosechain(IntPtr temp, IntPtr posechain)
public static int AlwaysNeTposechainTposechain(IntPtr temp1, IntPtr temp2)
=> SafeExecution(() => Native.AlwaysNeTposechainTposechain(temp1, temp2));
+ public static int AlwaysOverlapsStboxTposechain(IntPtr box, IntPtr temp)
+ => SafeExecution(() => Native.AlwaysOverlapsStboxTposechain(box, temp));
+
+ public static int AlwaysOverlapsTposechainStbox(IntPtr temp, IntPtr box)
+ => SafeExecution(() => Native.AlwaysOverlapsTposechainStbox(temp, box));
+
public static int EverEqPosechainTposechain(IntPtr posechain, IntPtr temp)
=> SafeExecution(() => Native.EverEqPosechainTposechain(posechain, temp));
@@ -1259,6 +1271,12 @@ public static int EverNeTposechainPosechain(IntPtr temp, IntPtr posechain)
public static int EverNeTposechainTposechain(IntPtr temp1, IntPtr temp2)
=> SafeExecution(() => Native.EverNeTposechainTposechain(temp1, temp2));
+ public static int EverOverlapsStboxTposechain(IntPtr box, IntPtr temp)
+ => SafeExecution(() => Native.EverOverlapsStboxTposechain(box, temp));
+
+ public static int EverOverlapsTposechainStbox(IntPtr temp, IntPtr box)
+ => SafeExecution(() => Native.EverOverlapsTposechainStbox(temp, box));
+
public static IntPtr TeqPosechainTposechain(IntPtr posechain, IntPtr temp)
=> SafeExecution(() => Native.TeqPosechainTposechain(posechain, temp));
diff --git a/MEOS.NET/Functions/Meos.pg_time.g.cs b/MEOS.NET/Functions/Meos.pg_time.g.cs
index 2c9e3bf..8274aa3 100644
--- a/MEOS.NET/Functions/Meos.pg_time.g.cs
+++ b/MEOS.NET/Functions/Meos.pg_time.g.cs
@@ -39,6 +39,9 @@ public static bool TimeEq(long time1, long time2)
public static IntPtr TimeExtract(long time, IntPtr units)
=> SafeExecution(() => Native.TimeExtract(time, units));
+ public static long TimeFromParts(long us)
+ => SafeExecution(() => Native.TimeFromParts(us));
+
public static bool TimeGe(long time1, long time2)
=> SafeExecution(() => Native.TimeGe(time1, time2));
@@ -81,6 +84,9 @@ public static long TimeSmaller(long time1, long time2)
public static IntPtr TimeToInterval(long time)
=> SafeExecution(() => Native.TimeToInterval(time));
+ public static bool TimeToParts(long time, IntPtr us)
+ => SafeExecution(() => Native.TimeToParts(time, us));
+
public static IntPtr TimeToTimetz(long time)
=> SafeExecution(() => Native.TimeToTimetz(time));
@@ -138,6 +144,9 @@ public static bool TimetzNe(IntPtr timetz1, IntPtr timetz2)
public static IntPtr TimetzCopy(IntPtr timetz)
=> SafeExecution(() => Native.TimetzCopy(timetz));
+ public static IntPtr TimetzFromParts(long us, int offset)
+ => SafeExecution(() => Native.TimetzFromParts(us, offset));
+
public static string TimetzOut(IntPtr timetz)
{
nuint _size = 0;
@@ -169,6 +178,9 @@ public static IntPtr TimetzScale(IntPtr timetz, int typmod)
public static IntPtr TimetzSmaller(IntPtr timetz1, IntPtr timetz2)
=> SafeExecution(() => Native.TimetzSmaller(timetz1, timetz2));
+ public static bool TimetzToParts(IntPtr timetz, IntPtr us, IntPtr offset)
+ => SafeExecution(() => Native.TimetzToParts(timetz, us, offset));
+
public static long TimetzToTime(IntPtr timetz)
=> SafeExecution(() => Native.TimetzToTime(timetz));
diff --git a/MEOS.NET/Types/MEOSConvert.g.cs b/MEOS.NET/Types/MEOSConvert.g.cs
index b65354c..98e8662 100644
--- a/MEOS.NET/Types/MEOSConvert.g.cs
+++ b/MEOS.NET/Types/MEOSConvert.g.cs
@@ -7,31 +7,70 @@
namespace MEOS.NET.Types
{
- /// The MEOS scalar time types as .NET values, and back.
+ /// The MEOS scalar time types as .NET values, and back, through
+ /// the MEOS conversions of the counts from the Unix epoch: a DateTime and a
+ /// DateOnly count from 0001-01-01, MEOS from 2000-01-01, and both sides
+ /// state the Unix epoch exactly. A DateTime counts ticks of 100 ns, so one
+ /// below a microsecond, which no MEOS timestamp holds, is refused; a value
+ /// the other side cannot state is refused by its constructor.
[System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")]
internal static class MEOSConvert
{
- /// A MEOS TimestampTz as a DateTime.
+ private const long TicksPerMicrosecond = TimeSpan.TicksPerMillisecond / 1000;
+
+ private static readonly int UnixEpochDayNumber =
+ DateOnly.FromDateTime(DateTime.UnixEpoch).DayNumber;
+
+ /// The microseconds from the Unix epoch of the clock a DateTime
+ /// reads, refusing a tick below a microsecond.
+ private static long UnixMicroseconds(DateTime moment)
+ {
+ long ticks = moment.Ticks - DateTime.UnixEpoch.Ticks;
+ if (ticks % TicksPerMicrosecond != 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(moment), moment,
+ "A MEOS timestamp holds whole microseconds.");
+ }
+
+ return ticks / TicksPerMicrosecond;
+ }
+
+ /// The DateTime of a count of microseconds from the Unix epoch.
+ private static DateTime FromUnixMicroseconds(long us, DateTimeKind kind)
+ => DateTime.SpecifyKind(DateTime.UnixEpoch.AddTicks(
+ checked(us * TicksPerMicrosecond)), kind);
+
+ /// A MEOS TimestampTz as a DateTime of UTC kind.
internal static DateTime ToDateTime(long timestamptz)
- => DateTime.Parse(Meos.TimestamptzOut(timestamptz),
- CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal
- | DateTimeStyles.AssumeUniversal);
+ => FromUnixMicroseconds(Meos.TimestamptzToUnixUs(timestamptz),
+ DateTimeKind.Utc);
- /// A DateTime as a MEOS TimestampTz.
+ /// A DateTime as a MEOS TimestampTz: a moment of UTC or local
+ /// kind at its instant, one of unspecified kind read in the zone of the
+ /// MEOS session, as MEOS reads a timestamp without an offset.
internal static long ToTimestampTz(DateTime moment)
- => Meos.TimestamptzIn(
- moment.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss.ffffff+00",
- CultureInfo.InvariantCulture), -1);
+ => moment.Kind == DateTimeKind.Unspecified
+ ? Meos.TimestampToTimestamptz(
+ Meos.UnixUsToTimestamp(UnixMicroseconds(moment)))
+ : Meos.UnixUsToTimestamptz(UnixMicroseconds(moment.ToUniversalTime()));
+
+ /// A MEOS Timestamp, which has no time zone, as a DateTime of
+ /// unspecified kind.
+ internal static DateTime ToUnzonedDateTime(long timestamp)
+ => FromUnixMicroseconds(Meos.TimestampToUnixUs(timestamp),
+ DateTimeKind.Unspecified);
+
+ /// A DateTime as a MEOS Timestamp: the clock it reads.
+ internal static long ToTimestamp(DateTime moment)
+ => Meos.UnixUsToTimestamp(UnixMicroseconds(moment));
/// A MEOS DateADT as a DateOnly.
internal static DateOnly ToDateOnly(int date)
- => DateOnly.Parse(Meos.DateOut(date),
- CultureInfo.InvariantCulture);
+ => DateOnly.FromDayNumber(checked(UnixEpochDayNumber + Meos.DateToUnixDays(date)));
/// A DateOnly as a MEOS DateADT.
internal static int ToDateADT(DateOnly day)
- => Meos.DateIn(
- day.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
+ => Meos.UnixDaysToDate(day.DayNumber - UnixEpochDayNumber);
/// Each MEOS TimestampTz of an array, as a DateTime.
internal static DateTime[] ToDateTimeArray(long[] moments)
@@ -45,6 +84,19 @@ internal static DateTime[] ToDateTimeArray(long[] moments)
return values;
}
+ /// Each MEOS Timestamp of an array, as a DateTime of unspecified
+ /// kind.
+ internal static DateTime[] ToUnzonedDateTimeArray(long[] moments)
+ {
+ DateTime[] values = new DateTime[moments.Length];
+ for (int i = 0; i < moments.Length; i++)
+ {
+ values[i] = ToUnzonedDateTime(moments[i]);
+ }
+
+ return values;
+ }
+
/// Each MEOS DateADT of an array, as a DateOnly.
internal static DateOnly[] ToDateOnlyArray(int[] days)
{
diff --git a/MEOS.NET/Types/STBox.g.cs b/MEOS.NET/Types/STBox.g.cs
index 82c002a..55a4487 100644
--- a/MEOS.NET/Types/STBox.g.cs
+++ b/MEOS.NET/Types/STBox.g.cs
@@ -144,12 +144,18 @@ public int AlwaysOverlaps(TGeo temp)
public int AlwaysOverlaps(TCBuffer temp)
=> Meos.AlwaysOverlapsStboxTcbuffer(this.Ptr, temp.Ptr);
+ public int AlwaysOverlaps(TQuadbin temp)
+ => Meos.AlwaysOverlapsStboxTcellindex(this.Ptr, temp.Ptr);
+
public int AlwaysOverlaps(TNPoint temp)
=> Meos.AlwaysOverlapsStboxTnpoint(this.Ptr, temp.Ptr);
public int AlwaysOverlaps(TPose temp)
=> Meos.AlwaysOverlapsStboxTpose(this.Ptr, temp.Ptr);
+ public int AlwaysOverlaps(TPoseChain temp)
+ => Meos.AlwaysOverlapsStboxTposechain(this.Ptr, temp.Ptr);
+
public int AlwaysOverlaps(TRGeometry temp)
=> Meos.AlwaysOverlapsStboxTrgeometry(this.Ptr, temp.Ptr);
@@ -420,12 +426,18 @@ public int EverOverlaps(TGeo temp)
public int EverOverlaps(TCBuffer temp)
=> Meos.EverOverlapsStboxTcbuffer(this.Ptr, temp.Ptr);
+ public int EverOverlaps(TQuadbin temp)
+ => Meos.EverOverlapsStboxTcellindex(this.Ptr, temp.Ptr);
+
public int EverOverlaps(TNPoint temp)
=> Meos.EverOverlapsStboxTnpoint(this.Ptr, temp.Ptr);
public int EverOverlaps(TPose temp)
=> Meos.EverOverlapsStboxTpose(this.Ptr, temp.Ptr);
+ public int EverOverlaps(TPoseChain temp)
+ => Meos.EverOverlapsStboxTposechain(this.Ptr, temp.Ptr);
+
public int EverOverlaps(TRGeometry temp)
=> Meos.EverOverlapsStboxTrgeometry(this.Ptr, temp.Ptr);
diff --git a/MEOS.NET/Types/TCBuffer.g.cs b/MEOS.NET/Types/TCBuffer.g.cs
index f3f7617..7affbdb 100644
--- a/MEOS.NET/Types/TCBuffer.g.cs
+++ b/MEOS.NET/Types/TCBuffer.g.cs
@@ -87,6 +87,9 @@ public int AlwaysNe(TCBuffer temp2)
public int AlwaysOverlaps(STBox box)
=> Meos.AlwaysOverlapsTcbufferStbox(this.Ptr, box.Ptr);
+ public int AlwaysOverlaps(TCBuffer temp2)
+ => Meos.AlwaysOverlapsTcbufferTcbuffer(this.Ptr, temp2.Ptr);
+
public Temporal? AtCbuffer(CBuffer cb)
=> MEOSFactory.WrapTemporal(Meos.TcbufferAtCbuffer(this.Ptr, cb.Ptr));
@@ -192,6 +195,9 @@ public int EverNe(TCBuffer temp2)
public int EverOverlaps(STBox box)
=> Meos.EverOverlapsTcbufferStbox(this.Ptr, box.Ptr);
+ public int EverOverlaps(TCBuffer temp2)
+ => Meos.EverOverlapsTcbufferTcbuffer(this.Ptr, temp2.Ptr);
+
public Temporal? Expand(double dist)
=> MEOSFactory.WrapTemporal(Meos.TcbufferExpand(this.Ptr, dist));
diff --git a/MEOS.NET/Types/TCellIndex.g.cs b/MEOS.NET/Types/TCellIndex.g.cs
index 819c5f7..e436adc 100644
--- a/MEOS.NET/Types/TCellIndex.g.cs
+++ b/MEOS.NET/Types/TCellIndex.g.cs
@@ -14,6 +14,9 @@ public class TCellIndex : TSpatial
{
internal TCellIndex(IntPtr ptr) : base(ptr) { }
+ public Temporal? AtStbox(STBox box, bool border_inc)
+ => MEOSFactory.WrapTemporal(Meos.TcellindexAtStbox(this.Ptr, box.Ptr, border_inc));
+
public Temporal? CellArea()
=> MEOSFactory.WrapTemporal(Meos.TcellindexCellArea(this.Ptr));
@@ -32,5 +35,8 @@ internal TCellIndex(IntPtr ptr) : base(ptr) { }
public Temporal? IsValidCell()
=> MEOSFactory.WrapTemporal(Meos.TcellindexIsValidCell(this.Ptr));
+ public Temporal? MinusStbox(STBox box, bool border_inc)
+ => MEOSFactory.WrapTemporal(Meos.TcellindexMinusStbox(this.Ptr, box.Ptr, border_inc));
+
}
}
diff --git a/MEOS.NET/Types/TNPoint.g.cs b/MEOS.NET/Types/TNPoint.g.cs
index 146f995..509a15d 100644
--- a/MEOS.NET/Types/TNPoint.g.cs
+++ b/MEOS.NET/Types/TNPoint.g.cs
@@ -42,6 +42,9 @@ public int AlwaysNe(TNPoint temp2)
public int AlwaysOverlaps(STBox box)
=> Meos.AlwaysOverlapsTnpointStbox(this.Ptr, box.Ptr);
+ public int AlwaysOverlaps(TNPoint temp2)
+ => Meos.AlwaysOverlapsTnpointTnpoint(this.Ptr, temp2.Ptr);
+
public Temporal? AtGeom(Geo gs)
=> MEOSFactory.WrapTemporal(Meos.TnpointAtGeom(this.Ptr, gs.Ptr));
@@ -117,6 +120,9 @@ public int EverNe(TNPoint temp2)
public int EverOverlaps(STBox box)
=> Meos.EverOverlapsTnpointStbox(this.Ptr, box.Ptr);
+ public int EverOverlaps(TNPoint temp2)
+ => Meos.EverOverlapsTnpointTnpoint(this.Ptr, temp2.Ptr);
+
public bool Left(TNPoint temp2)
=> Meos.LeftTspatialTspatial(this.Ptr, temp2.Ptr);
diff --git a/MEOS.NET/Types/TPCPatch.g.cs b/MEOS.NET/Types/TPCPatch.g.cs
index a2c2f84..0fcf589 100644
--- a/MEOS.NET/Types/TPCPatch.g.cs
+++ b/MEOS.NET/Types/TPCPatch.g.cs
@@ -36,6 +36,9 @@ public int AlwaysOverlaps(TPCBox box)
public Temporal? AtTpcbox(TPCBox box, bool border_inc)
=> MEOSFactory.WrapTemporal(Meos.TpcpatchAtTpcbox(this.Ptr, box.Ptr, border_inc));
+ public Temporal? AtTpcboxFine(TPCBox box, bool border_inc)
+ => MEOSFactory.WrapTemporal(Meos.TpcpatchAtTpcboxFine(this.Ptr, box.Ptr, border_inc));
+
public Temporal? AtValue(PCPatch pa)
=> MEOSFactory.WrapTemporal(Meos.TpcpatchAtValue(this.Ptr, pa.Ptr));
@@ -63,6 +66,9 @@ public int EverOverlaps(TPCBox box)
public Temporal? MinusTpcbox(TPCBox box, bool border_inc)
=> MEOSFactory.WrapTemporal(Meos.TpcpatchMinusTpcbox(this.Ptr, box.Ptr, border_inc));
+ public Temporal? MinusTpcboxFine(TPCBox box, bool border_inc)
+ => MEOSFactory.WrapTemporal(Meos.TpcpatchMinusTpcboxFine(this.Ptr, box.Ptr, border_inc));
+
public Temporal? MinusValue(PCPatch pa)
=> MEOSFactory.WrapTemporal(Meos.TpcpatchMinusValue(this.Ptr, pa.Ptr));
diff --git a/MEOS.NET/Types/TPoseChain.g.cs b/MEOS.NET/Types/TPoseChain.g.cs
index ba327a4..49fa5b1 100644
--- a/MEOS.NET/Types/TPoseChain.g.cs
+++ b/MEOS.NET/Types/TPoseChain.g.cs
@@ -39,9 +39,15 @@ public int AlwaysNe(PoseChain posechain)
public int AlwaysNe(TPoseChain temp2)
=> Meos.AlwaysNeTposechainTposechain(this.Ptr, temp2.Ptr);
+ public int AlwaysOverlaps(STBox box)
+ => Meos.AlwaysOverlapsTposechainStbox(this.Ptr, box.Ptr);
+
public string AsGeopose(int precision)
=> Meos.TposechainAsGeopose(this.Ptr, precision);
+ public Temporal? AtStbox(STBox box, bool border_inc)
+ => MEOSFactory.WrapTemporal(Meos.TposechainAtStbox(this.Ptr, box.Ptr, border_inc));
+
public Temporal? AtValue(PoseChain pc)
=> MEOSFactory.WrapTemporal(Meos.TposechainAtValue(this.Ptr, pc.Ptr));
@@ -93,12 +99,18 @@ public int EverNe(PoseChain posechain)
public int EverNe(TPoseChain temp2)
=> Meos.EverNeTposechainTposechain(this.Ptr, temp2.Ptr);
+ public int EverOverlaps(STBox box)
+ => Meos.EverOverlapsTposechainStbox(this.Ptr, box.Ptr);
+
public bool Front(TPoseChain temp2)
=> Meos.FrontTspatialTspatial(this.Ptr, temp2.Ptr);
public bool Left(TPoseChain temp2)
=> Meos.LeftTspatialTspatial(this.Ptr, temp2.Ptr);
+ public Temporal? MinusStbox(STBox box, bool border_inc)
+ => MEOSFactory.WrapTemporal(Meos.TposechainMinusStbox(this.Ptr, box.Ptr, border_inc));
+
public Temporal? MinusValue(PoseChain pc)
=> MEOSFactory.WrapTemporal(Meos.TposechainMinusValue(this.Ptr, pc.Ptr));
diff --git a/MEOS.NET/Types/TQuadbin.g.cs b/MEOS.NET/Types/TQuadbin.g.cs
index ced5d20..6114f7d 100644
--- a/MEOS.NET/Types/TQuadbin.g.cs
+++ b/MEOS.NET/Types/TQuadbin.g.cs
@@ -39,6 +39,9 @@ public int AlwaysNe(Quadbin cell)
public int AlwaysNe(TQuadbin temp2)
=> Meos.AlwaysNeTquadbinTquadbin(this.Ptr, temp2.Ptr);
+ public int AlwaysOverlaps(STBox box)
+ => Meos.AlwaysOverlapsTcellindexStbox(this.Ptr, box.Ptr);
+
public Temporal? AtValue(Quadbin cell)
=> MEOSFactory.WrapTemporal(Meos.TquadbinAtValue(this.Ptr, cell.value));
@@ -87,6 +90,9 @@ public int EverNe(Quadbin cell)
public int EverNe(TQuadbin temp2)
=> Meos.EverNeTquadbinTquadbin(this.Ptr, temp2.Ptr);
+ public int EverOverlaps(STBox box)
+ => Meos.EverOverlapsTcellindexStbox(this.Ptr, box.Ptr);
+
public Temporal? GridDistance(Temporal dest)
=> MEOSFactory.WrapTemporal(Meos.TquadbinGridDistance(this.Ptr, dest.Ptr));
diff --git a/tools/objectgen.py b/tools/objectgen.py
index 48a01b7..722b11c 100644
--- a/tools/objectgen.py
+++ b/tools/objectgen.py
@@ -505,8 +505,10 @@ def map_return(self, f: dict, wrapper_ret: str) -> tuple[str, str] | None:
c = clean(f["returnType"]["canonical"])
if wrapper_ret == "void":
return ("void", "$")
- if c in ("TimestampTz", "Timestamp"):
+ if c == "TimestampTz":
return ("DateTime", "MEOSConvert.ToDateTime($)")
+ if c == "Timestamp":
+ return ("DateTime", "MEOSConvert.ToUnzonedDateTime($)")
if c == "DateADT":
return ("DateOnly", "MEOSConvert.ToDateOnly($)")
# A value of a class held by value (#class_for_value) is the class
@@ -791,8 +793,10 @@ def map_array_item(self, piece: str, c_type: str, item: str,
cls = (self.m.class_for_ctype(c_type)
or self.m.class_for_ctype(f"{c_type} *"))
return (f"{cls}?[]", f"MEOSFactory.Wrap{cls}Array({item})") if cls else None
- if c_type in ("TimestampTz", "Timestamp") and piece == "long[]":
+ if c_type == "TimestampTz" and piece == "long[]":
return ("DateTime[]", f"MEOSConvert.ToDateTimeArray({item})")
+ if c_type == "Timestamp" and piece == "long[]":
+ return ("DateTime[]", f"MEOSConvert.ToUnzonedDateTimeArray({item})")
if c_type == "DateADT" and piece == "int[]":
return ("DateOnly[]", f"MEOSConvert.ToDateOnlyArray({item})")
if piece.endswith("[]") and is_scalar(piece[:-2]):
@@ -833,8 +837,10 @@ def map_param(self, c_type: str, cs_type: str, name: str,
c = clean(c_type)
if value and "*" not in c and is_scalar(cs_type):
return (value, f"{name}.value")
- if c in ("TimestampTz", "Timestamp"):
+ if c == "TimestampTz":
return ("DateTime", f"MEOSConvert.ToTimestampTz({name})")
+ if c == "Timestamp":
+ return ("DateTime", f"MEOSConvert.ToTimestamp({name})")
if c == "DateADT":
return ("DateOnly", f"MEOSConvert.ToDateADT({name})")
text = self.enum_text(c) if c in codegen.ENUM_TYPES else None
@@ -1832,31 +1838,70 @@ def convert_file(self) -> str:
namespace {NAMESPACE}
{{
- /// The MEOS scalar time types as .NET values, and back.
+ /// The MEOS scalar time types as .NET values, and back, through
+ /// the MEOS conversions of the counts from the Unix epoch: a DateTime and a
+ /// DateOnly count from 0001-01-01, MEOS from 2000-01-01, and both sides
+ /// state the Unix epoch exactly. A DateTime counts ticks of 100 ns, so one
+ /// below a microsecond, which no MEOS timestamp holds, is refused; a value
+ /// the other side cannot state is refused by its constructor.
[System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "{GENERATOR_VERSION}")]
internal static class MEOSConvert
{{
- /// A MEOS TimestampTz as a DateTime.
+ private const long TicksPerMicrosecond = TimeSpan.TicksPerMillisecond / 1000;
+
+ private static readonly int UnixEpochDayNumber =
+ DateOnly.FromDateTime(DateTime.UnixEpoch).DayNumber;
+
+ /// The microseconds from the Unix epoch of the clock a DateTime
+ /// reads, refusing a tick below a microsecond.
+ private static long UnixMicroseconds(DateTime moment)
+ {{
+ long ticks = moment.Ticks - DateTime.UnixEpoch.Ticks;
+ if (ticks % TicksPerMicrosecond != 0)
+ {{
+ throw new ArgumentOutOfRangeException(nameof(moment), moment,
+ "A MEOS timestamp holds whole microseconds.");
+ }}
+
+ return ticks / TicksPerMicrosecond;
+ }}
+
+ /// The DateTime of a count of microseconds from the Unix epoch.
+ private static DateTime FromUnixMicroseconds(long us, DateTimeKind kind)
+ => DateTime.SpecifyKind(DateTime.UnixEpoch.AddTicks(
+ checked(us * TicksPerMicrosecond)), kind);
+
+ /// A MEOS TimestampTz as a DateTime of UTC kind.
internal static DateTime ToDateTime(long timestamptz)
- => DateTime.Parse(Meos.TimestamptzOut(timestamptz),
- CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal
- | DateTimeStyles.AssumeUniversal);
+ => FromUnixMicroseconds(Meos.TimestamptzToUnixUs(timestamptz),
+ DateTimeKind.Utc);
- /// A DateTime as a MEOS TimestampTz.
+ /// A DateTime as a MEOS TimestampTz: a moment of UTC or local
+ /// kind at its instant, one of unspecified kind read in the zone of the
+ /// MEOS session, as MEOS reads a timestamp without an offset.
internal static long ToTimestampTz(DateTime moment)
- => Meos.TimestamptzIn(
- moment.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss.ffffff+00",
- CultureInfo.InvariantCulture), -1);
+ => moment.Kind == DateTimeKind.Unspecified
+ ? Meos.TimestampToTimestamptz(
+ Meos.UnixUsToTimestamp(UnixMicroseconds(moment)))
+ : Meos.UnixUsToTimestamptz(UnixMicroseconds(moment.ToUniversalTime()));
+
+ /// A MEOS Timestamp, which has no time zone, as a DateTime of
+ /// unspecified kind.
+ internal static DateTime ToUnzonedDateTime(long timestamp)
+ => FromUnixMicroseconds(Meos.TimestampToUnixUs(timestamp),
+ DateTimeKind.Unspecified);
+
+ /// A DateTime as a MEOS Timestamp: the clock it reads.
+ internal static long ToTimestamp(DateTime moment)
+ => Meos.UnixUsToTimestamp(UnixMicroseconds(moment));
/// A MEOS DateADT as a DateOnly.
internal static DateOnly ToDateOnly(int date)
- => DateOnly.Parse(Meos.DateOut(date),
- CultureInfo.InvariantCulture);
+ => DateOnly.FromDayNumber(checked(UnixEpochDayNumber + Meos.DateToUnixDays(date)));
/// A DateOnly as a MEOS DateADT.
internal static int ToDateADT(DateOnly day)
- => Meos.DateIn(
- day.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
+ => Meos.UnixDaysToDate(day.DayNumber - UnixEpochDayNumber);
/// Each MEOS TimestampTz of an array, as a DateTime.
internal static DateTime[] ToDateTimeArray(long[] moments)
@@ -1870,6 +1915,19 @@ def convert_file(self) -> str:
return values;
}}
+ /// Each MEOS Timestamp of an array, as a DateTime of unspecified
+ /// kind.
+ internal static DateTime[] ToUnzonedDateTimeArray(long[] moments)
+ {{
+ DateTime[] values = new DateTime[moments.Length];
+ for (int i = 0; i < moments.Length; i++)
+ {{
+ values[i] = ToUnzonedDateTime(moments[i]);
+ }}
+
+ return values;
+ }}
+
/// Each MEOS DateADT of an array, as a DateOnly.
internal static DateOnly[] ToDateOnlyArray(int[] days)
{{