diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml new file mode 100644 index 0000000..4b59efd --- /dev/null +++ b/.github/workflows/pr_build.yml @@ -0,0 +1,108 @@ +name: PR build validation + +on: + pull_request: + branches: [master, "stable-[0-9]+.[0-9]+"] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Build PyMEOS CFFI on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-13, macos-14] + include: + - ld_prefix: "/usr/local" + - os: macos-14 + ld_prefix: "/opt/homebrew" + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Derive MEOS branch from package version + id: meos_branch + shell: bash + run: | + python_version=$(sed -nE 's/^__version__ = "([^"]+)".*/\1/p' pymeos_cffi/__init__.py) + major_minor=$(echo "$python_version" | sed -nE 's/^([0-9]+\.[0-9]+).*/\1/p') + candidate="stable-${major_minor}" + if git ls-remote --exit-code https://github.com/MobilityDB/MobilityDB "$candidate" >/dev/null 2>&1; then + meos_branch=$candidate + else + meos_branch="master" + fi + echo "Package version $python_version => MEOS branch $meos_branch" + echo "meos_branch=$meos_branch" >> "$GITHUB_OUTPUT" + + - name: Install MEOS build deps (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y build-essential cmake postgresql-server-dev-16 \ + libproj-dev libgeos-dev libgsl-dev libjson-c-dev + + - name: Install MEOS build deps (macOS) + if: runner.os == 'macOS' + uses: tecolicom/actions-use-homebrew-tools@v1 + with: + tools: cmake libpq proj json-c gsl geos + + - name: Build and install MEOS + shell: bash + run: | + git clone --depth 1 --branch ${{ steps.meos_branch.outputs.meos_branch }} \ + https://github.com/MobilityDB/MobilityDB + mkdir MobilityDB/build + cd MobilityDB/build + if [ "${{ runner.os }}" = "macOS" ]; then + export MACOSX_DEPLOYMENT_TARGET="${{ matrix.os == 'macos-14' && 14 || 13.6 }}" + fi + cmake .. -DMEOS=ON -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${{ matrix.ld_prefix }} + make -j + sudo make install + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: "pip" + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + python -m pip install build cffi setuptools + + - name: Build sdist + run: | + python -m build -s + ls -l dist + + - name: Install from sdist + shell: bash + run: | + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib + export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib + pip install dist/pymeos_cffi-*.tar.gz + + - name: Smoke-test CFFI binding + shell: bash + run: | + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib + export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib + python -c " + import pymeos_cffi + from pymeos_cffi import meos_initialize, meos_finalize + meos_initialize('UTC') + # Confirm a representative C function resolves + assert callable(pymeos_cffi.tstzspan_make), 'tstzspan_make missing' + meos_finalize() + print('PyMEOS CFFI build + smoke test OK on ${{ matrix.os }}') + " diff --git a/builder/build_header.py b/builder/build_header.py index e7c612a..70443d8 100644 --- a/builder/build_header.py +++ b/builder/build_header.py @@ -24,7 +24,7 @@ def get_defined_functions(library_path): def remove_undefined_functions(content, so_path): defined = get_defined_functions(so_path) - undefined_types = ["json_object"] + undefined_types = ["json_object", "GEOSContextHandle_t"] def remove_if_not_defined(m): function = m.group(0).split("(")[0].strip().split(" ")[-1].strip("*") diff --git a/builder/build_pymeos_functions.py b/builder/build_pymeos_functions.py index cf30396..e1d109a 100644 --- a/builder/build_pymeos_functions.py +++ b/builder/build_pymeos_functions.py @@ -197,7 +197,9 @@ def is_result_parameter(function: str, parameter: Parameter) -> bool: def is_output_parameter(function: str, parameter: Parameter) -> bool: if parameter.name.endswith("_out"): return True - if parameter.name == "count" and parameter.ptype.endswith("*'"): + # ``int *count`` is the canonical trailing-output pattern that returns + # an array's length; auto-detect it on name + raw ctype. + if parameter.name == "count" and parameter.ctype == "int *": return True return (function, parameter.name) in output_parameters diff --git a/builder/build_pymeos_functions_modifiers.py b/builder/build_pymeos_functions_modifiers.py index df851e1..bd1c14f 100644 --- a/builder/build_pymeos_functions_modifiers.py +++ b/builder/build_pymeos_functions_modifiers.py @@ -29,8 +29,11 @@ def custom_array_modifier(function: str) -> str: def textset_make_modifier(function: str) -> str: function = array_parameter_modifier("values", "count")(function) - return function.replace("_ffi.cast('const text *', x)", "cstring2text(x)").replace( - "'list[const text]'", "list[str]" + return ( + function.replace("_ffi.cast('const text *', x)", "cstring2text(x)") + .replace("_ffi.cast('text *', x)", "cstring2text(x)") + .replace("'list[const text]'", "list[str]") + .replace("'list[text]'", "list[str]") ) @@ -77,8 +80,8 @@ def text2cstring_modifier(_: str) -> str: def from_wkb_modifier(function: str, return_type: str) -> Callable[[str], str]: - return ( - lambda _: f"""def {function}(wkb: bytes) -> '{return_type} *': + return lambda _: ( + f"""def {function}(wkb: bytes) -> '{return_type} *': wkb_converted = _ffi.new('uint8_t []', wkb) result = _lib.{function}(wkb_converted, len(wkb)) return result if result != _ffi.NULL else None""" diff --git a/builder/meos.h b/builder/meos.h index 07baee7..4066b3f 100644 --- a/builder/meos.h +++ b/builder/meos.h @@ -202,30 +202,21 @@ typedef struct int j; } Match; -#define SKIPLIST_MAXLEVEL 32 -typedef struct -{ - void *value; - int height; - int next[SKIPLIST_MAXLEVEL]; -} SkipListElem; - -typedef struct -{ - int capacity; - int next; - int length; - int *freed; - int freecount; - int freecap; - int tail; - void *extra; - size_t extrasize; - SkipListElem *elems; -} SkipList; +typedef struct SkipList SkipList; typedef struct RTree RTree; +extern RTree *rtree_create_intspan(); +extern RTree *rtree_create_bigintspan(); +extern RTree *rtree_create_floatspan(); +extern RTree *rtree_create_datespan(); +extern RTree *rtree_create_tstzspan(); +extern RTree *rtree_create_tbox(); +extern RTree *rtree_create_stbox(); +extern void rtree_free(RTree *rtree); +extern void rtree_insert(RTree *rtree, void *box, int64 id); +extern int *rtree_search(const RTree *rtree,const void *query, int *count); + typedef enum { MEOS_SUCCESS = 0, @@ -291,9 +282,12 @@ extern TimestampTz date_to_timestamptz(DateADT d); extern double float_exp(double d); extern double float_ln(double d); extern double float_log10(double d); +extern char *float8_out(double d, int maxdd); extern double float_round(double d, int maxdd); +extern int int32_cmp(int32 l, int32 r); +extern int int64_cmp(int64 l, int64 r); extern Interval *interval_make(int32 years, int32 months, int32 weeks, int32 days, int32 hours, int32 mins, double secs); -extern Interval *minus_date_date(DateADT d1, DateADT d2); +extern int minus_date_date(DateADT d1, DateADT d2); extern DateADT minus_date_int(DateADT d, int32 days); extern TimestampTz minus_timestamptz_interval(TimestampTz t, const Interval *interv); extern Interval *minus_timestamptz_timestamptz(TimestampTz t1, TimestampTz t2); @@ -310,6 +304,7 @@ extern char *pg_timestamptz_out(TimestampTz t); extern char *text2cstring(const text *txt); extern int text_cmp(const text *txt1, const text *txt2); extern text *text_copy(const text *txt); +extern text *text_in(const char *str); extern text *text_initcap(const text *txt); extern text *text_lower(const text *txt); extern char *text_out(const text *txt); @@ -321,6 +316,7 @@ extern DateADT timestamptz_to_date(TimestampTz t); extern Set *bigintset_in(const char *str); extern char *bigintset_out(const Set *set); +extern Span *bigintspan_expand(const Span *s, int64 value); extern Span *bigintspan_in(const char *str); extern char *bigintspan_out(const Span *s); extern SpanSet *bigintspanset_in(const char *str); @@ -333,12 +329,14 @@ extern SpanSet *datespanset_in(const char *str); extern char *datespanset_out(const SpanSet *ss); extern Set *floatset_in(const char *str); extern char *floatset_out(const Set *set, int maxdd); +extern Span *floatspan_expand(const Span *s, double value); extern Span *floatspan_in(const char *str); extern char *floatspan_out(const Span *s, int maxdd); extern SpanSet *floatspanset_in(const char *str); extern char *floatspanset_out(const SpanSet *ss, int maxdd); extern Set *intset_in(const char *str); extern char *intset_out(const Set *set); +extern Span *intspan_expand(const Span *s, int32 value); extern Span *intspan_in(const char *str); extern char *intspan_out(const Span *s); extern SpanSet *intspanset_in(const char *str); @@ -376,7 +374,7 @@ extern Set *set_copy(const Set *s); extern Span *span_copy(const Span *s); extern SpanSet *spanset_copy(const SpanSet *ss); extern SpanSet *spanset_make(Span *spans, int count); -extern Set *textset_make(const text **values, int count); +extern Set *textset_make(text **values, int count); extern Set *tstzset_make(const TimestampTz *values, int count); extern Span *tstzspan_make(TimestampTz lower, TimestampTz upper, bool lower_inc, bool upper_inc); @@ -518,7 +516,6 @@ extern SpanSet *floatspanset_shift_scale(const SpanSet *ss, double shift, double extern Set *intset_shift_scale(const Set *s, int shift, int width, bool hasshift, bool haswidth); extern Span *intspan_shift_scale(const Span *s, int shift, int width, bool hasshift, bool haswidth); extern SpanSet *intspanset_shift_scale(const SpanSet *ss, int shift, int width, bool hasshift, bool haswidth); -extern Span *numspan_expand(const Span *s, Datum value); extern Span *tstzspan_expand(const Span *s, const Interval *interv); extern Set *set_round(const Set *s, int maxdd); extern Set *textcat_text_textset(const text *txt, const Set *s); @@ -974,6 +971,8 @@ extern Span *tbox_to_floatspan(const TBox *box); extern Span *tbox_to_tstzspan(const TBox *box); extern TBox *timestamptz_to_tbox(TimestampTz t); +extern uint32 tbox_hash(const TBox *box); +extern uint64 tbox_hash_extended(const TBox *box, uint64 seed); extern bool tbox_hast(const TBox *box); extern bool tbox_hasx(const TBox *box); extern bool tbox_tmax(const TBox *box, TimestampTz *result); @@ -989,13 +988,13 @@ extern bool tboxfloat_xmin(const TBox *box, double *result); extern bool tboxint_xmax(const TBox *box, int *result); extern bool tboxint_xmin(const TBox *box, int *result); -extern TBox *tbox_expand_float(const TBox *box, double d); -extern TBox *tbox_expand_int(const TBox *box, int i); extern TBox *tbox_expand_time(const TBox *box, const Interval *interv); extern TBox *tbox_round(const TBox *box, int maxdd); -extern TBox *tbox_shift_scale_float(const TBox *box, double shift, double width, bool hasshift, bool haswidth); -extern TBox *tbox_shift_scale_int(const TBox *box, int shift, int width, bool hasshift, bool haswidth); extern TBox *tbox_shift_scale_time(const TBox *box, const Interval *shift, const Interval *duration); +extern TBox *tfloatbox_expand(const TBox *box, double d); +extern TBox *tfloatbox_shift_scale(const TBox *box, double shift, double width, bool hasshift, bool haswidth); +extern TBox *tintbox_expand(const TBox *box, int i); +extern TBox *tintbox_shift_scale(const TBox *box, int shift, int width, bool hasshift, bool haswidth); extern TBox *union_tbox_tbox(const TBox *box1, const TBox *box2, bool strict); extern TBox *intersection_tbox_tbox(const TBox *box1, const TBox *box2); @@ -1057,9 +1056,9 @@ extern TInstant *tintinst_make(int i, TimestampTz t); extern TSequence *tintseq_from_base_tstzset(int i, const Set *s); extern TSequence *tintseq_from_base_tstzspan(int i, const Span *s); extern TSequenceSet *tintseqset_from_base_tstzspanset(int i, const SpanSet *ss); -extern TSequence *tsequence_make(const TInstant **instants, int count, bool lower_inc, bool upper_inc, interpType interp, bool normalize); -extern TSequenceSet *tsequenceset_make(const TSequence **sequences, int count, bool normalize); -extern TSequenceSet *tsequenceset_make_gaps(const TInstant **instants, int count, interpType interp, const Interval *maxt, double maxdist); +extern TSequence *tsequence_make(TInstant **instants, int count, bool lower_inc, bool upper_inc, interpType interp, bool normalize); +extern TSequenceSet *tsequenceset_make(TSequence **sequences, int count, bool normalize); +extern TSequenceSet *tsequenceset_make_gaps(TInstant **instants, int count, interpType interp, const Interval *maxt, double maxdist); extern Temporal *ttext_from_base_temp(const text *txt, const Temporal *temp); extern TInstant *ttextinst_make(const text *txt, TimestampTz t); extern TSequence *ttextseq_from_base_tstzset(const text *txt, const Set *s); @@ -1092,6 +1091,7 @@ extern TInstant *temporal_min_instant(const Temporal *temp); extern int temporal_num_instants(const Temporal *temp); extern int temporal_num_sequences(const Temporal *temp); extern int temporal_num_timestamps(const Temporal *temp); +extern TSequenceSet *temporal_segm_duration(const Temporal *temp, const Interval *duration, bool atleast, bool strict); extern TSequence **temporal_segments(const Temporal *temp, int *count); extern TSequence *temporal_sequence_n(const Temporal *temp, int i); extern TSequence **temporal_sequences(const Temporal *temp, int *count); @@ -1104,9 +1104,10 @@ extern SpanSet *temporal_time(const Temporal *temp); extern TimestampTz *temporal_timestamps(const Temporal *temp, int *count); extern bool temporal_timestamptz_n(const Temporal *temp, int n, TimestampTz *result); extern bool temporal_upper_inc(const Temporal *temp); +/* extern double tfloat_avg_value(const Temporal *temp); (undefined) */ extern double tfloat_end_value(const Temporal *temp); -extern double tfloat_max_value(const Temporal *temp); extern double tfloat_min_value(const Temporal *temp); +extern double tfloat_max_value(const Temporal *temp); extern double tfloat_start_value(const Temporal *temp); extern bool tfloat_value_at_timestamptz(const Temporal *temp, TimestampTz t, bool strict, double *value); extern bool tfloat_value_n(const Temporal *temp, int n, double *result); @@ -1118,6 +1119,7 @@ extern int tint_start_value(const Temporal *temp); extern bool tint_value_at_timestamptz(const Temporal *temp, TimestampTz t, bool strict, int *value); extern bool tint_value_n(const Temporal *temp, int n, int *result); extern int *tint_values(const Temporal *temp, int *count); +extern double tnumber_avg_value(const Temporal *temp); extern double tnumber_integral(const Temporal *temp); extern double tnumber_twavg(const Temporal *temp); extern SpanSet *tnumber_valuespans(const Temporal *temp); @@ -1130,7 +1132,7 @@ extern bool ttext_value_n(const Temporal *temp, int n, text **result); extern text **ttext_values(const Temporal *temp, int *count); extern double float_degrees(double value, bool normalize); -extern Temporal **temparr_round(const Temporal **temp, int count, int maxdd); +extern Temporal **temparr_round(Temporal **temp, int count, int maxdd); extern Temporal *temporal_round(const Temporal *temp, int maxdd); extern Temporal *temporal_scale_time(const Temporal *temp, const Interval *duration); extern Temporal *temporal_set_interp(const Temporal *temp, interpType interp); @@ -1158,11 +1160,12 @@ extern Temporal *temporal_delete_tstzspan(const Temporal *temp, const Span *s, b extern Temporal *temporal_delete_tstzspanset(const Temporal *temp, const SpanSet *ss, bool connect); extern Temporal *temporal_insert(const Temporal *temp1, const Temporal *temp2, bool connect); extern Temporal *temporal_merge(const Temporal *temp1, const Temporal *temp2); -extern Temporal *temporal_merge_array(const Temporal **temparr, int count); +extern Temporal *temporal_merge_array(Temporal **temparr, int count); extern Temporal *temporal_update(const Temporal *temp1, const Temporal *temp2, bool connect); extern Temporal *tbool_at_value(const Temporal *temp, bool b); extern Temporal *tbool_minus_value(const Temporal *temp, bool b); +extern Temporal *temporal_after_timestamptz(const Temporal *temp, TimestampTz t, bool strict); extern Temporal *temporal_at_max(const Temporal *temp); extern Temporal *temporal_at_min(const Temporal *temp); extern Temporal *temporal_at_timestamptz(const Temporal *temp, TimestampTz t); @@ -1170,6 +1173,7 @@ extern Temporal *temporal_at_tstzset(const Temporal *temp, const Set *s); extern Temporal *temporal_at_tstzspan(const Temporal *temp, const Span *s); extern Temporal *temporal_at_tstzspanset(const Temporal *temp, const SpanSet *ss); extern Temporal *temporal_at_values(const Temporal *temp, const Set *set); +extern Temporal *temporal_before_timestamptz(const Temporal *temp, TimestampTz t, bool strict); extern Temporal *temporal_minus_max(const Temporal *temp); extern Temporal *temporal_minus_min(const Temporal *temp); extern Temporal *temporal_minus_timestamptz(const Temporal *temp, TimestampTz t); @@ -1465,6 +1469,7 @@ extern Temporal *tfloat_exp(const Temporal *temp); extern Temporal *tfloat_ln(const Temporal *temp); extern Temporal *tfloat_log10(const Temporal *temp); extern Temporal *tnumber_abs(const Temporal *temp); +extern Temporal *tnumber_trend(const Temporal *temp); extern double float_angular_difference(double degrees1, double degrees2); extern Temporal *tnumber_angular_difference(const Temporal *temp); extern Temporal *tnumber_delta_value(const Temporal *temp); @@ -1625,9 +1630,9 @@ typedef enum T_TGEOMETRY = 60, T_TGEOGRAPHY = 61, T_TRGEOMETRY = 62, + NO_MEOS_TYPES } meosType; -#define NO_MEOS_TYPES 63 typedef enum { UNKNOWN_OP = 0, @@ -2159,12 +2164,19 @@ extern GSERIALIZED *geo_from_ewkb(const uint8_t *wkb, size_t wkb_size, int32 sri extern GSERIALIZED *geo_from_geojson(const char *geojson); extern GSERIALIZED *geo_from_text(const char *wkt, int32_t srid); extern char *geo_out(const GSERIALIZED *gs); -extern GSERIALIZED *geog_from_binary(const char *wkb_bytea); +/* extern GSERIALIZED *geog_from_binary(const char *wkb_bytea); (undefined) */ extern GSERIALIZED *geog_from_hexewkb(const char *wkt); extern GSERIALIZED *geog_in(const char *str, int32 typmod); extern GSERIALIZED *geom_from_hexewkb(const char *wkt); extern GSERIALIZED *geom_in(const char *str, int32 typmod); +extern BOX3D *box3d_make(double xmin, double xmax, double ymin, double ymax, + double zmin, double zmax, int32_t srid); +extern char *box3d_out(const BOX3D *box, int maxdd); +extern GBOX *gbox_make(bool hasz, double xmin, double xmax, double ymin, + double ymax, double zmin, double zmax); +extern char *gbox_out(const GBOX *box, int maxdd); + extern GSERIALIZED *geo_copy(const GSERIALIZED *g); extern GSERIALIZED *geogpoint_make2d(int32_t srid, double x, double y); extern GSERIALIZED *geogpoint_make3dz(int32_t srid, double x, double y, double z); @@ -2175,8 +2187,7 @@ extern GSERIALIZED *geom_to_geog(const GSERIALIZED *geom); extern GSERIALIZED *geog_to_geom(const GSERIALIZED *geog); extern bool geo_is_empty(const GSERIALIZED *g); -/* extern bool geo_is_unitary(const GSERIALIZED *gs); (undefined) */ - +extern bool geo_is_unitary(const GSERIALIZED *gs); extern const char *geo_typename(int type); extern double geog_area(const GSERIALIZED *g, bool use_spheroid); extern GSERIALIZED *geog_centroid(const GSERIALIZED *g, bool use_spheroid); @@ -2193,31 +2204,29 @@ extern GSERIALIZED *geo_round(const GSERIALIZED *gs, int maxdd); extern GSERIALIZED *geo_set_srid(const GSERIALIZED *gs, int32_t srid); extern int32_t geo_srid(const GSERIALIZED *gs); -extern GSERIALIZED *geo_transform(GSERIALIZED *geom, int32_t srid_to); +extern GSERIALIZED *geo_transform(const GSERIALIZED *geom, int32_t srid_to); extern GSERIALIZED *geo_transform_pipeline(const GSERIALIZED *gs, char *pipeline, int32_t srid_to, bool is_forward); extern GSERIALIZED *geo_collect_garray(GSERIALIZED **gsarr, int count); extern GSERIALIZED *geo_makeline_garray(GSERIALIZED **gsarr, int count); -extern int geo_npoints(const GSERIALIZED *gs); -extern int geo_ngeos(const GSERIALIZED *gs); -extern GSERIALIZED *geo_geoN(const GSERIALIZED *geom, int n); -/* extern GSERIALIZED **geo_pointarr(const GSERIALIZED *gs, int *count); (undefined) */ -/* extern GSERIALIZED *geo_points(const GSERIALIZED *gs); (undefined) */ - +extern int geo_num_points(const GSERIALIZED *gs); +extern int geo_num_geos(const GSERIALIZED *gs); +extern GSERIALIZED *geo_geo_n(const GSERIALIZED *geom, int n); +extern GSERIALIZED **geo_pointarr(const GSERIALIZED *gs, int *count); +extern GSERIALIZED *geo_points(const GSERIALIZED *gs); extern GSERIALIZED *geom_array_union(GSERIALIZED **gsarr, int count); extern GSERIALIZED *geom_boundary(const GSERIALIZED *gs); -extern GSERIALIZED *geom_buffer(const GSERIALIZED *gs, double size, char *params); +extern GSERIALIZED *geom_buffer(const GSERIALIZED *gs, double size, const char *params); extern GSERIALIZED *geom_centroid(const GSERIALIZED *gs); extern GSERIALIZED *geom_convex_hull(const GSERIALIZED *gs); extern GSERIALIZED *geom_difference2d(const GSERIALIZED *gs1, const GSERIALIZED *gs2); extern GSERIALIZED *geom_intersection2d(const GSERIALIZED *gs1, const GSERIALIZED *gs2); -/* extern GSERIALIZED *geom_intersection2d_coll(const GSERIALIZED *gs1, const GSERIALIZED *gs2); (undefined) */ -/* extern GSERIALIZED *geom_min_bounding_radius(const GSERIALIZED *geom, double *radius); (undefined) */ - +extern GSERIALIZED *geom_intersection2d_coll(const GSERIALIZED *gs1, const GSERIALIZED *gs2); +extern GSERIALIZED *geom_min_bounding_radius(const GSERIALIZED *geom, double *radius); extern GSERIALIZED *geom_shortestline2d(const GSERIALIZED *gs1, const GSERIALIZED *s2); extern GSERIALIZED *geom_shortestline3d(const GSERIALIZED *gs1, const GSERIALIZED *s2); -extern GSERIALIZED *geom_unary_union(GSERIALIZED *gs, double prec); -extern GSERIALIZED *line_interpolate_point(GSERIALIZED *gs, double distance_fraction, bool repeat); +extern GSERIALIZED *geom_unary_union(const GSERIALIZED *gs, double prec); +extern GSERIALIZED *line_interpolate_point(const GSERIALIZED *gs, double distance_fraction, bool repeat); extern double line_locate_point(const GSERIALIZED *gs1, const GSERIALIZED *gs2); extern GSERIALIZED *line_substring(const GSERIALIZED *gs, double from, double to); @@ -2249,7 +2258,7 @@ extern Set *geomset_in(const char *str); extern char *spatialset_as_text(const Set *set, int maxdd); extern char *spatialset_as_ewkt(const Set *set, int maxdd); -extern Set *geoset_make(const GSERIALIZED **values, int count); +extern Set *geoset_make(GSERIALIZED **values, int count); extern Set *geo_to_set(const GSERIALIZED *gs); @@ -2297,6 +2306,8 @@ extern STBox *tstzspan_to_stbox(const Span *s); extern STBox *tstzspanset_to_stbox(const SpanSet *ss); extern double stbox_area(const STBox *box, bool spheroid); +extern uint32 stbox_hash(const STBox *box); +extern uint64 stbox_hash_extended(const STBox *box, uint64 seed); extern bool stbox_hast(const STBox *box); extern bool stbox_hasx(const STBox *box); extern bool stbox_hasz(const STBox *box); @@ -2361,12 +2372,6 @@ extern bool stbox_le(const STBox *box1, const STBox *box2); extern bool stbox_lt(const STBox *box1, const STBox *box2); extern bool stbox_ne(const STBox *box1, const STBox *box2); -extern RTree *rtree_create_stbox(); -extern void rtree_free(RTree *rtree); -extern void rtree_insert(RTree *rtree, STBox *box, int64 id); -extern int *rtree_search(const RTree *rtree,const STBox *query, int *count); - -extern char *tgeo_out(const Temporal *temp, int maxdd); extern Temporal *tgeogpoint_from_mfjson(const char *str); extern Temporal *tgeogpoint_in(const char *str); extern Temporal *tgeography_from_mfjson(const char *mfjson); @@ -2377,6 +2382,7 @@ extern Temporal *tgeompoint_from_mfjson(const char *str); extern Temporal *tgeompoint_in(const char *str); extern char *tspatial_as_ewkt(const Temporal *temp, int maxdd); extern char *tspatial_as_text(const Temporal *temp, int maxdd); +extern char *tspatial_out(const Temporal *temp, int maxdd); extern Temporal *tgeo_from_base_temp(const GSERIALIZED *gs, const Temporal *temp); extern TInstant *tgeoinst_make(const GSERIALIZED *gs, TimestampTz t); @@ -2609,7 +2615,7 @@ extern Temporal **tgeo_space_split(const Temporal *temp, double xsize, double ys extern Temporal **tgeo_space_time_split(const Temporal *temp, double xsize, double ysize, double zsize, const Interval *duration, const GSERIALIZED *sorigin, TimestampTz torigin, bool bitmatrix, bool border_inc, GSERIALIZED ***space_bins, TimestampTz **time_bins, int *count); extern int *geo_cluster_kmeans(const GSERIALIZED **geoms, uint32_t ngeoms, uint32_t k); -extern uint32_t *geo_cluster_dbscan(const GSERIALIZED **geoms, uint32_t ngeoms, double tolerance, int minpoints); +extern uint32_t *geo_cluster_dbscan(const GSERIALIZED **geoms, uint32_t ngeoms, double tolerance, int minpoints, int *count); extern GSERIALIZED **geo_cluster_intersecting(const GSERIALIZED **geoms, uint32_t ngeoms, int *count); extern GSERIALIZED **geo_cluster_within(const GSERIALIZED **geoms, uint32_t ngeoms, double tolerance, int *count); @@ -2717,6 +2723,43 @@ extern GSERIALIZED **geo_cluster_within(const GSERIALIZED **geoms, uint32_t ngeo +#define SKIPLIST_MAXLEVEL 32 +typedef struct +{ + void *key; + void *value; + int height; + int next[SKIPLIST_MAXLEVEL]; +} SkipListElem; + +struct SkipList +{ + size_t key_size; + size_t value_size; + int capacity; + int length; + int next; + int tail; + int *freed; + int freecount; + int freecap; + void *extra; + size_t extrasize; + int (*comp_fn)(void *, void *); + void *(*merge_fn)(void *, void *); + SkipListElem *elems; +}; + +typedef enum +{ + TEMPORAL, + KEYVALUE +} SkipListType; + +typedef Datum (*datum_func1) (Datum); +typedef Datum (*datum_func2) (Datum, Datum); +typedef Datum (*datum_func3) (Datum, Datum, Datum); + extern gsl_rng *gsl_get_generation_rng(void); extern gsl_rng *gsl_get_aggregation_rng(void); @@ -2772,13 +2815,14 @@ extern void datespan_set_tstzspan(const Span *s1, Span *s2); extern void floatspan_set_intspan(const Span *s1, Span *s2); extern void intspan_set_floatspan(const Span *s1, Span *s2); extern Set *numset_shift_scale(const Set *s, Datum shift, Datum width, bool hasshift, bool haswidth); +extern Span *numspan_expand(const Span *s, Datum value); extern Span *numspan_shift_scale(const Span *s, Datum shift, Datum width, bool hasshift, bool haswidth); extern SpanSet *numspanset_shift_scale(const SpanSet *ss, Datum shift, Datum width, bool hasshift, bool haswidth); extern Set *set_compact(const Set *s); extern void span_expand(const Span *s1, Span *s2); extern SpanSet *spanset_compact(const SpanSet *ss); extern TBox *tbox_expand_value(const TBox *box, Datum value, meosType basetyp); -extern Set *textcat_textset_text_int(const Set *s, const text *txt, bool invert); +extern Set *textcat_textset_text_common(const Set *s, const text *txt, bool invert); extern void tstzspan_set_datespan(const Span *s1, Span *s2); extern bool adjacent_span_value(const Span *s, Datum value); @@ -2818,6 +2862,14 @@ extern bool right_value_spanset(Datum value, const SpanSet *ss); extern bool right_span_value(const Span *s, Datum value); extern bool right_spanset_value(const SpanSet *ss, Datum value); +extern bool bbox_type(meosType bboxtype); +extern size_t bbox_get_size(meosType bboxtype); +extern int bbox_max_dims(meosType bboxtype); +extern bool temporal_bbox_eq(const void *box1, const void *box2, + meosType temptype); +extern int temporal_bbox_cmp(const void *box1, const void *box2, + meosType temptype); + extern void bbox_union_span_span(const Span *s1, const Span *s2, Span *result); extern bool inter_span_span(const Span *s1, const Span *s2, Span *result); extern Set *intersection_set_value(const Set *s, Datum value); @@ -2880,7 +2932,7 @@ extern TSequence *tboolseq_in(const char *str, interpType interp); extern TSequenceSet *tboolseqset_in(const char *str); extern Temporal *temporal_in(const char *str, meosType temptype); extern char *temporal_out(const Temporal *temp, int maxdd); -extern char **temparr_out(const Temporal **temparr, int count, int maxdd); +extern char **temparr_out(Temporal **temparr, int count, int maxdd); /* extern TInstant *tfloatinst_from_mfjson(json_object *mfjson); (undefined type json_object) */ extern TInstant *tfloatinst_in(const char *str); /* extern TSequence *tfloatseq_from_mfjson(json_object *mfjson, interpType interp); (undefined type json_object) */ @@ -2918,13 +2970,13 @@ extern TSequence *tsequence_copy(const TSequence *seq); extern TSequence *tsequence_from_base_temp(Datum value, meosType temptype, const TSequence *seq); extern TSequence *tsequence_from_base_tstzset(Datum value, meosType temptype, const Set *s); extern TSequence *tsequence_from_base_tstzspan(Datum value, meosType temptype, const Span *s, interpType interp); -extern TSequence *tsequence_make_exp(const TInstant **instants, int count, int maxcount, bool lower_inc, bool upper_inc, interpType interp, bool normalize); +extern TSequence *tsequence_make_exp(TInstant **instants, int count, int maxcount, bool lower_inc, bool upper_inc, interpType interp, bool normalize); extern TSequence *tsequence_make_free(TInstant **instants, int count, bool lower_inc, bool upper_inc, interpType interp, bool normalize); extern TSequenceSet *tsequenceset_copy(const TSequenceSet *ss); extern TSequenceSet *tseqsetarr_to_tseqset(TSequenceSet **seqsets, int count, int totalseqs); extern TSequenceSet *tsequenceset_from_base_temp(Datum value, meosType temptype, const TSequenceSet *ss); extern TSequenceSet *tsequenceset_from_base_tstzspanset(Datum value, meosType temptype, const SpanSet *ss, interpType interp); -extern TSequenceSet *tsequenceset_make_exp(const TSequence **sequences, int count, int maxcount, bool normalize); +extern TSequenceSet *tsequenceset_make_exp(TSequence **sequences, int count, int maxcount, bool normalize); extern TSequenceSet *tsequenceset_make_free(TSequence **sequences, int count, bool normalize); extern void temporal_set_tstzspan(const Temporal *temp, Span *s); @@ -2939,9 +2991,11 @@ extern void tsequenceset_set_tstzspan(const TSequenceSet *ss, Span *s); extern const TInstant *temporal_end_inst(const Temporal *temp); extern Datum temporal_end_value(const Temporal *temp); extern const TInstant *temporal_inst_n(const Temporal *temp, int n); -extern const TInstant **temporal_instants_p(const Temporal *temp, int *count); +extern const TInstant **temporal_insts_p(const Temporal *temp, int *count); +extern const TInstant *temporal_max_inst_p(const Temporal *temp); extern Datum temporal_max_value(const Temporal *temp); extern size_t temporal_mem_size(const Temporal *temp); +extern const TInstant *temporal_min_inst_p(const Temporal *temp); extern Datum temporal_min_value(const Temporal *temp); extern const TSequence **temporal_sequences_p(const Temporal *temp, int *count); extern void temporal_set_bbox(const Temporal *temp, void *box); @@ -2961,15 +3015,17 @@ extern bool tinstant_value_at_timestamptz(const TInstant *inst, TimestampTz t, D extern Datum *tinstant_values_p(const TInstant *inst, int *count); extern void tnumber_set_span(const Temporal *temp, Span *span); extern SpanSet *tnumberinst_valuespans(const TInstant *inst); +extern double tnumberseq_avg_val(const TSequence *seq); extern SpanSet *tnumberseq_valuespans(const TSequence *seq); +extern double tnumberseqset_avg_val(const TSequenceSet *ss); extern SpanSet *tnumberseqset_valuespans(const TSequenceSet *ss); extern Interval *tsequence_duration(const TSequence *seq); extern TimestampTz tsequence_end_timestamptz(const TSequence *seq); extern uint32 tsequence_hash(const TSequence *seq); extern const TInstant **tsequence_insts_p(const TSequence *seq); -extern const TInstant *tsequence_max_inst(const TSequence *seq); +extern const TInstant *tsequence_max_inst_p(const TSequence *seq); extern Datum tsequence_max_val(const TSequence *seq); -extern const TInstant *tsequence_min_inst(const TSequence *seq); +extern const TInstant *tsequence_min_inst_p(const TSequence *seq); extern Datum tsequence_min_val(const TSequence *seq); extern TSequence **tsequence_segments(const TSequence *seq, int *count); extern const TSequence **tsequence_seqs(const TSequence *seq, int *count); @@ -2983,9 +3039,9 @@ extern TimestampTz tsequenceset_end_timestamptz(const TSequenceSet *ss); extern uint32 tsequenceset_hash(const TSequenceSet *ss); extern const TInstant *tsequenceset_inst_n(const TSequenceSet *ss, int n); extern const TInstant **tsequenceset_insts_p(const TSequenceSet *ss); -extern const TInstant *tsequenceset_max_inst(const TSequenceSet *ss); +extern const TInstant *tsequenceset_max_inst_p(const TSequenceSet *ss); extern Datum tsequenceset_max_val(const TSequenceSet *ss); -extern const TInstant *tsequenceset_min_inst(const TSequenceSet *ss); +extern const TInstant *tsequenceset_min_inst_p(const TSequenceSet *ss); extern Datum tsequenceset_min_val(const TSequenceSet *ss); extern int tsequenceset_num_instants(const TSequenceSet *ss); extern int tsequenceset_num_timestamps(const TSequenceSet *ss); @@ -3028,7 +3084,7 @@ extern TInstant *tsequenceset_to_tinstant(const TSequenceSet *ss); extern TSequence *tsequenceset_to_tsequence(const TSequenceSet *ss); extern Temporal *tinstant_merge(const TInstant *inst1, const TInstant *inst2); -extern Temporal *tinstant_merge_array(const TInstant **instants, int count); +extern Temporal *tinstant_merge_array(TInstant **instants, int count); extern Temporal *tsequence_append_tinstant(TSequence *seq, const TInstant *inst, double maxdist, const Interval *maxt, bool expand); extern Temporal *tsequence_append_tsequence(const TSequence *seq1, const TSequence *seq2, bool expand); extern Temporal *tsequence_delete_timestamptz(const TSequence *seq, TimestampTz t, bool connect); @@ -3037,7 +3093,7 @@ extern Temporal *tsequence_delete_tstzspan(const TSequence *seq, const Span *s, extern Temporal *tsequence_delete_tstzspanset(const TSequence *seq, const SpanSet *ss, bool connect); extern Temporal *tsequence_insert(const TSequence *seq1, const TSequence *seq2, bool connect); extern Temporal *tsequence_merge(const TSequence *seq1, const TSequence *seq2); -extern Temporal *tsequence_merge_array(const TSequence **sequences, int count); +extern Temporal *tsequence_merge_array(TSequence **sequences, int count); extern TSequenceSet *tsequenceset_append_tinstant(TSequenceSet *ss, const TInstant *inst, double maxdist, const Interval *maxt, bool expand); extern TSequenceSet *tsequenceset_append_tsequence(TSequenceSet *ss, const TSequence *seq, bool expand); extern TSequenceSet *tsequenceset_delete_timestamptz(const TSequenceSet *ss, TimestampTz t); @@ -3046,15 +3102,19 @@ extern TSequenceSet *tsequenceset_delete_tstzspan(const TSequenceSet *ss, const extern TSequenceSet *tsequenceset_delete_tstzspanset(const TSequenceSet *ss, const SpanSet *ps); extern TSequenceSet *tsequenceset_insert(const TSequenceSet *ss1, const TSequenceSet *ss2); extern TSequenceSet *tsequenceset_merge(const TSequenceSet *ss1, const TSequenceSet *ss2); -extern TSequenceSet *tsequenceset_merge_array(const TSequenceSet **seqsets, int count); +extern TSequenceSet *tsequenceset_merge_array(TSequenceSet **seqsets, int count); extern void tsequence_expand_bbox(TSequence *seq, const TInstant *inst); extern void tsequence_set_bbox(const TSequence *seq, void *box); extern void tsequenceset_expand_bbox(TSequenceSet *ss, const TSequence *seq); extern void tsequenceset_set_bbox(const TSequenceSet *ss, void *box); -extern TSequence *tdiscseq_restrict_minmax(const TSequence *seq, bool min, bool atfunc); +extern TSequence *tcontseq_after_timestamptz(const TSequence *seq, TimestampTz t, bool strict); +extern TSequence *tcontseq_before_timestamptz(const TSequence *seq, TimestampTz t, bool strict); extern TSequenceSet *tcontseq_restrict_minmax(const TSequence *seq, bool min, bool atfunc); +extern TSequence *tdiscseq_after_timestamptz(const TSequence *seq, TimestampTz t, bool strict); +extern TSequence *tdiscseq_before_timestamptz(const TSequence *seq, TimestampTz t, bool strict); +extern TSequence *tdiscseq_restrict_minmax(const TSequence *seq, bool min, bool atfunc); extern bool temporal_bbox_restrict_set(const Temporal *temp, const Set *set); extern Temporal *temporal_restrict_minmax(const Temporal *temp, bool min, bool atfunc); extern Temporal *temporal_restrict_timestamptz(const Temporal *temp, TimestampTz t, bool atfunc); @@ -3064,6 +3124,8 @@ extern Temporal *temporal_restrict_tstzspanset(const Temporal *temp, const SpanS extern Temporal *temporal_restrict_value(const Temporal *temp, Datum value, bool atfunc); extern Temporal *temporal_restrict_values(const Temporal *temp, const Set *set, bool atfunc); extern bool temporal_value_at_timestamptz(const Temporal *temp, TimestampTz t, bool strict, Datum *result); +extern TInstant *tinstant_after_timestamptz(const TInstant *inst, TimestampTz t, bool strict); +extern TInstant *tinstant_before_timestamptz(const TInstant *inst, TimestampTz t, bool strict); extern TInstant *tinstant_restrict_tstzspan(const TInstant *inst, const Span *period, bool atfunc); extern TInstant *tinstant_restrict_tstzspanset(const TInstant *inst, const SpanSet *ss, bool atfunc); extern TInstant *tinstant_restrict_timestamptz(const TInstant *inst, TimestampTz t, bool atfunc); @@ -3079,6 +3141,8 @@ extern TSequenceSet *tnumberseqset_restrict_spanset(const TSequenceSet *ss, cons extern TInstant *tsequence_at_timestamptz(const TSequence *seq, TimestampTz t); extern Temporal *tsequence_restrict_tstzspan(const TSequence *seq, const Span *s, bool atfunc); extern Temporal *tsequence_restrict_tstzspanset(const TSequence *seq, const SpanSet *ss, bool atfunc); +extern TSequenceSet *tsequenceset_after_timestamptz(const TSequenceSet *ss, TimestampTz t, bool strict); +extern TSequenceSet *tsequenceset_before_timestamptz(const TSequenceSet *ss, TimestampTz t, bool strict); extern TSequenceSet *tsequenceset_restrict_minmax(const TSequenceSet *ss, bool min, bool atfunc); extern TSequenceSet *tsequenceset_restrict_tstzspan(const TSequenceSet *ss, const Span *s, bool atfunc); extern TSequenceSet *tsequenceset_restrict_tstzspanset(const TSequenceSet *ss, const SpanSet *ps, bool atfunc); @@ -3142,7 +3206,16 @@ extern Temporal *temporal_compact(const Temporal *temp); extern TSequence *tsequence_compact(const TSequence *seq); extern TSequenceSet *tsequenceset_compact(const TSequenceSet *ss); +extern SkipList *temporal_skiplist_make(); +extern SkipList *skiplist_make(size_t key_size, size_t value_size, + int (*comp_fn)(void *, void *), void *(*merge_fn)(void *, void *)); +extern int skiplist_search(SkipList *list, void *key, void *value); extern void skiplist_free(SkipList *list); +extern void skiplist_splice(SkipList *list, void **keys, void **values, int count, datum_func2 func, bool crossings, SkipListType sktype); +extern void temporal_skiplist_splice(SkipList *list, void **values, int count, datum_func2 func, bool crossings); +extern void **skiplist_values(SkipList *list); +extern void **skiplist_keys_values(SkipList *list, void **values); + extern Temporal *temporal_app_tinst_transfn(Temporal *state, const TInstant *inst, interpType interp, double maxdist, const Interval *maxt); extern Temporal *temporal_app_tseq_transfn(Temporal *state, const TSequence *seq); @@ -3323,7 +3396,7 @@ extern int64 nsegment_route(const Nsegment *ns); extern double nsegment_start_position(const Nsegment *ns); extern bool route_exists(int64 rid); -extern GSERIALIZED *route_geom(int64 rid); +extern const GSERIALIZED *route_geom(int64 rid); extern double route_length(int64 rid); extern Npoint *npoint_round(const Npoint *np, int maxdd); @@ -3355,7 +3428,7 @@ extern bool nsegment_ne(const Nsegment *ns1, const Nsegment *ns2); extern Set *npointset_in(const char *str); extern char *npointset_out(const Set *s, int maxdd); -extern Set *npointset_make(const Npoint **values, int count); +extern Set *npointset_make(Npoint **values, int count); extern Set *npoint_to_set(const Npoint *np); @@ -3366,7 +3439,7 @@ extern bool npointset_value_n(const Set *s, int n, Npoint **result); extern Npoint **npointset_values(const Set *s); extern bool contained_npoint_set(const Npoint *np, const Set *s); -extern bool contains_set_npoint(const Set *s, Npoint *np); +extern bool contains_set_npoint(const Set *s, const Npoint *np); extern Set *intersection_npoint_set(const Npoint *np, const Set *s); extern Set *intersection_set_npoint(const Set *s, const Npoint *np); extern Set *minus_npoint_set(const Npoint *np, const Set *s); diff --git a/builder/templates/functions.py b/builder/templates/functions.py index dcb2e73..7a0e243 100644 --- a/builder/templates/functions.py +++ b/builder/templates/functions.py @@ -132,6 +132,45 @@ def as_tsequenceset(temporal: Annotated[_ffi.CData, "Temporal *"]) -> Annotated[ return _ffi.cast("TSequenceSet *", temporal) +def float_to_datum(value: float) -> Annotated[_ffi.CData, "Datum"]: + # PostgreSQL's Float8GetDatum reinterprets the 8-byte double as a Datum. + buf = _ffi.new("double[1]", [value]) + return _ffi.cast("Datum *", buf)[0] + + +def int_to_datum(value: int) -> Annotated[_ffi.CData, "Datum"]: + # Int32GetDatum / Int64GetDatum widen the integer to Datum (uintptr_t). + return _ffi.cast("Datum", value) + + +def tbox_expand_float(box: Annotated[_ffi.CData, "const TBox *"], d: float) -> Annotated[_ffi.CData, "TBox *"]: + return tbox_expand_value(box, float_to_datum(d), _lib.T_FLOAT8) + + +def tbox_expand_int(box: Annotated[_ffi.CData, "const TBox *"], i: int) -> Annotated[_ffi.CData, "TBox *"]: + return tbox_expand_value(box, int_to_datum(i), _lib.T_INT4) + + +def tbox_shift_scale_float( + box: Annotated[_ffi.CData, "const TBox *"], + shift: float, + width: float, + hasshift: bool, + haswidth: bool, +) -> Annotated[_ffi.CData, "TBox *"]: + return tbox_shift_scale_value(box, float_to_datum(shift), float_to_datum(width), hasshift, haswidth) + + +def tbox_shift_scale_int( + box: Annotated[_ffi.CData, "const TBox *"], + shift: int, + width: int, + hasshift: bool, + haswidth: bool, +) -> Annotated[_ffi.CData, "TBox *"]: + return tbox_shift_scale_value(box, int_to_datum(shift), int_to_datum(width), hasshift, haswidth) + + # ----------------------------------------------------------------------------- # ----------------------End of manually-defined functions---------------------- # ----------------------------------------------------------------------------- diff --git a/pymeos_cffi/__init__.py b/pymeos_cffi/__init__.py index 61df1c6..4ad3ce1 100644 --- a/pymeos_cffi/__init__.py +++ b/pymeos_cffi/__init__.py @@ -51,6 +51,12 @@ "as_tinstant", "as_tsequence", "as_tsequenceset", + "float_to_datum", + "int_to_datum", + "tbox_expand_float", + "tbox_expand_int", + "tbox_shift_scale_float", + "tbox_shift_scale_int", "date_in", "date_out", "interval_cmp", @@ -62,6 +68,16 @@ "timestamp_out", "timestamptz_in", "timestamptz_out", + "rtree_create_intspan", + "rtree_create_bigintspan", + "rtree_create_floatspan", + "rtree_create_datespan", + "rtree_create_tstzspan", + "rtree_create_tbox", + "rtree_create_stbox", + "rtree_free", + "rtree_insert", + "rtree_search", "meos_errno", "meos_errno_set", "meos_errno_restore", @@ -86,7 +102,10 @@ "float_exp", "float_ln", "float_log10", + "float8_out", "float_round", + "int32_cmp", + "int64_cmp", "interval_make", "minus_date_date", "minus_date_int", @@ -105,6 +124,7 @@ "text2cstring", "text_cmp", "text_copy", + "text_in", "text_initcap", "text_lower", "text_out", @@ -115,6 +135,7 @@ "timestamptz_to_date", "bigintset_in", "bigintset_out", + "bigintspan_expand", "bigintspan_in", "bigintspan_out", "bigintspanset_in", @@ -127,12 +148,14 @@ "datespanset_out", "floatset_in", "floatset_out", + "floatspan_expand", "floatspan_in", "floatspan_out", "floatspanset_in", "floatspanset_out", "intset_in", "intset_out", + "intspan_expand", "intspan_in", "intspan_out", "intspanset_in", @@ -308,7 +331,6 @@ "intset_shift_scale", "intspan_shift_scale", "intspanset_shift_scale", - "numspan_expand", "tstzspan_expand", "set_round", "textcat_text_textset", @@ -752,6 +774,8 @@ "tbox_to_floatspan", "tbox_to_tstzspan", "timestamptz_to_tbox", + "tbox_hash", + "tbox_hash_extended", "tbox_hast", "tbox_hasx", "tbox_tmax", @@ -766,13 +790,13 @@ "tboxfloat_xmin", "tboxint_xmax", "tboxint_xmin", - "tbox_expand_float", - "tbox_expand_int", "tbox_expand_time", "tbox_round", - "tbox_shift_scale_float", - "tbox_shift_scale_int", "tbox_shift_scale_time", + "tfloatbox_expand", + "tfloatbox_shift_scale", + "tintbox_expand", + "tintbox_shift_scale", "union_tbox_tbox", "intersection_tbox_tbox", "adjacent_tbox_tbox", @@ -861,6 +885,7 @@ "temporal_num_instants", "temporal_num_sequences", "temporal_num_timestamps", + "temporal_segm_duration", "temporal_segments", "temporal_sequence_n", "temporal_sequences", @@ -874,8 +899,8 @@ "temporal_timestamptz_n", "temporal_upper_inc", "tfloat_end_value", - "tfloat_max_value", "tfloat_min_value", + "tfloat_max_value", "tfloat_start_value", "tfloat_value_at_timestamptz", "tfloat_value_n", @@ -887,6 +912,7 @@ "tint_value_at_timestamptz", "tint_value_n", "tint_values", + "tnumber_avg_value", "tnumber_integral", "tnumber_twavg", "tnumber_valuespans", @@ -929,6 +955,7 @@ "temporal_update", "tbool_at_value", "tbool_minus_value", + "temporal_after_timestamptz", "temporal_at_max", "temporal_at_min", "temporal_at_timestamptz", @@ -936,6 +963,7 @@ "temporal_at_tstzspan", "temporal_at_tstzspanset", "temporal_at_values", + "temporal_before_timestamptz", "temporal_minus_max", "temporal_minus_min", "temporal_minus_timestamptz", @@ -1223,6 +1251,7 @@ "tfloat_ln", "tfloat_log10", "tnumber_abs", + "tnumber_trend", "float_angular_difference", "tnumber_angular_difference", "tnumber_delta_value", @@ -1376,11 +1405,14 @@ "geo_from_geojson", "geo_from_text", "geo_out", - "geog_from_binary", "geog_from_hexewkb", "geog_in", "geom_from_hexewkb", "geom_in", + "box3d_make", + "box3d_out", + "gbox_make", + "gbox_out", "geo_copy", "geogpoint_make2d", "geogpoint_make3dz", @@ -1389,6 +1421,7 @@ "geom_to_geog", "geog_to_geom", "geo_is_empty", + "geo_is_unitary", "geo_typename", "geog_area", "geog_centroid", @@ -1407,9 +1440,11 @@ "geo_transform_pipeline", "geo_collect_garray", "geo_makeline_garray", - "geo_npoints", - "geo_ngeos", - "geo_geoN", + "geo_num_points", + "geo_num_geos", + "geo_geo_n", + "geo_pointarr", + "geo_points", "geom_array_union", "geom_boundary", "geom_buffer", @@ -1417,6 +1452,8 @@ "geom_convex_hull", "geom_difference2d", "geom_intersection2d", + "geom_intersection2d_coll", + "geom_min_bounding_radius", "geom_shortestline2d", "geom_shortestline3d", "geom_unary_union", @@ -1486,6 +1523,8 @@ "tstzspan_to_stbox", "tstzspanset_to_stbox", "stbox_area", + "stbox_hash", + "stbox_hash_extended", "stbox_hast", "stbox_hasx", "stbox_hasz", @@ -1543,11 +1582,6 @@ "stbox_le", "stbox_lt", "stbox_ne", - "rtree_create_stbox", - "rtree_free", - "rtree_insert", - "rtree_search", - "tgeo_out", "tgeogpoint_from_mfjson", "tgeogpoint_in", "tgeography_from_mfjson", @@ -1558,6 +1592,7 @@ "tgeompoint_in", "tspatial_as_ewkt", "tspatial_as_text", + "tspatial_out", "tgeo_from_base_temp", "tgeoinst_make", "tgeoseq_from_base_tstzset", @@ -1823,13 +1858,14 @@ "floatspan_set_intspan", "intspan_set_floatspan", "numset_shift_scale", + "numspan_expand", "numspan_shift_scale", "numspanset_shift_scale", "set_compact", "span_expand", "spanset_compact", "tbox_expand_value", - "textcat_textset_text_int", + "textcat_textset_text_common", "tstzspan_set_datespan", "adjacent_span_value", "adjacent_spanset_value", @@ -1866,6 +1902,11 @@ "right_value_spanset", "right_span_value", "right_spanset_value", + "bbox_type", + "bbox_get_size", + "bbox_max_dims", + "temporal_bbox_eq", + "temporal_bbox_cmp", "bbox_union_span_span", "inter_span_span", "intersection_set_value", @@ -1962,9 +2003,11 @@ "temporal_end_inst", "temporal_end_value", "temporal_inst_n", - "temporal_instants_p", + "temporal_insts_p", + "temporal_max_inst_p", "temporal_max_value", "temporal_mem_size", + "temporal_min_inst_p", "temporal_min_value", "temporal_sequences_p", "temporal_set_bbox", @@ -1984,15 +2027,17 @@ "tinstant_values_p", "tnumber_set_span", "tnumberinst_valuespans", + "tnumberseq_avg_val", "tnumberseq_valuespans", + "tnumberseqset_avg_val", "tnumberseqset_valuespans", "tsequence_duration", "tsequence_end_timestamptz", "tsequence_hash", "tsequence_insts_p", - "tsequence_max_inst", + "tsequence_max_inst_p", "tsequence_max_val", - "tsequence_min_inst", + "tsequence_min_inst_p", "tsequence_min_val", "tsequence_segments", "tsequence_seqs", @@ -2006,9 +2051,9 @@ "tsequenceset_hash", "tsequenceset_inst_n", "tsequenceset_insts_p", - "tsequenceset_max_inst", + "tsequenceset_max_inst_p", "tsequenceset_max_val", - "tsequenceset_min_inst", + "tsequenceset_min_inst_p", "tsequenceset_min_val", "tsequenceset_num_instants", "tsequenceset_num_timestamps", @@ -2072,8 +2117,12 @@ "tsequence_set_bbox", "tsequenceset_expand_bbox", "tsequenceset_set_bbox", - "tdiscseq_restrict_minmax", + "tcontseq_after_timestamptz", + "tcontseq_before_timestamptz", "tcontseq_restrict_minmax", + "tdiscseq_after_timestamptz", + "tdiscseq_before_timestamptz", + "tdiscseq_restrict_minmax", "temporal_bbox_restrict_set", "temporal_restrict_minmax", "temporal_restrict_timestamptz", @@ -2083,6 +2132,8 @@ "temporal_restrict_value", "temporal_restrict_values", "temporal_value_at_timestamptz", + "tinstant_after_timestamptz", + "tinstant_before_timestamptz", "tinstant_restrict_tstzspan", "tinstant_restrict_tstzspanset", "tinstant_restrict_timestamptz", @@ -2098,6 +2149,8 @@ "tsequence_at_timestamptz", "tsequence_restrict_tstzspan", "tsequence_restrict_tstzspanset", + "tsequenceset_after_timestamptz", + "tsequenceset_before_timestamptz", "tsequenceset_restrict_minmax", "tsequenceset_restrict_tstzspan", "tsequenceset_restrict_tstzspanset", @@ -2154,7 +2207,13 @@ "temporal_compact", "tsequence_compact", "tsequenceset_compact", + "temporal_skiplist_make", + "skiplist_search", "skiplist_free", + "skiplist_splice", + "temporal_skiplist_splice", + "skiplist_values", + "skiplist_keys_values", "temporal_app_tinst_transfn", "temporal_app_tseq_transfn", "span_bins", diff --git a/pymeos_cffi/functions.py b/pymeos_cffi/functions.py index b5d46eb..24f15ea 100644 --- a/pymeos_cffi/functions.py +++ b/pymeos_cffi/functions.py @@ -132,6 +132,45 @@ def as_tsequenceset(temporal: Annotated[_ffi.CData, "Temporal *"]) -> Annotated[ return _ffi.cast("TSequenceSet *", temporal) +def float_to_datum(value: float) -> Annotated[_ffi.CData, "Datum"]: + # PostgreSQL's Float8GetDatum reinterprets the 8-byte double as a Datum. + buf = _ffi.new("double[1]", [value]) + return _ffi.cast("Datum *", buf)[0] + + +def int_to_datum(value: int) -> Annotated[_ffi.CData, "Datum"]: + # Int32GetDatum / Int64GetDatum widen the integer to Datum (uintptr_t). + return _ffi.cast("Datum", value) + + +def tbox_expand_float(box: Annotated[_ffi.CData, "const TBox *"], d: float) -> Annotated[_ffi.CData, "TBox *"]: + return tbox_expand_value(box, float_to_datum(d), _lib.T_FLOAT8) + + +def tbox_expand_int(box: Annotated[_ffi.CData, "const TBox *"], i: int) -> Annotated[_ffi.CData, "TBox *"]: + return tbox_expand_value(box, int_to_datum(i), _lib.T_INT4) + + +def tbox_shift_scale_float( + box: Annotated[_ffi.CData, "const TBox *"], + shift: float, + width: float, + hasshift: bool, + haswidth: bool, +) -> Annotated[_ffi.CData, "TBox *"]: + return tbox_shift_scale_value(box, float_to_datum(shift), float_to_datum(width), hasshift, haswidth) + + +def tbox_shift_scale_int( + box: Annotated[_ffi.CData, "const TBox *"], + shift: int, + width: int, + hasshift: bool, + haswidth: bool, +) -> Annotated[_ffi.CData, "TBox *"]: + return tbox_shift_scale_value(box, int_to_datum(shift), int_to_datum(width), hasshift, haswidth) + + # ----------------------------------------------------------------------------- # ----------------------End of manually-defined functions---------------------- # ----------------------------------------------------------------------------- @@ -224,6 +263,75 @@ def timestamptz_out(t: int) -> Annotated[str, "char *"]: return result if result != _ffi.NULL else None +def rtree_create_intspan() -> Annotated[_ffi.CData, "RTree *"]: + result = _lib.rtree_create_intspan() + _check_error() + return result if result != _ffi.NULL else None + + +def rtree_create_bigintspan() -> Annotated[_ffi.CData, "RTree *"]: + result = _lib.rtree_create_bigintspan() + _check_error() + return result if result != _ffi.NULL else None + + +def rtree_create_floatspan() -> Annotated[_ffi.CData, "RTree *"]: + result = _lib.rtree_create_floatspan() + _check_error() + return result if result != _ffi.NULL else None + + +def rtree_create_datespan() -> Annotated[_ffi.CData, "RTree *"]: + result = _lib.rtree_create_datespan() + _check_error() + return result if result != _ffi.NULL else None + + +def rtree_create_tstzspan() -> Annotated[_ffi.CData, "RTree *"]: + result = _lib.rtree_create_tstzspan() + _check_error() + return result if result != _ffi.NULL else None + + +def rtree_create_tbox() -> Annotated[_ffi.CData, "RTree *"]: + result = _lib.rtree_create_tbox() + _check_error() + return result if result != _ffi.NULL else None + + +def rtree_create_stbox() -> Annotated[_ffi.CData, "RTree *"]: + result = _lib.rtree_create_stbox() + _check_error() + return result if result != _ffi.NULL else None + + +def rtree_free(rtree: Annotated[_ffi.CData, "RTree *"]) -> Annotated[None, "void"]: + rtree_converted = _ffi.cast("RTree *", rtree) + _lib.rtree_free(rtree_converted) + _check_error() + + +def rtree_insert( + rtree: Annotated[_ffi.CData, "RTree *"], box: Annotated[_ffi.CData, "void *"], id: int +) -> Annotated[None, "void"]: + rtree_converted = _ffi.cast("RTree *", rtree) + box_converted = _ffi.cast("void *", box) + id_converted = _ffi.cast("int64", id) + _lib.rtree_insert(rtree_converted, box_converted, id_converted) + _check_error() + + +def rtree_search( + rtree: Annotated[_ffi.CData, "const RTree *"], query: Annotated[_ffi.CData, "const void *"] +) -> tuple[Annotated[_ffi.CData, "int *"], Annotated[_ffi.CData, "int"]]: + rtree_converted = _ffi.cast("const RTree *", rtree) + query_converted = _ffi.cast("const void *", query) + count = _ffi.new("int *") + result = _lib.rtree_search(rtree_converted, query_converted, count) + _check_error() + return result if result != _ffi.NULL else None, count[0] + + def meos_errno() -> Annotated[int, "int"]: result = _lib.meos_errno() _check_error() @@ -400,12 +508,35 @@ def float_log10(d: float) -> Annotated[float, "double"]: return result if result != _ffi.NULL else None +def float8_out(d: float, maxdd: int) -> Annotated[str, "char *"]: + result = _lib.float8_out(d, maxdd) + _check_error() + result = _ffi.string(result).decode("utf-8") + return result if result != _ffi.NULL else None + + def float_round(d: float, maxdd: int) -> Annotated[float, "double"]: result = _lib.float_round(d, maxdd) _check_error() return result if result != _ffi.NULL else None +def int32_cmp(l: int, r: int) -> Annotated[int, "int"]: + l_converted = _ffi.cast("int32", l) + r_converted = _ffi.cast("int32", r) + result = _lib.int32_cmp(l_converted, r_converted) + _check_error() + return result if result != _ffi.NULL else None + + +def int64_cmp(l: int, r: int) -> Annotated[int, "int"]: + l_converted = _ffi.cast("int64", l) + r_converted = _ffi.cast("int64", r) + result = _lib.int64_cmp(l_converted, r_converted) + _check_error() + return result if result != _ffi.NULL else None + + def interval_make( years: int, months: int, weeks: int, days: int, hours: int, mins: int, secs: float ) -> Annotated[_ffi.CData, "Interval *"]: @@ -422,7 +553,7 @@ def interval_make( return result if result != _ffi.NULL else None -def minus_date_date(d1: int, d2: int) -> Annotated[_ffi.CData, "Interval *"]: +def minus_date_date(d1: int, d2: int) -> Annotated[int, "int"]: d1_converted = _ffi.cast("DateADT", d1) d2_converted = _ffi.cast("DateADT", d2) result = _lib.minus_date_date(d1_converted, d2_converted) @@ -560,6 +691,14 @@ def text_copy(txt: str) -> Annotated[str, "text *"]: return result if result != _ffi.NULL else None +def text_in(string: str) -> Annotated[str, "text *"]: + string_converted = string.encode("utf-8") + result = _lib.text_in(string_converted) + _check_error() + result = text2cstring(result) + return result if result != _ffi.NULL else None + + def text_initcap(txt: str) -> Annotated[str, "text *"]: txt_converted = cstring2text(txt) result = _lib.text_initcap(txt_converted) @@ -638,6 +777,14 @@ def bigintset_out(set: Annotated[_ffi.CData, "const Set *"]) -> Annotated[str, " return result if result != _ffi.NULL else None +def bigintspan_expand(s: Annotated[_ffi.CData, "const Span *"], value: int) -> Annotated[_ffi.CData, "Span *"]: + s_converted = _ffi.cast("const Span *", s) + value_converted = _ffi.cast("int64", value) + result = _lib.bigintspan_expand(s_converted, value_converted) + _check_error() + return result if result != _ffi.NULL else None + + def bigintspan_in(string: str) -> Annotated[_ffi.CData, "Span *"]: string_converted = string.encode("utf-8") result = _lib.bigintspan_in(string_converted) @@ -728,6 +875,13 @@ def floatset_out(set: Annotated[_ffi.CData, "const Set *"], maxdd: int) -> Annot return result if result != _ffi.NULL else None +def floatspan_expand(s: Annotated[_ffi.CData, "const Span *"], value: float) -> Annotated[_ffi.CData, "Span *"]: + s_converted = _ffi.cast("const Span *", s) + result = _lib.floatspan_expand(s_converted, value) + _check_error() + return result if result != _ffi.NULL else None + + def floatspan_in(string: str) -> Annotated[_ffi.CData, "Span *"]: string_converted = string.encode("utf-8") result = _lib.floatspan_in(string_converted) @@ -773,6 +927,14 @@ def intset_out(set: Annotated[_ffi.CData, "const Set *"]) -> Annotated[str, "cha return result if result != _ffi.NULL else None +def intspan_expand(s: Annotated[_ffi.CData, "const Span *"], value: int) -> Annotated[_ffi.CData, "Span *"]: + s_converted = _ffi.cast("const Span *", s) + value_converted = _ffi.cast("int32", value) + result = _lib.intspan_expand(s_converted, value_converted) + _check_error() + return result if result != _ffi.NULL else None + + def intspan_in(string: str) -> Annotated[_ffi.CData, "Span *"]: string_converted = string.encode("utf-8") result = _lib.intspan_in(string_converted) @@ -2089,16 +2251,6 @@ def intspanset_shift_scale( return result if result != _ffi.NULL else None -def numspan_expand( - s: Annotated[_ffi.CData, "const Span *"], value: Annotated[_ffi.CData, "Datum"] -) -> Annotated[_ffi.CData, "Span *"]: - s_converted = _ffi.cast("const Span *", s) - value_converted = _ffi.cast("Datum", value) - result = _lib.numspan_expand(s_converted, value_converted) - _check_error() - return result if result != _ffi.NULL else None - - def tstzspan_expand( s: Annotated[_ffi.CData, "const Span *"], interv: Annotated[_ffi.CData, "const Interval *"] ) -> Annotated[_ffi.CData, "Span *"]: @@ -2454,23 +2606,23 @@ def set_spans(s: Annotated[_ffi.CData, "const Set *"]) -> Annotated[_ffi.CData, def set_split_each_n_spans( - s: Annotated[_ffi.CData, "const Set *"], elems_per_span: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + s: Annotated[_ffi.CData, "const Set *"], elems_per_span: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: s_converted = _ffi.cast("const Set *", s) - count_converted = _ffi.cast("int *", count) - result = _lib.set_split_each_n_spans(s_converted, elems_per_span, count_converted) + count = _ffi.new("int *") + result = _lib.set_split_each_n_spans(s_converted, elems_per_span, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def set_split_n_spans( - s: Annotated[_ffi.CData, "const Set *"], span_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + s: Annotated[_ffi.CData, "const Set *"], span_count: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: s_converted = _ffi.cast("const Set *", s) - count_converted = _ffi.cast("int *", count) - result = _lib.set_split_n_spans(s_converted, span_count, count_converted) + count = _ffi.new("int *") + result = _lib.set_split_n_spans(s_converted, span_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def spanset_spans(ss: Annotated[_ffi.CData, "const SpanSet *"]) -> Annotated[_ffi.CData, "Span *"]: @@ -2481,23 +2633,23 @@ def spanset_spans(ss: Annotated[_ffi.CData, "const SpanSet *"]) -> Annotated[_ff def spanset_split_each_n_spans( - ss: Annotated[_ffi.CData, "const SpanSet *"], elems_per_span: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + ss: Annotated[_ffi.CData, "const SpanSet *"], elems_per_span: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const SpanSet *", ss) - count_converted = _ffi.cast("int *", count) - result = _lib.spanset_split_each_n_spans(ss_converted, elems_per_span, count_converted) + count = _ffi.new("int *") + result = _lib.spanset_split_each_n_spans(ss_converted, elems_per_span, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def spanset_split_n_spans( - ss: Annotated[_ffi.CData, "const SpanSet *"], span_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + ss: Annotated[_ffi.CData, "const SpanSet *"], span_count: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const SpanSet *", ss) - count_converted = _ffi.cast("int *", count) - result = _lib.spanset_split_n_spans(ss_converted, span_count, count_converted) + count = _ffi.new("int *") + result = _lib.spanset_split_n_spans(ss_converted, span_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def adjacent_span_bigint(s: Annotated[_ffi.CData, "const Span *"], i: int) -> Annotated[bool, "bool"]: @@ -5491,27 +5643,27 @@ def bigint_get_bin(value: int, vsize: int, vorigin: int) -> Annotated[int, "int6 def bigintspan_bins( - s: Annotated[_ffi.CData, "const Span *"], vsize: int, vorigin: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + s: Annotated[_ffi.CData, "const Span *"], vsize: int, vorigin: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: s_converted = _ffi.cast("const Span *", s) vsize_converted = _ffi.cast("int64", vsize) vorigin_converted = _ffi.cast("int64", vorigin) - count_converted = _ffi.cast("int *", count) - result = _lib.bigintspan_bins(s_converted, vsize_converted, vorigin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.bigintspan_bins(s_converted, vsize_converted, vorigin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def bigintspanset_bins( - ss: Annotated[_ffi.CData, "const SpanSet *"], vsize: int, vorigin: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + ss: Annotated[_ffi.CData, "const SpanSet *"], vsize: int, vorigin: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const SpanSet *", ss) vsize_converted = _ffi.cast("int64", vsize) vorigin_converted = _ffi.cast("int64", vorigin) - count_converted = _ffi.cast("int *", count) - result = _lib.bigintspanset_bins(ss_converted, vsize_converted, vorigin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.bigintspanset_bins(ss_converted, vsize_converted, vorigin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def date_get_bin( @@ -5526,33 +5678,27 @@ def date_get_bin( def datespan_bins( - s: Annotated[_ffi.CData, "const Span *"], - duration: Annotated[_ffi.CData, "const Interval *"], - torigin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Span *"]: + s: Annotated[_ffi.CData, "const Span *"], duration: Annotated[_ffi.CData, "const Interval *"], torigin: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: s_converted = _ffi.cast("const Span *", s) duration_converted = _ffi.cast("const Interval *", duration) torigin_converted = _ffi.cast("DateADT", torigin) - count_converted = _ffi.cast("int *", count) - result = _lib.datespan_bins(s_converted, duration_converted, torigin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.datespan_bins(s_converted, duration_converted, torigin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def datespanset_bins( - ss: Annotated[_ffi.CData, "const SpanSet *"], - duration: Annotated[_ffi.CData, "const Interval *"], - torigin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Span *"]: + ss: Annotated[_ffi.CData, "const SpanSet *"], duration: Annotated[_ffi.CData, "const Interval *"], torigin: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const SpanSet *", ss) duration_converted = _ffi.cast("const Interval *", duration) torigin_converted = _ffi.cast("DateADT", torigin) - count_converted = _ffi.cast("int *", count) - result = _lib.datespanset_bins(ss_converted, duration_converted, torigin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.datespanset_bins(ss_converted, duration_converted, torigin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def float_get_bin(value: float, vsize: float, vorigin: float) -> Annotated[float, "double"]: @@ -5562,23 +5708,23 @@ def float_get_bin(value: float, vsize: float, vorigin: float) -> Annotated[float def floatspan_bins( - s: Annotated[_ffi.CData, "const Span *"], vsize: float, vorigin: float, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + s: Annotated[_ffi.CData, "const Span *"], vsize: float, vorigin: float +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: s_converted = _ffi.cast("const Span *", s) - count_converted = _ffi.cast("int *", count) - result = _lib.floatspan_bins(s_converted, vsize, vorigin, count_converted) + count = _ffi.new("int *") + result = _lib.floatspan_bins(s_converted, vsize, vorigin, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def floatspanset_bins( - ss: Annotated[_ffi.CData, "const SpanSet *"], vsize: float, vorigin: float, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + ss: Annotated[_ffi.CData, "const SpanSet *"], vsize: float, vorigin: float +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const SpanSet *", ss) - count_converted = _ffi.cast("int *", count) - result = _lib.floatspanset_bins(ss_converted, vsize, vorigin, count_converted) + count = _ffi.new("int *") + result = _lib.floatspanset_bins(ss_converted, vsize, vorigin, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def int_get_bin(value: int, vsize: int, vorigin: int) -> Annotated[int, "int"]: @@ -5588,23 +5734,23 @@ def int_get_bin(value: int, vsize: int, vorigin: int) -> Annotated[int, "int"]: def intspan_bins( - s: Annotated[_ffi.CData, "const Span *"], vsize: int, vorigin: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + s: Annotated[_ffi.CData, "const Span *"], vsize: int, vorigin: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: s_converted = _ffi.cast("const Span *", s) - count_converted = _ffi.cast("int *", count) - result = _lib.intspan_bins(s_converted, vsize, vorigin, count_converted) + count = _ffi.new("int *") + result = _lib.intspan_bins(s_converted, vsize, vorigin, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def intspanset_bins( - ss: Annotated[_ffi.CData, "const SpanSet *"], vsize: int, vorigin: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + ss: Annotated[_ffi.CData, "const SpanSet *"], vsize: int, vorigin: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const SpanSet *", ss) - count_converted = _ffi.cast("int *", count) - result = _lib.intspanset_bins(ss_converted, vsize, vorigin, count_converted) + count = _ffi.new("int *") + result = _lib.intspanset_bins(ss_converted, vsize, vorigin, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def timestamptz_get_bin( @@ -5619,33 +5765,27 @@ def timestamptz_get_bin( def tstzspan_bins( - s: Annotated[_ffi.CData, "const Span *"], - duration: Annotated[_ffi.CData, "const Interval *"], - origin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Span *"]: + s: Annotated[_ffi.CData, "const Span *"], duration: Annotated[_ffi.CData, "const Interval *"], origin: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: s_converted = _ffi.cast("const Span *", s) duration_converted = _ffi.cast("const Interval *", duration) origin_converted = _ffi.cast("TimestampTz", origin) - count_converted = _ffi.cast("int *", count) - result = _lib.tstzspan_bins(s_converted, duration_converted, origin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tstzspan_bins(s_converted, duration_converted, origin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tstzspanset_bins( - ss: Annotated[_ffi.CData, "const SpanSet *"], - duration: Annotated[_ffi.CData, "const Interval *"], - torigin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Span *"]: + ss: Annotated[_ffi.CData, "const SpanSet *"], duration: Annotated[_ffi.CData, "const Interval *"], torigin: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const SpanSet *", ss) duration_converted = _ffi.cast("const Interval *", duration) torigin_converted = _ffi.cast("TimestampTz", torigin) - count_converted = _ffi.cast("int *", count) - result = _lib.tstzspanset_bins(ss_converted, duration_converted, torigin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tstzspanset_bins(ss_converted, duration_converted, torigin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tbox_as_hexwkb( @@ -5824,6 +5964,21 @@ def timestamptz_to_tbox(t: int) -> Annotated[_ffi.CData, "TBox *"]: return result if result != _ffi.NULL else None +def tbox_hash(box: Annotated[_ffi.CData, "const TBox *"]) -> Annotated[int, "uint32"]: + box_converted = _ffi.cast("const TBox *", box) + result = _lib.tbox_hash(box_converted) + _check_error() + return result if result != _ffi.NULL else None + + +def tbox_hash_extended(box: Annotated[_ffi.CData, "const TBox *"], seed: int) -> Annotated[int, "uint64"]: + box_converted = _ffi.cast("const TBox *", box) + seed_converted = _ffi.cast("uint64", seed) + result = _lib.tbox_hash_extended(box_converted, seed_converted) + _check_error() + return result if result != _ffi.NULL else None + + def tbox_hast(box: Annotated[_ffi.CData, "const TBox *"]) -> Annotated[bool, "bool"]: box_converted = _ffi.cast("const TBox *", box) result = _lib.tbox_hast(box_converted) @@ -5958,64 +6113,64 @@ def tboxint_xmin(box: Annotated[_ffi.CData, "const TBox *"]) -> Annotated[_ffi.C return None -def tbox_expand_float(box: Annotated[_ffi.CData, "const TBox *"], d: float) -> Annotated[_ffi.CData, "TBox *"]: +def tbox_expand_time( + box: Annotated[_ffi.CData, "const TBox *"], interv: Annotated[_ffi.CData, "const Interval *"] +) -> Annotated[_ffi.CData, "TBox *"]: box_converted = _ffi.cast("const TBox *", box) - result = _lib.tbox_expand_float(box_converted, d) + interv_converted = _ffi.cast("const Interval *", interv) + result = _lib.tbox_expand_time(box_converted, interv_converted) _check_error() return result if result != _ffi.NULL else None -def tbox_expand_int(box: Annotated[_ffi.CData, "const TBox *"], i: int) -> Annotated[_ffi.CData, "TBox *"]: +def tbox_round(box: Annotated[_ffi.CData, "const TBox *"], maxdd: int) -> Annotated[_ffi.CData, "TBox *"]: box_converted = _ffi.cast("const TBox *", box) - result = _lib.tbox_expand_int(box_converted, i) + result = _lib.tbox_round(box_converted, maxdd) _check_error() return result if result != _ffi.NULL else None -def tbox_expand_time( - box: Annotated[_ffi.CData, "const TBox *"], interv: Annotated[_ffi.CData, "const Interval *"] +def tbox_shift_scale_time( + box: Annotated[_ffi.CData, "const TBox *"], + shift: Annotated[_ffi.CData, "const Interval *"] | None, + duration: Annotated[_ffi.CData, "const Interval *"] | None, ) -> Annotated[_ffi.CData, "TBox *"]: box_converted = _ffi.cast("const TBox *", box) - interv_converted = _ffi.cast("const Interval *", interv) - result = _lib.tbox_expand_time(box_converted, interv_converted) + shift_converted = _ffi.cast("const Interval *", shift) if shift is not None else _ffi.NULL + duration_converted = _ffi.cast("const Interval *", duration) if duration is not None else _ffi.NULL + result = _lib.tbox_shift_scale_time(box_converted, shift_converted, duration_converted) _check_error() return result if result != _ffi.NULL else None -def tbox_round(box: Annotated[_ffi.CData, "const TBox *"], maxdd: int) -> Annotated[_ffi.CData, "TBox *"]: +def tfloatbox_expand(box: Annotated[_ffi.CData, "const TBox *"], d: float) -> Annotated[_ffi.CData, "TBox *"]: box_converted = _ffi.cast("const TBox *", box) - result = _lib.tbox_round(box_converted, maxdd) + result = _lib.tfloatbox_expand(box_converted, d) _check_error() return result if result != _ffi.NULL else None -def tbox_shift_scale_float( +def tfloatbox_shift_scale( box: Annotated[_ffi.CData, "const TBox *"], shift: float, width: float, hasshift: bool, haswidth: bool ) -> Annotated[_ffi.CData, "TBox *"]: box_converted = _ffi.cast("const TBox *", box) - result = _lib.tbox_shift_scale_float(box_converted, shift, width, hasshift, haswidth) + result = _lib.tfloatbox_shift_scale(box_converted, shift, width, hasshift, haswidth) _check_error() return result if result != _ffi.NULL else None -def tbox_shift_scale_int( - box: Annotated[_ffi.CData, "const TBox *"], shift: int, width: int, hasshift: bool, haswidth: bool -) -> Annotated[_ffi.CData, "TBox *"]: +def tintbox_expand(box: Annotated[_ffi.CData, "const TBox *"], i: int) -> Annotated[_ffi.CData, "TBox *"]: box_converted = _ffi.cast("const TBox *", box) - result = _lib.tbox_shift_scale_int(box_converted, shift, width, hasshift, haswidth) + result = _lib.tintbox_expand(box_converted, i) _check_error() return result if result != _ffi.NULL else None -def tbox_shift_scale_time( - box: Annotated[_ffi.CData, "const TBox *"], - shift: Annotated[_ffi.CData, "const Interval *"] | None, - duration: Annotated[_ffi.CData, "const Interval *"] | None, +def tintbox_shift_scale( + box: Annotated[_ffi.CData, "const TBox *"], shift: int, width: int, hasshift: bool, haswidth: bool ) -> Annotated[_ffi.CData, "TBox *"]: box_converted = _ffi.cast("const TBox *", box) - shift_converted = _ffi.cast("const Interval *", shift) if shift is not None else _ffi.NULL - duration_converted = _ffi.cast("const Interval *", duration) if duration is not None else _ffi.NULL - result = _lib.tbox_shift_scale_time(box_converted, shift_converted, duration_converted) + result = _lib.tintbox_shift_scale(box_converted, shift, width, hasshift, haswidth) _check_error() return result if result != _ffi.NULL else None @@ -6509,35 +6664,35 @@ def tintseqset_from_base_tstzspanset( def tsequence_make( - instants: Annotated[list, "const TInstant **"], + instants: Annotated[list, "TInstant **"], count: int, lower_inc: bool, upper_inc: bool, interp: InterpolationType, normalize: bool, ) -> Annotated[_ffi.CData, "TSequence *"]: - instants_converted = [_ffi.cast("const TInstant *", x) for x in instants] + instants_converted = [_ffi.cast("TInstant *", x) for x in instants] result = _lib.tsequence_make(instants_converted, count, lower_inc, upper_inc, interp, normalize) _check_error() return result if result != _ffi.NULL else None def tsequenceset_make( - sequences: Annotated[list, "const TSequence **"], count: int, normalize: bool + sequences: Annotated[list, "TSequence **"], count: int, normalize: bool ) -> Annotated[_ffi.CData, "TSequenceSet *"]: - sequences_converted = [_ffi.cast("const TSequence *", x) for x in sequences] + sequences_converted = [_ffi.cast("TSequence *", x) for x in sequences] result = _lib.tsequenceset_make(sequences_converted, count, normalize) _check_error() return result if result != _ffi.NULL else None def tsequenceset_make_gaps( - instants: Annotated[list, "const TInstant **"], + instants: Annotated[list, "TInstant **"], interp: InterpolationType, maxt: Annotated[_ffi.CData, "const Interval *"] | None, maxdist: float, ) -> Annotated[_ffi.CData, "TSequenceSet *"]: - instants_converted = [_ffi.cast("const TInstant *", x) for x in instants] + instants_converted = [_ffi.cast("TInstant *", x) for x in instants] maxt_converted = _ffi.cast("const Interval *", maxt) if maxt is not None else _ffi.NULL result = _lib.tsequenceset_make_gaps(instants_converted, len(instants), interp, maxt_converted, maxdist) _check_error() @@ -6672,13 +6827,13 @@ def tbool_value_n(temp: Annotated[_ffi.CData, "const Temporal *"], n: int) -> An def tbool_values( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "bool *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "bool *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tbool_values(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tbool_values(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_duration( @@ -6726,13 +6881,13 @@ def temporal_instant_n(temp: Annotated[_ffi.CData, "const Temporal *"], n: int) def temporal_instants( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TInstant **"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "TInstant **"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_instants(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_instants(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_interp(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[str, "const char *"]: @@ -6785,16 +6940,29 @@ def temporal_num_timestamps(temp: Annotated[_ffi.CData, "const Temporal *"]) -> return result if result != _ffi.NULL else None -def temporal_segments( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TSequence **"]: +def temporal_segm_duration( + temp: Annotated[_ffi.CData, "const Temporal *"], + duration: Annotated[_ffi.CData, "const Interval *"], + atleast: bool, + strict: bool, +) -> Annotated[_ffi.CData, "TSequenceSet *"]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_segments(temp_converted, count_converted) + duration_converted = _ffi.cast("const Interval *", duration) + result = _lib.temporal_segm_duration(temp_converted, duration_converted, atleast, strict) _check_error() return result if result != _ffi.NULL else None +def temporal_segments( + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "TSequence **"], Annotated[_ffi.CData, "int"]]: + temp_converted = _ffi.cast("const Temporal *", temp) + count = _ffi.new("int *") + result = _lib.temporal_segments(temp_converted, count) + _check_error() + return result if result != _ffi.NULL else None, count[0] + + def temporal_sequence_n( temp: Annotated[_ffi.CData, "const Temporal *"], i: int ) -> Annotated[_ffi.CData, "TSequence *"]: @@ -6805,13 +6973,13 @@ def temporal_sequence_n( def temporal_sequences( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TSequence **"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "TSequence **"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_sequences(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_sequences(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_start_instant(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[_ffi.CData, "TInstant *"]: @@ -6863,13 +7031,13 @@ def temporal_time(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[ def temporal_timestamps( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[int, "TimestampTz *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[int, "TimestampTz *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_timestamps(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_timestamps(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_timestamptz_n(temp: Annotated[_ffi.CData, "const Temporal *"], n: int) -> int: @@ -6896,16 +7064,16 @@ def tfloat_end_value(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotat return result if result != _ffi.NULL else None -def tfloat_max_value(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[float, "double"]: +def tfloat_min_value(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[float, "double"]: temp_converted = _ffi.cast("const Temporal *", temp) - result = _lib.tfloat_max_value(temp_converted) + result = _lib.tfloat_min_value(temp_converted) _check_error() return result if result != _ffi.NULL else None -def tfloat_min_value(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[float, "double"]: +def tfloat_max_value(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[float, "double"]: temp_converted = _ffi.cast("const Temporal *", temp) - result = _lib.tfloat_min_value(temp_converted) + result = _lib.tfloat_max_value(temp_converted) _check_error() return result if result != _ffi.NULL else None @@ -6941,13 +7109,13 @@ def tfloat_value_n(temp: Annotated[_ffi.CData, "const Temporal *"], n: int) -> A def tfloat_values( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "double *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "double *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tfloat_values(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tfloat_values(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tint_end_value(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[int, "int"]: @@ -7002,11 +7170,18 @@ def tint_value_n(temp: Annotated[_ffi.CData, "const Temporal *"], n: int) -> Ann def tint_values( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "int *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "int *"], Annotated[_ffi.CData, "int"]]: + temp_converted = _ffi.cast("const Temporal *", temp) + count = _ffi.new("int *") + result = _lib.tint_values(temp_converted, count) + _check_error() + return result if result != _ffi.NULL else None, count[0] + + +def tnumber_avg_value(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[float, "double"]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tint_values(temp_converted, count_converted) + result = _lib.tnumber_avg_value(temp_converted) _check_error() return result if result != _ffi.NULL else None @@ -7088,13 +7263,13 @@ def ttext_value_n(temp: Annotated[_ffi.CData, "const Temporal *"], n: int) -> An def ttext_values( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "text **"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "text **"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.ttext_values(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.ttext_values(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def float_degrees(value: float, normalize: bool) -> Annotated[float, "double"]: @@ -7103,10 +7278,8 @@ def float_degrees(value: float, normalize: bool) -> Annotated[float, "double"]: return result if result != _ffi.NULL else None -def temparr_round( - temp: Annotated[list, "const Temporal **"], count: int, maxdd: int -) -> Annotated[_ffi.CData, "Temporal **"]: - temp_converted = [_ffi.cast("const Temporal *", x) for x in temp] +def temparr_round(temp: Annotated[list, "Temporal **"], count: int, maxdd: int) -> Annotated[_ffi.CData, "Temporal **"]: + temp_converted = [_ffi.cast("Temporal *", x) for x in temp] result = _lib.temparr_round(temp_converted, count, maxdd) _check_error() return result if result != _ffi.NULL else None @@ -7356,10 +7529,8 @@ def temporal_merge( return result if result != _ffi.NULL else None -def temporal_merge_array( - temparr: Annotated[list, "const Temporal **"], count: int -) -> Annotated[_ffi.CData, "Temporal *"]: - temparr_converted = [_ffi.cast("const Temporal *", x) for x in temparr] +def temporal_merge_array(temparr: Annotated[list, "Temporal **"], count: int) -> Annotated[_ffi.CData, "Temporal *"]: + temparr_converted = [_ffi.cast("Temporal *", x) for x in temparr] result = _lib.temporal_merge_array(temparr_converted, count) _check_error() return result if result != _ffi.NULL else None @@ -7389,6 +7560,16 @@ def tbool_minus_value(temp: Annotated[_ffi.CData, "const Temporal *"], b: bool) return result if result != _ffi.NULL else None +def temporal_after_timestamptz( + temp: Annotated[_ffi.CData, "const Temporal *"], t: int, strict: bool +) -> Annotated[_ffi.CData, "Temporal *"]: + temp_converted = _ffi.cast("const Temporal *", temp) + t_converted = _ffi.cast("TimestampTz", t) + result = _lib.temporal_after_timestamptz(temp_converted, t_converted, strict) + _check_error() + return result if result != _ffi.NULL else None + + def temporal_at_max(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[_ffi.CData, "Temporal *"]: temp_converted = _ffi.cast("const Temporal *", temp) result = _lib.temporal_at_max(temp_converted) @@ -7453,6 +7634,16 @@ def temporal_at_values( return result if result != _ffi.NULL else None +def temporal_before_timestamptz( + temp: Annotated[_ffi.CData, "const Temporal *"], t: int, strict: bool +) -> Annotated[_ffi.CData, "Temporal *"]: + temp_converted = _ffi.cast("const Temporal *", temp) + t_converted = _ffi.cast("TimestampTz", t) + result = _lib.temporal_before_timestamptz(temp_converted, t_converted, strict) + _check_error() + return result if result != _ffi.NULL else None + + def temporal_minus_max(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[_ffi.CData, "Temporal *"]: temp_converted = _ffi.cast("const Temporal *", temp) result = _lib.temporal_minus_max(temp_converted) @@ -8750,63 +8941,63 @@ def tne_ttext_text(temp: Annotated[_ffi.CData, "const Temporal *"], txt: str) -> def temporal_spans( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_spans(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_spans(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_split_each_n_spans( - temp: Annotated[_ffi.CData, "const Temporal *"], elem_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], elem_count: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_split_each_n_spans(temp_converted, elem_count, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_split_each_n_spans(temp_converted, elem_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_split_n_spans( - temp: Annotated[_ffi.CData, "const Temporal *"], span_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], span_count: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_split_n_spans(temp_converted, span_count, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_split_n_spans(temp_converted, span_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tnumber_split_each_n_tboxes( - temp: Annotated[_ffi.CData, "const Temporal *"], elem_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TBox *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], elem_count: int +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tnumber_split_each_n_tboxes(temp_converted, elem_count, count_converted) + count = _ffi.new("int *") + result = _lib.tnumber_split_each_n_tboxes(temp_converted, elem_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tnumber_split_n_tboxes( - temp: Annotated[_ffi.CData, "const Temporal *"], box_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TBox *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], box_count: int +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tnumber_split_n_tboxes(temp_converted, box_count, count_converted) + count = _ffi.new("int *") + result = _lib.tnumber_split_n_tboxes(temp_converted, box_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tnumber_tboxes( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TBox *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tnumber_tboxes(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tnumber_tboxes(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def adjacent_numspan_tnumber( @@ -9914,6 +10105,13 @@ def tnumber_abs(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[_f return result if result != _ffi.NULL else None +def tnumber_trend(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[_ffi.CData, "Temporal *"]: + temp_converted = _ffi.cast("const Temporal *", temp) + result = _lib.tnumber_trend(temp_converted) + _check_error() + return result if result != _ffi.NULL else None + + def float_angular_difference(degrees1: float, degrees2: float) -> Annotated[float, "double"]: result = _lib.float_angular_difference(degrees1, degrees2) _check_error() @@ -10443,16 +10641,14 @@ def temporal_dyntimewarp_distance( def temporal_dyntimewarp_path( - temp1: Annotated[_ffi.CData, "const Temporal *"], - temp2: Annotated[_ffi.CData, "const Temporal *"], - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Match *"]: + temp1: Annotated[_ffi.CData, "const Temporal *"], temp2: Annotated[_ffi.CData, "const Temporal *"] +) -> tuple[Annotated[_ffi.CData, "Match *"], Annotated[_ffi.CData, "int"]]: temp1_converted = _ffi.cast("const Temporal *", temp1) temp2_converted = _ffi.cast("const Temporal *", temp2) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_dyntimewarp_path(temp1_converted, temp2_converted, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_dyntimewarp_path(temp1_converted, temp2_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_frechet_distance( @@ -10466,16 +10662,14 @@ def temporal_frechet_distance( def temporal_frechet_path( - temp1: Annotated[_ffi.CData, "const Temporal *"], - temp2: Annotated[_ffi.CData, "const Temporal *"], - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Match *"]: + temp1: Annotated[_ffi.CData, "const Temporal *"], temp2: Annotated[_ffi.CData, "const Temporal *"] +) -> tuple[Annotated[_ffi.CData, "Match *"], Annotated[_ffi.CData, "int"]]: temp1_converted = _ffi.cast("const Temporal *", temp1) temp2_converted = _ffi.cast("const Temporal *", temp2) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_frechet_path(temp1_converted, temp2_converted, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_frechet_path(temp1_converted, temp2_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_hausdorff_distance( @@ -10489,18 +10683,15 @@ def temporal_hausdorff_distance( def temporal_time_bins( - temp: Annotated[_ffi.CData, "const Temporal *"], - duration: Annotated[_ffi.CData, "const Interval *"], - origin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Span *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], duration: Annotated[_ffi.CData, "const Interval *"], origin: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) duration_converted = _ffi.cast("const Interval *", duration) origin_converted = _ffi.cast("TimestampTz", origin) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_time_bins(temp_converted, duration_converted, origin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_time_bins(temp_converted, duration_converted, origin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_time_split( @@ -10517,38 +10708,35 @@ def temporal_time_split( def tfloat_time_boxes( - temp: Annotated[_ffi.CData, "const Temporal *"], - duration: Annotated[_ffi.CData, "const Interval *"], - torigin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "TBox *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], duration: Annotated[_ffi.CData, "const Interval *"], torigin: int +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) duration_converted = _ffi.cast("const Interval *", duration) torigin_converted = _ffi.cast("TimestampTz", torigin) - count_converted = _ffi.cast("int *", count) - result = _lib.tfloat_time_boxes(temp_converted, duration_converted, torigin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tfloat_time_boxes(temp_converted, duration_converted, torigin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tfloat_value_bins( - temp: Annotated[_ffi.CData, "const Temporal *"], vsize: float, vorigin: float, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], vsize: float, vorigin: float +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tfloat_value_bins(temp_converted, vsize, vorigin, count_converted) + count = _ffi.new("int *") + result = _lib.tfloat_value_bins(temp_converted, vsize, vorigin, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tfloat_value_boxes( - temp: Annotated[_ffi.CData, "const Temporal *"], vsize: float, vorigin: float, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TBox *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], vsize: float, vorigin: float +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tfloat_value_boxes(temp_converted, vsize, vorigin, count_converted) + count = _ffi.new("int *") + result = _lib.tfloat_value_boxes(temp_converted, vsize, vorigin, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tfloat_value_split( @@ -10568,17 +10756,14 @@ def tfloat_value_time_boxes( duration: Annotated[_ffi.CData, "const Interval *"], vorigin: float, torigin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "TBox *"]: +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) duration_converted = _ffi.cast("const Interval *", duration) torigin_converted = _ffi.cast("TimestampTz", torigin) - count_converted = _ffi.cast("int *", count) - result = _lib.tfloat_value_time_boxes( - temp_converted, vsize, duration_converted, vorigin, torigin_converted, count_converted - ) + count = _ffi.new("int *") + result = _lib.tfloat_value_time_boxes(temp_converted, vsize, duration_converted, vorigin, torigin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tfloat_value_time_split( @@ -10607,28 +10792,25 @@ def tfloat_value_time_split( def tfloatbox_time_tiles( - box: Annotated[_ffi.CData, "const TBox *"], - duration: Annotated[_ffi.CData, "const Interval *"], - torigin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "TBox *"]: + box: Annotated[_ffi.CData, "const TBox *"], duration: Annotated[_ffi.CData, "const Interval *"], torigin: int +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: box_converted = _ffi.cast("const TBox *", box) duration_converted = _ffi.cast("const Interval *", duration) torigin_converted = _ffi.cast("TimestampTz", torigin) - count_converted = _ffi.cast("int *", count) - result = _lib.tfloatbox_time_tiles(box_converted, duration_converted, torigin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tfloatbox_time_tiles(box_converted, duration_converted, torigin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tfloatbox_value_tiles( - box: Annotated[_ffi.CData, "const TBox *"], vsize: float, vorigin: float, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TBox *"]: + box: Annotated[_ffi.CData, "const TBox *"], vsize: float, vorigin: float +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: box_converted = _ffi.cast("const TBox *", box) - count_converted = _ffi.cast("int *", count) - result = _lib.tfloatbox_value_tiles(box_converted, vsize, vorigin, count_converted) + count = _ffi.new("int *") + result = _lib.tfloatbox_value_tiles(box_converted, vsize, vorigin, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tfloatbox_value_time_tiles( @@ -10650,38 +10832,35 @@ def tfloatbox_value_time_tiles( def tint_time_boxes( - temp: Annotated[_ffi.CData, "const Temporal *"], - duration: Annotated[_ffi.CData, "const Interval *"], - torigin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "TBox *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], duration: Annotated[_ffi.CData, "const Interval *"], torigin: int +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) duration_converted = _ffi.cast("const Interval *", duration) torigin_converted = _ffi.cast("TimestampTz", torigin) - count_converted = _ffi.cast("int *", count) - result = _lib.tint_time_boxes(temp_converted, duration_converted, torigin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tint_time_boxes(temp_converted, duration_converted, torigin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tint_value_bins( - temp: Annotated[_ffi.CData, "const Temporal *"], vsize: int, vorigin: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Span *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], vsize: int, vorigin: int +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tint_value_bins(temp_converted, vsize, vorigin, count_converted) + count = _ffi.new("int *") + result = _lib.tint_value_bins(temp_converted, vsize, vorigin, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tint_value_boxes( - temp: Annotated[_ffi.CData, "const Temporal *"], vsize: int, vorigin: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TBox *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], vsize: int, vorigin: int +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tint_value_boxes(temp_converted, vsize, vorigin, count_converted) + count = _ffi.new("int *") + result = _lib.tint_value_boxes(temp_converted, vsize, vorigin, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tint_value_split( @@ -10701,17 +10880,14 @@ def tint_value_time_boxes( duration: Annotated[_ffi.CData, "const Interval *"], vorigin: int, torigin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "TBox *"]: +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) duration_converted = _ffi.cast("const Interval *", duration) torigin_converted = _ffi.cast("TimestampTz", torigin) - count_converted = _ffi.cast("int *", count) - result = _lib.tint_value_time_boxes( - temp_converted, vsize, duration_converted, vorigin, torigin_converted, count_converted - ) + count = _ffi.new("int *") + result = _lib.tint_value_time_boxes(temp_converted, vsize, duration_converted, vorigin, torigin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tint_value_time_split( @@ -10740,28 +10916,25 @@ def tint_value_time_split( def tintbox_time_tiles( - box: Annotated[_ffi.CData, "const TBox *"], - duration: Annotated[_ffi.CData, "const Interval *"], - torigin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "TBox *"]: + box: Annotated[_ffi.CData, "const TBox *"], duration: Annotated[_ffi.CData, "const Interval *"], torigin: int +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: box_converted = _ffi.cast("const TBox *", box) duration_converted = _ffi.cast("const Interval *", duration) torigin_converted = _ffi.cast("TimestampTz", torigin) - count_converted = _ffi.cast("int *", count) - result = _lib.tintbox_time_tiles(box_converted, duration_converted, torigin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tintbox_time_tiles(box_converted, duration_converted, torigin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tintbox_value_tiles( - box: Annotated[_ffi.CData, "const TBox *"], xsize: int, xorigin: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TBox *"]: + box: Annotated[_ffi.CData, "const TBox *"], xsize: int, xorigin: int +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: box_converted = _ffi.cast("const TBox *", box) - count_converted = _ffi.cast("int *", count) - result = _lib.tintbox_value_tiles(box_converted, xsize, xorigin, count_converted) + count = _ffi.new("int *") + result = _lib.tintbox_value_tiles(box_converted, xsize, xorigin, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tintbox_value_time_tiles( @@ -11330,13 +11503,6 @@ def geo_out(gs: Annotated[_ffi.CData, "const GSERIALIZED *"]) -> Annotated[str, return result if result != _ffi.NULL else None -def geog_from_binary(wkb_bytea: str) -> Annotated[_ffi.CData, "GSERIALIZED *"]: - wkb_bytea_converted = wkb_bytea.encode("utf-8") - result = _lib.geog_from_binary(wkb_bytea_converted) - _check_error() - return result if result != _ffi.NULL else None - - def geog_from_hexewkb(wkt: str) -> Annotated[_ffi.CData, "GSERIALIZED *"]: wkt_converted = wkt.encode("utf-8") result = _lib.geog_from_hexewkb(wkt_converted) @@ -11367,6 +11533,39 @@ def geom_in(string: str, typmod: int) -> Annotated[_ffi.CData, "GSERIALIZED *"]: return result if result != _ffi.NULL else None +def box3d_make( + xmin: float, xmax: float, ymin: float, ymax: float, zmin: float, zmax: float, srid: Annotated[_ffi.CData, "int32_t"] +) -> Annotated[_ffi.CData, "BOX3D *"]: + srid_converted = _ffi.cast("int32_t", srid) + result = _lib.box3d_make(xmin, xmax, ymin, ymax, zmin, zmax, srid_converted) + _check_error() + return result if result != _ffi.NULL else None + + +def box3d_out(box: Annotated[_ffi.CData, "const BOX3D *"], maxdd: int) -> Annotated[str, "char *"]: + box_converted = _ffi.cast("const BOX3D *", box) + result = _lib.box3d_out(box_converted, maxdd) + _check_error() + result = _ffi.string(result).decode("utf-8") + return result if result != _ffi.NULL else None + + +def gbox_make( + hasz: bool, xmin: float, xmax: float, ymin: float, ymax: float, zmin: float, zmax: float +) -> Annotated[_ffi.CData, "GBOX *"]: + result = _lib.gbox_make(hasz, xmin, xmax, ymin, ymax, zmin, zmax) + _check_error() + return result if result != _ffi.NULL else None + + +def gbox_out(box: Annotated[_ffi.CData, "const GBOX *"], maxdd: int) -> Annotated[str, "char *"]: + box_converted = _ffi.cast("const GBOX *", box) + result = _lib.gbox_out(box_converted, maxdd) + _check_error() + result = _ffi.string(result).decode("utf-8") + return result if result != _ffi.NULL else None + + def geo_copy(g: Annotated[_ffi.CData, "const GSERIALIZED *"]) -> Annotated[_ffi.CData, "GSERIALIZED *"]: g_converted = _ffi.cast("const GSERIALIZED *", g) result = _lib.geo_copy(g_converted) @@ -11431,6 +11630,13 @@ def geo_is_empty(g: Annotated[_ffi.CData, "const GSERIALIZED *"]) -> Annotated[b return result if result != _ffi.NULL else None +def geo_is_unitary(gs: Annotated[_ffi.CData, "const GSERIALIZED *"]) -> Annotated[bool, "bool"]: + gs_converted = _ffi.cast("const GSERIALIZED *", gs) + result = _lib.geo_is_unitary(gs_converted) + _check_error() + return result if result != _ffi.NULL else None + + def geo_typename(type: int) -> Annotated[str, "const char *"]: result = _lib.geo_typename(type) _check_error() @@ -11541,9 +11747,9 @@ def geo_srid(gs: Annotated[_ffi.CData, "const GSERIALIZED *"]) -> Annotated[_ffi def geo_transform( - geom: Annotated[_ffi.CData, "GSERIALIZED *"], srid_to: Annotated[_ffi.CData, "int32_t"] + geom: Annotated[_ffi.CData, "const GSERIALIZED *"], srid_to: Annotated[_ffi.CData, "int32_t"] ) -> Annotated[_ffi.CData, "GSERIALIZED *"]: - geom_converted = _ffi.cast("GSERIALIZED *", geom) + geom_converted = _ffi.cast("const GSERIALIZED *", geom) srid_to_converted = _ffi.cast("int32_t", srid_to) result = _lib.geo_transform(geom_converted, srid_to_converted) _check_error() @@ -11578,23 +11784,40 @@ def geo_makeline_garray(gsarr: Annotated[list, "GSERIALIZED **"], count: int) -> return result if result != _ffi.NULL else None -def geo_npoints(gs: Annotated[_ffi.CData, "const GSERIALIZED *"]) -> Annotated[int, "int"]: +def geo_num_points(gs: Annotated[_ffi.CData, "const GSERIALIZED *"]) -> Annotated[int, "int"]: gs_converted = _ffi.cast("const GSERIALIZED *", gs) - result = _lib.geo_npoints(gs_converted) + result = _lib.geo_num_points(gs_converted) _check_error() return result if result != _ffi.NULL else None -def geo_ngeos(gs: Annotated[_ffi.CData, "const GSERIALIZED *"]) -> Annotated[int, "int"]: +def geo_num_geos(gs: Annotated[_ffi.CData, "const GSERIALIZED *"]) -> Annotated[int, "int"]: gs_converted = _ffi.cast("const GSERIALIZED *", gs) - result = _lib.geo_ngeos(gs_converted) + result = _lib.geo_num_geos(gs_converted) _check_error() return result if result != _ffi.NULL else None -def geo_geoN(geom: Annotated[_ffi.CData, "const GSERIALIZED *"], n: int) -> Annotated[_ffi.CData, "GSERIALIZED *"]: +def geo_geo_n(geom: Annotated[_ffi.CData, "const GSERIALIZED *"], n: int) -> Annotated[_ffi.CData, "GSERIALIZED *"]: geom_converted = _ffi.cast("const GSERIALIZED *", geom) - result = _lib.geo_geoN(geom_converted, n) + result = _lib.geo_geo_n(geom_converted, n) + _check_error() + return result if result != _ffi.NULL else None + + +def geo_pointarr( + gs: Annotated[_ffi.CData, "const GSERIALIZED *"], +) -> tuple[Annotated[_ffi.CData, "GSERIALIZED **"], Annotated[_ffi.CData, "int"]]: + gs_converted = _ffi.cast("const GSERIALIZED *", gs) + count = _ffi.new("int *") + result = _lib.geo_pointarr(gs_converted, count) + _check_error() + return result if result != _ffi.NULL else None, count[0] + + +def geo_points(gs: Annotated[_ffi.CData, "const GSERIALIZED *"]) -> Annotated[_ffi.CData, "GSERIALIZED *"]: + gs_converted = _ffi.cast("const GSERIALIZED *", gs) + result = _lib.geo_points(gs_converted) _check_error() return result if result != _ffi.NULL else None @@ -11657,6 +11880,26 @@ def geom_intersection2d( return result if result != _ffi.NULL else None +def geom_intersection2d_coll( + gs1: Annotated[_ffi.CData, "const GSERIALIZED *"], gs2: Annotated[_ffi.CData, "const GSERIALIZED *"] +) -> Annotated[_ffi.CData, "GSERIALIZED *"]: + gs1_converted = _ffi.cast("const GSERIALIZED *", gs1) + gs2_converted = _ffi.cast("const GSERIALIZED *", gs2) + result = _lib.geom_intersection2d_coll(gs1_converted, gs2_converted) + _check_error() + return result if result != _ffi.NULL else None + + +def geom_min_bounding_radius( + geom: Annotated[_ffi.CData, "const GSERIALIZED *"], radius: Annotated[_ffi.CData, "double *"] +) -> Annotated[_ffi.CData, "GSERIALIZED *"]: + geom_converted = _ffi.cast("const GSERIALIZED *", geom) + radius_converted = _ffi.cast("double *", radius) + result = _lib.geom_min_bounding_radius(geom_converted, radius_converted) + _check_error() + return result if result != _ffi.NULL else None + + def geom_shortestline2d( gs1: Annotated[_ffi.CData, "const GSERIALIZED *"], s2: Annotated[_ffi.CData, "const GSERIALIZED *"] ) -> Annotated[_ffi.CData, "GSERIALIZED *"]: @@ -11677,17 +11920,19 @@ def geom_shortestline3d( return result if result != _ffi.NULL else None -def geom_unary_union(gs: Annotated[_ffi.CData, "GSERIALIZED *"], prec: float) -> Annotated[_ffi.CData, "GSERIALIZED *"]: - gs_converted = _ffi.cast("GSERIALIZED *", gs) +def geom_unary_union( + gs: Annotated[_ffi.CData, "const GSERIALIZED *"], prec: float +) -> Annotated[_ffi.CData, "GSERIALIZED *"]: + gs_converted = _ffi.cast("const GSERIALIZED *", gs) result = _lib.geom_unary_union(gs_converted, prec) _check_error() return result if result != _ffi.NULL else None def line_interpolate_point( - gs: Annotated[_ffi.CData, "GSERIALIZED *"], distance_fraction: float, repeat: bool + gs: Annotated[_ffi.CData, "const GSERIALIZED *"], distance_fraction: float, repeat: bool ) -> Annotated[_ffi.CData, "GSERIALIZED *"]: - gs_converted = _ffi.cast("GSERIALIZED *", gs) + gs_converted = _ffi.cast("const GSERIALIZED *", gs) result = _lib.line_interpolate_point(gs_converted, distance_fraction, repeat) _check_error() return result if result != _ffi.NULL else None @@ -11833,33 +12078,33 @@ def geom_touches( def geo_stboxes( - gs: Annotated[_ffi.CData, "const GSERIALIZED *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "STBox *"]: + gs: Annotated[_ffi.CData, "const GSERIALIZED *"], +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: gs_converted = _ffi.cast("const GSERIALIZED *", gs) - count_converted = _ffi.cast("int *", count) - result = _lib.geo_stboxes(gs_converted, count_converted) + count = _ffi.new("int *") + result = _lib.geo_stboxes(gs_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def geo_split_each_n_stboxes( - gs: Annotated[_ffi.CData, "const GSERIALIZED *"], elem_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "STBox *"]: + gs: Annotated[_ffi.CData, "const GSERIALIZED *"], elem_count: int +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: gs_converted = _ffi.cast("const GSERIALIZED *", gs) - count_converted = _ffi.cast("int *", count) - result = _lib.geo_split_each_n_stboxes(gs_converted, elem_count, count_converted) + count = _ffi.new("int *") + result = _lib.geo_split_each_n_stboxes(gs_converted, elem_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def geo_split_n_stboxes( - gs: Annotated[_ffi.CData, "const GSERIALIZED *"], box_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "STBox *"]: + gs: Annotated[_ffi.CData, "const GSERIALIZED *"], box_count: int +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: gs_converted = _ffi.cast("const GSERIALIZED *", gs) - count_converted = _ffi.cast("int *", count) - result = _lib.geo_split_n_stboxes(gs_converted, box_count, count_converted) + count = _ffi.new("int *") + result = _lib.geo_split_n_stboxes(gs_converted, box_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def geog_distance( @@ -11942,8 +12187,8 @@ def spatialset_as_ewkt(set: Annotated[_ffi.CData, "const Set *"], maxdd: int) -> return result if result != _ffi.NULL else None -def geoset_make(values: Annotated[list, "const GSERIALIZED **"]) -> Annotated[_ffi.CData, "Set *"]: - values_converted = [_ffi.cast("const GSERIALIZED *", x) for x in values] +def geoset_make(values: Annotated[list, "GSERIALIZED **"]) -> Annotated[_ffi.CData, "Set *"]: + values_converted = [_ffi.cast("GSERIALIZED *", x) for x in values] result = _lib.geoset_make(values_converted, len(values)) _check_error() return result if result != _ffi.NULL else None @@ -12291,6 +12536,21 @@ def stbox_area(box: Annotated[_ffi.CData, "const STBox *"], spheroid: bool) -> A return result if result != _ffi.NULL else None +def stbox_hash(box: Annotated[_ffi.CData, "const STBox *"]) -> Annotated[int, "uint32"]: + box_converted = _ffi.cast("const STBox *", box) + result = _lib.stbox_hash(box_converted) + _check_error() + return result if result != _ffi.NULL else None + + +def stbox_hash_extended(box: Annotated[_ffi.CData, "const STBox *"], seed: int) -> Annotated[int, "uint64"]: + box_converted = _ffi.cast("const STBox *", box) + seed_converted = _ffi.cast("uint64", seed) + result = _lib.stbox_hash_extended(box_converted, seed_converted) + _check_error() + return result if result != _ffi.NULL else None + + def stbox_hast(box: Annotated[_ffi.CData, "const STBox *"]) -> Annotated[bool, "bool"]: box_converted = _ffi.cast("const STBox *", box) result = _lib.stbox_hast(box_converted) @@ -12458,13 +12718,13 @@ def stbox_get_space(box: Annotated[_ffi.CData, "const STBox *"]) -> Annotated[_f def stbox_quad_split( - box: Annotated[_ffi.CData, "const STBox *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "STBox *"]: + box: Annotated[_ffi.CData, "const STBox *"], +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: box_converted = _ffi.cast("const STBox *", box) - count_converted = _ffi.cast("int *", count) - result = _lib.stbox_quad_split(box_converted, count_converted) + count = _ffi.new("int *") + result = _lib.stbox_quad_split(box_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def stbox_round(box: Annotated[_ffi.CData, "const STBox *"], maxdd: int) -> Annotated[_ffi.CData, "STBox *"]: @@ -12837,49 +13097,6 @@ def stbox_ne( return result if result != _ffi.NULL else None -def rtree_create_stbox() -> Annotated[_ffi.CData, "RTree *"]: - result = _lib.rtree_create_stbox() - _check_error() - return result if result != _ffi.NULL else None - - -def rtree_free(rtree: Annotated[_ffi.CData, "RTree *"]) -> Annotated[None, "void"]: - rtree_converted = _ffi.cast("RTree *", rtree) - _lib.rtree_free(rtree_converted) - _check_error() - - -def rtree_insert( - rtree: Annotated[_ffi.CData, "RTree *"], box: Annotated[_ffi.CData, "STBox *"], id: int -) -> Annotated[None, "void"]: - rtree_converted = _ffi.cast("RTree *", rtree) - box_converted = _ffi.cast("STBox *", box) - id_converted = _ffi.cast("int64", id) - _lib.rtree_insert(rtree_converted, box_converted, id_converted) - _check_error() - - -def rtree_search( - rtree: Annotated[_ffi.CData, "const RTree *"], - query: Annotated[_ffi.CData, "const STBox *"], - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "int *"]: - rtree_converted = _ffi.cast("const RTree *", rtree) - query_converted = _ffi.cast("const STBox *", query) - count_converted = _ffi.cast("int *", count) - result = _lib.rtree_search(rtree_converted, query_converted, count_converted) - _check_error() - return result if result != _ffi.NULL else None - - -def tgeo_out(temp: Annotated[_ffi.CData, "const Temporal *"], maxdd: int) -> Annotated[str, "char *"]: - temp_converted = _ffi.cast("const Temporal *", temp) - result = _lib.tgeo_out(temp_converted, maxdd) - _check_error() - result = _ffi.string(result).decode("utf-8") - return result if result != _ffi.NULL else None - - def tgeogpoint_from_mfjson(string: str) -> Annotated[_ffi.CData, "Temporal *"]: string_converted = string.encode("utf-8") result = _lib.tgeogpoint_from_mfjson(string_converted) @@ -12952,6 +13169,14 @@ def tspatial_as_text(temp: Annotated[_ffi.CData, "const Temporal *"], maxdd: int return result if result != _ffi.NULL else None +def tspatial_out(temp: Annotated[_ffi.CData, "const Temporal *"], maxdd: int) -> Annotated[str, "char *"]: + temp_converted = _ffi.cast("const Temporal *", temp) + result = _lib.tspatial_out(temp_converted, maxdd) + _check_error() + result = _ffi.string(result).decode("utf-8") + return result if result != _ffi.NULL else None + + def tgeo_from_base_temp( gs: Annotated[_ffi.CData, "const GSERIALIZED *"], temp: Annotated[_ffi.CData, "const Temporal *"] ) -> Annotated[_ffi.CData, "Temporal *"]: @@ -13162,15 +13387,14 @@ def tpoint_as_mvtgeom( clip_geom: bool, gsarr: Annotated[list, "GSERIALIZED **"], timesarr: Annotated[list, "int64 **"], - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[bool, "bool"]: +) -> tuple[Annotated[bool, "bool"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) bounds_converted = _ffi.cast("const STBox *", bounds) extent_converted = _ffi.cast("int32_t", extent) buffer_converted = _ffi.cast("int32_t", buffer) gsarr_converted = [_ffi.cast("GSERIALIZED *", x) for x in gsarr] timesarr_converted = [_ffi.cast("int64 *", x) for x in timesarr] - count_converted = _ffi.cast("int *", count) + count = _ffi.new("int *") result = _lib.tpoint_as_mvtgeom( temp_converted, bounds_converted, @@ -13179,10 +13403,10 @@ def tpoint_as_mvtgeom( clip_geom, gsarr_converted, timesarr_converted, - count_converted, + count, ) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tpoint_tfloat_to_geomeas( @@ -13301,13 +13525,13 @@ def tgeo_value_n(temp: Annotated[_ffi.CData, "const Temporal *"], n: int) -> Ann def tgeo_values( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "GSERIALIZED **"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "GSERIALIZED **"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tgeo_values(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tgeo_values(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tpoint_angular_difference(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[_ffi.CData, "Temporal *"]: @@ -13423,13 +13647,13 @@ def tgeo_scale( def tpoint_make_simple( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Temporal **"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "Temporal **"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tpoint_make_simple(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tpoint_make_simple(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tspatial_srid(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[_ffi.CData, "int32_t"]: @@ -13740,13 +13964,13 @@ def tne_tgeo_geo( def tgeo_stboxes( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "STBox *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tgeo_stboxes(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tgeo_stboxes(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tgeo_space_boxes( @@ -13757,16 +13981,13 @@ def tgeo_space_boxes( sorigin: Annotated[_ffi.CData, "const GSERIALIZED *"], bitmatrix: bool, border_inc: bool, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "STBox *"]: +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) sorigin_converted = _ffi.cast("const GSERIALIZED *", sorigin) - count_converted = _ffi.cast("int *", count) - result = _lib.tgeo_space_boxes( - temp_converted, xsize, ysize, zsize, sorigin_converted, bitmatrix, border_inc, count_converted - ) + count = _ffi.new("int *") + result = _lib.tgeo_space_boxes(temp_converted, xsize, ysize, zsize, sorigin_converted, bitmatrix, border_inc, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tgeo_space_time_boxes( @@ -13779,13 +14000,12 @@ def tgeo_space_time_boxes( torigin: int, bitmatrix: bool, border_inc: bool, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "STBox *"]: +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) duration_converted = _ffi.cast("const Interval *", duration) sorigin_converted = _ffi.cast("const GSERIALIZED *", sorigin) torigin_converted = _ffi.cast("TimestampTz", torigin) - count_converted = _ffi.cast("int *", count) + count = _ffi.new("int *") result = _lib.tgeo_space_time_boxes( temp_converted, xsize, @@ -13796,30 +14016,30 @@ def tgeo_space_time_boxes( torigin_converted, bitmatrix, border_inc, - count_converted, + count, ) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tgeo_split_each_n_stboxes( - temp: Annotated[_ffi.CData, "const Temporal *"], elem_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "STBox *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], elem_count: int +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tgeo_split_each_n_stboxes(temp_converted, elem_count, count_converted) + count = _ffi.new("int *") + result = _lib.tgeo_split_each_n_stboxes(temp_converted, elem_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tgeo_split_n_stboxes( - temp: Annotated[_ffi.CData, "const Temporal *"], box_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "STBox *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], box_count: int +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tgeo_split_n_stboxes(temp_converted, box_count, count_converted) + count = _ffi.new("int *") + result = _lib.tgeo_split_n_stboxes(temp_converted, box_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def adjacent_stbox_tspatial( @@ -15150,16 +15370,13 @@ def stbox_space_tiles( zsize: float, sorigin: Annotated[_ffi.CData, "const GSERIALIZED *"], border_inc: bool, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "STBox *"]: +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: bounds_converted = _ffi.cast("const STBox *", bounds) sorigin_converted = _ffi.cast("const GSERIALIZED *", sorigin) - count_converted = _ffi.cast("int *", count) - result = _lib.stbox_space_tiles( - bounds_converted, xsize, ysize, zsize, sorigin_converted, border_inc, count_converted - ) + count = _ffi.new("int *") + result = _lib.stbox_space_tiles(bounds_converted, xsize, ysize, zsize, sorigin_converted, border_inc, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def stbox_space_time_tiles( @@ -15197,15 +15414,14 @@ def stbox_time_tiles( duration: Annotated[_ffi.CData, "const Interval *"], torigin: int, border_inc: bool, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "STBox *"]: +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: bounds_converted = _ffi.cast("const STBox *", bounds) duration_converted = _ffi.cast("const Interval *", duration) torigin_converted = _ffi.cast("TimestampTz", torigin) - count_converted = _ffi.cast("int *", count) - result = _lib.stbox_time_tiles(bounds_converted, duration_converted, torigin_converted, border_inc, count_converted) + count = _ffi.new("int *") + result = _lib.stbox_time_tiles(bounds_converted, duration_converted, torigin_converted, border_inc, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tgeo_space_split( @@ -15287,39 +15503,35 @@ def geo_cluster_dbscan( ngeoms: Annotated[_ffi.CData, "uint32_t"], tolerance: float, minpoints: int, -) -> Annotated[_ffi.CData, "uint32_t *"]: +) -> tuple[Annotated[_ffi.CData, "uint32_t *"], Annotated[_ffi.CData, "int"]]: geoms_converted = [_ffi.cast("const GSERIALIZED *", x) for x in geoms] ngeoms_converted = _ffi.cast("uint32_t", ngeoms) - result = _lib.geo_cluster_dbscan(geoms_converted, ngeoms_converted, tolerance, minpoints) + count = _ffi.new("int *") + result = _lib.geo_cluster_dbscan(geoms_converted, ngeoms_converted, tolerance, minpoints, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def geo_cluster_intersecting( - geoms: Annotated[list, "const GSERIALIZED **"], - ngeoms: Annotated[_ffi.CData, "uint32_t"], - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "GSERIALIZED **"]: + geoms: Annotated[list, "const GSERIALIZED **"], ngeoms: Annotated[_ffi.CData, "uint32_t"] +) -> tuple[Annotated[_ffi.CData, "GSERIALIZED **"], Annotated[_ffi.CData, "int"]]: geoms_converted = [_ffi.cast("const GSERIALIZED *", x) for x in geoms] ngeoms_converted = _ffi.cast("uint32_t", ngeoms) - count_converted = _ffi.cast("int *", count) - result = _lib.geo_cluster_intersecting(geoms_converted, ngeoms_converted, count_converted) + count = _ffi.new("int *") + result = _lib.geo_cluster_intersecting(geoms_converted, ngeoms_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def geo_cluster_within( - geoms: Annotated[list, "const GSERIALIZED **"], - ngeoms: Annotated[_ffi.CData, "uint32_t"], - tolerance: float, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "GSERIALIZED **"]: + geoms: Annotated[list, "const GSERIALIZED **"], ngeoms: Annotated[_ffi.CData, "uint32_t"], tolerance: float +) -> tuple[Annotated[_ffi.CData, "GSERIALIZED **"], Annotated[_ffi.CData, "int"]]: geoms_converted = [_ffi.cast("const GSERIALIZED *", x) for x in geoms] ngeoms_converted = _ffi.cast("uint32_t", ngeoms) - count_converted = _ffi.cast("int *", count) - result = _lib.geo_cluster_within(geoms_converted, ngeoms_converted, tolerance, count_converted) + count = _ffi.new("int *") + result = _lib.geo_cluster_within(geoms_converted, ngeoms_converted, tolerance, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def gsl_get_generation_rng() -> Annotated[_ffi.CData, "gsl_rng *"]: @@ -15742,6 +15954,16 @@ def numset_shift_scale( return result if result != _ffi.NULL else None +def numspan_expand( + s: Annotated[_ffi.CData, "const Span *"], value: Annotated[_ffi.CData, "Datum"] +) -> Annotated[_ffi.CData, "Span *"]: + s_converted = _ffi.cast("const Span *", s) + value_converted = _ffi.cast("Datum", value) + result = _lib.numspan_expand(s_converted, value_converted) + _check_error() + return result if result != _ffi.NULL else None + + def numspan_shift_scale( s: Annotated[_ffi.CData, "const Span *"], shift: Annotated[_ffi.CData, "Datum"], @@ -15808,12 +16030,12 @@ def tbox_expand_value( return result if result != _ffi.NULL else None -def textcat_textset_text_int( +def textcat_textset_text_common( s: Annotated[_ffi.CData, "const Set *"], txt: str, invert: bool ) -> Annotated[_ffi.CData, "Set *"]: s_converted = _ffi.cast("const Set *", s) txt_converted = cstring2text(txt) - result = _lib.textcat_textset_text_int(s_converted, txt_converted, invert) + result = _lib.textcat_textset_text_common(s_converted, txt_converted, invert) _check_error() return result if result != _ffi.NULL else None @@ -16177,6 +16399,53 @@ def right_spanset_value( return result if result != _ffi.NULL else None +def bbox_type(bboxtype: Annotated[_ffi.CData, "meosType"]) -> Annotated[bool, "bool"]: + bboxtype_converted = _ffi.cast("meosType", bboxtype) + result = _lib.bbox_type(bboxtype_converted) + _check_error() + return result if result != _ffi.NULL else None + + +def bbox_get_size(bboxtype: Annotated[_ffi.CData, "meosType"]) -> Annotated[_ffi.CData, "size_t"]: + bboxtype_converted = _ffi.cast("meosType", bboxtype) + result = _lib.bbox_get_size(bboxtype_converted) + _check_error() + return result if result != _ffi.NULL else None + + +def bbox_max_dims(bboxtype: Annotated[_ffi.CData, "meosType"]) -> Annotated[int, "int"]: + bboxtype_converted = _ffi.cast("meosType", bboxtype) + result = _lib.bbox_max_dims(bboxtype_converted) + _check_error() + return result if result != _ffi.NULL else None + + +def temporal_bbox_eq( + box1: Annotated[_ffi.CData, "const void *"], + box2: Annotated[_ffi.CData, "const void *"], + temptype: Annotated[_ffi.CData, "meosType"], +) -> Annotated[bool, "bool"]: + box1_converted = _ffi.cast("const void *", box1) + box2_converted = _ffi.cast("const void *", box2) + temptype_converted = _ffi.cast("meosType", temptype) + result = _lib.temporal_bbox_eq(box1_converted, box2_converted, temptype_converted) + _check_error() + return result if result != _ffi.NULL else None + + +def temporal_bbox_cmp( + box1: Annotated[_ffi.CData, "const void *"], + box2: Annotated[_ffi.CData, "const void *"], + temptype: Annotated[_ffi.CData, "meosType"], +) -> Annotated[int, "int"]: + box1_converted = _ffi.cast("const void *", box1) + box2_converted = _ffi.cast("const void *", box2) + temptype_converted = _ffi.cast("meosType", temptype) + result = _lib.temporal_bbox_cmp(box1_converted, box2_converted, temptype_converted) + _check_error() + return result if result != _ffi.NULL else None + + def bbox_union_span_span( s1: Annotated[_ffi.CData, "const Span *"], s2: Annotated[_ffi.CData, "const Span *"] ) -> Annotated[_ffi.CData, "Span *"]: @@ -16694,10 +16963,8 @@ def temporal_out(temp: Annotated[_ffi.CData, "const Temporal *"], maxdd: int) -> return result if result != _ffi.NULL else None -def temparr_out( - temparr: Annotated[list, "const Temporal **"], count: int, maxdd: int -) -> Annotated[_ffi.CData, "char **"]: - temparr_converted = [_ffi.cast("const Temporal *", x) for x in temparr] +def temparr_out(temparr: Annotated[list, "Temporal **"], count: int, maxdd: int) -> Annotated[_ffi.CData, "char **"]: + temparr_converted = [_ffi.cast("Temporal *", x) for x in temparr] result = _lib.temparr_out(temparr_converted, count, maxdd) _check_error() return result if result != _ffi.NULL else None @@ -16918,7 +17185,7 @@ def tsequence_from_base_tstzspan( def tsequence_make_exp( - instants: Annotated[list, "const TInstant **"], + instants: Annotated[list, "TInstant **"], count: int, maxcount: int, lower_inc: bool, @@ -16926,7 +17193,7 @@ def tsequence_make_exp( interp: InterpolationType, normalize: bool, ) -> Annotated[_ffi.CData, "TSequence *"]: - instants_converted = [_ffi.cast("const TInstant *", x) for x in instants] + instants_converted = [_ffi.cast("TInstant *", x) for x in instants] result = _lib.tsequence_make_exp(instants_converted, count, maxcount, lower_inc, upper_inc, interp, normalize) _check_error() return result if result != _ffi.NULL else None @@ -16990,9 +17257,9 @@ def tsequenceset_from_base_tstzspanset( def tsequenceset_make_exp( - sequences: Annotated[list, "const TSequence **"], count: int, maxcount: int, normalize: bool + sequences: Annotated[list, "TSequence **"], count: int, maxcount: int, normalize: bool ) -> Annotated[_ffi.CData, "TSequenceSet *"]: - sequences_converted = [_ffi.cast("const TSequence *", x) for x in sequences] + sequences_converted = [_ffi.cast("TSequence *", x) for x in sequences] result = _lib.tsequenceset_make_exp(sequences_converted, count, maxcount, normalize) _check_error() return result if result != _ffi.NULL else None @@ -17102,12 +17369,19 @@ def temporal_inst_n( return result if result != _ffi.NULL else None -def temporal_instants_p( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "const TInstant **"]: +def temporal_insts_p( + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "const TInstant **"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_instants_p(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_insts_p(temp_converted, count) + _check_error() + return result if result != _ffi.NULL else None, count[0] + + +def temporal_max_inst_p(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[_ffi.CData, "const TInstant *"]: + temp_converted = _ffi.cast("const Temporal *", temp) + result = _lib.temporal_max_inst_p(temp_converted) _check_error() return result if result != _ffi.NULL else None @@ -17126,6 +17400,13 @@ def temporal_mem_size(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annota return result if result != _ffi.NULL else None +def temporal_min_inst_p(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[_ffi.CData, "const TInstant *"]: + temp_converted = _ffi.cast("const Temporal *", temp) + result = _lib.temporal_min_inst_p(temp_converted) + _check_error() + return result if result != _ffi.NULL else None + + def temporal_min_value(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[_ffi.CData, "Datum"]: temp_converted = _ffi.cast("const Temporal *", temp) result = _lib.temporal_min_value(temp_converted) @@ -17134,13 +17415,13 @@ def temporal_min_value(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annot def temporal_sequences_p( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "const TSequence **"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "const TSequence **"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_sequences_p(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_sequences_p(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_set_bbox( @@ -17167,13 +17448,13 @@ def temporal_start_value(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Ann def temporal_values_p( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Datum *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "Datum *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_values_p(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_values_p(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_value_n(temp: Annotated[_ffi.CData, "const Temporal *"], n: int) -> Annotated[_ffi.CData, "Datum *"]: @@ -17187,13 +17468,13 @@ def temporal_value_n(temp: Annotated[_ffi.CData, "const Temporal *"], n: int) -> def temporal_values( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Datum *"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "Datum *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.temporal_values(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.temporal_values(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tinstant_hash(inst: Annotated[_ffi.CData, "const TInstant *"]) -> Annotated[int, "uint32"]: @@ -17204,13 +17485,13 @@ def tinstant_hash(inst: Annotated[_ffi.CData, "const TInstant *"]) -> Annotated[ def tinstant_insts( - inst: Annotated[_ffi.CData, "const TInstant *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "const TInstant **"]: + inst: Annotated[_ffi.CData, "const TInstant *"], +) -> tuple[Annotated[_ffi.CData, "const TInstant **"], Annotated[_ffi.CData, "int"]]: inst_converted = _ffi.cast("const TInstant *", inst) - count_converted = _ffi.cast("int *", count) - result = _lib.tinstant_insts(inst_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tinstant_insts(inst_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tinstant_set_bbox( @@ -17230,13 +17511,13 @@ def tinstant_time(inst: Annotated[_ffi.CData, "const TInstant *"]) -> Annotated[ def tinstant_timestamps( - inst: Annotated[_ffi.CData, "const TInstant *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[int, "TimestampTz *"]: + inst: Annotated[_ffi.CData, "const TInstant *"], +) -> tuple[Annotated[int, "TimestampTz *"], Annotated[_ffi.CData, "int"]]: inst_converted = _ffi.cast("const TInstant *", inst) - count_converted = _ffi.cast("int *", count) - result = _lib.tinstant_timestamps(inst_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tinstant_timestamps(inst_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tinstant_value_p(inst: Annotated[_ffi.CData, "const TInstant *"]) -> Annotated[_ffi.CData, "Datum"]: @@ -17267,13 +17548,13 @@ def tinstant_value_at_timestamptz( def tinstant_values_p( - inst: Annotated[_ffi.CData, "const TInstant *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Datum *"]: + inst: Annotated[_ffi.CData, "const TInstant *"], +) -> tuple[Annotated[_ffi.CData, "Datum *"], Annotated[_ffi.CData, "int"]]: inst_converted = _ffi.cast("const TInstant *", inst) - count_converted = _ffi.cast("int *", count) - result = _lib.tinstant_values_p(inst_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tinstant_values_p(inst_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tnumber_set_span( @@ -17292,6 +17573,13 @@ def tnumberinst_valuespans(inst: Annotated[_ffi.CData, "const TInstant *"]) -> A return result if result != _ffi.NULL else None +def tnumberseq_avg_val(seq: Annotated[_ffi.CData, "const TSequence *"]) -> Annotated[float, "double"]: + seq_converted = _ffi.cast("const TSequence *", seq) + result = _lib.tnumberseq_avg_val(seq_converted) + _check_error() + return result if result != _ffi.NULL else None + + def tnumberseq_valuespans(seq: Annotated[_ffi.CData, "const TSequence *"]) -> Annotated[_ffi.CData, "SpanSet *"]: seq_converted = _ffi.cast("const TSequence *", seq) result = _lib.tnumberseq_valuespans(seq_converted) @@ -17299,6 +17587,13 @@ def tnumberseq_valuespans(seq: Annotated[_ffi.CData, "const TSequence *"]) -> An return result if result != _ffi.NULL else None +def tnumberseqset_avg_val(ss: Annotated[_ffi.CData, "const TSequenceSet *"]) -> Annotated[float, "double"]: + ss_converted = _ffi.cast("const TSequenceSet *", ss) + result = _lib.tnumberseqset_avg_val(ss_converted) + _check_error() + return result if result != _ffi.NULL else None + + def tnumberseqset_valuespans(ss: Annotated[_ffi.CData, "const TSequenceSet *"]) -> Annotated[_ffi.CData, "SpanSet *"]: ss_converted = _ffi.cast("const TSequenceSet *", ss) result = _lib.tnumberseqset_valuespans(ss_converted) @@ -17334,9 +17629,9 @@ def tsequence_insts_p(seq: Annotated[_ffi.CData, "const TSequence *"]) -> Annota return result if result != _ffi.NULL else None -def tsequence_max_inst(seq: Annotated[_ffi.CData, "const TSequence *"]) -> Annotated[_ffi.CData, "const TInstant *"]: +def tsequence_max_inst_p(seq: Annotated[_ffi.CData, "const TSequence *"]) -> Annotated[_ffi.CData, "const TInstant *"]: seq_converted = _ffi.cast("const TSequence *", seq) - result = _lib.tsequence_max_inst(seq_converted) + result = _lib.tsequence_max_inst_p(seq_converted) _check_error() return result if result != _ffi.NULL else None @@ -17348,9 +17643,9 @@ def tsequence_max_val(seq: Annotated[_ffi.CData, "const TSequence *"]) -> Annota return result if result != _ffi.NULL else None -def tsequence_min_inst(seq: Annotated[_ffi.CData, "const TSequence *"]) -> Annotated[_ffi.CData, "const TInstant *"]: +def tsequence_min_inst_p(seq: Annotated[_ffi.CData, "const TSequence *"]) -> Annotated[_ffi.CData, "const TInstant *"]: seq_converted = _ffi.cast("const TSequence *", seq) - result = _lib.tsequence_min_inst(seq_converted) + result = _lib.tsequence_min_inst_p(seq_converted) _check_error() return result if result != _ffi.NULL else None @@ -17363,23 +17658,23 @@ def tsequence_min_val(seq: Annotated[_ffi.CData, "const TSequence *"]) -> Annota def tsequence_segments( - seq: Annotated[_ffi.CData, "const TSequence *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TSequence **"]: + seq: Annotated[_ffi.CData, "const TSequence *"], +) -> tuple[Annotated[_ffi.CData, "TSequence **"], Annotated[_ffi.CData, "int"]]: seq_converted = _ffi.cast("const TSequence *", seq) - count_converted = _ffi.cast("int *", count) - result = _lib.tsequence_segments(seq_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tsequence_segments(seq_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tsequence_seqs( - seq: Annotated[_ffi.CData, "const TSequence *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "const TSequence **"]: + seq: Annotated[_ffi.CData, "const TSequence *"], +) -> tuple[Annotated[_ffi.CData, "const TSequence **"], Annotated[_ffi.CData, "int"]]: seq_converted = _ffi.cast("const TSequence *", seq) - count_converted = _ffi.cast("int *", count) - result = _lib.tsequence_seqs(seq_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tsequence_seqs(seq_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tsequence_start_timestamptz(seq: Annotated[_ffi.CData, "const TSequence *"]) -> Annotated[int, "TimestampTz"]: @@ -17397,13 +17692,13 @@ def tsequence_time(seq: Annotated[_ffi.CData, "const TSequence *"]) -> Annotated def tsequence_timestamps( - seq: Annotated[_ffi.CData, "const TSequence *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[int, "TimestampTz *"]: + seq: Annotated[_ffi.CData, "const TSequence *"], +) -> tuple[Annotated[int, "TimestampTz *"], Annotated[_ffi.CData, "int"]]: seq_converted = _ffi.cast("const TSequence *", seq) - count_converted = _ffi.cast("int *", count) - result = _lib.tsequence_timestamps(seq_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tsequence_timestamps(seq_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tsequence_value_at_timestamptz( @@ -17420,13 +17715,13 @@ def tsequence_value_at_timestamptz( def tsequence_values_p( - seq: Annotated[_ffi.CData, "const TSequence *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Datum *"]: + seq: Annotated[_ffi.CData, "const TSequence *"], +) -> tuple[Annotated[_ffi.CData, "Datum *"], Annotated[_ffi.CData, "int"]]: seq_converted = _ffi.cast("const TSequence *", seq) - count_converted = _ffi.cast("int *", count) - result = _lib.tsequence_values_p(seq_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tsequence_values_p(seq_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tsequenceset_duration( @@ -17470,11 +17765,11 @@ def tsequenceset_insts_p( return result if result != _ffi.NULL else None -def tsequenceset_max_inst( +def tsequenceset_max_inst_p( ss: Annotated[_ffi.CData, "const TSequenceSet *"], ) -> Annotated[_ffi.CData, "const TInstant *"]: ss_converted = _ffi.cast("const TSequenceSet *", ss) - result = _lib.tsequenceset_max_inst(ss_converted) + result = _lib.tsequenceset_max_inst_p(ss_converted) _check_error() return result if result != _ffi.NULL else None @@ -17486,11 +17781,11 @@ def tsequenceset_max_val(ss: Annotated[_ffi.CData, "const TSequenceSet *"]) -> A return result if result != _ffi.NULL else None -def tsequenceset_min_inst( +def tsequenceset_min_inst_p( ss: Annotated[_ffi.CData, "const TSequenceSet *"], ) -> Annotated[_ffi.CData, "const TInstant *"]: ss_converted = _ffi.cast("const TSequenceSet *", ss) - result = _lib.tsequenceset_min_inst(ss_converted) + result = _lib.tsequenceset_min_inst_p(ss_converted) _check_error() return result if result != _ffi.NULL else None @@ -17517,13 +17812,13 @@ def tsequenceset_num_timestamps(ss: Annotated[_ffi.CData, "const TSequenceSet *" def tsequenceset_segments( - ss: Annotated[_ffi.CData, "const TSequenceSet *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TSequence **"]: + ss: Annotated[_ffi.CData, "const TSequenceSet *"], +) -> tuple[Annotated[_ffi.CData, "TSequence **"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const TSequenceSet *", ss) - count_converted = _ffi.cast("int *", count) - result = _lib.tsequenceset_segments(ss_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tsequenceset_segments(ss_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tsequenceset_sequences_p( @@ -17560,13 +17855,13 @@ def tsequenceset_timestamptz_n(ss: Annotated[_ffi.CData, "const TSequenceSet *"] def tsequenceset_timestamps( - ss: Annotated[_ffi.CData, "const TSequenceSet *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[int, "TimestampTz *"]: + ss: Annotated[_ffi.CData, "const TSequenceSet *"], +) -> tuple[Annotated[int, "TimestampTz *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const TSequenceSet *", ss) - count_converted = _ffi.cast("int *", count) - result = _lib.tsequenceset_timestamps(ss_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tsequenceset_timestamps(ss_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tsequenceset_value_at_timestamptz( @@ -17593,13 +17888,13 @@ def tsequenceset_value_n(ss: Annotated[_ffi.CData, "const TSequenceSet *"], n: i def tsequenceset_values_p( - ss: Annotated[_ffi.CData, "const TSequenceSet *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Datum *"]: + ss: Annotated[_ffi.CData, "const TSequenceSet *"], +) -> tuple[Annotated[_ffi.CData, "Datum *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const TSequenceSet *", ss) - count_converted = _ffi.cast("int *", count) - result = _lib.tsequenceset_values_p(ss_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tsequenceset_values_p(ss_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def temporal_restart(temp: Annotated[_ffi.CData, "Temporal *"], count: int) -> Annotated[None, "void"]: @@ -17866,10 +18161,8 @@ def tinstant_merge( return result if result != _ffi.NULL else None -def tinstant_merge_array( - instants: Annotated[list, "const TInstant **"], count: int -) -> Annotated[_ffi.CData, "Temporal *"]: - instants_converted = [_ffi.cast("const TInstant *", x) for x in instants] +def tinstant_merge_array(instants: Annotated[list, "TInstant **"], count: int) -> Annotated[_ffi.CData, "Temporal *"]: + instants_converted = [_ffi.cast("TInstant *", x) for x in instants] result = _lib.tinstant_merge_array(instants_converted, count) _check_error() return result if result != _ffi.NULL else None @@ -17961,9 +18254,9 @@ def tsequence_merge( def tsequence_merge_array( - sequences: Annotated[list, "const TSequence **"], count: int + sequences: Annotated[list, "TSequence **"], count: int ) -> Annotated[_ffi.CData, "Temporal *"]: - sequences_converted = [_ffi.cast("const TSequence *", x) for x in sequences] + sequences_converted = [_ffi.cast("TSequence *", x) for x in sequences] result = _lib.tsequence_merge_array(sequences_converted, count) _check_error() return result if result != _ffi.NULL else None @@ -18055,9 +18348,9 @@ def tsequenceset_merge( def tsequenceset_merge_array( - seqsets: Annotated[list, "const TSequenceSet **"], count: int + seqsets: Annotated[list, "TSequenceSet **"], count: int ) -> Annotated[_ffi.CData, "TSequenceSet *"]: - seqsets_converted = [_ffi.cast("const TSequenceSet *", x) for x in seqsets] + seqsets_converted = [_ffi.cast("TSequenceSet *", x) for x in seqsets] result = _lib.tsequenceset_merge_array(seqsets_converted, count) _check_error() return result if result != _ffi.NULL else None @@ -18099,11 +18392,22 @@ def tsequenceset_set_bbox( _check_error() -def tdiscseq_restrict_minmax( - seq: Annotated[_ffi.CData, "const TSequence *"], min: bool, atfunc: bool +def tcontseq_after_timestamptz( + seq: Annotated[_ffi.CData, "const TSequence *"], t: int, strict: bool ) -> Annotated[_ffi.CData, "TSequence *"]: seq_converted = _ffi.cast("const TSequence *", seq) - result = _lib.tdiscseq_restrict_minmax(seq_converted, min, atfunc) + t_converted = _ffi.cast("TimestampTz", t) + result = _lib.tcontseq_after_timestamptz(seq_converted, t_converted, strict) + _check_error() + return result if result != _ffi.NULL else None + + +def tcontseq_before_timestamptz( + seq: Annotated[_ffi.CData, "const TSequence *"], t: int, strict: bool +) -> Annotated[_ffi.CData, "TSequence *"]: + seq_converted = _ffi.cast("const TSequence *", seq) + t_converted = _ffi.cast("TimestampTz", t) + result = _lib.tcontseq_before_timestamptz(seq_converted, t_converted, strict) _check_error() return result if result != _ffi.NULL else None @@ -18117,6 +18421,35 @@ def tcontseq_restrict_minmax( return result if result != _ffi.NULL else None +def tdiscseq_after_timestamptz( + seq: Annotated[_ffi.CData, "const TSequence *"], t: int, strict: bool +) -> Annotated[_ffi.CData, "TSequence *"]: + seq_converted = _ffi.cast("const TSequence *", seq) + t_converted = _ffi.cast("TimestampTz", t) + result = _lib.tdiscseq_after_timestamptz(seq_converted, t_converted, strict) + _check_error() + return result if result != _ffi.NULL else None + + +def tdiscseq_before_timestamptz( + seq: Annotated[_ffi.CData, "const TSequence *"], t: int, strict: bool +) -> Annotated[_ffi.CData, "TSequence *"]: + seq_converted = _ffi.cast("const TSequence *", seq) + t_converted = _ffi.cast("TimestampTz", t) + result = _lib.tdiscseq_before_timestamptz(seq_converted, t_converted, strict) + _check_error() + return result if result != _ffi.NULL else None + + +def tdiscseq_restrict_minmax( + seq: Annotated[_ffi.CData, "const TSequence *"], min: bool, atfunc: bool +) -> Annotated[_ffi.CData, "TSequence *"]: + seq_converted = _ffi.cast("const TSequence *", seq) + result = _lib.tdiscseq_restrict_minmax(seq_converted, min, atfunc) + _check_error() + return result if result != _ffi.NULL else None + + def temporal_bbox_restrict_set( temp: Annotated[_ffi.CData, "const Temporal *"], set: Annotated[_ffi.CData, "const Set *"] ) -> Annotated[bool, "bool"]: @@ -18209,6 +18542,26 @@ def temporal_value_at_timestamptz( return None +def tinstant_after_timestamptz( + inst: Annotated[_ffi.CData, "const TInstant *"], t: int, strict: bool +) -> Annotated[_ffi.CData, "TInstant *"]: + inst_converted = _ffi.cast("const TInstant *", inst) + t_converted = _ffi.cast("TimestampTz", t) + result = _lib.tinstant_after_timestamptz(inst_converted, t_converted, strict) + _check_error() + return result if result != _ffi.NULL else None + + +def tinstant_before_timestamptz( + inst: Annotated[_ffi.CData, "const TInstant *"], t: int, strict: bool +) -> Annotated[_ffi.CData, "TInstant *"]: + inst_converted = _ffi.cast("const TInstant *", inst) + t_converted = _ffi.cast("TimestampTz", t) + result = _lib.tinstant_before_timestamptz(inst_converted, t_converted, strict) + _check_error() + return result if result != _ffi.NULL else None + + def tinstant_restrict_tstzspan( inst: Annotated[_ffi.CData, "const TInstant *"], period: Annotated[_ffi.CData, "const Span *"], atfunc: bool ) -> Annotated[_ffi.CData, "TInstant *"]: @@ -18359,6 +18712,26 @@ def tsequence_restrict_tstzspanset( return result if result != _ffi.NULL else None +def tsequenceset_after_timestamptz( + ss: Annotated[_ffi.CData, "const TSequenceSet *"], t: int, strict: bool +) -> Annotated[_ffi.CData, "TSequenceSet *"]: + ss_converted = _ffi.cast("const TSequenceSet *", ss) + t_converted = _ffi.cast("TimestampTz", t) + result = _lib.tsequenceset_after_timestamptz(ss_converted, t_converted, strict) + _check_error() + return result if result != _ffi.NULL else None + + +def tsequenceset_before_timestamptz( + ss: Annotated[_ffi.CData, "const TSequenceSet *"], t: int, strict: bool +) -> Annotated[_ffi.CData, "TSequenceSet *"]: + ss_converted = _ffi.cast("const TSequenceSet *", ss) + t_converted = _ffi.cast("TimestampTz", t) + result = _lib.tsequenceset_before_timestamptz(ss_converted, t_converted, strict) + _check_error() + return result if result != _ffi.NULL else None + + def tsequenceset_restrict_minmax( ss: Annotated[_ffi.CData, "const TSequenceSet *"], min: bool, atfunc: bool ) -> Annotated[_ffi.CData, "TSequenceSet *"]: @@ -18882,12 +19255,82 @@ def tsequenceset_compact(ss: Annotated[_ffi.CData, "const TSequenceSet *"]) -> A return result if result != _ffi.NULL else None +def temporal_skiplist_make() -> Annotated[_ffi.CData, "SkipList *"]: + result = _lib.temporal_skiplist_make() + _check_error() + return result if result != _ffi.NULL else None + + +def skiplist_search( + list: Annotated[_ffi.CData, "SkipList *"], + key: Annotated[_ffi.CData, "void *"], + value: Annotated[_ffi.CData, "void *"], +) -> Annotated[int, "int"]: + list_converted = _ffi.cast("SkipList *", list) + key_converted = _ffi.cast("void *", key) + value_converted = _ffi.cast("void *", value) + result = _lib.skiplist_search(list_converted, key_converted, value_converted) + _check_error() + return result if result != _ffi.NULL else None + + def skiplist_free(list: Annotated[_ffi.CData, "SkipList *"]) -> Annotated[None, "void"]: list_converted = _ffi.cast("SkipList *", list) _lib.skiplist_free(list_converted) _check_error() +def skiplist_splice( + list: Annotated[_ffi.CData, "SkipList *"], + keys: Annotated[list, "void **"], + values: Annotated[list, "void **"], + count: int, + func: Annotated[_ffi.CData, "datum_func2"], + crossings: bool, + sktype: Annotated[_ffi.CData, "SkipListType"], +) -> Annotated[None, "void"]: + list_converted = _ffi.cast("SkipList *", list) + keys_converted = [_ffi.cast("void *", x) for x in keys] + values_converted = [_ffi.cast("void *", x) for x in values] + func_converted = _ffi.cast("datum_func2", func) + sktype_converted = _ffi.cast("SkipListType", sktype) + _lib.skiplist_splice( + list_converted, keys_converted, values_converted, count, func_converted, crossings, sktype_converted + ) + _check_error() + + +def temporal_skiplist_splice( + list: Annotated[_ffi.CData, "SkipList *"], + values: Annotated[list, "void **"], + count: int, + func: Annotated[_ffi.CData, "datum_func2"], + crossings: bool, +) -> Annotated[None, "void"]: + list_converted = _ffi.cast("SkipList *", list) + values_converted = [_ffi.cast("void *", x) for x in values] + func_converted = _ffi.cast("datum_func2", func) + _lib.temporal_skiplist_splice(list_converted, values_converted, count, func_converted, crossings) + _check_error() + + +def skiplist_values(list: Annotated[_ffi.CData, "SkipList *"]) -> Annotated[_ffi.CData, "void **"]: + list_converted = _ffi.cast("SkipList *", list) + result = _lib.skiplist_values(list_converted) + _check_error() + return result if result != _ffi.NULL else None + + +def skiplist_keys_values( + list: Annotated[_ffi.CData, "SkipList *"], values: Annotated[list, "void **"] +) -> Annotated[_ffi.CData, "void **"]: + list_converted = _ffi.cast("SkipList *", list) + values_converted = [_ffi.cast("void *", x) for x in values] + result = _lib.skiplist_keys_values(list_converted, values_converted) + _check_error() + return result if result != _ffi.NULL else None + + def temporal_app_tinst_transfn( state: Annotated[_ffi.CData, "Temporal *"], inst: Annotated[_ffi.CData, "const TInstant *"], @@ -18917,45 +19360,42 @@ def span_bins( s: Annotated[_ffi.CData, "const Span *"], size: Annotated[_ffi.CData, "Datum"], origin: Annotated[_ffi.CData, "Datum"], - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Span *"]: +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: s_converted = _ffi.cast("const Span *", s) size_converted = _ffi.cast("Datum", size) origin_converted = _ffi.cast("Datum", origin) - count_converted = _ffi.cast("int *", count) - result = _lib.span_bins(s_converted, size_converted, origin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.span_bins(s_converted, size_converted, origin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def spanset_bins( ss: Annotated[_ffi.CData, "const SpanSet *"], size: Annotated[_ffi.CData, "Datum"], origin: Annotated[_ffi.CData, "Datum"], - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Span *"]: +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const SpanSet *", ss) size_converted = _ffi.cast("Datum", size) origin_converted = _ffi.cast("Datum", origin) - count_converted = _ffi.cast("int *", count) - result = _lib.spanset_bins(ss_converted, size_converted, origin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.spanset_bins(ss_converted, size_converted, origin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tnumber_value_bins( temp: Annotated[_ffi.CData, "const Temporal *"], size: Annotated[_ffi.CData, "Datum"], origin: Annotated[_ffi.CData, "Datum"], - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Span *"]: +) -> tuple[Annotated[_ffi.CData, "Span *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) size_converted = _ffi.cast("Datum", size) origin_converted = _ffi.cast("Datum", origin) - count_converted = _ffi.cast("int *", count) - result = _lib.tnumber_value_bins(temp_converted, size_converted, origin_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tnumber_value_bins(temp_converted, size_converted, origin_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tnumber_value_time_boxes( @@ -18964,19 +19404,18 @@ def tnumber_value_time_boxes( duration: Annotated[_ffi.CData, "const Interval *"], vorigin: Annotated[_ffi.CData, "Datum"], torigin: int, - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "TBox *"]: +) -> tuple[Annotated[_ffi.CData, "TBox *"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) vsize_converted = _ffi.cast("Datum", vsize) duration_converted = _ffi.cast("const Interval *", duration) vorigin_converted = _ffi.cast("Datum", vorigin) torigin_converted = _ffi.cast("TimestampTz", torigin) - count_converted = _ffi.cast("int *", count) + count = _ffi.new("int *") result = _lib.tnumber_value_time_boxes( - temp_converted, vsize_converted, duration_converted, vorigin_converted, torigin_converted, count_converted + temp_converted, vsize_converted, duration_converted, vorigin_converted, torigin_converted, count ) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tnumber_value_split( @@ -18984,18 +19423,15 @@ def tnumber_value_split( vsize: Annotated[_ffi.CData, "Datum"], vorigin: Annotated[_ffi.CData, "Datum"], bins: Annotated[list, "Datum **"], - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Temporal **"]: +) -> tuple[Annotated[_ffi.CData, "Temporal **"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) vsize_converted = _ffi.cast("Datum", vsize) vorigin_converted = _ffi.cast("Datum", vorigin) bins_converted = [_ffi.cast("Datum *", x) for x in bins] - count_converted = _ffi.cast("int *", count) - result = _lib.tnumber_value_split( - temp_converted, vsize_converted, vorigin_converted, bins_converted, count_converted - ) + count = _ffi.new("int *") + result = _lib.tnumber_value_split(temp_converted, vsize_converted, vorigin_converted, bins_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tbox_get_value_time_tile( @@ -19038,8 +19474,7 @@ def tnumber_value_time_split( torigin: int, value_bins: Annotated[list, "Datum **"], time_bins: Annotated[list, "TimestampTz **"], - count: Annotated[_ffi.CData, "int *"], -) -> Annotated[_ffi.CData, "Temporal **"]: +) -> tuple[Annotated[_ffi.CData, "Temporal **"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) size_converted = _ffi.cast("Datum", size) duration_converted = _ffi.cast("const Interval *", duration) @@ -19047,7 +19482,7 @@ def tnumber_value_time_split( torigin_converted = _ffi.cast("TimestampTz", torigin) value_bins_converted = [_ffi.cast("Datum *", x) for x in value_bins] time_bins_converted = [_ffi.cast("TimestampTz *", x) for x in time_bins] - count_converted = _ffi.cast("int *", count) + count = _ffi.new("int *") result = _lib.tnumber_value_time_split( temp_converted, size_converted, @@ -19056,10 +19491,10 @@ def tnumber_value_time_split( torigin_converted, value_bins_converted, time_bins_converted, - count_converted, + count, ) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def proj_get_context() -> Annotated[_ffi.CData, "PJ_CONTEXT *"]: @@ -19530,23 +19965,23 @@ def tpointseq_linear_trajectory( def tgeoseq_stboxes( - seq: Annotated[_ffi.CData, "const TSequence *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "STBox *"]: + seq: Annotated[_ffi.CData, "const TSequence *"], +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: seq_converted = _ffi.cast("const TSequence *", seq) - count_converted = _ffi.cast("int *", count) - result = _lib.tgeoseq_stboxes(seq_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tgeoseq_stboxes(seq_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tgeoseq_split_n_stboxes( - seq: Annotated[_ffi.CData, "const TSequence *"], max_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "STBox *"]: + seq: Annotated[_ffi.CData, "const TSequence *"], max_count: int +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: seq_converted = _ffi.cast("const TSequence *", seq) - count_converted = _ffi.cast("int *", count) - result = _lib.tgeoseq_split_n_stboxes(seq_converted, max_count, count_converted) + count = _ffi.new("int *") + result = _lib.tgeoseq_split_n_stboxes(seq_converted, max_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tpointseqset_azimuth(ss: Annotated[_ffi.CData, "const TSequenceSet *"]) -> Annotated[_ffi.CData, "TSequenceSet *"]: @@ -19580,23 +20015,23 @@ def tpointseqset_length(ss: Annotated[_ffi.CData, "const TSequenceSet *"]) -> An def tgeoseqset_stboxes( - ss: Annotated[_ffi.CData, "const TSequenceSet *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "STBox *"]: + ss: Annotated[_ffi.CData, "const TSequenceSet *"], +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const TSequenceSet *", ss) - count_converted = _ffi.cast("int *", count) - result = _lib.tgeoseqset_stboxes(ss_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tgeoseqset_stboxes(ss_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tgeoseqset_split_n_stboxes( - ss: Annotated[_ffi.CData, "const TSequenceSet *"], max_count: int, count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "STBox *"]: + ss: Annotated[_ffi.CData, "const TSequenceSet *"], max_count: int +) -> tuple[Annotated[_ffi.CData, "STBox *"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const TSequenceSet *", ss) - count_converted = _ffi.cast("int *", count) - result = _lib.tgeoseqset_split_n_stboxes(ss_converted, max_count, count_converted) + count = _ffi.new("int *") + result = _lib.tgeoseqset_split_n_stboxes(ss_converted, max_count, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tpoint_get_coord( @@ -19659,13 +20094,13 @@ def tspatialinst_set_srid( def tpointseq_make_simple( - seq: Annotated[_ffi.CData, "const TSequence *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TSequence **"]: + seq: Annotated[_ffi.CData, "const TSequence *"], +) -> tuple[Annotated[_ffi.CData, "TSequence **"], Annotated[_ffi.CData, "int"]]: seq_converted = _ffi.cast("const TSequence *", seq) - count_converted = _ffi.cast("int *", count) - result = _lib.tpointseq_make_simple(seq_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tpointseq_make_simple(seq_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tspatialseq_set_srid( @@ -19678,13 +20113,13 @@ def tspatialseq_set_srid( def tpointseqset_make_simple( - ss: Annotated[_ffi.CData, "const TSequenceSet *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "TSequence **"]: + ss: Annotated[_ffi.CData, "const TSequenceSet *"], +) -> tuple[Annotated[_ffi.CData, "TSequence **"], Annotated[_ffi.CData, "int"]]: ss_converted = _ffi.cast("const TSequenceSet *", ss) - count_converted = _ffi.cast("int *", count) - result = _lib.tpointseqset_make_simple(ss_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tpointseqset_make_simple(ss_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tspatialseqset_set_srid( @@ -19918,7 +20353,7 @@ def route_exists(rid: int) -> Annotated[bool, "bool"]: return result if result != _ffi.NULL else None -def route_geom(rid: int) -> Annotated[_ffi.CData, "GSERIALIZED *"]: +def route_geom(rid: int) -> Annotated[_ffi.CData, "const GSERIALIZED *"]: rid_converted = _ffi.cast("int64", rid) result = _lib.route_geom(rid_converted) _check_error() @@ -20151,8 +20586,8 @@ def npointset_out(s: Annotated[_ffi.CData, "const Set *"], maxdd: int) -> Annota return result if result != _ffi.NULL else None -def npointset_make(values: Annotated[list, "const Npoint **"], count: int) -> Annotated[_ffi.CData, "Set *"]: - values_converted = [_ffi.cast("const Npoint *", x) for x in values] +def npointset_make(values: Annotated[list, "Npoint **"], count: int) -> Annotated[_ffi.CData, "Set *"]: + values_converted = [_ffi.cast("Npoint *", x) for x in values] result = _lib.npointset_make(values_converted, count) _check_error() return result if result != _ffi.NULL else None @@ -20214,10 +20649,10 @@ def contained_npoint_set( def contains_set_npoint( - s: Annotated[_ffi.CData, "const Set *"], np: Annotated[_ffi.CData, "Npoint *"] + s: Annotated[_ffi.CData, "const Set *"], np: Annotated[_ffi.CData, "const Npoint *"] ) -> Annotated[bool, "bool"]: s_converted = _ffi.cast("const Set *", s) - np_converted = _ffi.cast("Npoint *", np) + np_converted = _ffi.cast("const Npoint *", np) result = _lib.contains_set_npoint(s_converted, np_converted) _check_error() return result if result != _ffi.NULL else None @@ -20345,13 +20780,13 @@ def tnpoint_length(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated def tnpoint_positions( - temp: Annotated[_ffi.CData, "const Temporal *"], count: Annotated[_ffi.CData, "int *"] -) -> Annotated[_ffi.CData, "Nsegment **"]: + temp: Annotated[_ffi.CData, "const Temporal *"], +) -> tuple[Annotated[_ffi.CData, "Nsegment **"], Annotated[_ffi.CData, "int"]]: temp_converted = _ffi.cast("const Temporal *", temp) - count_converted = _ffi.cast("int *", count) - result = _lib.tnpoint_positions(temp_converted, count_converted) + count = _ffi.new("int *") + result = _lib.tnpoint_positions(temp_converted, count) _check_error() - return result if result != _ffi.NULL else None + return result if result != _ffi.NULL else None, count[0] def tnpoint_route(temp: Annotated[_ffi.CData, "const Temporal *"]) -> Annotated[int, "int64"]: