From ac2c5709c17f267777fb93d031887cdcb06aa255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Zim=C3=A1nyi?= Date: Thu, 3 Sep 2026 13:33:43 +0200 Subject: [PATCH] Answer the nearest-neighbour walk as the cursor it is The catalog gives the R-tree and SP-tree kNN cursors classes, so the object layer carries `RTreeNNCursor` and `SPNNCursor`: a cursor is opened from a tree, closed when the walk ends, and the three entries sit on the cursor rather than among the tree's twenty methods. 115 classes and 1342 methods against 113 and 1338, 18 deferred against 22. `TBigint.Values` reaches the layer with them, its count declared the way its definition writes it, so every temporal number answers its distinct values as an array of them. `next` stays deferred on both cursors: it answers the id AND the distance through two out-parameters, and one body writing both is the same shape the value-and-time splits need. --- MEOS.NET/Functions/Meos.meos.g.cs | 15 ++++++++-- MEOS.NET/Types/MEOSFactory.g.cs | 48 +++++++++++++++++++++++++++++++ MEOS.NET/Types/RTreeNNCursor.g.cs | 24 ++++++++++++++++ MEOS.NET/Types/SPNNCursor.g.cs | 24 ++++++++++++++++ MEOS.NET/Types/TBigint.g.cs | 3 ++ 5 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 MEOS.NET/Types/RTreeNNCursor.g.cs create mode 100644 MEOS.NET/Types/SPNNCursor.g.cs diff --git a/MEOS.NET/Functions/Meos.meos.g.cs b/MEOS.NET/Functions/Meos.meos.g.cs index 757a524..dd03274 100644 --- a/MEOS.NET/Functions/Meos.meos.g.cs +++ b/MEOS.NET/Functions/Meos.meos.g.cs @@ -3136,8 +3136,19 @@ public static int[] TintValues(IntPtr temp) finally { Marshal.FreeHGlobal(_cnt); } } - public static IntPtr TbigintValues(IntPtr temp, IntPtr count) - => SafeExecution(() => Native.TbigintValues(temp, count)); + public static long[] TbigintValues(IntPtr temp) + { + IntPtr _cnt = Marshal.AllocHGlobal(sizeof(int)); + try + { + IntPtr _p = SafeExecution(() => Native.TbigintValues(temp, _cnt)); + int _n = Marshal.ReadInt32(_cnt); + long[] _out = new long[_n]; + Marshal.Copy(_p, _out, 0, _n); + return _out; + } + finally { Marshal.FreeHGlobal(_cnt); } + } public static double TnumberAvgValue(IntPtr temp) => SafeExecution(() => Native.TnumberAvgValue(temp)); diff --git a/MEOS.NET/Types/MEOSFactory.g.cs b/MEOS.NET/Types/MEOSFactory.g.cs index bf0c29c..2768a23 100644 --- a/MEOS.NET/Types/MEOSFactory.g.cs +++ b/MEOS.NET/Types/MEOSFactory.g.cs @@ -329,6 +329,30 @@ public static class MEOSFactory return wrapped; } + /// The value at as the RTreeNNCursor + /// class the model gives its runtime type. + public static RTreeNNCursor? WrapRTreeNNCursor(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new RTreeNNCursor(ptr); + } + + /// Every element of a C array of RTreeNNCursor pointers, wrapped. + public static RTreeNNCursor?[] WrapRTreeNNCursorArray(IntPtr[] ptrs) + { + RTreeNNCursor?[] wrapped = new RTreeNNCursor?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapRTreeNNCursor(ptrs[i]); + } + + return wrapped; + } + /// The value at as the Raquet /// class the model gives its runtime type. public static Raquet? WrapRaquet(IntPtr ptr) @@ -353,6 +377,30 @@ public static class MEOSFactory return wrapped; } + /// The value at as the SPNNCursor + /// class the model gives its runtime type. + public static SPNNCursor? WrapSPNNCursor(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + { + return null; + } + + return new SPNNCursor(ptr); + } + + /// Every element of a C array of SPNNCursor pointers, wrapped. + public static SPNNCursor?[] WrapSPNNCursorArray(IntPtr[] ptrs) + { + SPNNCursor?[] wrapped = new SPNNCursor?[ptrs.Length]; + for (int i = 0; i < ptrs.Length; i++) + { + wrapped[i] = WrapSPNNCursor(ptrs[i]); + } + + return wrapped; + } + /// The value at as the SPTree /// class the model gives its runtime type. public static SPTree? WrapSPTree(IntPtr ptr) diff --git a/MEOS.NET/Types/RTreeNNCursor.g.cs b/MEOS.NET/Types/RTreeNNCursor.g.cs new file mode 100644 index 0000000..0c638b4 --- /dev/null +++ b/MEOS.NET/Types/RTreeNNCursor.g.cs @@ -0,0 +1,24 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; +using MEOS.NET.Structures; + +namespace MEOS.NET.Types +{ + /// A walk over an R-tree's entries in order of distance from a query. MEOS registers it in no enum, so it names no temptype. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class RTreeNNCursor : Value + { + internal RTreeNNCursor(IntPtr ptr) : base(ptr) { } + + public void Close() + => Meos.RtreeNnCursorClose(this.Ptr); + + public static RTreeNNCursor? Open(RTree rtree, IntPtr query) + => MEOSFactory.WrapRTreeNNCursor(Meos.RtreeNnCursorOpen(rtree.Ptr, query)); + + } +} diff --git a/MEOS.NET/Types/SPNNCursor.g.cs b/MEOS.NET/Types/SPNNCursor.g.cs new file mode 100644 index 0000000..6ad4c3a --- /dev/null +++ b/MEOS.NET/Types/SPNNCursor.g.cs @@ -0,0 +1,24 @@ +#nullable enable + +using System.Runtime.InteropServices; + +using MEOS.NET.Enums; +using MEOS.NET.Functions; +using MEOS.NET.Structures; + +namespace MEOS.NET.Types +{ + /// The SP-tree's nearest-neighbour walk, the R-tree cursor's sibling. MEOS registers it in no enum, so it names no temptype. + [System.CodeDom.Compiler.GeneratedCode("MEOS.NET.ObjectGen", "0.1.0")] + public class SPNNCursor : Value + { + internal SPNNCursor(IntPtr ptr) : base(ptr) { } + + public void Close() + => Meos.SptreeNnCursorClose(this.Ptr); + + public static SPNNCursor? Open(SPTree sptree, IntPtr query) + => MEOSFactory.WrapSPNNCursor(Meos.SptreeNnCursorOpen(sptree.Ptr, query)); + + } +} diff --git a/MEOS.NET/Types/TBigint.g.cs b/MEOS.NET/Types/TBigint.g.cs index 5105d83..8fa2835 100644 --- a/MEOS.NET/Types/TBigint.g.cs +++ b/MEOS.NET/Types/TBigint.g.cs @@ -93,6 +93,9 @@ public long StartValue() } } + public long[] Values() + => Meos.TbigintValues(this.Ptr); + public static Temporal? FromBaseTemp(long i, Temporal temp) => MEOSFactory.WrapTemporal(Meos.TbigintFromBaseTemp(i, temp.Ptr));