diff --git a/functions/meos_meos.go b/functions/meos_meos.go index 33e4052..0ce5f79 100644 --- a/functions/meos_meos.go +++ b/functions/meos_meos.go @@ -10307,7 +10307,7 @@ func TintValues(temp *Temporal, count unsafe.Pointer) (_r0 unsafe.Pointer, _err // TbigintValues wraps MEOS C function tbigint_values. func TbigintValues(temp *Temporal, count unsafe.Pointer) (_r0 unsafe.Pointer, _err error) { C.meos_errno_reset() - _cret := C.tbigint_values(temp._inner, (*C.int32)(unsafe.Pointer(count))) + _cret := C.tbigint_values(temp._inner, (*C.int)(unsafe.Pointer(count))) if _err = meosError(); _err != nil { return } diff --git a/functions/meos_meos_geo.go b/functions/meos_meos_geo.go index 904bcbc..9e3b7ca 100644 --- a/functions/meos_meos_geo.go +++ b/functions/meos_meos_geo.go @@ -491,6 +491,17 @@ func GeomAzimuth(gs1 *Geom, gs2 *Geom) (_r0 bool, _r1 float64, _err error) { } +// GeomArea wraps MEOS C function geom_area. +func GeomArea(gs *Geom) (_r0 float64, _err error) { + C.meos_errno_reset() + _cret := C.geom_area(gs._inner) + if _err = meosError(); _err != nil { + return + } + return float64(_cret), nil +} + + // GeomLength wraps MEOS C function geom_length. func GeomLength(gs *Geom) (_r0 float64, _err error) { C.meos_errno_reset() diff --git a/tools/objectgen.py b/tools/objectgen.py new file mode 100644 index 0000000..06ff37b --- /dev/null +++ b/tools/objectgen.py @@ -0,0 +1,437 @@ +#!/usr/bin/env python3 +# BINDING-HEADER-PARSE-OK: this generator reads only the meos-idl.json catalog, +# never a C header; the catalog is the binding's single source of truth. +"""Generate the GoMEOS object layer from MEOS-API's meos-idl.json. + +The catalog's ``objectModel`` is the ecosystem-wide statement of the class hierarchy +implicit in MEOS: ``lattice`` carries the temporal tree, ``companions`` the Box, +Collection and Value hierarchies, and ``classes..methods`` assigns every public +MEOS function to the class it is a method of, under its canonical camelCase ``ooName``. +This projects that model onto Go -- one type per model class, the model's parent edge +spelled as struct embedding, and one method per assigned function delegating to the +wrapper ``codegen.py`` emits for the same function. + +THE WRAPPER SIGNATURES COME FROM ``codegen.SIGNATURES``, never from the raw C parameter +list, so the two generators cannot disagree about a folded out-parameter: MEOS declares +``bool tbool_value_at_timestamptz(..., bool *value)`` and the emitted wrapper takes three +arguments and answers two values, which no C signature states. That table is filled by +RUNNING the flat generator, so which functions have a wrapper is decided in exactly one +place; this file holds no second copy of what that generator skips. + +Go spells inheritance as embedding, so ``TBool`` embeds ``TAlpha`` embeds ``Temporal`` +and a parent's methods are promoted. Every instance is a handle to the MEOS value, and +the two packages exchange one across ``unsafe.Pointer`` -- cgo types are package-scoped, +so ``*C.Temporal`` in ``functions`` and here are different Go types and the pointer is +the only shared currency. + +Usage: + python3 tools/objectgen.py path/to/meos-idl.json [--report] + +Regenerates functions/ (through codegen) and writes types/*.go, replacing that directory. +""" + +from __future__ import annotations + +import argparse +import json +import shutil +import sys +from collections import defaultdict +from pathlib import Path + +import codegen + +PACKAGE = "types" +FUNCTIONS_IMPORT = "github.com/MobilityDB/GoMEOS/functions" + +# The C structs that carry the Temporal header and are discriminated by its ``subtype`` +# field. A pointer to any of them is a Temporal at the surface, exactly as MEOS.NET's +# object layer resolves them, because the concrete class is the product leaf x subtype +# and the leaf family carries by far the larger surface. +TEMPORAL_STRUCTS = ("Temporal", "TInstant", "TSequence", "TSequenceSet") + +GO_KEYWORDS = { + "break", "case", "chan", "const", "continue", "default", "defer", "else", + "fallthrough", "for", "func", "go", "goto", "if", "import", "interface", "map", + "package", "range", "return", "select", "struct", "switch", "type", "var", +} + +# Acronym runs kept upper case so a Go name reads the way the catalog's own camelCase +# name does: ``asMFJSON`` becomes ``AsMFJSON`` rather than ``AsMfjson``. +ACRONYMS = {"mfjson", "geojson", "wkb", "wkt", "ewkb", "ewkt", "hexwkb", "hexewkb", + "srid", "json", "jsonb", "mvt", "gml", "kml", "de9im", "id", "url"} + + +def pascal(name: str) -> str: + """The Go exported spelling of a catalog camelCase ``ooName``.""" + out, word = [], [] + + def flush(): + if not word: + return + w = "".join(word) + out.append(w.upper() if w.lower() in ACRONYMS else w[:1].upper() + w[1:]) + word.clear() + + for ch in name: + if ch in "_-": + flush() + continue + if ch.isupper() and word: + flush() + word.append(ch) + flush() + return "".join(out) or name + + +def ident(name: str) -> str: + """A Go parameter name, kept clear of the keywords.""" + return name + "_" if name in GO_KEYWORDS else name + + +def zero(go_type: str) -> str: + """The zero value of a Go type, for the error and absent returns.""" + if go_type.startswith("*") or go_type.startswith("[]") or go_type == "unsafe.Pointer": + return "nil" + if go_type == "string": + return '""' + if go_type == "bool": + return "false" + return "0" + + +class Model: + """The class hierarchy the catalog defines, indexed for emission.""" + + def __init__(self, idl: dict): + self.idl = idl + self.om = idl["objectModel"] + self.functions = {f["name"]: f for f in idl["functions"]} + self.parent: dict[str, str | None] = {} + self.ctype: dict[str, str] = {} + self.wrap_root: dict[str, str] = {} + self._build() + + def _build(self) -> None: + for name, node in self.om["lattice"].items(): + self.parent[name] = node["parent"] + + # The template subtypes are classes of their own, under the root. + for value in self.om["axes"]["subtype"]["values"]: + cls = value.get("class") + if cls: + self.parent[cls] = "Temporal" + + for family in [k for k in self.om["companions"] if not k.startswith("_")]: + for name, node in self.om["companions"][family]["nodes"].items(): + if name.startswith("_"): + continue + self.parent[name] = node["parent"] + + # What a class's instances point to is the catalog's to say, so every class + # takes the cType the model derives from MEOS's own signatures. A binding + # holding that map itself cannot reach a class the model gains. + for name, spec in self.om["classes"].items(): + if spec.get("cType"): + self.ctype[name] = spec["cType"] + self.parent.setdefault(name, None) + + # A pointer to a C struct is wrapped in the SHALLOWEST class carrying it, so a + # GSERIALIZED * is a Geo and its Geometry and Geography leaves stay distinct + # classes under it, exactly as a Set * is a Set. + for name, ct in self.ctype.items(): + best = self.wrap_root.get(ct) + if best is None or self.depth(name) < self.depth(best): + self.wrap_root[ct] = name + + def depth(self, cls: str) -> int: + d, seen = 0, {cls} + p = self.parent.get(cls) + while p and p not in seen: + seen.add(p) + d += 1 + p = self.parent.get(p) + return d + + def ancestors(self, cls: str) -> list[str]: + out, seen = [], {cls} + p = self.parent.get(cls) + while p and p not in seen: + out.append(p) + seen.add(p) + p = self.parent.get(p) + return out + + def classes(self) -> list[str]: + """Every type the layer declares, superclass included. + + A companion ROOT -- Box, Collection, Value -- is a parent edge in the model + and carries no ``classes`` entry of its own, so emitting only what ``classes`` + names leaves each child embedding a type nothing declares. The set to emit is + therefore the classes UNION everything named as a parent. + """ + named = set(self.om["classes"]) + parents = {p for p in self.parent.values() if p} + return sorted(named | parents) + + def class_for_ctype(self, struct: str) -> str | None: + """The class a single pointer to this C struct is wrapped in.""" + if struct in TEMPORAL_STRUCTS: + return "Temporal" + return self.wrap_root.get(struct) + + +class Generator: + def __init__(self, model: Model): + self.m = model + self.deferred: dict[str, list[str]] = defaultdict(list) + self.emitted = 0 + # The Go handle each wrapper struct reaches the flat layer as, read from the + # flat generator rather than restated: WRAPPER_TYPES is what decides it. Its + # value carries the star and need not echo the struct -- GSERIALIZED reaches + # Go as `*Geom` -- so the handle NAME is that value without the star, and it + # is what `functions.FromPointer` is called. + self.handle_of = {c: go.lstrip("*") for c, (go, _) in codegen.WRAPPER_TYPES.items()} + self.struct_of = {go: c for c, (go, _) in codegen.WRAPPER_TYPES.items()} + self.scalars = set(t.go_type for t in codegen.TYPE_MAP.values()) + + # -- marshalling ------------------------------------------------------ + + def class_of_handle(self, go_type: str) -> str | None: + """The model class behind a wrapper's ``*Handle`` Go type, if there is one.""" + if not go_type.startswith("*"): + return None + struct = self.struct_of.get(go_type) + return self.m.class_for_ctype(struct) if struct else None + + def passthrough(self, go_type: str) -> bool: + return go_type in self.scalars or go_type in ("string", "bool", "unsafe.Pointer") + + def qualify(self, go_type: str) -> str: + """A passthrough type as this package must spell it. + + The flat generator declares the catalog's enums and named scalars as Go types + of its OWN package -- `Interpolation`, `NullHandleType`, `MeosType` -- so a + method carrying one names it `functions.X` here. Go's predeclared types are all + lower case, which is the discriminator, so a new enum needs no list entry. + """ + prefix, base = "", go_type + while base.startswith("[]"): + prefix, base = prefix + "[]", base[2:] + if base.startswith("*"): + prefix, base = prefix + "*", base[1:] + if base[:1].isupper(): + return f"{prefix}functions.{base}" + return go_type + + def map_param(self, go_type: str, name: str) -> tuple[str, str] | None: + """``(go type in this layer, the expression handed to the wrapper)``.""" + cls = self.class_of_handle(go_type) + if cls: + # THE DECLARED TYPE AND THE HANDLE ARE NOT THE SAME QUESTION. The surface + # takes the CLASS a pointer is wrapped in -- TInstant, TSequence and + # TSequenceSet all surface as Temporal -- while the wrapper wants the + # handle IT declares, so the conversion reads the wrapper's own struct. + # Only the pointer crosses, so the two need not agree. + handle = self.handle_of.get(self.struct_of.get(go_type, "")) + if handle is None: + return None + return (f"*{cls}", f"functions.{handle}FromPointer({name}.Pointer())") + if self.passthrough(go_type): + return (self.qualify(go_type), name) + return None + + def map_return(self, go_type: str, expr: str) -> tuple[str, str] | None: + """``(go type in this layer, the expression producing it)``.""" + cls = self.class_of_handle(go_type) + if cls: + return (f"*{cls}", f"{cls}FromPointer({expr}.Pointer())") + if self.passthrough(go_type): + return (self.qualify(go_type), expr) + return None + + # -- emission --------------------------------------------------------- + + def method_for(self, cls: str, entry: dict) -> str | None: + oo = entry["ooName"] + fname = entry["function"] + sig = codegen.SIGNATURES.get(fname) + if sig is None: + self.deferred[cls].append(f"{oo}: {fname} has no emitted wrapper") + return None + f = self.m.functions.get(fname) + if f is None: + self.deferred[cls].append(f"{oo}: no catalog function {fname}") + return None + + # A first parameter that is this class (or an ancestor of it) makes the + # function a METHOD ON the value; anything else is a plain function of the + # class, which is how Go spells a static. + family = {cls, *self.m.ancestors(cls)} + params = list(sig.params) + recv = None + if params and self.class_of_handle(params[0][1]) in family: + recv = params.pop(0) + + args, decl = [], [] + for pname, ptype in params: + mapped = self.map_param(ptype, ident(pname)) + if mapped is None: + self.deferred[cls].append(f"{oo}: parameter {pname} is {ptype}") + return None + gotype, expr = mapped + decl.append(f"{ident(pname)} {gotype}") + args.append(expr) + + if recv is not None: + handle = self.handle_of.get(self.struct_of.get(recv[1], "")) + if handle is None: + self.deferred[cls].append(f"{oo}: receiver {recv[1]} has no handle") + return None + args.insert(0, f"functions.{handle}FromPointer(x.Pointer())") + + name = pascal(oo) if recv is not None else cls + pascal(oo) + + # THE OUT-PARAMETER FOLD, and the shape is the repository's own: MEOS answers + # a bool saying whether a value is there and writes the value out, so the + # wrapper returns (found, value, error) and the method answers (value, ok, + # error) -- absence is an optional result, never an error. + folded = (len(sig.returns) == 2 and sig.returns[0] == "bool" + and f["returnType"]["c"].replace("const ", "").strip() == "bool") + + rets, body = [], [] + call = f"functions.{sig.go_name}({', '.join(args)})" + + if not sig.returns: + body.append(f"\treturn {call}") + elif folded: + mapped = self.map_return(sig.returns[1], "_value") + if mapped is None: + self.deferred[cls].append(f"{oo}: result {sig.returns[1]}") + return None + gotype, expr = mapped + rets = [gotype, "bool"] + body.append(f"\t_found, _value, _err := {call}") + body.append(f"\tif _err != nil {{\n\t\treturn {zero(gotype)}, false, _err\n\t}}") + body.append(f"\tif !_found {{\n\t\treturn {zero(gotype)}, false, nil\n\t}}") + body.append(f"\treturn {expr}, true, nil") + else: + names = [f"_r{i}" for i in range(len(sig.returns))] + outs = [] + for i, rt in enumerate(sig.returns): + mapped = self.map_return(rt, names[i]) + if mapped is None: + self.deferred[cls].append(f"{oo}: result {rt}") + return None + rets.append(mapped[0]) + outs.append(mapped[1]) + body.append(f"\t{', '.join(names)}, _err := {call}") + body.append("\tif _err != nil {\n\t\treturn " + + ", ".join(zero(r) for r in rets) + ", _err\n\t}") + body.append(f"\treturn {', '.join(outs)}, nil") + + result = f"({', '.join(rets + ['error'])})" if rets else "error" + head = (f"func (x *{cls}) {name}({', '.join(decl)}) {result} {{" + if recv is not None else + f"func {name}({', '.join(decl)}) {result} {{") + self.emitted += 1 + return f"// {name} is MEOS {fname}.\n{head}\n" + "\n".join(body) + "\n}\n" + + def emit_class(self, cls: str) -> str: + spec = self.m.om["classes"].get(cls) or {"methods": []} + parent = self.m.parent.get(cls) + + methods, seen = [], set() + for entry in spec["methods"]: + if entry.get("ooExclude"): + continue + code = self.method_for(cls, entry) + if code is None: + continue + head = code.split("\n")[1] + if head in seen: + continue + seen.add(head) + methods.append(code) + + uses_functions = any("functions." in m for m in methods) + imports = ['\t"unsafe"'] + if uses_functions: + imports.append(f'\n\t"{FUNCTIONS_IMPORT}"') + + out = [f"package {PACKAGE}\n", + "// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT.\n", + "import (\n" + "\n".join(imports) + "\n)\n"] + + doc = (self.m.om["lattice"].get(cls) or {}).get("doc") or "" + if doc: + out.append(f"// {cls} is {doc[0].lower() + doc[1:]}\n") + + out.append(f"type {cls} struct {{\n\t{parent if parent else 'handle'}\n}}\n") + out.append( + f"// {cls}FromPointer wraps a MEOS pointer, answering nil for nil so an\n" + f"// absent MEOS result stays absent rather than becoming a live handle.\n" + f"func {cls}FromPointer(p unsafe.Pointer) *{cls} {{\n" + f"\tif p == nil {{\n\t\treturn nil\n\t}}\n" + f"\tv := &{cls}{{}}\n\tv.ptr = p\n\treturn v\n}}\n") + out.extend(methods) + return "\n".join(out) + + def base_file(self) -> str: + return ( + f"package {PACKAGE}\n\n" + "// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT.\n\n" + 'import "unsafe"\n\n' + "// handle is the MEOS value every class in this package stands for.\n" + "//\n" + "// cgo types are package-scoped, so the *C.Temporal the functions package\n" + "// holds and one declared here would be DIFFERENT Go types. The untyped\n" + "// pointer is the only currency the two packages share, which is why each\n" + "// class carries one and hands it across at every call.\n" + "type handle struct {\n\tptr unsafe.Pointer\n}\n\n" + "// Pointer answers the MEOS value this handle stands for, or nil.\n" + "func (h *handle) Pointer() unsafe.Pointer {\n" + "\tif h == nil {\n\t\treturn nil\n\t}\n\treturn h.ptr\n}\n") + + +def main() -> int: + ap = argparse.ArgumentParser() + ap.add_argument("catalog", type=Path) + ap.add_argument("--report", action="store_true", + help="print what each class deferred and why") + args = ap.parse_args() + + repo = Path(__file__).resolve().parent.parent + + # Fill codegen.SIGNATURES by RUNNING the flat generator, so which functions have a + # wrapper is decided in one place. Re-deriving that here would be a second copy of + # its exclusions, and the two would drift. + stats = codegen.generate(args.catalog, repo / "functions") + print(f"Flat layer: {stats['emitted']} wrappers, " + f"{len(codegen.SIGNATURES)} signatures recorded", file=sys.stderr) + + idl = json.loads(args.catalog.read_text()) + model = Model(idl) + gen = Generator(model) + + out_dir = repo / PACKAGE + if out_dir.exists(): + shutil.rmtree(out_dir) + out_dir.mkdir(parents=True) + (out_dir / "meos.go").write_text(gen.base_file()) + for cls in model.classes(): + (out_dir / f"{cls.lower()}.go").write_text(gen.emit_class(cls)) + + total_deferred = sum(len(v) for v in gen.deferred.values()) + print(f"Object layer: {len(model.classes())} classes, {gen.emitted} methods, " + f"{total_deferred} deferred", file=sys.stderr) + if args.report: + for cls in sorted(gen.deferred, key=lambda c: -len(gen.deferred[c])): + print(f"--- {cls} ({len(gen.deferred[cls])} deferred)", file=sys.stderr) + for reason in gen.deferred[cls]: + print(f" {reason}", file=sys.stderr) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/types/bigintset.go b/types/bigintset.go new file mode 100644 index 0000000..2e40f1a --- /dev/null +++ b/types/bigintset.go @@ -0,0 +1,99 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type BigIntSet struct { + Set +} + +// BigIntSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func BigIntSetFromPointer(p unsafe.Pointer) *BigIntSet { + if p == nil { + return nil + } + v := &BigIntSet{} + v.ptr = p + return v +} + +// BigIntSetIn is MEOS bigintset_in. +func BigIntSetIn(str string) (*Set, error) { + _r0, _err := functions.BigintsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS bigintset_out. +func (x *BigIntSet) Out() (string, error) { + _r0, _err := functions.BigintsetOut(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// BigIntSetMake is MEOS bigintset_make. +func BigIntSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.BigintsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS bigintset_end_value. +func (x *BigIntSet) EndValue() (int64, error) { + _r0, _err := functions.BigintsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS bigintset_start_value. +func (x *BigIntSet) StartValue() (int64, error) { + _r0, _err := functions.BigintsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueN is MEOS bigintset_value_n. +func (x *BigIntSet) ValueN(n int) (int64, bool, error) { + _found, _value, _err := functions.BigintsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS bigintset_values. +func (x *BigIntSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.BigintsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ShiftScale is MEOS bigintset_shift_scale. +func (x *BigIntSet) ShiftScale(shift int64, width int64, hasshift bool, haswidth bool) (*Set, error) { + _r0, _err := functions.BigintsetShiftScale(functions.SetFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/bigintspan.go b/types/bigintspan.go new file mode 100644 index 0000000..b755290 --- /dev/null +++ b/types/bigintspan.go @@ -0,0 +1,123 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type BigIntSpan struct { + Span +} + +// BigIntSpanFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func BigIntSpanFromPointer(p unsafe.Pointer) *BigIntSpan { + if p == nil { + return nil + } + v := &BigIntSpan{} + v.ptr = p + return v +} + +// Expand is MEOS bigintspan_expand. +func (x *BigIntSpan) Expand(value int64) (*Span, error) { + _r0, _err := functions.BigintspanExpand(functions.SpanFromPointer(x.Pointer()), value) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// BigIntSpanIn is MEOS bigintspan_in. +func BigIntSpanIn(str string) (*Span, error) { + _r0, _err := functions.BigintspanIn(str) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS bigintspan_out. +func (x *BigIntSpan) Out() (string, error) { + _r0, _err := functions.BigintspanOut(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// BigIntSpanMake is MEOS bigintspan_make. +func BigIntSpanMake(lower int64, upper int64, lower_inc bool, upper_inc bool) (*Span, error) { + _r0, _err := functions.BigintspanMake(lower, upper, lower_inc, upper_inc) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToIntspan is MEOS bigintspan_to_intspan. +func (x *BigIntSpan) ToIntspan() (*Span, error) { + _r0, _err := functions.BigintspanToIntspan(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToFloatspan is MEOS bigintspan_to_floatspan. +func (x *BigIntSpan) ToFloatspan() (*Span, error) { + _r0, _err := functions.BigintspanToFloatspan(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Lower is MEOS bigintspan_lower. +func (x *BigIntSpan) Lower() (int64, error) { + _r0, _err := functions.BigintspanLower(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Upper is MEOS bigintspan_upper. +func (x *BigIntSpan) Upper() (int64, error) { + _r0, _err := functions.BigintspanUpper(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Width is MEOS bigintspan_width. +func (x *BigIntSpan) Width() (int64, error) { + _r0, _err := functions.BigintspanWidth(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ShiftScale is MEOS bigintspan_shift_scale. +func (x *BigIntSpan) ShiftScale(shift int64, width int64, hasshift bool, haswidth bool) (*Span, error) { + _r0, _err := functions.BigintspanShiftScale(functions.SpanFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Bins is MEOS bigintspan_bins. +func (x *BigIntSpan) Bins(vsize int64, vorigin int64, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.BigintspanBins(functions.SpanFromPointer(x.Pointer()), vsize, vorigin, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} diff --git a/types/bigintspanset.go b/types/bigintspanset.go new file mode 100644 index 0000000..6422151 --- /dev/null +++ b/types/bigintspanset.go @@ -0,0 +1,87 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type BigIntSpanSet struct { + SpanSet +} + +// BigIntSpanSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func BigIntSpanSetFromPointer(p unsafe.Pointer) *BigIntSpanSet { + if p == nil { + return nil + } + v := &BigIntSpanSet{} + v.ptr = p + return v +} + +// BigIntSpanSetIn is MEOS bigintspanset_in. +func BigIntSpanSetIn(str string) (*SpanSet, error) { + _r0, _err := functions.BigintspansetIn(str) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS bigintspanset_out. +func (x *BigIntSpanSet) Out() (string, error) { + _r0, _err := functions.BigintspansetOut(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// Lower is MEOS bigintspanset_lower. +func (x *BigIntSpanSet) Lower() (int64, error) { + _r0, _err := functions.BigintspansetLower(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Upper is MEOS bigintspanset_upper. +func (x *BigIntSpanSet) Upper() (int64, error) { + _r0, _err := functions.BigintspansetUpper(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Width is MEOS bigintspanset_width. +func (x *BigIntSpanSet) Width(boundspan bool) (int64, error) { + _r0, _err := functions.BigintspansetWidth(functions.SpanSetFromPointer(x.Pointer()), boundspan) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ShiftScale is MEOS bigintspanset_shift_scale. +func (x *BigIntSpanSet) ShiftScale(shift int64, width int64, hasshift bool, haswidth bool) (*SpanSet, error) { + _r0, _err := functions.BigintspansetShiftScale(functions.SpanSetFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Bins is MEOS bigintspanset_bins. +func (x *BigIntSpanSet) Bins(vsize int64, vorigin int64, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.BigintspansetBins(functions.SpanSetFromPointer(x.Pointer()), vsize, vorigin, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} diff --git a/types/box.go b/types/box.go new file mode 100644 index 0000000..e97f973 --- /dev/null +++ b/types/box.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type Box struct { + handle +} + +// BoxFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func BoxFromPointer(p unsafe.Pointer) *Box { + if p == nil { + return nil + } + v := &Box{} + v.ptr = p + return v +} diff --git a/types/cbuffer.go b/types/cbuffer.go new file mode 100644 index 0000000..44ededc --- /dev/null +++ b/types/cbuffer.go @@ -0,0 +1,321 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Cbuffer struct { + Value +} + +// CbufferFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func CbufferFromPointer(p unsafe.Pointer) *Cbuffer { + if p == nil { + return nil + } + v := &Cbuffer{} + v.ptr = p + return v +} + +// AsEWKT is MEOS cbuffer_as_ewkt. +func (x *Cbuffer) AsEWKT(maxdd int) (string, error) { + _r0, _err := functions.CbufferAsEWKT(functions.CbufferFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsHEXWKB is MEOS cbuffer_as_hexwkb. +func (x *Cbuffer) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { + _r0, _err := functions.CbufferAsHexwkb(functions.CbufferFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsText is MEOS cbuffer_as_text. +func (x *Cbuffer) AsText(maxdd int) (string, error) { + _r0, _err := functions.CbufferAsText(functions.CbufferFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsWKB is MEOS cbuffer_as_wkb. +func (x *Cbuffer) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.CbufferAsWKB(functions.CbufferFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// CbufferFromHEXWKB is MEOS cbuffer_from_hexwkb. +func CbufferFromHEXWKB(hexwkb string) (*Cbuffer, error) { + _r0, _err := functions.CbufferFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// CbufferFromWKB is MEOS cbuffer_from_wkb. +func CbufferFromWKB(wkb unsafe.Pointer, size uint) (*Cbuffer, error) { + _r0, _err := functions.CbufferFromWKB(wkb, size) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// CbufferIn is MEOS cbuffer_in. +func CbufferIn(str string) (*Cbuffer, error) { + _r0, _err := functions.CbufferIn(str) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS cbuffer_out. +func (x *Cbuffer) Out(maxdd int) (string, error) { + _r0, _err := functions.CbufferOut(functions.CbufferFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// Copy is MEOS cbuffer_copy. +func (x *Cbuffer) Copy() (*Cbuffer, error) { + _r0, _err := functions.CbufferCopy(functions.CbufferFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// CbufferMake is MEOS cbuffer_make. +func CbufferMake(point *TRGeometrySeqSet, radius float64) (*Cbuffer, error) { + _r0, _err := functions.CbufferMake(functions.GeomFromPointer(point.Pointer()), radius) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// ToGeom is MEOS cbuffer_to_geom. +func (x *Cbuffer) ToGeom() (*TRGeometrySeqSet, error) { + _r0, _err := functions.CbufferToGeom(functions.CbufferFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ToStbox is MEOS cbuffer_to_stbox. +func (x *Cbuffer) ToStbox() (*STBox, error) { + _r0, _err := functions.CbufferToSTBOX(functions.CbufferFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// Hash is MEOS cbuffer_hash. +func (x *Cbuffer) Hash() (uint32, error) { + _r0, _err := functions.CbufferHash(functions.CbufferFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS cbuffer_hash_extended. +func (x *Cbuffer) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.CbufferHashExtended(functions.CbufferFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Point is MEOS cbuffer_point. +func (x *Cbuffer) Point() (*TRGeometrySeqSet, error) { + _r0, _err := functions.CbufferPoint(functions.CbufferFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// Radius is MEOS cbuffer_radius. +func (x *Cbuffer) Radius() (float64, error) { + _r0, _err := functions.CbufferRadius(functions.CbufferFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Round is MEOS cbuffer_round. +func (x *Cbuffer) Round(maxdd int) (*Cbuffer, error) { + _r0, _err := functions.CbufferRound(functions.CbufferFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// SetSRID is MEOS cbuffer_set_srid. +func (x *Cbuffer) SetSRID(srid int32) (*Cbuffer, error) { + _r0, _err := functions.CbufferSetSRID(functions.CbufferFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// SRID is MEOS cbuffer_srid. +func (x *Cbuffer) SRID() (int32, error) { + _r0, _err := functions.CbufferSRID(functions.CbufferFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Transform is MEOS cbuffer_transform. +func (x *Cbuffer) Transform(srid int32) (*Cbuffer, error) { + _r0, _err := functions.CbufferTransform(functions.CbufferFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// TransformPipeline is MEOS cbuffer_transform_pipeline. +func (x *Cbuffer) TransformPipeline(pipelinestr string, srid int32, is_forward bool) (*Cbuffer, error) { + _r0, _err := functions.CbufferTransformPipeline(functions.CbufferFromPointer(x.Pointer()), pipelinestr, srid, is_forward) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// TstzspanToStbox is MEOS cbuffer_tstzspan_to_stbox. +func (x *Cbuffer) TstzspanToStbox(s *Span) (*STBox, error) { + _r0, _err := functions.CbufferTstzspanToSTBOX(functions.CbufferFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// TimestamptzToStbox is MEOS cbuffer_timestamptz_to_stbox. +func (x *Cbuffer) TimestamptzToStbox(t int64) (*STBox, error) { + _r0, _err := functions.CbufferTimestamptzToSTBOX(functions.CbufferFromPointer(x.Pointer()), t) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// Cmp is MEOS cbuffer_cmp. +func (x *Cbuffer) Cmp(cb2 *Cbuffer) (int, error) { + _r0, _err := functions.CbufferCmp(functions.CbufferFromPointer(x.Pointer()), functions.CbufferFromPointer(cb2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Eq is MEOS cbuffer_eq. +func (x *Cbuffer) Eq(cb2 *Cbuffer) (bool, error) { + _r0, _err := functions.CbufferEq(functions.CbufferFromPointer(x.Pointer()), functions.CbufferFromPointer(cb2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ge is MEOS cbuffer_ge. +func (x *Cbuffer) Ge(cb2 *Cbuffer) (bool, error) { + _r0, _err := functions.CbufferGe(functions.CbufferFromPointer(x.Pointer()), functions.CbufferFromPointer(cb2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Gt is MEOS cbuffer_gt. +func (x *Cbuffer) Gt(cb2 *Cbuffer) (bool, error) { + _r0, _err := functions.CbufferGt(functions.CbufferFromPointer(x.Pointer()), functions.CbufferFromPointer(cb2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Le is MEOS cbuffer_le. +func (x *Cbuffer) Le(cb2 *Cbuffer) (bool, error) { + _r0, _err := functions.CbufferLe(functions.CbufferFromPointer(x.Pointer()), functions.CbufferFromPointer(cb2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Lt is MEOS cbuffer_lt. +func (x *Cbuffer) Lt(cb2 *Cbuffer) (bool, error) { + _r0, _err := functions.CbufferLt(functions.CbufferFromPointer(x.Pointer()), functions.CbufferFromPointer(cb2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ne is MEOS cbuffer_ne. +func (x *Cbuffer) Ne(cb2 *Cbuffer) (bool, error) { + _r0, _err := functions.CbufferNe(functions.CbufferFromPointer(x.Pointer()), functions.CbufferFromPointer(cb2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Nsame is MEOS cbuffer_nsame. +func (x *Cbuffer) Nsame(cb2 *Cbuffer) (bool, error) { + _r0, _err := functions.CbufferNsame(functions.CbufferFromPointer(x.Pointer()), functions.CbufferFromPointer(cb2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Same is MEOS cbuffer_same. +func (x *Cbuffer) Same(cb2 *Cbuffer) (bool, error) { + _r0, _err := functions.CbufferSame(functions.CbufferFromPointer(x.Pointer()), functions.CbufferFromPointer(cb2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// ToSet is MEOS cbuffer_to_set. +func (x *Cbuffer) ToSet() (*Set, error) { + _r0, _err := functions.CbufferToSet(functions.CbufferFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/cbufferset.go b/types/cbufferset.go new file mode 100644 index 0000000..433ac07 --- /dev/null +++ b/types/cbufferset.go @@ -0,0 +1,90 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type CbufferSet struct { + Set +} + +// CbufferSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func CbufferSetFromPointer(p unsafe.Pointer) *CbufferSet { + if p == nil { + return nil + } + v := &CbufferSet{} + v.ptr = p + return v +} + +// CbufferSetIn is MEOS cbufferset_in. +func CbufferSetIn(str string) (*Set, error) { + _r0, _err := functions.CbuffersetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS cbufferset_out. +func (x *CbufferSet) Out(maxdd int) (string, error) { + _r0, _err := functions.CbuffersetOut(functions.SetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// CbufferSetMake is MEOS cbufferset_make. +func CbufferSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.CbuffersetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS cbufferset_end_value. +func (x *CbufferSet) EndValue() (*Cbuffer, error) { + _r0, _err := functions.CbuffersetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS cbufferset_start_value. +func (x *CbufferSet) StartValue() (*Cbuffer, error) { + _r0, _err := functions.CbuffersetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// ValueN is MEOS cbufferset_value_n. +func (x *CbufferSet) ValueN(n int) (*Cbuffer, bool, error) { + _found, _value, _err := functions.CbuffersetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return CbufferFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS cbufferset_values. +func (x *CbufferSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.CbuffersetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} diff --git a/types/collection.go b/types/collection.go new file mode 100644 index 0000000..8a727b8 --- /dev/null +++ b/types/collection.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type Collection struct { + handle +} + +// CollectionFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func CollectionFromPointer(p unsafe.Pointer) *Collection { + if p == nil { + return nil + } + v := &Collection{} + v.ptr = p + return v +} diff --git a/types/dateset.go b/types/dateset.go new file mode 100644 index 0000000..5234bb5 --- /dev/null +++ b/types/dateset.go @@ -0,0 +1,108 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type DateSet struct { + Set +} + +// DateSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func DateSetFromPointer(p unsafe.Pointer) *DateSet { + if p == nil { + return nil + } + v := &DateSet{} + v.ptr = p + return v +} + +// DateSetIn is MEOS dateset_in. +func DateSetIn(str string) (*Set, error) { + _r0, _err := functions.DatesetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS dateset_out. +func (x *DateSet) Out() (string, error) { + _r0, _err := functions.DatesetOut(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// DateSetMake is MEOS dateset_make. +func DateSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.DatesetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToTstzset is MEOS dateset_to_tstzset. +func (x *DateSet) ToTstzset() (*Set, error) { + _r0, _err := functions.DatesetToTstzset(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS dateset_end_value. +func (x *DateSet) EndValue() (int32, error) { + _r0, _err := functions.DatesetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS dateset_start_value. +func (x *DateSet) StartValue() (int32, error) { + _r0, _err := functions.DatesetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueN is MEOS dateset_value_n. +func (x *DateSet) ValueN(n int) (int32, bool, error) { + _found, _value, _err := functions.DatesetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS dateset_values. +func (x *DateSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.DatesetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ShiftScale is MEOS dateset_shift_scale. +func (x *DateSet) ShiftScale(shift int, width int, hasshift bool, haswidth bool) (*Set, error) { + _r0, _err := functions.DatesetShiftScale(functions.SetFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/datespan.go b/types/datespan.go new file mode 100644 index 0000000..44d9b70 --- /dev/null +++ b/types/datespan.go @@ -0,0 +1,87 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type DateSpan struct { + Span +} + +// DateSpanFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func DateSpanFromPointer(p unsafe.Pointer) *DateSpan { + if p == nil { + return nil + } + v := &DateSpan{} + v.ptr = p + return v +} + +// DateSpanIn is MEOS datespan_in. +func DateSpanIn(str string) (*Span, error) { + _r0, _err := functions.DatespanIn(str) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS datespan_out. +func (x *DateSpan) Out() (string, error) { + _r0, _err := functions.DatespanOut(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// DateSpanMake is MEOS datespan_make. +func DateSpanMake(lower int32, upper int32, lower_inc bool, upper_inc bool) (*Span, error) { + _r0, _err := functions.DatespanMake(lower, upper, lower_inc, upper_inc) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToTstzspan is MEOS datespan_to_tstzspan. +func (x *DateSpan) ToTstzspan() (*Span, error) { + _r0, _err := functions.DatespanToTstzspan(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Lower is MEOS datespan_lower. +func (x *DateSpan) Lower() (int32, error) { + _r0, _err := functions.DatespanLower(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Upper is MEOS datespan_upper. +func (x *DateSpan) Upper() (int32, error) { + _r0, _err := functions.DatespanUpper(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ShiftScale is MEOS datespan_shift_scale. +func (x *DateSpan) ShiftScale(shift int, width int, hasshift bool, haswidth bool) (*Span, error) { + _r0, _err := functions.DatespanShiftScale(functions.SpanFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} diff --git a/types/datespanset.go b/types/datespanset.go new file mode 100644 index 0000000..ec592d3 --- /dev/null +++ b/types/datespanset.go @@ -0,0 +1,126 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type DateSpanSet struct { + SpanSet +} + +// DateSpanSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func DateSpanSetFromPointer(p unsafe.Pointer) *DateSpanSet { + if p == nil { + return nil + } + v := &DateSpanSet{} + v.ptr = p + return v +} + +// DateSpanSetIn is MEOS datespanset_in. +func DateSpanSetIn(str string) (*SpanSet, error) { + _r0, _err := functions.DatespansetIn(str) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS datespanset_out. +func (x *DateSpanSet) Out() (string, error) { + _r0, _err := functions.DatespansetOut(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ToTstzspanset is MEOS datespanset_to_tstzspanset. +func (x *DateSpanSet) ToTstzspanset() (*SpanSet, error) { + _r0, _err := functions.DatespansetToTstzspanset(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// DateN is MEOS datespanset_date_n. +func (x *DateSpanSet) DateN(n int) (int32, bool, error) { + _found, _value, _err := functions.DatespansetDateN(functions.SpanSetFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Dates is MEOS datespanset_dates. +func (x *DateSpanSet) Dates() (*Set, error) { + _r0, _err := functions.DatespansetDates(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndDate is MEOS datespanset_end_date. +func (x *DateSpanSet) EndDate() (int32, error) { + _r0, _err := functions.DatespansetEndDate(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Lower is MEOS datespanset_lower. +func (x *DateSpanSet) Lower() (int32, error) { + _r0, _err := functions.DatespansetLower(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// NumDates is MEOS datespanset_num_dates. +func (x *DateSpanSet) NumDates() (int, error) { + _r0, _err := functions.DatespansetNumDates(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartDate is MEOS datespanset_start_date. +func (x *DateSpanSet) StartDate() (int32, error) { + _r0, _err := functions.DatespansetStartDate(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Upper is MEOS datespanset_upper. +func (x *DateSpanSet) Upper() (int32, error) { + _r0, _err := functions.DatespansetUpper(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ShiftScale is MEOS datespanset_shift_scale. +func (x *DateSpanSet) ShiftScale(shift int, width int, hasshift bool, haswidth bool) (*SpanSet, error) { + _r0, _err := functions.DatespansetShiftScale(functions.SpanSetFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} diff --git a/types/floatset.go b/types/floatset.go new file mode 100644 index 0000000..ba8305e --- /dev/null +++ b/types/floatset.go @@ -0,0 +1,144 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type FloatSet struct { + Set +} + +// FloatSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func FloatSetFromPointer(p unsafe.Pointer) *FloatSet { + if p == nil { + return nil + } + v := &FloatSet{} + v.ptr = p + return v +} + +// FloatSetIn is MEOS floatset_in. +func FloatSetIn(str string) (*Set, error) { + _r0, _err := functions.FloatsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS floatset_out. +func (x *FloatSet) Out(maxdd int) (string, error) { + _r0, _err := functions.FloatsetOut(functions.SetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// FloatSetMake is MEOS floatset_make. +func FloatSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.FloatsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToIntset is MEOS floatset_to_intset. +func (x *FloatSet) ToIntset() (*Set, error) { + _r0, _err := functions.FloatsetToIntset(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS floatset_end_value. +func (x *FloatSet) EndValue() (float64, error) { + _r0, _err := functions.FloatsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS floatset_start_value. +func (x *FloatSet) StartValue() (float64, error) { + _r0, _err := functions.FloatsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueN is MEOS floatset_value_n. +func (x *FloatSet) ValueN(n int) (float64, bool, error) { + _found, _value, _err := functions.FloatsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS floatset_values. +func (x *FloatSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.FloatsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Ceil is MEOS floatset_ceil. +func (x *FloatSet) Ceil() (*Set, error) { + _r0, _err := functions.FloatsetCeil(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Degrees is MEOS floatset_degrees. +func (x *FloatSet) Degrees(normalize bool) (*Set, error) { + _r0, _err := functions.FloatsetDegrees(functions.SetFromPointer(x.Pointer()), normalize) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Floor is MEOS floatset_floor. +func (x *FloatSet) Floor() (*Set, error) { + _r0, _err := functions.FloatsetFloor(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Radians is MEOS floatset_radians. +func (x *FloatSet) Radians() (*Set, error) { + _r0, _err := functions.FloatsetRadians(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ShiftScale is MEOS floatset_shift_scale. +func (x *FloatSet) ShiftScale(shift float64, width float64, hasshift bool, haswidth bool) (*Set, error) { + _r0, _err := functions.FloatsetShiftScale(functions.SetFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/floatspan.go b/types/floatspan.go new file mode 100644 index 0000000..748f6b4 --- /dev/null +++ b/types/floatspan.go @@ -0,0 +1,168 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type FloatSpan struct { + Span +} + +// FloatSpanFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func FloatSpanFromPointer(p unsafe.Pointer) *FloatSpan { + if p == nil { + return nil + } + v := &FloatSpan{} + v.ptr = p + return v +} + +// Expand is MEOS floatspan_expand. +func (x *FloatSpan) Expand(value float64) (*Span, error) { + _r0, _err := functions.FloatspanExpand(functions.SpanFromPointer(x.Pointer()), value) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// FloatSpanIn is MEOS floatspan_in. +func FloatSpanIn(str string) (*Span, error) { + _r0, _err := functions.FloatspanIn(str) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS floatspan_out. +func (x *FloatSpan) Out(maxdd int) (string, error) { + _r0, _err := functions.FloatspanOut(functions.SpanFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// FloatSpanMake is MEOS floatspan_make. +func FloatSpanMake(lower float64, upper float64, lower_inc bool, upper_inc bool) (*Span, error) { + _r0, _err := functions.FloatspanMake(lower, upper, lower_inc, upper_inc) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToIntspan is MEOS floatspan_to_intspan. +func (x *FloatSpan) ToIntspan() (*Span, error) { + _r0, _err := functions.FloatspanToIntspan(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToBigintspan is MEOS floatspan_to_bigintspan. +func (x *FloatSpan) ToBigintspan() (*Span, error) { + _r0, _err := functions.FloatspanToBigintspan(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Lower is MEOS floatspan_lower. +func (x *FloatSpan) Lower() (float64, error) { + _r0, _err := functions.FloatspanLower(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Upper is MEOS floatspan_upper. +func (x *FloatSpan) Upper() (float64, error) { + _r0, _err := functions.FloatspanUpper(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Width is MEOS floatspan_width. +func (x *FloatSpan) Width() (float64, error) { + _r0, _err := functions.FloatspanWidth(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Ceil is MEOS floatspan_ceil. +func (x *FloatSpan) Ceil() (*Span, error) { + _r0, _err := functions.FloatspanCeil(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Degrees is MEOS floatspan_degrees. +func (x *FloatSpan) Degrees(normalize bool) (*Span, error) { + _r0, _err := functions.FloatspanDegrees(functions.SpanFromPointer(x.Pointer()), normalize) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Floor is MEOS floatspan_floor. +func (x *FloatSpan) Floor() (*Span, error) { + _r0, _err := functions.FloatspanFloor(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Radians is MEOS floatspan_radians. +func (x *FloatSpan) Radians() (*Span, error) { + _r0, _err := functions.FloatspanRadians(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Round is MEOS floatspan_round. +func (x *FloatSpan) Round(maxdd int) (*Span, error) { + _r0, _err := functions.FloatspanRound(functions.SpanFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ShiftScale is MEOS floatspan_shift_scale. +func (x *FloatSpan) ShiftScale(shift float64, width float64, hasshift bool, haswidth bool) (*Span, error) { + _r0, _err := functions.FloatspanShiftScale(functions.SpanFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Bins is MEOS floatspan_bins. +func (x *FloatSpan) Bins(vsize float64, vorigin float64, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.FloatspanBins(functions.SpanFromPointer(x.Pointer()), vsize, vorigin, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} diff --git a/types/floatspanset.go b/types/floatspanset.go new file mode 100644 index 0000000..a8aa492 --- /dev/null +++ b/types/floatspanset.go @@ -0,0 +1,141 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type FloatSpanSet struct { + SpanSet +} + +// FloatSpanSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func FloatSpanSetFromPointer(p unsafe.Pointer) *FloatSpanSet { + if p == nil { + return nil + } + v := &FloatSpanSet{} + v.ptr = p + return v +} + +// FloatSpanSetIn is MEOS floatspanset_in. +func FloatSpanSetIn(str string) (*SpanSet, error) { + _r0, _err := functions.FloatspansetIn(str) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS floatspanset_out. +func (x *FloatSpanSet) Out(maxdd int) (string, error) { + _r0, _err := functions.FloatspansetOut(functions.SpanSetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ToIntspanset is MEOS floatspanset_to_intspanset. +func (x *FloatSpanSet) ToIntspanset() (*SpanSet, error) { + _r0, _err := functions.FloatspansetToIntspanset(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Lower is MEOS floatspanset_lower. +func (x *FloatSpanSet) Lower() (float64, error) { + _r0, _err := functions.FloatspansetLower(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Upper is MEOS floatspanset_upper. +func (x *FloatSpanSet) Upper() (float64, error) { + _r0, _err := functions.FloatspansetUpper(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Width is MEOS floatspanset_width. +func (x *FloatSpanSet) Width(boundspan bool) (float64, error) { + _r0, _err := functions.FloatspansetWidth(functions.SpanSetFromPointer(x.Pointer()), boundspan) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Ceil is MEOS floatspanset_ceil. +func (x *FloatSpanSet) Ceil() (*SpanSet, error) { + _r0, _err := functions.FloatspansetCeil(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Floor is MEOS floatspanset_floor. +func (x *FloatSpanSet) Floor() (*SpanSet, error) { + _r0, _err := functions.FloatspansetFloor(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Degrees is MEOS floatspanset_degrees. +func (x *FloatSpanSet) Degrees(normalize bool) (*SpanSet, error) { + _r0, _err := functions.FloatspansetDegrees(functions.SpanSetFromPointer(x.Pointer()), normalize) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Radians is MEOS floatspanset_radians. +func (x *FloatSpanSet) Radians() (*SpanSet, error) { + _r0, _err := functions.FloatspansetRadians(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Round is MEOS floatspanset_round. +func (x *FloatSpanSet) Round(maxdd int) (*SpanSet, error) { + _r0, _err := functions.FloatspansetRound(functions.SpanSetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// ShiftScale is MEOS floatspanset_shift_scale. +func (x *FloatSpanSet) ShiftScale(shift float64, width float64, hasshift bool, haswidth bool) (*SpanSet, error) { + _r0, _err := functions.FloatspansetShiftScale(functions.SpanSetFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Bins is MEOS floatspanset_bins. +func (x *FloatSpanSet) Bins(vsize float64, vorigin float64, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.FloatspansetBins(functions.SpanSetFromPointer(x.Pointer()), vsize, vorigin, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} diff --git a/types/geo.go b/types/geo.go new file mode 100644 index 0000000..51c20a0 --- /dev/null +++ b/types/geo.go @@ -0,0 +1,402 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Geo struct { + Value +} + +// GeoFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func GeoFromPointer(p unsafe.Pointer) *Geo { + if p == nil { + return nil + } + v := &Geo{} + v.ptr = p + return v +} + +// GeoAsEWKB is MEOS geo_as_ewkb. +func GeoAsEWKB(gs *TRGeometrySeqSet, endian string, size unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.GeoAsEWKB(functions.GeomFromPointer(gs.Pointer()), endian, size) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// GeoAsEWKT is MEOS geo_as_ewkt. +func GeoAsEWKT(gs *TRGeometrySeqSet, precision int) (string, error) { + _r0, _err := functions.GeoAsEWKT(functions.GeomFromPointer(gs.Pointer()), precision) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// GeoAsGEOJSON is MEOS geo_as_geojson. +func GeoAsGEOJSON(gs *TRGeometrySeqSet, option int, precision int, srs string) (string, error) { + _r0, _err := functions.GeoAsGeojson(functions.GeomFromPointer(gs.Pointer()), option, precision, srs) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// GeoAsHEXEWKB is MEOS geo_as_hexewkb. +func GeoAsHEXEWKB(gs *TRGeometrySeqSet, endian string) (string, error) { + _r0, _err := functions.GeoAsHexewkb(functions.GeomFromPointer(gs.Pointer()), endian) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// GeoAsText is MEOS geo_as_text. +func GeoAsText(gs *TRGeometrySeqSet, precision int) (string, error) { + _r0, _err := functions.GeoAsText(functions.GeomFromPointer(gs.Pointer()), precision) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// GeoFromEWKB is MEOS geo_from_ewkb. +func GeoFromEWKB(wkb unsafe.Pointer, wkb_size uint, srid int32) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoFromEWKB(wkb, wkb_size, srid) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoFromGEOJSON is MEOS geo_from_geojson. +func GeoFromGEOJSON(geojson string) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoFromGeojson(geojson) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoFromText is MEOS geo_from_text. +func GeoFromText(wkt string, srid int32) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoFromText(wkt, srid) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoOut is MEOS geo_out. +func GeoOut(gs *TRGeometrySeqSet) (string, error) { + _r0, _err := functions.GeoOut(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// GeoCopy is MEOS geo_copy. +func GeoCopy(gs *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoCopy(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoIsEmpty is MEOS geo_is_empty. +func GeoIsEmpty(gs *TRGeometrySeqSet) (bool, error) { + _r0, _err := functions.GeoIsEmpty(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeoIsUnitary is MEOS geo_is_unitary. +func GeoIsUnitary(gs *TRGeometrySeqSet) (bool, error) { + _r0, _err := functions.GeoIsUnitary(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeoTypename is MEOS geo_typename. +func GeoTypename(type_ int) (string, error) { + _r0, _err := functions.GeoTypename(type_) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// GeoReverse is MEOS geo_reverse. +func GeoReverse(gs *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoReverse(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoRound is MEOS geo_round. +func GeoRound(gs *TRGeometrySeqSet, maxdd int) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoRound(functions.GeomFromPointer(gs.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoSetSRID is MEOS geo_set_srid. +func GeoSetSRID(gs *TRGeometrySeqSet, srid int32) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoSetSRID(functions.GeomFromPointer(gs.Pointer()), srid) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoSRID is MEOS geo_srid. +func GeoSRID(gs *TRGeometrySeqSet) (int32, error) { + _r0, _err := functions.GeoSRID(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeoTransform is MEOS geo_transform. +func GeoTransform(geom *TRGeometrySeqSet, srid_to int32) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoTransform(functions.GeomFromPointer(geom.Pointer()), srid_to) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoTransformPipeline is MEOS geo_transform_pipeline. +func GeoTransformPipeline(gs *TRGeometrySeqSet, pipeline string, srid_to int32, is_forward bool) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoTransformPipeline(functions.GeomFromPointer(gs.Pointer()), pipeline, srid_to, is_forward) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoCollectGarray is MEOS geo_collect_garray. +func GeoCollectGarray(gsarr unsafe.Pointer, count int) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoCollectGarray(gsarr, count) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoMakelineGarray is MEOS geo_makeline_garray. +func GeoMakelineGarray(gsarr unsafe.Pointer, count int) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoMakelineGarray(gsarr, count) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoNumPoints is MEOS geo_num_points. +func GeoNumPoints(gs *TRGeometrySeqSet) (int, error) { + _r0, _err := functions.GeoNumPoints(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeoNumGeos is MEOS geo_num_geos. +func GeoNumGeos(gs *TRGeometrySeqSet) (int, error) { + _r0, _err := functions.GeoNumGeos(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeoGeoN is MEOS geo_geo_n. +func GeoGeoN(geom *TRGeometrySeqSet, n int) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoGeoN(functions.GeomFromPointer(geom.Pointer()), n) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoPointarr is MEOS geo_pointarr. +func GeoPointarr(gs *TRGeometrySeqSet, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.GeoPointarr(functions.GeomFromPointer(gs.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// GeoPoints is MEOS geo_points. +func GeoPoints(gs *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeoPoints(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeoStboxes is MEOS geo_stboxes. +func GeoStboxes(gs *TRGeometrySeqSet, count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.GeoStboxes(functions.GeomFromPointer(gs.Pointer()), count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// GeoSplitEachNStboxes is MEOS geo_split_each_n_stboxes. +func GeoSplitEachNStboxes(gs *TRGeometrySeqSet, elem_count int, count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.GeoSplitEachNStboxes(functions.GeomFromPointer(gs.Pointer()), elem_count, count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// GeoSplitNStboxes is MEOS geo_split_n_stboxes. +func GeoSplitNStboxes(gs *TRGeometrySeqSet, box_count int, count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.GeoSplitNStboxes(functions.GeomFromPointer(gs.Pointer()), box_count, count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// GeoEquals is MEOS geo_equals. +func GeoEquals(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (int, error) { + _r0, _err := functions.GeoEquals(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeoSame is MEOS geo_same. +func GeoSame(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (bool, error) { + _r0, _err := functions.GeoSame(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeoToSet is MEOS geo_to_set. +func GeoToSet(gs *TRGeometrySeqSet) (*Set, error) { + _r0, _err := functions.GeoToSet(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// GeoTimestamptzToStbox is MEOS geo_timestamptz_to_stbox. +func GeoTimestamptzToStbox(gs *TRGeometrySeqSet, t int64) (*STBox, error) { + _r0, _err := functions.GeoTimestamptzToSTBOX(functions.GeomFromPointer(gs.Pointer()), t) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// GeoTstzspanToStbox is MEOS geo_tstzspan_to_stbox. +func GeoTstzspanToStbox(gs *TRGeometrySeqSet, s *Span) (*STBox, error) { + _r0, _err := functions.GeoTstzspanToSTBOX(functions.GeomFromPointer(gs.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// GeoToStbox is MEOS geo_to_stbox. +func GeoToStbox(gs *TRGeometrySeqSet) (*STBox, error) { + _r0, _err := functions.GeoToSTBOX(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// GeoClusterKmeans is MEOS geo_cluster_kmeans. +func GeoClusterKmeans(geoms unsafe.Pointer, ngeoms uint32, k uint32, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.GeoClusterKmeans(geoms, ngeoms, k, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// GeoClusterDbscan is MEOS geo_cluster_dbscan. +func GeoClusterDbscan(geoms unsafe.Pointer, ngeoms uint32, tolerance float64, minpoints int, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.GeoClusterDbscan(geoms, ngeoms, tolerance, minpoints, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// GeoClusterIntersecting is MEOS geo_cluster_intersecting. +func GeoClusterIntersecting(geoms unsafe.Pointer, ngeoms uint32, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.GeoClusterIntersecting(geoms, ngeoms, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// GeoClusterWithin is MEOS geo_cluster_within. +func GeoClusterWithin(geoms unsafe.Pointer, ngeoms uint32, tolerance float64, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.GeoClusterWithin(geoms, ngeoms, tolerance, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// GeoToH3indexCell is MEOS geo_to_h3index_cell. +func GeoToH3indexCell(point *TRGeometrySeqSet, resolution int32) (uint64, error) { + _r0, _err := functions.GeoToH3indexCell(functions.GeomFromPointer(point.Pointer()), resolution) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeoToH3indexSet is MEOS geo_to_h3index_set. +func GeoToH3indexSet(gs *TRGeometrySeqSet, resolution int32) (*Set, error) { + _r0, _err := functions.GeoToH3indexSet(functions.GeomFromPointer(gs.Pointer()), resolution) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// GeoToQuadbinCell is MEOS geo_to_quadbin_cell. +func GeoToQuadbinCell(point *TRGeometrySeqSet, resolution int32) (uint64, error) { + _r0, _err := functions.GeoToQuadbinCell(functions.GeomFromPointer(point.Pointer()), resolution) + if _err != nil { + return 0, _err + } + return _r0, nil +} diff --git a/types/geography.go b/types/geography.go new file mode 100644 index 0000000..cb18390 --- /dev/null +++ b/types/geography.go @@ -0,0 +1,114 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Geography struct { + Geo +} + +// GeographyFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func GeographyFromPointer(p unsafe.Pointer) *Geography { + if p == nil { + return nil + } + v := &Geography{} + v.ptr = p + return v +} + +// GeographyFromHEXEWKB is MEOS geog_from_hexewkb. +func GeographyFromHEXEWKB(wkt string) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeogFromHexewkb(wkt) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeographyIn is MEOS geog_in. +func GeographyIn(str string, typmod int32) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeogIn(str, typmod) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeographyToGeom is MEOS geog_to_geom. +func GeographyToGeom(geog *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeogToGeom(functions.GeomFromPointer(geog.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeographyArea is MEOS geog_area. +func GeographyArea(gs *TRGeometrySeqSet, use_spheroid bool) (float64, error) { + _r0, _err := functions.GeogArea(functions.GeomFromPointer(gs.Pointer()), use_spheroid) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeographyCentroid is MEOS geog_centroid. +func GeographyCentroid(gs *TRGeometrySeqSet, use_spheroid bool) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeogCentroid(functions.GeomFromPointer(gs.Pointer()), use_spheroid) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeographyLength is MEOS geog_length. +func GeographyLength(gs *TRGeometrySeqSet, use_spheroid bool) (float64, error) { + _r0, _err := functions.GeogLength(functions.GeomFromPointer(gs.Pointer()), use_spheroid) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeographyPerimeter is MEOS geog_perimeter. +func GeographyPerimeter(gs *TRGeometrySeqSet, use_spheroid bool) (float64, error) { + _r0, _err := functions.GeogPerimeter(functions.GeomFromPointer(gs.Pointer()), use_spheroid) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeographyArrayUnion is MEOS geog_array_union. +func GeographyArrayUnion(gsarr unsafe.Pointer, count int) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeogArrayUnion(gsarr, count) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeographyDwithin is MEOS geog_dwithin. +func GeographyDwithin(g1 *TRGeometrySeqSet, g2 *TRGeometrySeqSet, tolerance float64, use_spheroid bool) (bool, error) { + _r0, _err := functions.GeogDwithin(functions.GeomFromPointer(g1.Pointer()), functions.GeomFromPointer(g2.Pointer()), tolerance, use_spheroid) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeographyDistance is MEOS geog_distance. +func GeographyDistance(g1 *TRGeometrySeqSet, g2 *TRGeometrySeqSet) (float64, error) { + _r0, _err := functions.GeogDistance(functions.GeomFromPointer(g1.Pointer()), functions.GeomFromPointer(g2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} diff --git a/types/geogset.go b/types/geogset.go new file mode 100644 index 0000000..f56730e --- /dev/null +++ b/types/geogset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type GeogSet struct { + Set +} + +// GeogSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func GeogSetFromPointer(p unsafe.Pointer) *GeogSet { + if p == nil { + return nil + } + v := &GeogSet{} + v.ptr = p + return v +} + +// GeogSetIn is MEOS geogset_in. +func GeogSetIn(str string) (*Set, error) { + _r0, _err := functions.GeogsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/geometry.go b/types/geometry.go new file mode 100644 index 0000000..1b20685 --- /dev/null +++ b/types/geometry.go @@ -0,0 +1,360 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Geometry struct { + Geo +} + +// GeometryFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func GeometryFromPointer(p unsafe.Pointer) *Geometry { + if p == nil { + return nil + } + v := &Geometry{} + v.ptr = p + return v +} + +// GeometryFromHEXEWKB is MEOS geom_from_hexewkb. +func GeometryFromHEXEWKB(wkt string) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomFromHexewkb(wkt) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryIn is MEOS geom_in. +func GeometryIn(str string, typmod int32) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomIn(str, typmod) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryToGeog is MEOS geom_to_geog. +func GeometryToGeog(geom *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomToGeog(functions.GeomFromPointer(geom.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryAzimuth is MEOS geom_azimuth. +func GeometryAzimuth(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (float64, bool, error) { + _found, _value, _err := functions.GeomAzimuth(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// GeometryArea is MEOS geom_area. +func GeometryArea(gs *TRGeometrySeqSet) (float64, error) { + _r0, _err := functions.GeomArea(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeometryLength is MEOS geom_length. +func GeometryLength(gs *TRGeometrySeqSet) (float64, error) { + _r0, _err := functions.GeomLength(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeometryPerimeter is MEOS geom_perimeter. +func GeometryPerimeter(gs *TRGeometrySeqSet) (float64, error) { + _r0, _err := functions.GeomPerimeter(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeometryArrayUnion is MEOS geom_array_union. +func GeometryArrayUnion(gsarr unsafe.Pointer, count int) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomArrayUnion(gsarr, count) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryBoundary is MEOS geom_boundary. +func GeometryBoundary(gs *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomBoundary(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryBuffer is MEOS geom_buffer. +func GeometryBuffer(gs *TRGeometrySeqSet, size float64, params string) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomBuffer(functions.GeomFromPointer(gs.Pointer()), size, params) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryCentroid is MEOS geom_centroid. +func GeometryCentroid(gs *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomCentroid(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryConvexHull is MEOS geom_convex_hull. +func GeometryConvexHull(gs *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomConvexHull(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryDifference2d is MEOS geom_difference2d. +func GeometryDifference2d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomDifference2d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryIsSimple is MEOS geom_is_simple. +func GeometryIsSimple(gs *TRGeometrySeqSet) (bool, error) { + _r0, _err := functions.GeomIsSimple(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeometryIntersection2d is MEOS geom_intersection2d. +func GeometryIntersection2d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomIntersection2d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryIntersection2dColl is MEOS geom_intersection2d_coll. +func GeometryIntersection2dColl(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomIntersection2dColl(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryMinBoundingRadius is MEOS geom_min_bounding_radius. +func GeometryMinBoundingRadius(geom *TRGeometrySeqSet, radius unsafe.Pointer) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomMinBoundingRadius(functions.GeomFromPointer(geom.Pointer()), radius) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryOrientedEnvelope is MEOS geom_oriented_envelope. +func GeometryOrientedEnvelope(gs *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomOrientedEnvelope(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryShortestline2d is MEOS geom_shortestline2d. +func GeometryShortestline2d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomShortestline2d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryShortestline3d is MEOS geom_shortestline3d. +func GeometryShortestline3d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomShortestline3d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryUnaryUnion is MEOS geom_unary_union. +func GeometryUnaryUnion(gs *TRGeometrySeqSet, prec float64) (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeomUnaryUnion(functions.GeomFromPointer(gs.Pointer()), prec) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// GeometryCovers is MEOS geom_covers. +func GeometryCovers(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (bool, error) { + _r0, _err := functions.GeomCovers(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeometryDisjoint2d is MEOS geom_disjoint2d. +func GeometryDisjoint2d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (bool, error) { + _r0, _err := functions.GeomDisjoint2d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeometryDwithin is MEOS geom_dwithin. +func GeometryDwithin(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet, tolerance float64) (bool, error) { + _r0, _err := functions.GeomDwithin(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer()), tolerance) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeometryDwithin2d is MEOS geom_dwithin2d. +func GeometryDwithin2d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet, tolerance float64) (bool, error) { + _r0, _err := functions.GeomDwithin2d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer()), tolerance) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeometryDwithin3d is MEOS geom_dwithin3d. +func GeometryDwithin3d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet, tolerance float64) (bool, error) { + _r0, _err := functions.GeomDwithin3d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer()), tolerance) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeometryIntersects2d is MEOS geom_intersects2d. +func GeometryIntersects2d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (bool, error) { + _r0, _err := functions.GeomIntersects2d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeometryIntersects3d is MEOS geom_intersects3d. +func GeometryIntersects3d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (bool, error) { + _r0, _err := functions.GeomIntersects3d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeometryRelate is MEOS geom_relate. +func GeometryRelate(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (string, error) { + _r0, _err := functions.GeomRelate(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// GeometryRelatePattern is MEOS geom_relate_pattern. +func GeometryRelatePattern(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet, patt string) (bool, error) { + _r0, _err := functions.GeomRelatePattern(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer()), patt) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeometryTouches is MEOS geom_touches. +func GeometryTouches(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (bool, error) { + _r0, _err := functions.GeomTouches(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GeometryDistance2d is MEOS geom_distance2d. +func GeometryDistance2d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (float64, error) { + _r0, _err := functions.GeomDistance2d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeometryMaxDistance2d is MEOS geom_max_distance2d. +func GeometryMaxDistance2d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (float64, error) { + _r0, _err := functions.GeomMaxDistance2d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeometryDistance3d is MEOS geom_distance3d. +func GeometryDistance3d(gs1 *TRGeometrySeqSet, gs2 *TRGeometrySeqSet) (float64, error) { + _r0, _err := functions.GeomDistance3d(functions.GeomFromPointer(gs1.Pointer()), functions.GeomFromPointer(gs2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GeometryToCbuffer is MEOS geom_to_cbuffer. +func GeometryToCbuffer(gs *TRGeometrySeqSet) (*Cbuffer, error) { + _r0, _err := functions.GeomToCbuffer(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// GeometryToNsegment is MEOS geom_to_nsegment. +func GeometryToNsegment(gs *TRGeometrySeqSet) (*Nsegment, error) { + _r0, _err := functions.GeomToNsegment(functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return NsegmentFromPointer(_r0.Pointer()), nil +} + +// GeometryTposeToTrgeometry is MEOS geometry_tpose_to_trgeometry. +func GeometryTposeToTrgeometry(gs *TRGeometrySeqSet, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.GeometryTposeToTrgeometry(functions.GeomFromPointer(gs.Pointer()), functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/geomset.go b/types/geomset.go new file mode 100644 index 0000000..da0d951 --- /dev/null +++ b/types/geomset.go @@ -0,0 +1,81 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type GeomSet struct { + Set +} + +// GeomSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func GeomSetFromPointer(p unsafe.Pointer) *GeomSet { + if p == nil { + return nil + } + v := &GeomSet{} + v.ptr = p + return v +} + +// GeomSetIn is MEOS geomset_in. +func GeomSetIn(str string) (*Set, error) { + _r0, _err := functions.GeomsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// GeomSetMake is MEOS geoset_make. +func GeomSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.GeosetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS geoset_end_value. +func (x *GeomSet) EndValue() (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeosetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS geoset_start_value. +func (x *GeomSet) StartValue() (*TRGeometrySeqSet, error) { + _r0, _err := functions.GeosetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ValueN is MEOS geoset_value_n. +func (x *GeomSet) ValueN(n int) (*TRGeometrySeqSet, bool, error) { + _found, _value, _err := functions.GeosetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return TRGeometrySeqSetFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS geoset_values. +func (x *GeomSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.GeosetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} diff --git a/types/intset.go b/types/intset.go new file mode 100644 index 0000000..394846a --- /dev/null +++ b/types/intset.go @@ -0,0 +1,108 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type IntSet struct { + Set +} + +// IntSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func IntSetFromPointer(p unsafe.Pointer) *IntSet { + if p == nil { + return nil + } + v := &IntSet{} + v.ptr = p + return v +} + +// IntSetIn is MEOS intset_in. +func IntSetIn(str string) (*Set, error) { + _r0, _err := functions.IntsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS intset_out. +func (x *IntSet) Out() (string, error) { + _r0, _err := functions.IntsetOut(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// IntSetMake is MEOS intset_make. +func IntSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.IntsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToFloatset is MEOS intset_to_floatset. +func (x *IntSet) ToFloatset() (*Set, error) { + _r0, _err := functions.IntsetToFloatset(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS intset_end_value. +func (x *IntSet) EndValue() (int, error) { + _r0, _err := functions.IntsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS intset_start_value. +func (x *IntSet) StartValue() (int, error) { + _r0, _err := functions.IntsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueN is MEOS intset_value_n. +func (x *IntSet) ValueN(n int) (int, bool, error) { + _found, _value, _err := functions.IntsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS intset_values. +func (x *IntSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.IntsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ShiftScale is MEOS intset_shift_scale. +func (x *IntSet) ShiftScale(shift int, width int, hasshift bool, haswidth bool) (*Set, error) { + _r0, _err := functions.IntsetShiftScale(functions.SetFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/intspan.go b/types/intspan.go new file mode 100644 index 0000000..a40fa7c --- /dev/null +++ b/types/intspan.go @@ -0,0 +1,123 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type IntSpan struct { + Span +} + +// IntSpanFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func IntSpanFromPointer(p unsafe.Pointer) *IntSpan { + if p == nil { + return nil + } + v := &IntSpan{} + v.ptr = p + return v +} + +// Expand is MEOS intspan_expand. +func (x *IntSpan) Expand(value int32) (*Span, error) { + _r0, _err := functions.IntspanExpand(functions.SpanFromPointer(x.Pointer()), value) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// IntSpanIn is MEOS intspan_in. +func IntSpanIn(str string) (*Span, error) { + _r0, _err := functions.IntspanIn(str) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS intspan_out. +func (x *IntSpan) Out() (string, error) { + _r0, _err := functions.IntspanOut(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// IntSpanMake is MEOS intspan_make. +func IntSpanMake(lower int, upper int, lower_inc bool, upper_inc bool) (*Span, error) { + _r0, _err := functions.IntspanMake(lower, upper, lower_inc, upper_inc) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToFloatspan is MEOS intspan_to_floatspan. +func (x *IntSpan) ToFloatspan() (*Span, error) { + _r0, _err := functions.IntspanToFloatspan(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToBigintspan is MEOS intspan_to_bigintspan. +func (x *IntSpan) ToBigintspan() (*Span, error) { + _r0, _err := functions.IntspanToBigintspan(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Lower is MEOS intspan_lower. +func (x *IntSpan) Lower() (int, error) { + _r0, _err := functions.IntspanLower(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Upper is MEOS intspan_upper. +func (x *IntSpan) Upper() (int, error) { + _r0, _err := functions.IntspanUpper(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Width is MEOS intspan_width. +func (x *IntSpan) Width() (int, error) { + _r0, _err := functions.IntspanWidth(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ShiftScale is MEOS intspan_shift_scale. +func (x *IntSpan) ShiftScale(shift int, width int, hasshift bool, haswidth bool) (*Span, error) { + _r0, _err := functions.IntspanShiftScale(functions.SpanFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Bins is MEOS intspan_bins. +func (x *IntSpan) Bins(vsize int, vorigin int, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.IntspanBins(functions.SpanFromPointer(x.Pointer()), vsize, vorigin, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} diff --git a/types/intspanset.go b/types/intspanset.go new file mode 100644 index 0000000..4aa9aaf --- /dev/null +++ b/types/intspanset.go @@ -0,0 +1,96 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type IntSpanSet struct { + SpanSet +} + +// IntSpanSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func IntSpanSetFromPointer(p unsafe.Pointer) *IntSpanSet { + if p == nil { + return nil + } + v := &IntSpanSet{} + v.ptr = p + return v +} + +// IntSpanSetIn is MEOS intspanset_in. +func IntSpanSetIn(str string) (*SpanSet, error) { + _r0, _err := functions.IntspansetIn(str) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS intspanset_out. +func (x *IntSpanSet) Out() (string, error) { + _r0, _err := functions.IntspansetOut(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ToFloatspanset is MEOS intspanset_to_floatspanset. +func (x *IntSpanSet) ToFloatspanset() (*SpanSet, error) { + _r0, _err := functions.IntspansetToFloatspanset(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Lower is MEOS intspanset_lower. +func (x *IntSpanSet) Lower() (int, error) { + _r0, _err := functions.IntspansetLower(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Upper is MEOS intspanset_upper. +func (x *IntSpanSet) Upper() (int, error) { + _r0, _err := functions.IntspansetUpper(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Width is MEOS intspanset_width. +func (x *IntSpanSet) Width(boundspan bool) (int, error) { + _r0, _err := functions.IntspansetWidth(functions.SpanSetFromPointer(x.Pointer()), boundspan) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ShiftScale is MEOS intspanset_shift_scale. +func (x *IntSpanSet) ShiftScale(shift int, width int, hasshift bool, haswidth bool) (*SpanSet, error) { + _r0, _err := functions.IntspansetShiftScale(functions.SpanSetFromPointer(x.Pointer()), shift, width, hasshift, haswidth) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Bins is MEOS intspanset_bins. +func (x *IntSpanSet) Bins(vsize int, vorigin int, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.IntspansetBins(functions.SpanSetFromPointer(x.Pointer()), vsize, vorigin, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} diff --git a/types/jsonb.go b/types/jsonb.go new file mode 100644 index 0000000..f18012f --- /dev/null +++ b/types/jsonb.go @@ -0,0 +1,429 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Jsonb struct { + Value +} + +// JsonbFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func JsonbFromPointer(p unsafe.Pointer) *Jsonb { + if p == nil { + return nil + } + v := &Jsonb{} + v.ptr = p + return v +} + +// JsonbFromText is MEOS jsonb_from_text. +func JsonbFromText(txt string, unique_keys bool) (*Jsonb, error) { + _r0, _err := functions.JsonbFromText(txt, unique_keys) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// JsonbIn is MEOS jsonb_in. +func JsonbIn(str string) (*Jsonb, error) { + _r0, _err := functions.JsonbIn(str) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS jsonb_out. +func (x *Jsonb) Out() (string, error) { + _r0, _err := functions.JsonbOut(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// Copy is MEOS jsonb_copy. +func (x *Jsonb) Copy() (*Jsonb, error) { + _r0, _err := functions.JsonbCopy(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// JsonbMake is MEOS jsonb_make. +func JsonbMake(keys_vals unsafe.Pointer, count int) (*Jsonb, error) { + _r0, _err := functions.JsonbMake(keys_vals, count) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// JsonbMakeTwoArg is MEOS jsonb_make_two_arg. +func JsonbMakeTwoArg(keys unsafe.Pointer, values unsafe.Pointer, count int) (*Jsonb, error) { + _r0, _err := functions.JsonbMakeTwoArg(keys, values, count) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// ToBool is MEOS jsonb_to_bool. +func (x *Jsonb) ToBool() (bool, error) { + _r0, _err := functions.JsonbToBool(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// ToCstring is MEOS jsonb_to_cstring. +func (x *Jsonb) ToCstring() (string, error) { + _r0, _err := functions.JsonbToCstring(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ToInt16 is MEOS jsonb_to_int16. +func (x *Jsonb) ToInt16() (int16, error) { + _r0, _err := functions.JsonbToInt16(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ToInt32 is MEOS jsonb_to_int32. +func (x *Jsonb) ToInt32() (int32, error) { + _r0, _err := functions.JsonbToInt32(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ToInt64 is MEOS jsonb_to_int64. +func (x *Jsonb) ToInt64() (int64, error) { + _r0, _err := functions.JsonbToInt64(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ToText is MEOS jsonb_to_text. +func (x *Jsonb) ToText() (string, error) { + _r0, _err := functions.JsonbToText(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ArrayElement is MEOS jsonb_array_element. +func (x *Jsonb) ArrayElement(element int) (*Jsonb, error) { + _r0, _err := functions.JsonbArrayElement(functions.JsonbFromPointer(x.Pointer()), element) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// ArrayElementText is MEOS jsonb_array_element_text. +func (x *Jsonb) ArrayElementText(element int) (string, error) { + _r0, _err := functions.JsonbArrayElementText(functions.JsonbFromPointer(x.Pointer()), element) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ArrayElements is MEOS jsonb_array_elements. +func (x *Jsonb) ArrayElements(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.JsonbArrayElements(functions.JsonbFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ArrayElementsText is MEOS jsonb_array_elements_text. +func (x *Jsonb) ArrayElementsText(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.JsonbArrayElementsText(functions.JsonbFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ArrayLength is MEOS jsonb_array_length. +func (x *Jsonb) ArrayLength() (int, error) { + _r0, _err := functions.JsonbArrayLength(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Contained is MEOS jsonb_contained. +func (x *Jsonb) Contained(jb2 *Jsonb) (bool, error) { + _r0, _err := functions.JsonbContained(functions.JsonbFromPointer(x.Pointer()), functions.JsonbFromPointer(jb2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Each is MEOS jsonb_each. +func (x *Jsonb) Each(values unsafe.Pointer, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.JsonbEach(functions.JsonbFromPointer(x.Pointer()), values, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// EachText is MEOS jsonb_each_text. +func (x *Jsonb) EachText(values unsafe.Pointer, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.JsonbEachText(functions.JsonbFromPointer(x.Pointer()), values, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Exists is MEOS jsonb_exists. +func (x *Jsonb) Exists(key string) (bool, error) { + _r0, _err := functions.JsonbExists(functions.JsonbFromPointer(x.Pointer()), key) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// ExistsArray is MEOS jsonb_exists_array. +func (x *Jsonb) ExistsArray(keys_elems unsafe.Pointer, keys_len int, any bool) (bool, error) { + _r0, _err := functions.JsonbExistsArray(functions.JsonbFromPointer(x.Pointer()), keys_elems, keys_len, any) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// ExtractPath is MEOS jsonb_extract_path. +func (x *Jsonb) ExtractPath(path_elems unsafe.Pointer, path_len int) (*Jsonb, error) { + _r0, _err := functions.JsonbExtractPath(functions.JsonbFromPointer(x.Pointer()), path_elems, path_len) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// ExtractPathText is MEOS jsonb_extract_path_text. +func (x *Jsonb) ExtractPathText(path_elems unsafe.Pointer, path_len int) (string, error) { + _r0, _err := functions.JsonbExtractPathText(functions.JsonbFromPointer(x.Pointer()), path_elems, path_len) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// Hash is MEOS jsonb_hash. +func (x *Jsonb) Hash() (uint32, error) { + _r0, _err := functions.JsonbHash(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS jsonb_hash_extended. +func (x *Jsonb) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.JsonbHashExtended(functions.JsonbFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ObjectField is MEOS jsonb_object_field. +func (x *Jsonb) ObjectField(key string) (*Jsonb, error) { + _r0, _err := functions.JsonbObjectField(functions.JsonbFromPointer(x.Pointer()), key) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// ObjectFieldText is MEOS jsonb_object_field_text. +func (x *Jsonb) ObjectFieldText(key string) (string, error) { + _r0, _err := functions.JsonbObjectFieldText(functions.JsonbFromPointer(x.Pointer()), key) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ObjectKeys is MEOS jsonb_object_keys. +func (x *Jsonb) ObjectKeys(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.JsonbObjectKeys(functions.JsonbFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Concat is MEOS jsonb_concat. +func (x *Jsonb) Concat(jb2 *Jsonb) (*Jsonb, error) { + _r0, _err := functions.JsonbConcat(functions.JsonbFromPointer(x.Pointer()), functions.JsonbFromPointer(jb2.Pointer())) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// Delete is MEOS jsonb_delete. +func (x *Jsonb) Delete(key string) (*Jsonb, error) { + _r0, _err := functions.JsonbDelete(functions.JsonbFromPointer(x.Pointer()), key) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// DeleteArray is MEOS jsonb_delete_array. +func (x *Jsonb) DeleteArray(keys_elems unsafe.Pointer, keys_len int) (*Jsonb, error) { + _r0, _err := functions.JsonbDeleteArray(functions.JsonbFromPointer(x.Pointer()), keys_elems, keys_len) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// DeleteIndex is MEOS jsonb_delete_index. +func (x *Jsonb) DeleteIndex(idx int) (*Jsonb, error) { + _r0, _err := functions.JsonbDeleteIndex(functions.JsonbFromPointer(x.Pointer()), idx) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// DeletePath is MEOS jsonb_delete_path. +func (x *Jsonb) DeletePath(path_elems unsafe.Pointer, path_len int) (*Jsonb, error) { + _r0, _err := functions.JsonbDeletePath(functions.JsonbFromPointer(x.Pointer()), path_elems, path_len) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// Insert is MEOS jsonb_insert. +func (x *Jsonb) Insert(path_elems unsafe.Pointer, path_len int, newjb *Jsonb, after bool) (*Jsonb, error) { + _r0, _err := functions.JsonbInsert(functions.JsonbFromPointer(x.Pointer()), path_elems, path_len, functions.JsonbFromPointer(newjb.Pointer()), after) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// Pretty is MEOS jsonb_pretty. +func (x *Jsonb) Pretty() (string, error) { + _r0, _err := functions.JsonbPretty(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// Set is MEOS jsonb_set. +func (x *Jsonb) Set(path_elems unsafe.Pointer, path_len int, newjb *Jsonb, create bool) (*Jsonb, error) { + _r0, _err := functions.JsonbSet(functions.JsonbFromPointer(x.Pointer()), path_elems, path_len, functions.JsonbFromPointer(newjb.Pointer()), create) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// SetLax is MEOS jsonb_set_lax. +func (x *Jsonb) SetLax(path_elems unsafe.Pointer, path_len int, newjb *Jsonb, create bool, handle_null string) (*Jsonb, error) { + _r0, _err := functions.JsonbSetLax(functions.JsonbFromPointer(x.Pointer()), path_elems, path_len, functions.JsonbFromPointer(newjb.Pointer()), create, handle_null) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// StripNulls is MEOS jsonb_strip_nulls. +func (x *Jsonb) StripNulls(strip_in_arrays bool) (*Jsonb, error) { + _r0, _err := functions.JsonbStripNulls(functions.JsonbFromPointer(x.Pointer()), strip_in_arrays) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// PathExists is MEOS jsonb_path_exists. +func (x *Jsonb) PathExists(jp *JsonPath, vars *Jsonb, silent bool, tz bool) (int, error) { + _r0, _err := functions.JsonbPathExists(functions.JsonbFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// PathMatch is MEOS jsonb_path_match. +func (x *Jsonb) PathMatch(jp *JsonPath, vars *Jsonb, silent bool, tz bool) (bool, error) { + _r0, _err := functions.JsonbPathMatch(functions.JsonbFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// PathQueryAll is MEOS jsonb_path_query_all. +func (x *Jsonb) PathQueryAll(jp *JsonPath, vars *Jsonb, silent bool, tz bool, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.JsonbPathQueryAll(functions.JsonbFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PathQueryArray is MEOS jsonb_path_query_array. +func (x *Jsonb) PathQueryArray(jp *JsonPath, vars *Jsonb, silent bool, tz bool) (*Jsonb, error) { + _r0, _err := functions.JsonbPathQueryArray(functions.JsonbFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// PathQueryFirst is MEOS jsonb_path_query_first. +func (x *Jsonb) PathQueryFirst(jp *JsonPath, vars *Jsonb, silent bool, tz bool) (*Jsonb, error) { + _r0, _err := functions.JsonbPathQueryFirst(functions.JsonbFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// ToSet is MEOS jsonb_to_set. +func (x *Jsonb) ToSet() (*Set, error) { + _r0, _err := functions.JsonbToSet(functions.JsonbFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/jsonpath.go b/types/jsonpath.go new file mode 100644 index 0000000..8af2c65 --- /dev/null +++ b/types/jsonpath.go @@ -0,0 +1,51 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type JsonPath struct { + Value +} + +// JsonPathFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func JsonPathFromPointer(p unsafe.Pointer) *JsonPath { + if p == nil { + return nil + } + v := &JsonPath{} + v.ptr = p + return v +} + +// JsonPathIn is MEOS jsonpath_in. +func JsonPathIn(str string) (*JsonPath, error) { + _r0, _err := functions.JsonpathIn(str) + if _err != nil { + return nil, _err + } + return JsonPathFromPointer(_r0.Pointer()), nil +} + +// Copy is MEOS jsonpath_copy. +func (x *JsonPath) Copy() (*JsonPath, error) { + _r0, _err := functions.JsonpathCopy(functions.JsonPathFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return JsonPathFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS jsonpath_out. +func (x *JsonPath) Out() (string, error) { + _r0, _err := functions.JsonpathOut(functions.JsonPathFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} diff --git a/types/meos.go b/types/meos.go new file mode 100644 index 0000000..0c925fb --- /dev/null +++ b/types/meos.go @@ -0,0 +1,23 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import "unsafe" + +// handle is the MEOS value every class in this package stands for. +// +// cgo types are package-scoped, so the *C.Temporal the functions package +// holds and one declared here would be DIFFERENT Go types. The untyped +// pointer is the only currency the two packages share, which is why each +// class carries one and hands it across at every call. +type handle struct { + ptr unsafe.Pointer +} + +// Pointer answers the MEOS value this handle stands for, or nil. +func (h *handle) Pointer() unsafe.Pointer { + if h == nil { + return nil + } + return h.ptr +} diff --git a/types/meosarray.go b/types/meosarray.go new file mode 100644 index 0000000..5df69ca --- /dev/null +++ b/types/meosarray.go @@ -0,0 +1,76 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type MeosArray struct { + Value +} + +// MeosArrayFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func MeosArrayFromPointer(p unsafe.Pointer) *MeosArray { + if p == nil { + return nil + } + v := &MeosArray{} + v.ptr = p + return v +} + +// MeosArrayCreate is MEOS meos_array_create. +func MeosArrayCreate(elem_size int) (*MeosArray, error) { + _r0, _err := functions.MeosArrayCreate(elem_size) + if _err != nil { + return nil, _err + } + return MeosArrayFromPointer(_r0.Pointer()), nil +} + +// Add is MEOS meos_array_add. +func (x *MeosArray) Add(value unsafe.Pointer) error { + return functions.MeosArrayAdd(functions.MeosArrayFromPointer(x.Pointer()), value) +} + +// Get is MEOS meos_array_get. +func (x *MeosArray) Get(n int) (unsafe.Pointer, error) { + _r0, _err := functions.MeosArrayGet(functions.MeosArrayFromPointer(x.Pointer()), n) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Count is MEOS meos_array_count. +func (x *MeosArray) Count() (int, error) { + _r0, _err := functions.MeosArrayCount(functions.MeosArrayFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Reset is MEOS meos_array_reset. +func (x *MeosArray) Reset() error { + return functions.MeosArrayReset(functions.MeosArrayFromPointer(x.Pointer())) +} + +// ResetFree is MEOS meos_array_reset_free. +func (x *MeosArray) ResetFree() error { + return functions.MeosArrayResetFree(functions.MeosArrayFromPointer(x.Pointer())) +} + +// Destroy is MEOS meos_array_destroy. +func (x *MeosArray) Destroy() error { + return functions.MeosArrayDestroy(functions.MeosArrayFromPointer(x.Pointer())) +} + +// DestroyFree is MEOS meos_array_destroy_free. +func (x *MeosArray) DestroyFree() error { + return functions.MeosArrayDestroyFree(functions.MeosArrayFromPointer(x.Pointer())) +} diff --git a/types/npoint.go b/types/npoint.go new file mode 100644 index 0000000..3c40f63 --- /dev/null +++ b/types/npoint.go @@ -0,0 +1,285 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Npoint struct { + Value +} + +// NpointFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func NpointFromPointer(p unsafe.Pointer) *Npoint { + if p == nil { + return nil + } + v := &Npoint{} + v.ptr = p + return v +} + +// AsEWKT is MEOS npoint_as_ewkt. +func (x *Npoint) AsEWKT(maxdd int) (string, error) { + _r0, _err := functions.NpointAsEWKT(functions.NpointFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsHEXWKB is MEOS npoint_as_hexwkb. +func (x *Npoint) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { + _r0, _err := functions.NpointAsHexwkb(functions.NpointFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsText is MEOS npoint_as_text. +func (x *Npoint) AsText(maxdd int) (string, error) { + _r0, _err := functions.NpointAsText(functions.NpointFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsWKB is MEOS npoint_as_wkb. +func (x *Npoint) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.NpointAsWKB(functions.NpointFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// NpointFromHEXWKB is MEOS npoint_from_hexwkb. +func NpointFromHEXWKB(hexwkb string) (*Npoint, error) { + _r0, _err := functions.NpointFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return NpointFromPointer(_r0.Pointer()), nil +} + +// NpointFromWKB is MEOS npoint_from_wkb. +func NpointFromWKB(wkb unsafe.Pointer, size uint) (*Npoint, error) { + _r0, _err := functions.NpointFromWKB(wkb, size) + if _err != nil { + return nil, _err + } + return NpointFromPointer(_r0.Pointer()), nil +} + +// NpointIn is MEOS npoint_in. +func NpointIn(str string) (*Npoint, error) { + _r0, _err := functions.NpointIn(str) + if _err != nil { + return nil, _err + } + return NpointFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS npoint_out. +func (x *Npoint) Out(maxdd int) (string, error) { + _r0, _err := functions.NpointOut(functions.NpointFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// NpointMake is MEOS npoint_make. +func NpointMake(rid int64, pos float64) (*Npoint, error) { + _r0, _err := functions.NpointMake(rid, pos) + if _err != nil { + return nil, _err + } + return NpointFromPointer(_r0.Pointer()), nil +} + +// ToGeompoint is MEOS npoint_to_geompoint. +func (x *Npoint) ToGeompoint() (*TRGeometrySeqSet, error) { + _r0, _err := functions.NpointToGeompoint(functions.NpointFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ToNsegment is MEOS npoint_to_nsegment. +func (x *Npoint) ToNsegment() (*Nsegment, error) { + _r0, _err := functions.NpointToNsegment(functions.NpointFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return NsegmentFromPointer(_r0.Pointer()), nil +} + +// ToStbox is MEOS npoint_to_stbox. +func (x *Npoint) ToStbox() (*STBox, error) { + _r0, _err := functions.NpointToSTBOX(functions.NpointFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// Hash is MEOS npoint_hash. +func (x *Npoint) Hash() (uint32, error) { + _r0, _err := functions.NpointHash(functions.NpointFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS npoint_hash_extended. +func (x *Npoint) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.NpointHashExtended(functions.NpointFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Position is MEOS npoint_position. +func (x *Npoint) Position() (float64, error) { + _r0, _err := functions.NpointPosition(functions.NpointFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Route is MEOS npoint_route. +func (x *Npoint) Route() (int64, error) { + _r0, _err := functions.NpointRoute(functions.NpointFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Round is MEOS npoint_round. +func (x *Npoint) Round(maxdd int) (*Npoint, error) { + _r0, _err := functions.NpointRound(functions.NpointFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return NpointFromPointer(_r0.Pointer()), nil +} + +// SRID is MEOS npoint_srid. +func (x *Npoint) SRID() (int32, error) { + _r0, _err := functions.NpointSRID(functions.NpointFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// TimestamptzToStbox is MEOS npoint_timestamptz_to_stbox. +func (x *Npoint) TimestamptzToStbox(t int64) (*STBox, error) { + _r0, _err := functions.NpointTimestamptzToSTBOX(functions.NpointFromPointer(x.Pointer()), t) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// TstzspanToStbox is MEOS npoint_tstzspan_to_stbox. +func (x *Npoint) TstzspanToStbox(s *Span) (*STBox, error) { + _r0, _err := functions.NpointTstzspanToSTBOX(functions.NpointFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// Cmp is MEOS npoint_cmp. +func (x *Npoint) Cmp(np2 *Npoint) (int, error) { + _r0, _err := functions.NpointCmp(functions.NpointFromPointer(x.Pointer()), functions.NpointFromPointer(np2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Eq is MEOS npoint_eq. +func (x *Npoint) Eq(np2 *Npoint) (bool, error) { + _r0, _err := functions.NpointEq(functions.NpointFromPointer(x.Pointer()), functions.NpointFromPointer(np2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ge is MEOS npoint_ge. +func (x *Npoint) Ge(np2 *Npoint) (bool, error) { + _r0, _err := functions.NpointGe(functions.NpointFromPointer(x.Pointer()), functions.NpointFromPointer(np2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Gt is MEOS npoint_gt. +func (x *Npoint) Gt(np2 *Npoint) (bool, error) { + _r0, _err := functions.NpointGt(functions.NpointFromPointer(x.Pointer()), functions.NpointFromPointer(np2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Le is MEOS npoint_le. +func (x *Npoint) Le(np2 *Npoint) (bool, error) { + _r0, _err := functions.NpointLe(functions.NpointFromPointer(x.Pointer()), functions.NpointFromPointer(np2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Lt is MEOS npoint_lt. +func (x *Npoint) Lt(np2 *Npoint) (bool, error) { + _r0, _err := functions.NpointLt(functions.NpointFromPointer(x.Pointer()), functions.NpointFromPointer(np2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ne is MEOS npoint_ne. +func (x *Npoint) Ne(np2 *Npoint) (bool, error) { + _r0, _err := functions.NpointNe(functions.NpointFromPointer(x.Pointer()), functions.NpointFromPointer(np2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Same is MEOS npoint_same. +func (x *Npoint) Same(np2 *Npoint) (bool, error) { + _r0, _err := functions.NpointSame(functions.NpointFromPointer(x.Pointer()), functions.NpointFromPointer(np2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// ToSet is MEOS npoint_to_set. +func (x *Npoint) ToSet() (*Set, error) { + _r0, _err := functions.NpointToSet(functions.NpointFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/npointset.go b/types/npointset.go new file mode 100644 index 0000000..6720a7c --- /dev/null +++ b/types/npointset.go @@ -0,0 +1,99 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type NpointSet struct { + Set +} + +// NpointSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func NpointSetFromPointer(p unsafe.Pointer) *NpointSet { + if p == nil { + return nil + } + v := &NpointSet{} + v.ptr = p + return v +} + +// NpointSetIn is MEOS npointset_in. +func NpointSetIn(str string) (*Set, error) { + _r0, _err := functions.NpointsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS npointset_out. +func (x *NpointSet) Out(maxdd int) (string, error) { + _r0, _err := functions.NpointsetOut(functions.SetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// NpointSetMake is MEOS npointset_make. +func NpointSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.NpointsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS npointset_end_value. +func (x *NpointSet) EndValue() (*Npoint, error) { + _r0, _err := functions.NpointsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return NpointFromPointer(_r0.Pointer()), nil +} + +// Routes is MEOS npointset_routes. +func (x *NpointSet) Routes() (*Set, error) { + _r0, _err := functions.NpointsetRoutes(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS npointset_start_value. +func (x *NpointSet) StartValue() (*Npoint, error) { + _r0, _err := functions.NpointsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return NpointFromPointer(_r0.Pointer()), nil +} + +// ValueN is MEOS npointset_value_n. +func (x *NpointSet) ValueN(n int) (*Npoint, bool, error) { + _found, _value, _err := functions.NpointsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return NpointFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS npointset_values. +func (x *NpointSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.NpointsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} diff --git a/types/nsegment.go b/types/nsegment.go new file mode 100644 index 0000000..63d9521 --- /dev/null +++ b/types/nsegment.go @@ -0,0 +1,177 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Nsegment struct { + Value +} + +// NsegmentFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func NsegmentFromPointer(p unsafe.Pointer) *Nsegment { + if p == nil { + return nil + } + v := &Nsegment{} + v.ptr = p + return v +} + +// NsegmentIn is MEOS nsegment_in. +func NsegmentIn(str string) (*Nsegment, error) { + _r0, _err := functions.NsegmentIn(str) + if _err != nil { + return nil, _err + } + return NsegmentFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS nsegment_out. +func (x *Nsegment) Out(maxdd int) (string, error) { + _r0, _err := functions.NsegmentOut(functions.NsegmentFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// NsegmentMake is MEOS nsegment_make. +func NsegmentMake(rid int64, pos1 float64, pos2 float64) (*Nsegment, error) { + _r0, _err := functions.NsegmentMake(rid, pos1, pos2) + if _err != nil { + return nil, _err + } + return NsegmentFromPointer(_r0.Pointer()), nil +} + +// ToGeom is MEOS nsegment_to_geom. +func (x *Nsegment) ToGeom() (*TRGeometrySeqSet, error) { + _r0, _err := functions.NsegmentToGeom(functions.NsegmentFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ToStbox is MEOS nsegment_to_stbox. +func (x *Nsegment) ToStbox() (*STBox, error) { + _r0, _err := functions.NsegmentToSTBOX(functions.NsegmentFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// EndPosition is MEOS nsegment_end_position. +func (x *Nsegment) EndPosition() (float64, error) { + _r0, _err := functions.NsegmentEndPosition(functions.NsegmentFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Route is MEOS nsegment_route. +func (x *Nsegment) Route() (int64, error) { + _r0, _err := functions.NsegmentRoute(functions.NsegmentFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartPosition is MEOS nsegment_start_position. +func (x *Nsegment) StartPosition() (float64, error) { + _r0, _err := functions.NsegmentStartPosition(functions.NsegmentFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Round is MEOS nsegment_round. +func (x *Nsegment) Round(maxdd int) (*Nsegment, error) { + _r0, _err := functions.NsegmentRound(functions.NsegmentFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return NsegmentFromPointer(_r0.Pointer()), nil +} + +// SRID is MEOS nsegment_srid. +func (x *Nsegment) SRID() (int32, error) { + _r0, _err := functions.NsegmentSRID(functions.NsegmentFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Cmp is MEOS nsegment_cmp. +func (x *Nsegment) Cmp(ns2 *Nsegment) (int, error) { + _r0, _err := functions.NsegmentCmp(functions.NsegmentFromPointer(x.Pointer()), functions.NsegmentFromPointer(ns2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Eq is MEOS nsegment_eq. +func (x *Nsegment) Eq(ns2 *Nsegment) (bool, error) { + _r0, _err := functions.NsegmentEq(functions.NsegmentFromPointer(x.Pointer()), functions.NsegmentFromPointer(ns2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ge is MEOS nsegment_ge. +func (x *Nsegment) Ge(ns2 *Nsegment) (bool, error) { + _r0, _err := functions.NsegmentGe(functions.NsegmentFromPointer(x.Pointer()), functions.NsegmentFromPointer(ns2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Gt is MEOS nsegment_gt. +func (x *Nsegment) Gt(ns2 *Nsegment) (bool, error) { + _r0, _err := functions.NsegmentGt(functions.NsegmentFromPointer(x.Pointer()), functions.NsegmentFromPointer(ns2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Le is MEOS nsegment_le. +func (x *Nsegment) Le(ns2 *Nsegment) (bool, error) { + _r0, _err := functions.NsegmentLe(functions.NsegmentFromPointer(x.Pointer()), functions.NsegmentFromPointer(ns2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Lt is MEOS nsegment_lt. +func (x *Nsegment) Lt(ns2 *Nsegment) (bool, error) { + _r0, _err := functions.NsegmentLt(functions.NsegmentFromPointer(x.Pointer()), functions.NsegmentFromPointer(ns2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ne is MEOS nsegment_ne. +func (x *Nsegment) Ne(ns2 *Nsegment) (bool, error) { + _r0, _err := functions.NsegmentNe(functions.NsegmentFromPointer(x.Pointer()), functions.NsegmentFromPointer(ns2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} diff --git a/types/pcpatch.go b/types/pcpatch.go new file mode 100644 index 0000000..1ca4211 --- /dev/null +++ b/types/pcpatch.go @@ -0,0 +1,177 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Pcpatch struct { + Value +} + +// PcpatchFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func PcpatchFromPointer(p unsafe.Pointer) *Pcpatch { + if p == nil { + return nil + } + v := &Pcpatch{} + v.ptr = p + return v +} + +// PcpatchHexIn is MEOS pcpatch_hex_in. +func PcpatchHexIn(str string) (*Pcpatch, error) { + _r0, _err := functions.PcpatchHexIn(str) + if _err != nil { + return nil, _err + } + return PcpatchFromPointer(_r0.Pointer()), nil +} + +// HexOut is MEOS pcpatch_hex_out. +func (x *Pcpatch) HexOut(maxdd int) (string, error) { + _r0, _err := functions.PcpatchHexOut(functions.PcpatchFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PcpatchFromHEXWKB is MEOS pcpatch_from_hexwkb. +func PcpatchFromHEXWKB(hexwkb string) (*Pcpatch, error) { + _r0, _err := functions.PcpatchFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return PcpatchFromPointer(_r0.Pointer()), nil +} + +// AsHEXWKB is MEOS pcpatch_as_hexwkb. +func (x *Pcpatch) AsHEXWKB() (string, error) { + _r0, _err := functions.PcpatchAsHexwkb(functions.PcpatchFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PcpatchMake is MEOS pcpatch_make. +func PcpatchMake(points unsafe.Pointer, count int) (*Pcpatch, error) { + _r0, _err := functions.PcpatchMake(points, count) + if _err != nil { + return nil, _err + } + return PcpatchFromPointer(_r0.Pointer()), nil +} + +// PcpatchMakeCoords is MEOS pcpatch_make_coords. +func PcpatchMakeCoords(pcid uint32, values unsafe.Pointer, count int) (*Pcpatch, error) { + _r0, _err := functions.PcpatchMakeCoords(pcid, values, count) + if _err != nil { + return nil, _err + } + return PcpatchFromPointer(_r0.Pointer()), nil +} + +// Copy is MEOS pcpatch_copy. +func (x *Pcpatch) Copy() (*Pcpatch, error) { + _r0, _err := functions.PcpatchCopy(functions.PcpatchFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpatchFromPointer(_r0.Pointer()), nil +} + +// GetPcid is MEOS pcpatch_get_pcid. +func (x *Pcpatch) GetPcid() (uint32, error) { + _r0, _err := functions.PcpatchGetPcid(functions.PcpatchFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Npoints is MEOS pcpatch_npoints. +func (x *Pcpatch) Npoints() (uint32, error) { + _r0, _err := functions.PcpatchNpoints(functions.PcpatchFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// PointN is MEOS pcpatch_point_n. +func (x *Pcpatch) PointN(n int) (*Pcpoint, error) { + _r0, _err := functions.PcpatchPointN(functions.PcpatchFromPointer(x.Pointer()), n) + if _err != nil { + return nil, _err + } + return PcpointFromPointer(_r0.Pointer()), nil +} + +// Points is MEOS pcpatch_points. +func (x *Pcpatch) Points(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.PcpatchPoints(functions.PcpatchFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Hash is MEOS pcpatch_hash. +func (x *Pcpatch) Hash() (uint32, error) { + _r0, _err := functions.PcpatchHash(functions.PcpatchFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS pcpatch_hash_extended. +func (x *Pcpatch) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.PcpatchHashExtended(functions.PcpatchFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ToGeom is MEOS pcpatch_to_geom. +func (x *Pcpatch) ToGeom() (*TRGeometrySeqSet, error) { + _r0, _err := functions.PcpatchToGeom(functions.PcpatchFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// Cmp is MEOS pcpatch_cmp. +func (x *Pcpatch) Cmp(pa2 *Pcpatch) (int, error) { + _r0, _err := functions.PcpatchCmp(functions.PcpatchFromPointer(x.Pointer()), functions.PcpatchFromPointer(pa2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ToSet is MEOS pcpatch_to_set. +func (x *Pcpatch) ToSet() (*Set, error) { + _r0, _err := functions.PcpatchToSet(functions.PcpatchFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToTpcbox is MEOS pcpatch_to_tpcbox. +func (x *Pcpatch) ToTpcbox(srid int32) (*TPCBox, error) { + _r0, _err := functions.PcpatchToTpcbox(functions.PcpatchFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return TPCBoxFromPointer(_r0.Pointer()), nil +} diff --git a/types/pcpoint.go b/types/pcpoint.go new file mode 100644 index 0000000..9bb8f45 --- /dev/null +++ b/types/pcpoint.go @@ -0,0 +1,168 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Pcpoint struct { + Value +} + +// PcpointFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func PcpointFromPointer(p unsafe.Pointer) *Pcpoint { + if p == nil { + return nil + } + v := &Pcpoint{} + v.ptr = p + return v +} + +// PcpointHexIn is MEOS pcpoint_hex_in. +func PcpointHexIn(str string) (*Pcpoint, error) { + _r0, _err := functions.PcpointHexIn(str) + if _err != nil { + return nil, _err + } + return PcpointFromPointer(_r0.Pointer()), nil +} + +// HexOut is MEOS pcpoint_hex_out. +func (x *Pcpoint) HexOut(maxdd int) (string, error) { + _r0, _err := functions.PcpointHexOut(functions.PcpointFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PcpointFromHEXWKB is MEOS pcpoint_from_hexwkb. +func PcpointFromHEXWKB(hexwkb string) (*Pcpoint, error) { + _r0, _err := functions.PcpointFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return PcpointFromPointer(_r0.Pointer()), nil +} + +// AsHEXWKB is MEOS pcpoint_as_hexwkb. +func (x *Pcpoint) AsHEXWKB() (string, error) { + _r0, _err := functions.PcpointAsHexwkb(functions.PcpointFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PcpointMake is MEOS pcpoint_make. +func PcpointMake(pcid uint32, values unsafe.Pointer, count int) (*Pcpoint, error) { + _r0, _err := functions.PcpointMake(pcid, values, count) + if _err != nil { + return nil, _err + } + return PcpointFromPointer(_r0.Pointer()), nil +} + +// Copy is MEOS pcpoint_copy. +func (x *Pcpoint) Copy() (*Pcpoint, error) { + _r0, _err := functions.PcpointCopy(functions.PcpointFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PcpointFromPointer(_r0.Pointer()), nil +} + +// GetPcid is MEOS pcpoint_get_pcid. +func (x *Pcpoint) GetPcid() (uint32, error) { + _r0, _err := functions.PcpointGetPcid(functions.PcpointFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Hash is MEOS pcpoint_hash. +func (x *Pcpoint) Hash() (uint32, error) { + _r0, _err := functions.PcpointHash(functions.PcpointFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS pcpoint_hash_extended. +func (x *Pcpoint) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.PcpointHashExtended(functions.PcpointFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// GetX is MEOS pcpoint_get_x. +func (x *Pcpoint) GetX(schema *Pcschema, out unsafe.Pointer) (bool, error) { + _r0, _err := functions.PcpointGetX(functions.PcpointFromPointer(x.Pointer()), functions.PCSchemaFromPointer(schema.Pointer()), out) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GetY is MEOS pcpoint_get_y. +func (x *Pcpoint) GetY(schema *Pcschema, out unsafe.Pointer) (bool, error) { + _r0, _err := functions.PcpointGetY(functions.PcpointFromPointer(x.Pointer()), functions.PCSchemaFromPointer(schema.Pointer()), out) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GetZ is MEOS pcpoint_get_z. +func (x *Pcpoint) GetZ(schema *Pcschema, out unsafe.Pointer) (bool, error) { + _r0, _err := functions.PcpointGetZ(functions.PcpointFromPointer(x.Pointer()), functions.PCSchemaFromPointer(schema.Pointer()), out) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// GetDim is MEOS pcpoint_get_dim. +func (x *Pcpoint) GetDim(schema *Pcschema, name string, out unsafe.Pointer) (bool, error) { + _r0, _err := functions.PcpointGetDim(functions.PcpointFromPointer(x.Pointer()), functions.PCSchemaFromPointer(schema.Pointer()), name, out) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// ToTpcbox is MEOS pcpoint_to_tpcbox. +func (x *Pcpoint) ToTpcbox(schema *Pcschema) (*TPCBox, error) { + _r0, _err := functions.PcpointToTpcbox(functions.PcpointFromPointer(x.Pointer()), functions.PCSchemaFromPointer(schema.Pointer())) + if _err != nil { + return nil, _err + } + return TPCBoxFromPointer(_r0.Pointer()), nil +} + +// Cmp is MEOS pcpoint_cmp. +func (x *Pcpoint) Cmp(pt2 *Pcpoint) (int, error) { + _r0, _err := functions.PcpointCmp(functions.PcpointFromPointer(x.Pointer()), functions.PcpointFromPointer(pt2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ToSet is MEOS pcpoint_to_set. +func (x *Pcpoint) ToSet() (*Set, error) { + _r0, _err := functions.PcpointToSet(functions.PcpointFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/pcschema.go b/types/pcschema.go new file mode 100644 index 0000000..73a5104 --- /dev/null +++ b/types/pcschema.go @@ -0,0 +1,102 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Pcschema struct { + Value +} + +// PcschemaFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func PcschemaFromPointer(p unsafe.Pointer) *Pcschema { + if p == nil { + return nil + } + v := &Pcschema{} + v.ptr = p + return v +} + +// PcschemaGet is MEOS meos_pc_schema. +func PcschemaGet(pcid uint32) (*Pcschema, error) { + _r0, _err := functions.MeosPcSchema(pcid) + if _err != nil { + return nil, _err + } + return PcschemaFromPointer(_r0.Pointer()), nil +} + +// PcschemaRegister is MEOS meos_pc_schema_register. +func PcschemaRegister(pcid uint32, schema *Pcschema) error { + return functions.MeosPcSchemaRegister(pcid, functions.PCSchemaFromPointer(schema.Pointer())) +} + +// PcschemaFromDims is MEOS meos_pc_schema_from_dims. +func PcschemaFromDims(pcid uint32, srid int32, compression string, dims unsafe.Pointer, ndims int) (*Pcschema, error) { + _r0, _err := functions.MeosPcSchemaFromDims(pcid, srid, compression, dims, ndims) + if _err != nil { + return nil, _err + } + return PcschemaFromPointer(_r0.Pointer()), nil +} + +// PcschemaRegisterDims is MEOS meos_pc_schema_register_dims. +func PcschemaRegisterDims(pcid uint32, srid int32, compression string, dims unsafe.Pointer, ndims int) (bool, error) { + _r0, _err := functions.MeosPcSchemaRegisterDims(pcid, srid, compression, dims, ndims) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// PcschemaRegisterXml is MEOS meos_pc_schema_register_xml. +func PcschemaRegisterXml(pcid uint32, schema *Pcschema, xml_text string) error { + return functions.MeosPcSchemaRegisterXml(pcid, functions.PCSchemaFromPointer(schema.Pointer()), xml_text) +} + +// PcschemaXml is MEOS meos_pc_schema_xml. +func PcschemaXml(pcid uint32) (string, error) { + _r0, _err := functions.MeosPcSchemaXml(pcid) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PcschemaClear is MEOS meos_pc_schema_clear. +func PcschemaClear() error { + return functions.MeosPcSchemaClear() +} + +// PcschemaSRID is MEOS meos_pc_schema_srid. +func PcschemaSRID(pcid uint32) (int32, error) { + _r0, _err := functions.MeosPcSchemaSRID(pcid) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// PcschemaCompression is MEOS meos_pc_schema_compression. +func PcschemaCompression(pcid uint32) (string, error) { + _r0, _err := functions.MeosPcSchemaCompression(pcid) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PcschemaNdims is MEOS meos_pc_schema_ndims. +func PcschemaNdims(pcid uint32) (int32, error) { + _r0, _err := functions.MeosPcSchemaNdims(pcid) + if _err != nil { + return 0, _err + } + return _r0, nil +} diff --git a/types/pose.go b/types/pose.go new file mode 100644 index 0000000..982b60d --- /dev/null +++ b/types/pose.go @@ -0,0 +1,465 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Pose struct { + Value +} + +// PoseFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func PoseFromPointer(p unsafe.Pointer) *Pose { + if p == nil { + return nil + } + v := &Pose{} + v.ptr = p + return v +} + +// AsEWKT is MEOS pose_as_ewkt. +func (x *Pose) AsEWKT(maxdd int) (string, error) { + _r0, _err := functions.PoseAsEWKT(functions.PoseFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsHEXWKB is MEOS pose_as_hexwkb. +func (x *Pose) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { + _r0, _err := functions.PoseAsHexwkb(functions.PoseFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsText is MEOS pose_as_text. +func (x *Pose) AsText(maxdd int) (string, error) { + _r0, _err := functions.PoseAsText(functions.PoseFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsWKB is MEOS pose_as_wkb. +func (x *Pose) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.PoseAsWKB(functions.PoseFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseFromWKB is MEOS pose_from_wkb. +func PoseFromWKB(wkb unsafe.Pointer, size uint) (*Pose, error) { + _r0, _err := functions.PoseFromWKB(wkb, size) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseFromHEXWKB is MEOS pose_from_hexwkb. +func PoseFromHEXWKB(hexwkb string) (*Pose, error) { + _r0, _err := functions.PoseFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseIn is MEOS pose_in. +func PoseIn(str string) (*Pose, error) { + _r0, _err := functions.PoseIn(str) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS pose_out. +func (x *Pose) Out(maxdd int) (string, error) { + _r0, _err := functions.PoseOut(functions.PoseFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PoseFromGeopose is MEOS pose_from_geopose. +func PoseFromGeopose(json string) (*Pose, error) { + _r0, _err := functions.PoseFromGeopose(json) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// AsGeopose is MEOS pose_as_geopose. +func (x *Pose) AsGeopose(conformance int, precision int) (string, error) { + _r0, _err := functions.PoseAsGeopose(functions.PoseFromPointer(x.Pointer()), conformance, precision) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ApplyGeo is MEOS pose_apply_geo. +func (x *Pose) ApplyGeo(body *TRGeometrySeqSet) (*TRGeometrySeqSet, error) { + _r0, _err := functions.PoseApplyGeo(functions.PoseFromPointer(x.Pointer()), functions.GeomFromPointer(body.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ComposeTpose is MEOS pose_compose_tpose. +func (x *Pose) ComposeTpose(frame *Temporal) (*Temporal, error) { + _r0, _err := functions.PoseComposeTpose(functions.PoseFromPointer(x.Pointer()), functions.TemporalFromPointer(frame.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Copy is MEOS pose_copy. +func (x *Pose) Copy() (*Pose, error) { + _r0, _err := functions.PoseCopy(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseMake2d is MEOS pose_make_2d. +func PoseMake2d(x float64, y float64, theta float64, geodetic bool, srid int32) (*Pose, error) { + _r0, _err := functions.PoseMake2d(x, y, theta, geodetic, srid) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseMake3d is MEOS pose_make_3d. +func PoseMake3d(x float64, y float64, z float64, W float64, X float64, Y float64, Z float64, geodetic bool, srid int32) (*Pose, error) { + _r0, _err := functions.PoseMake3d(x, y, z, W, X, Y, Z, geodetic, srid) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseMakePoint2d is MEOS pose_make_point2d. +func PoseMakePoint2d(gs *TRGeometrySeqSet, theta float64) (*Pose, error) { + _r0, _err := functions.PoseMakePoint2d(functions.GeomFromPointer(gs.Pointer()), theta) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseMakePoint3d is MEOS pose_make_point3d. +func PoseMakePoint3d(gs *TRGeometrySeqSet, W float64, X float64, Y float64, Z float64) (*Pose, error) { + _r0, _err := functions.PoseMakePoint3d(functions.GeomFromPointer(gs.Pointer()), W, X, Y, Z) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseMakePoint3dYpr is MEOS pose_make_point3d_ypr. +func PoseMakePoint3dYpr(gs *TRGeometrySeqSet, yaw float64, pitch float64, roll float64) (*Pose, error) { + _r0, _err := functions.PoseMakePoint3dYpr(functions.GeomFromPointer(gs.Pointer()), yaw, pitch, roll) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// ToPoint is MEOS pose_to_point. +func (x *Pose) ToPoint() (*TRGeometrySeqSet, error) { + _r0, _err := functions.PoseToPoint(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ToStbox is MEOS pose_to_stbox. +func (x *Pose) ToStbox() (*STBox, error) { + _r0, _err := functions.PoseToSTBOX(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// Hash is MEOS pose_hash. +func (x *Pose) Hash() (uint32, error) { + _r0, _err := functions.PoseHash(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS pose_hash_extended. +func (x *Pose) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.PoseHashExtended(functions.PoseFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Quaternion is MEOS pose_quaternion. +func (x *Pose) Quaternion(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.PoseQuaternion(functions.PoseFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Ypr is MEOS pose_ypr. +func (x *Pose) Ypr(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.PoseYpr(functions.PoseFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Yaw is MEOS pose_yaw. +func (x *Pose) Yaw() (float64, error) { + _r0, _err := functions.PoseYaw(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Pitch is MEOS pose_pitch. +func (x *Pose) Pitch() (float64, error) { + _r0, _err := functions.PosePitch(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Roll is MEOS pose_roll. +func (x *Pose) Roll() (float64, error) { + _r0, _err := functions.PoseRoll(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// AngularDistance is MEOS pose_angular_distance. +func (x *Pose) AngularDistance(pose2 *Pose) (float64, error) { + _r0, _err := functions.PoseAngularDistance(functions.PoseFromPointer(x.Pointer()), functions.PoseFromPointer(pose2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Compose is MEOS pose_compose. +func (x *Pose) Compose(frame *Pose) (*Pose, error) { + _r0, _err := functions.PoseCompose(functions.PoseFromPointer(x.Pointer()), functions.PoseFromPointer(frame.Pointer())) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// Inverse is MEOS pose_inverse. +func (x *Pose) Inverse() (*Pose, error) { + _r0, _err := functions.PoseInverse(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// Normalize is MEOS pose_normalize. +func (x *Pose) Normalize() (*Pose, error) { + _r0, _err := functions.PoseNormalize(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// Round is MEOS pose_round. +func (x *Pose) Round(maxdd int) (*Pose, error) { + _r0, _err := functions.PoseRound(functions.PoseFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// SetSRID is MEOS pose_set_srid. +func (x *Pose) SetSRID(srid int32) (*Pose, error) { + _r0, _err := functions.PoseSetSRID(functions.PoseFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// SRID is MEOS pose_srid. +func (x *Pose) SRID() (int32, error) { + _r0, _err := functions.PoseSRID(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Transform is MEOS pose_transform. +func (x *Pose) Transform(srid int32) (*Pose, error) { + _r0, _err := functions.PoseTransform(functions.PoseFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// TransformPipeline is MEOS pose_transform_pipeline. +func (x *Pose) TransformPipeline(pipelinestr string, srid int32, is_forward bool) (*Pose, error) { + _r0, _err := functions.PoseTransformPipeline(functions.PoseFromPointer(x.Pointer()), pipelinestr, srid, is_forward) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// TstzspanToStbox is MEOS pose_tstzspan_to_stbox. +func (x *Pose) TstzspanToStbox(s *Span) (*STBox, error) { + _r0, _err := functions.PoseTstzspanToSTBOX(functions.PoseFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// TimestamptzToStbox is MEOS pose_timestamptz_to_stbox. +func (x *Pose) TimestamptzToStbox(t int64) (*STBox, error) { + _r0, _err := functions.PoseTimestamptzToSTBOX(functions.PoseFromPointer(x.Pointer()), t) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// Cmp is MEOS pose_cmp. +func (x *Pose) Cmp(pose2 *Pose) (int, error) { + _r0, _err := functions.PoseCmp(functions.PoseFromPointer(x.Pointer()), functions.PoseFromPointer(pose2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Eq is MEOS pose_eq. +func (x *Pose) Eq(pose2 *Pose) (bool, error) { + _r0, _err := functions.PoseEq(functions.PoseFromPointer(x.Pointer()), functions.PoseFromPointer(pose2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ge is MEOS pose_ge. +func (x *Pose) Ge(pose2 *Pose) (bool, error) { + _r0, _err := functions.PoseGe(functions.PoseFromPointer(x.Pointer()), functions.PoseFromPointer(pose2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Gt is MEOS pose_gt. +func (x *Pose) Gt(pose2 *Pose) (bool, error) { + _r0, _err := functions.PoseGt(functions.PoseFromPointer(x.Pointer()), functions.PoseFromPointer(pose2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Le is MEOS pose_le. +func (x *Pose) Le(pose2 *Pose) (bool, error) { + _r0, _err := functions.PoseLe(functions.PoseFromPointer(x.Pointer()), functions.PoseFromPointer(pose2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Lt is MEOS pose_lt. +func (x *Pose) Lt(pose2 *Pose) (bool, error) { + _r0, _err := functions.PoseLt(functions.PoseFromPointer(x.Pointer()), functions.PoseFromPointer(pose2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ne is MEOS pose_ne. +func (x *Pose) Ne(pose2 *Pose) (bool, error) { + _r0, _err := functions.PoseNe(functions.PoseFromPointer(x.Pointer()), functions.PoseFromPointer(pose2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Nsame is MEOS pose_nsame. +func (x *Pose) Nsame(pose2 *Pose) (bool, error) { + _r0, _err := functions.PoseNsame(functions.PoseFromPointer(x.Pointer()), functions.PoseFromPointer(pose2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Same is MEOS pose_same. +func (x *Pose) Same(pose2 *Pose) (bool, error) { + _r0, _err := functions.PoseSame(functions.PoseFromPointer(x.Pointer()), functions.PoseFromPointer(pose2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// ToSet is MEOS pose_to_set. +func (x *Pose) ToSet() (*Set, error) { + _r0, _err := functions.PoseToSet(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToPosechain is MEOS pose_to_posechain. +func (x *Pose) ToPosechain() (unsafe.Pointer, error) { + _r0, _err := functions.PoseToPosechain(functions.PoseFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return _r0, nil +} diff --git a/types/posechain.go b/types/posechain.go new file mode 100644 index 0000000..f070a85 --- /dev/null +++ b/types/posechain.go @@ -0,0 +1,375 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type PoseChain struct { + Value +} + +// PoseChainFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func PoseChainFromPointer(p unsafe.Pointer) *PoseChain { + if p == nil { + return nil + } + v := &PoseChain{} + v.ptr = p + return v +} + +// PoseChainIn is MEOS posechain_in. +func PoseChainIn(str string) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainIn(str) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainOut is MEOS posechain_out. +func PoseChainOut(pc unsafe.Pointer, maxdd int) (string, error) { + _r0, _err := functions.PosechainOut(pc, maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PoseChainAsText is MEOS posechain_as_text. +func PoseChainAsText(pc unsafe.Pointer, maxdd int) (string, error) { + _r0, _err := functions.PosechainAsText(pc, maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PoseChainAsEWKT is MEOS posechain_as_ewkt. +func PoseChainAsEWKT(pc unsafe.Pointer, maxdd int) (string, error) { + _r0, _err := functions.PosechainAsEWKT(pc, maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PoseChainAsWKB is MEOS posechain_as_wkb. +func PoseChainAsWKB(pc unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainAsWKB(pc, variant, size_out) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainAsHEXWKB is MEOS posechain_as_hexwkb. +func PoseChainAsHEXWKB(pc unsafe.Pointer, variant uint8, size_out unsafe.Pointer) (string, error) { + _r0, _err := functions.PosechainAsHexwkb(pc, variant, size_out) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PoseChainFromWKB is MEOS posechain_from_wkb. +func PoseChainFromWKB(wkb unsafe.Pointer, size uint) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainFromWKB(wkb, size) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainFromHEXWKB is MEOS posechain_from_hexwkb. +func PoseChainFromHEXWKB(hexwkb string) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainMake is MEOS posechain_make. +func PoseChainMake(poses unsafe.Pointer, count int) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainMake(poses, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainCopy is MEOS posechain_copy. +func PoseChainCopy(pc unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainCopy(pc) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainAppend is MEOS posechain_append. +func PoseChainAppend(pc unsafe.Pointer, pose *Pose) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainAppend(pc, functions.PoseFromPointer(pose.Pointer())) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainToPose is MEOS posechain_to_pose. +func PoseChainToPose(pc unsafe.Pointer) (*Pose, error) { + _r0, _err := functions.PosechainToPose(pc) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseChainPrefixPose is MEOS posechain_prefix_pose. +func PoseChainPrefixPose(pc unsafe.Pointer, n int) (*Pose, error) { + _r0, _err := functions.PosechainPrefixPose(pc, n) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseChainToPoint is MEOS posechain_to_point. +func PoseChainToPoint(pc unsafe.Pointer) (*TRGeometrySeqSet, error) { + _r0, _err := functions.PosechainToPoint(pc) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// PoseChainToStbox is MEOS posechain_to_stbox. +func PoseChainToStbox(pc unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.PosechainToSTBOX(pc) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// PoseChainTimestamptzToStbox is MEOS posechain_timestamptz_to_stbox. +func PoseChainTimestamptzToStbox(pc unsafe.Pointer, t int64) (*STBox, error) { + _r0, _err := functions.PosechainTimestamptzToSTBOX(pc, t) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// PoseChainTstzspanToStbox is MEOS posechain_tstzspan_to_stbox. +func PoseChainTstzspanToStbox(pc unsafe.Pointer, s *Span) (*STBox, error) { + _r0, _err := functions.PosechainTstzspanToSTBOX(pc, functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// PoseChainNumPoses is MEOS posechain_num_poses. +func PoseChainNumPoses(pc unsafe.Pointer) (int, error) { + _r0, _err := functions.PosechainNumPoses(pc) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// PoseChainStartPose is MEOS posechain_start_pose. +func PoseChainStartPose(pc unsafe.Pointer) (*Pose, error) { + _r0, _err := functions.PosechainStartPose(pc) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseChainEndPose is MEOS posechain_end_pose. +func PoseChainEndPose(pc unsafe.Pointer) (*Pose, error) { + _r0, _err := functions.PosechainEndPose(pc) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseChainPoseN is MEOS posechain_pose_n. +func PoseChainPoseN(pc unsafe.Pointer, n int) (*Pose, error) { + _r0, _err := functions.PosechainPoseN(pc, n) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// PoseChainPoses is MEOS posechain_poses. +func PoseChainPoses(pc unsafe.Pointer, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainPoses(pc, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainHash is MEOS posechain_hash. +func PoseChainHash(pc unsafe.Pointer) (uint32, error) { + _r0, _err := functions.PosechainHash(pc) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// PoseChainHashExtended is MEOS posechain_hash_extended. +func PoseChainHashExtended(pc unsafe.Pointer, seed uint64) (uint64, error) { + _r0, _err := functions.PosechainHashExtended(pc, seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// PoseChainRound is MEOS posechain_round. +func PoseChainRound(pc unsafe.Pointer, maxdd int) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainRound(pc, maxdd) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainSRID is MEOS posechain_srid. +func PoseChainSRID(pc unsafe.Pointer) (int32, error) { + _r0, _err := functions.PosechainSRID(pc) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// PoseChainSetSRID is MEOS posechain_set_srid. +func PoseChainSetSRID(pc unsafe.Pointer, srid int32) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainSetSRID(pc, srid) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainTransform is MEOS posechain_transform. +func PoseChainTransform(pc unsafe.Pointer, srid_to int32) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainTransform(pc, srid_to) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainTransformPipeline is MEOS posechain_transform_pipeline. +func PoseChainTransformPipeline(pc unsafe.Pointer, pipeline string, srid_to int32, is_forward bool) (unsafe.Pointer, error) { + _r0, _err := functions.PosechainTransformPipeline(pc, pipeline, srid_to, is_forward) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// PoseChainEq is MEOS posechain_eq. +func PoseChainEq(pc1 unsafe.Pointer, pc2 unsafe.Pointer) (bool, error) { + _r0, _err := functions.PosechainEq(pc1, pc2) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// PoseChainNe is MEOS posechain_ne. +func PoseChainNe(pc1 unsafe.Pointer, pc2 unsafe.Pointer) (bool, error) { + _r0, _err := functions.PosechainNe(pc1, pc2) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// PoseChainSame is MEOS posechain_same. +func PoseChainSame(pc1 unsafe.Pointer, pc2 unsafe.Pointer) (bool, error) { + _r0, _err := functions.PosechainSame(pc1, pc2) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// PoseChainNsame is MEOS posechain_nsame. +func PoseChainNsame(pc1 unsafe.Pointer, pc2 unsafe.Pointer) (bool, error) { + _r0, _err := functions.PosechainNsame(pc1, pc2) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// PoseChainCmp is MEOS posechain_cmp. +func PoseChainCmp(pc1 unsafe.Pointer, pc2 unsafe.Pointer) (int, error) { + _r0, _err := functions.PosechainCmp(pc1, pc2) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// PoseChainLt is MEOS posechain_lt. +func PoseChainLt(pc1 unsafe.Pointer, pc2 unsafe.Pointer) (bool, error) { + _r0, _err := functions.PosechainLt(pc1, pc2) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// PoseChainLe is MEOS posechain_le. +func PoseChainLe(pc1 unsafe.Pointer, pc2 unsafe.Pointer) (bool, error) { + _r0, _err := functions.PosechainLe(pc1, pc2) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// PoseChainGt is MEOS posechain_gt. +func PoseChainGt(pc1 unsafe.Pointer, pc2 unsafe.Pointer) (bool, error) { + _r0, _err := functions.PosechainGt(pc1, pc2) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// PoseChainGe is MEOS posechain_ge. +func PoseChainGe(pc1 unsafe.Pointer, pc2 unsafe.Pointer) (bool, error) { + _r0, _err := functions.PosechainGe(pc1, pc2) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// PoseChainToSet is MEOS posechain_to_set. +func PoseChainToSet(pc unsafe.Pointer) (*Set, error) { + _r0, _err := functions.PosechainToSet(pc) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/poseset.go b/types/poseset.go new file mode 100644 index 0000000..98d99a5 --- /dev/null +++ b/types/poseset.go @@ -0,0 +1,90 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type PoseSet struct { + Set +} + +// PoseSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func PoseSetFromPointer(p unsafe.Pointer) *PoseSet { + if p == nil { + return nil + } + v := &PoseSet{} + v.ptr = p + return v +} + +// PoseSetIn is MEOS poseset_in. +func PoseSetIn(str string) (*Set, error) { + _r0, _err := functions.PosesetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS poseset_out. +func (x *PoseSet) Out(maxdd int) (string, error) { + _r0, _err := functions.PosesetOut(functions.SetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// PoseSetMake is MEOS poseset_make. +func PoseSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.PosesetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS poseset_end_value. +func (x *PoseSet) EndValue() (*Pose, error) { + _r0, _err := functions.PosesetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS poseset_start_value. +func (x *PoseSet) StartValue() (*Pose, error) { + _r0, _err := functions.PosesetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// ValueN is MEOS poseset_value_n. +func (x *PoseSet) ValueN(n int) (*Pose, bool, error) { + _found, _value, _err := functions.PosesetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return PoseFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS poseset_values. +func (x *PoseSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.PosesetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} diff --git a/types/raquet.go b/types/raquet.go new file mode 100644 index 0000000..6b3b0cb --- /dev/null +++ b/types/raquet.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type Raquet struct { + Value +} + +// RaquetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func RaquetFromPointer(p unsafe.Pointer) *Raquet { + if p == nil { + return nil + } + v := &Raquet{} + v.ptr = p + return v +} diff --git a/types/rtree.go b/types/rtree.go new file mode 100644 index 0000000..6ccf015 --- /dev/null +++ b/types/rtree.go @@ -0,0 +1,164 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type RTree struct { + Value +} + +// RTreeFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func RTreeFromPointer(p unsafe.Pointer) *RTree { + if p == nil { + return nil + } + v := &RTree{} + v.ptr = p + return v +} + +// RTreeCreateIntspan is MEOS rtree_create_intspan. +func RTreeCreateIntspan() (*RTree, error) { + _r0, _err := functions.RtreeCreateIntspan() + if _err != nil { + return nil, _err + } + return RTreeFromPointer(_r0.Pointer()), nil +} + +// RTreeCreateBigintspan is MEOS rtree_create_bigintspan. +func RTreeCreateBigintspan() (*RTree, error) { + _r0, _err := functions.RtreeCreateBigintspan() + if _err != nil { + return nil, _err + } + return RTreeFromPointer(_r0.Pointer()), nil +} + +// RTreeCreateFloatspan is MEOS rtree_create_floatspan. +func RTreeCreateFloatspan() (*RTree, error) { + _r0, _err := functions.RtreeCreateFloatspan() + if _err != nil { + return nil, _err + } + return RTreeFromPointer(_r0.Pointer()), nil +} + +// RTreeCreateDatespan is MEOS rtree_create_datespan. +func RTreeCreateDatespan() (*RTree, error) { + _r0, _err := functions.RtreeCreateDatespan() + if _err != nil { + return nil, _err + } + return RTreeFromPointer(_r0.Pointer()), nil +} + +// RTreeCreateTstzspan is MEOS rtree_create_tstzspan. +func RTreeCreateTstzspan() (*RTree, error) { + _r0, _err := functions.RtreeCreateTstzspan() + if _err != nil { + return nil, _err + } + return RTreeFromPointer(_r0.Pointer()), nil +} + +// RTreeCreateTbox is MEOS rtree_create_tbox. +func RTreeCreateTbox() (*RTree, error) { + _r0, _err := functions.RtreeCreateTBOX() + if _err != nil { + return nil, _err + } + return RTreeFromPointer(_r0.Pointer()), nil +} + +// RTreeCreateStbox is MEOS rtree_create_stbox. +func RTreeCreateStbox() (*RTree, error) { + _r0, _err := functions.RtreeCreateSTBOX() + if _err != nil { + return nil, _err + } + return RTreeFromPointer(_r0.Pointer()), nil +} + +// RTreeCreateTpcbox is MEOS rtree_create_tpcbox. +func RTreeCreateTpcbox() (*RTree, error) { + _r0, _err := functions.RtreeCreateTpcbox() + if _err != nil { + return nil, _err + } + return RTreeFromPointer(_r0.Pointer()), nil +} + +// Free is MEOS rtree_free. +func (x *RTree) Free() error { + return functions.RtreeFree(functions.RTreeFromPointer(x.Pointer())) +} + +// NumEntries is MEOS rtree_num_entries. +func (x *RTree) NumEntries() (int, error) { + _r0, _err := functions.RtreeNumEntries(functions.RTreeFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// MemSize is MEOS rtree_mem_size. +func (x *RTree) MemSize() (int64, error) { + _r0, _err := functions.RtreeMemSize(functions.RTreeFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Height is MEOS rtree_height. +func (x *RTree) Height() (int, error) { + _r0, _err := functions.RtreeHeight(functions.RTreeFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Insert is MEOS rtree_insert. +func (x *RTree) Insert(box unsafe.Pointer, id int64) (bool, error) { + _r0, _err := functions.RtreeInsert(functions.RTreeFromPointer(x.Pointer()), box, id) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Load is MEOS rtree_load. +func (x *RTree) Load(boxes unsafe.Pointer, ids unsafe.Pointer, count int) (bool, error) { + _r0, _err := functions.RtreeLoad(functions.RTreeFromPointer(x.Pointer()), boxes, ids, count) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// InsertTemporal is MEOS rtree_insert_temporal. +func (x *RTree) InsertTemporal(temp *Temporal, id int64) (bool, error) { + _r0, _err := functions.RtreeInsertTemporal(functions.RTreeFromPointer(x.Pointer()), functions.TemporalFromPointer(temp.Pointer()), id) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// InsertTemporalSplit is MEOS rtree_insert_temporal_split. +func (x *RTree) InsertTemporalSplit(temp *Temporal, id int64, maxboxes int) (bool, error) { + _r0, _err := functions.RtreeInsertTemporalSplit(functions.RTreeFromPointer(x.Pointer()), functions.TemporalFromPointer(temp.Pointer()), id, maxboxes) + if _err != nil { + return false, _err + } + return _r0, nil +} diff --git a/types/rtreenncursor.go b/types/rtreenncursor.go new file mode 100644 index 0000000..92613a4 --- /dev/null +++ b/types/rtreenncursor.go @@ -0,0 +1,47 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type RTreeNNCursor struct { + Value +} + +// RTreeNNCursorFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func RTreeNNCursorFromPointer(p unsafe.Pointer) *RTreeNNCursor { + if p == nil { + return nil + } + v := &RTreeNNCursor{} + v.ptr = p + return v +} + +// RTreeNNCursorOpen is MEOS rtree_nn_cursor_open. +func RTreeNNCursorOpen(rtree *RTree, query unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.RtreeNnCursorOpen(functions.RTreeFromPointer(rtree.Pointer()), query) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// RTreeNNCursorNext is MEOS rtree_nn_cursor_next. +func RTreeNNCursorNext(cursor unsafe.Pointer, id_out unsafe.Pointer, dist_out unsafe.Pointer) (bool, error) { + _r0, _err := functions.RtreeNnCursorNext(cursor, id_out, dist_out) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// RTreeNNCursorClose is MEOS rtree_nn_cursor_close. +func RTreeNNCursorClose(cursor unsafe.Pointer) error { + return functions.RtreeNnCursorClose(cursor) +} diff --git a/types/set.go b/types/set.go new file mode 100644 index 0000000..d6d5ffb --- /dev/null +++ b/types/set.go @@ -0,0 +1,222 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Set struct { + Collection +} + +// SetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func SetFromPointer(p unsafe.Pointer) *Set { + if p == nil { + return nil + } + v := &Set{} + v.ptr = p + return v +} + +// AsHEXWKB is MEOS set_as_hexwkb. +func (x *Set) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { + _r0, _err := functions.SetAsHexwkb(functions.SetFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsWKB is MEOS set_as_wkb. +func (x *Set) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.SetAsWKB(functions.SetFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// SetFromHEXWKB is MEOS set_from_hexwkb. +func SetFromHEXWKB(hexwkb string) (*Set, error) { + _r0, _err := functions.SetFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// SetFromWKB is MEOS set_from_wkb. +func SetFromWKB(wkb unsafe.Pointer, size uint) (*Set, error) { + _r0, _err := functions.SetFromWKB(wkb, size) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Copy is MEOS set_copy. +func (x *Set) Copy() (*Set, error) { + _r0, _err := functions.SetCopy(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToSpan is MEOS set_to_span. +func (x *Set) ToSpan() (*Span, error) { + _r0, _err := functions.SetToSpan(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToSpanset is MEOS set_to_spanset. +func (x *Set) ToSpanset() (*SpanSet, error) { + _r0, _err := functions.SetToSpanset(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Hash is MEOS set_hash. +func (x *Set) Hash() (uint32, error) { + _r0, _err := functions.SetHash(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS set_hash_extended. +func (x *Set) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.SetHashExtended(functions.SetFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// NumValues is MEOS set_num_values. +func (x *Set) NumValues() (int, error) { + _r0, _err := functions.SetNumValues(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Round is MEOS set_round. +func (x *Set) Round(maxdd int) (*Set, error) { + _r0, _err := functions.SetRound(functions.SetFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Cmp is MEOS set_cmp. +func (x *Set) Cmp(s2 *Set) (int, error) { + _r0, _err := functions.SetCmp(functions.SetFromPointer(x.Pointer()), functions.SetFromPointer(s2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Eq is MEOS set_eq. +func (x *Set) Eq(s2 *Set) (bool, error) { + _r0, _err := functions.SetEq(functions.SetFromPointer(x.Pointer()), functions.SetFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ge is MEOS set_ge. +func (x *Set) Ge(s2 *Set) (bool, error) { + _r0, _err := functions.SetGe(functions.SetFromPointer(x.Pointer()), functions.SetFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Gt is MEOS set_gt. +func (x *Set) Gt(s2 *Set) (bool, error) { + _r0, _err := functions.SetGt(functions.SetFromPointer(x.Pointer()), functions.SetFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Le is MEOS set_le. +func (x *Set) Le(s2 *Set) (bool, error) { + _r0, _err := functions.SetLe(functions.SetFromPointer(x.Pointer()), functions.SetFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Lt is MEOS set_lt. +func (x *Set) Lt(s2 *Set) (bool, error) { + _r0, _err := functions.SetLt(functions.SetFromPointer(x.Pointer()), functions.SetFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ne is MEOS set_ne. +func (x *Set) Ne(s2 *Set) (bool, error) { + _r0, _err := functions.SetNe(functions.SetFromPointer(x.Pointer()), functions.SetFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Spans is MEOS set_spans. +func (x *Set) Spans(count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.SetSpans(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// SplitEachNSpans is MEOS set_split_each_n_spans. +func (x *Set) SplitEachNSpans(elems_per_span int, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.SetSplitEachNSpans(functions.SetFromPointer(x.Pointer()), elems_per_span, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// SplitNSpans is MEOS set_split_n_spans. +func (x *Set) SplitNSpans(span_count int, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.SetSplitNSpans(functions.SetFromPointer(x.Pointer()), span_count, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToTbox is MEOS set_to_tbox. +func (x *Set) ToTbox() (*TBox, error) { + _r0, _err := functions.SetToTBOX(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} diff --git a/types/span.go b/types/span.go new file mode 100644 index 0000000..d362268 --- /dev/null +++ b/types/span.go @@ -0,0 +1,186 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Span struct { + Collection +} + +// SpanFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func SpanFromPointer(p unsafe.Pointer) *Span { + if p == nil { + return nil + } + v := &Span{} + v.ptr = p + return v +} + +// AsHEXWKB is MEOS span_as_hexwkb. +func (x *Span) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { + _r0, _err := functions.SpanAsHexwkb(functions.SpanFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsWKB is MEOS span_as_wkb. +func (x *Span) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.SpanAsWKB(functions.SpanFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// SpanFromHEXWKB is MEOS span_from_hexwkb. +func SpanFromHEXWKB(hexwkb string) (*Span, error) { + _r0, _err := functions.SpanFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// SpanFromWKB is MEOS span_from_wkb. +func SpanFromWKB(wkb unsafe.Pointer, size uint) (*Span, error) { + _r0, _err := functions.SpanFromWKB(wkb, size) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Copy is MEOS span_copy. +func (x *Span) Copy() (*Span, error) { + _r0, _err := functions.SpanCopy(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToSpanset is MEOS span_to_spanset. +func (x *Span) ToSpanset() (*SpanSet, error) { + _r0, _err := functions.SpanToSpanset(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Hash is MEOS span_hash. +func (x *Span) Hash() (uint32, error) { + _r0, _err := functions.SpanHash(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS span_hash_extended. +func (x *Span) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.SpanHashExtended(functions.SpanFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// LowerInc is MEOS span_lower_inc. +func (x *Span) LowerInc() (bool, error) { + _r0, _err := functions.SpanLowerInc(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// UpperInc is MEOS span_upper_inc. +func (x *Span) UpperInc() (bool, error) { + _r0, _err := functions.SpanUpperInc(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Cmp is MEOS span_cmp. +func (x *Span) Cmp(s2 *Span) (int, error) { + _r0, _err := functions.SpanCmp(functions.SpanFromPointer(x.Pointer()), functions.SpanFromPointer(s2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Eq is MEOS span_eq. +func (x *Span) Eq(s2 *Span) (bool, error) { + _r0, _err := functions.SpanEq(functions.SpanFromPointer(x.Pointer()), functions.SpanFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ge is MEOS span_ge. +func (x *Span) Ge(s2 *Span) (bool, error) { + _r0, _err := functions.SpanGe(functions.SpanFromPointer(x.Pointer()), functions.SpanFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Gt is MEOS span_gt. +func (x *Span) Gt(s2 *Span) (bool, error) { + _r0, _err := functions.SpanGt(functions.SpanFromPointer(x.Pointer()), functions.SpanFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Le is MEOS span_le. +func (x *Span) Le(s2 *Span) (bool, error) { + _r0, _err := functions.SpanLe(functions.SpanFromPointer(x.Pointer()), functions.SpanFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Lt is MEOS span_lt. +func (x *Span) Lt(s2 *Span) (bool, error) { + _r0, _err := functions.SpanLt(functions.SpanFromPointer(x.Pointer()), functions.SpanFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ne is MEOS span_ne. +func (x *Span) Ne(s2 *Span) (bool, error) { + _r0, _err := functions.SpanNe(functions.SpanFromPointer(x.Pointer()), functions.SpanFromPointer(s2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// ToTbox is MEOS span_to_tbox. +func (x *Span) ToTbox() (*TBox, error) { + _r0, _err := functions.SpanToTBOX(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} diff --git a/types/spanset.go b/types/spanset.go new file mode 100644 index 0000000..86db18a --- /dev/null +++ b/types/spanset.go @@ -0,0 +1,267 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type SpanSet struct { + Collection +} + +// SpanSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func SpanSetFromPointer(p unsafe.Pointer) *SpanSet { + if p == nil { + return nil + } + v := &SpanSet{} + v.ptr = p + return v +} + +// AsHEXWKB is MEOS spanset_as_hexwkb. +func (x *SpanSet) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { + _r0, _err := functions.SpansetAsHexwkb(functions.SpanSetFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsWKB is MEOS spanset_as_wkb. +func (x *SpanSet) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.SpansetAsWKB(functions.SpanSetFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// SpanSetFromHEXWKB is MEOS spanset_from_hexwkb. +func SpanSetFromHEXWKB(hexwkb string) (*SpanSet, error) { + _r0, _err := functions.SpansetFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// SpanSetFromWKB is MEOS spanset_from_wkb. +func SpanSetFromWKB(wkb unsafe.Pointer, size uint) (*SpanSet, error) { + _r0, _err := functions.SpansetFromWKB(wkb, size) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Copy is MEOS spanset_copy. +func (x *SpanSet) Copy() (*SpanSet, error) { + _r0, _err := functions.SpansetCopy(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// SpanSetMake is MEOS spanset_make. +func SpanSetMake(spans *Span, count int) (*SpanSet, error) { + _r0, _err := functions.SpansetMake(functions.SpanFromPointer(spans.Pointer()), count) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// EndSpan is MEOS spanset_end_span. +func (x *SpanSet) EndSpan() (*Span, error) { + _r0, _err := functions.SpansetEndSpan(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Hash is MEOS spanset_hash. +func (x *SpanSet) Hash() (uint32, error) { + _r0, _err := functions.SpansetHash(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS spanset_hash_extended. +func (x *SpanSet) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.SpansetHashExtended(functions.SpanSetFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// LowerInc is MEOS spanset_lower_inc. +func (x *SpanSet) LowerInc() (bool, error) { + _r0, _err := functions.SpansetLowerInc(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// NumSpans is MEOS spanset_num_spans. +func (x *SpanSet) NumSpans() (int, error) { + _r0, _err := functions.SpansetNumSpans(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Span is MEOS spanset_span. +func (x *SpanSet) Span() (*Span, error) { + _r0, _err := functions.SpansetSpan(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// SpanN is MEOS spanset_span_n. +func (x *SpanSet) SpanN(i int) (*Span, error) { + _r0, _err := functions.SpansetSpanN(functions.SpanSetFromPointer(x.Pointer()), i) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Spanarr is MEOS spanset_spanarr. +func (x *SpanSet) Spanarr(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.SpansetSpanarr(functions.SpanSetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// StartSpan is MEOS spanset_start_span. +func (x *SpanSet) StartSpan() (*Span, error) { + _r0, _err := functions.SpansetStartSpan(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// UpperInc is MEOS spanset_upper_inc. +func (x *SpanSet) UpperInc() (bool, error) { + _r0, _err := functions.SpansetUpperInc(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Cmp is MEOS spanset_cmp. +func (x *SpanSet) Cmp(ss2 *SpanSet) (int, error) { + _r0, _err := functions.SpansetCmp(functions.SpanSetFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Eq is MEOS spanset_eq. +func (x *SpanSet) Eq(ss2 *SpanSet) (bool, error) { + _r0, _err := functions.SpansetEq(functions.SpanSetFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ge is MEOS spanset_ge. +func (x *SpanSet) Ge(ss2 *SpanSet) (bool, error) { + _r0, _err := functions.SpansetGe(functions.SpanSetFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Gt is MEOS spanset_gt. +func (x *SpanSet) Gt(ss2 *SpanSet) (bool, error) { + _r0, _err := functions.SpansetGt(functions.SpanSetFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Le is MEOS spanset_le. +func (x *SpanSet) Le(ss2 *SpanSet) (bool, error) { + _r0, _err := functions.SpansetLe(functions.SpanSetFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Lt is MEOS spanset_lt. +func (x *SpanSet) Lt(ss2 *SpanSet) (bool, error) { + _r0, _err := functions.SpansetLt(functions.SpanSetFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ne is MEOS spanset_ne. +func (x *SpanSet) Ne(ss2 *SpanSet) (bool, error) { + _r0, _err := functions.SpansetNe(functions.SpanSetFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Spans is MEOS spanset_spans. +func (x *SpanSet) Spans(count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.SpansetSpans(functions.SpanSetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// SplitEachNSpans is MEOS spanset_split_each_n_spans. +func (x *SpanSet) SplitEachNSpans(elems_per_span int, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.SpansetSplitEachNSpans(functions.SpanSetFromPointer(x.Pointer()), elems_per_span, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// SplitNSpans is MEOS spanset_split_n_spans. +func (x *SpanSet) SplitNSpans(span_count int, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.SpansetSplitNSpans(functions.SpanSetFromPointer(x.Pointer()), span_count, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToTbox is MEOS spanset_to_tbox. +func (x *SpanSet) ToTbox() (*TBox, error) { + _r0, _err := functions.SpansetToTBOX(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} diff --git a/types/spnncursor.go b/types/spnncursor.go new file mode 100644 index 0000000..6175860 --- /dev/null +++ b/types/spnncursor.go @@ -0,0 +1,47 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type SPNNCursor struct { + Value +} + +// SPNNCursorFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func SPNNCursorFromPointer(p unsafe.Pointer) *SPNNCursor { + if p == nil { + return nil + } + v := &SPNNCursor{} + v.ptr = p + return v +} + +// SPNNCursorOpen is MEOS sptree_nn_cursor_open. +func SPNNCursorOpen(sptree unsafe.Pointer, query unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.SptreeNnCursorOpen(sptree, query) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// SPNNCursorNext is MEOS sptree_nn_cursor_next. +func SPNNCursorNext(cursor unsafe.Pointer, id_out unsafe.Pointer, dist_out unsafe.Pointer) (bool, error) { + _r0, _err := functions.SptreeNnCursorNext(cursor, id_out, dist_out) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// SPNNCursorClose is MEOS sptree_nn_cursor_close. +func SPNNCursorClose(cursor unsafe.Pointer) error { + return functions.SptreeNnCursorClose(cursor) +} diff --git a/types/sptree.go b/types/sptree.go new file mode 100644 index 0000000..a31e45a --- /dev/null +++ b/types/sptree.go @@ -0,0 +1,92 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type SPTree struct { + Value +} + +// SPTreeFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func SPTreeFromPointer(p unsafe.Pointer) *SPTree { + if p == nil { + return nil + } + v := &SPTree{} + v.ptr = p + return v +} + +// SPTreeFree is MEOS sptree_free. +func SPTreeFree(sptree unsafe.Pointer) error { + return functions.SptreeFree(sptree) +} + +// SPTreeNumEntries is MEOS sptree_num_entries. +func SPTreeNumEntries(sptree unsafe.Pointer) (int, error) { + _r0, _err := functions.SptreeNumEntries(sptree) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// SPTreeMemSize is MEOS sptree_mem_size. +func SPTreeMemSize(sptree unsafe.Pointer) (int64, error) { + _r0, _err := functions.SptreeMemSize(sptree) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// SPTreeHeight is MEOS sptree_height. +func SPTreeHeight(sptree unsafe.Pointer) (int, error) { + _r0, _err := functions.SptreeHeight(sptree) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// SPTreeInsert is MEOS sptree_insert. +func SPTreeInsert(sptree unsafe.Pointer, box unsafe.Pointer, id int64) (bool, error) { + _r0, _err := functions.SptreeInsert(sptree, box, id) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// SPTreeLoad is MEOS sptree_load. +func SPTreeLoad(sptree unsafe.Pointer, boxes unsafe.Pointer, ids unsafe.Pointer, count int) (bool, error) { + _r0, _err := functions.SptreeLoad(sptree, boxes, ids, count) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// SPTreeInsertTemporal is MEOS sptree_insert_temporal. +func SPTreeInsertTemporal(sptree unsafe.Pointer, temp *Temporal, id int64) (bool, error) { + _r0, _err := functions.SptreeInsertTemporal(sptree, functions.TemporalFromPointer(temp.Pointer()), id) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// SPTreeInsertTemporalSplit is MEOS sptree_insert_temporal_split. +func SPTreeInsertTemporalSplit(sptree unsafe.Pointer, temp *Temporal, id int64, maxboxes int) (bool, error) { + _r0, _err := functions.SptreeInsertTemporalSplit(sptree, functions.TemporalFromPointer(temp.Pointer()), id, maxboxes) + if _err != nil { + return false, _err + } + return _r0, nil +} diff --git a/types/stbox.go b/types/stbox.go new file mode 100644 index 0000000..59ef53b --- /dev/null +++ b/types/stbox.go @@ -0,0 +1,477 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type STBox struct { + Box +} + +// STBoxFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func STBoxFromPointer(p unsafe.Pointer) *STBox { + if p == nil { + return nil + } + v := &STBox{} + v.ptr = p + return v +} + +// AsHEXWKB is MEOS stbox_as_hexwkb. +func (x *STBox) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { + _r0, _err := functions.STBOXAsHexwkb(functions.STBoxFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsWKB is MEOS stbox_as_wkb. +func (x *STBox) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.STBOXAsWKB(functions.STBoxFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// STBoxFromHEXWKB is MEOS stbox_from_hexwkb. +func STBoxFromHEXWKB(hexwkb string) (*STBox, error) { + _r0, _err := functions.STBOXFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// STBoxFromWKB is MEOS stbox_from_wkb. +func STBoxFromWKB(wkb unsafe.Pointer, size uint) (*STBox, error) { + _r0, _err := functions.STBOXFromWKB(wkb, size) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// STBoxIn is MEOS stbox_in. +func STBoxIn(str string) (*STBox, error) { + _r0, _err := functions.STBOXIn(str) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS stbox_out. +func (x *STBox) Out(maxdd int) (string, error) { + _r0, _err := functions.STBOXOut(functions.STBoxFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// Copy is MEOS stbox_copy. +func (x *STBox) Copy() (*STBox, error) { + _r0, _err := functions.STBOXCopy(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// STBoxMake is MEOS stbox_make. +func STBoxMake(hasx bool, hasz bool, geodetic bool, srid int32, xmin float64, xmax float64, ymin float64, ymax float64, zmin float64, zmax float64, s *Span) (*STBox, error) { + _r0, _err := functions.STBOXMake(hasx, hasz, geodetic, srid, xmin, xmax, ymin, ymax, zmin, zmax, functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// ToGeo is MEOS stbox_to_geo. +func (x *STBox) ToGeo() (*TRGeometrySeqSet, error) { + _r0, _err := functions.STBOXToGeo(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ToTstzspan is MEOS stbox_to_tstzspan. +func (x *STBox) ToTstzspan() (*Span, error) { + _r0, _err := functions.STBOXToTstzspan(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Area is MEOS stbox_area. +func (x *STBox) Area(spheroid bool) (float64, error) { + _r0, _err := functions.STBOXArea(functions.STBoxFromPointer(x.Pointer()), spheroid) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Hash is MEOS stbox_hash. +func (x *STBox) Hash() (uint32, error) { + _r0, _err := functions.STBOXHash(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS stbox_hash_extended. +func (x *STBox) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.STBOXHashExtended(functions.STBoxFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Hast is MEOS stbox_hast. +func (x *STBox) Hast() (bool, error) { + _r0, _err := functions.STBOXHast(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Hasx is MEOS stbox_hasx. +func (x *STBox) Hasx() (bool, error) { + _r0, _err := functions.STBOXHasx(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Hasz is MEOS stbox_hasz. +func (x *STBox) Hasz() (bool, error) { + _r0, _err := functions.STBOXHasz(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Isgeodetic is MEOS stbox_isgeodetic. +func (x *STBox) Isgeodetic() (bool, error) { + _r0, _err := functions.STBOXIsgeodetic(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Perimeter is MEOS stbox_perimeter. +func (x *STBox) Perimeter(spheroid bool) (float64, error) { + _r0, _err := functions.STBOXPerimeter(functions.STBoxFromPointer(x.Pointer()), spheroid) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Tmax is MEOS stbox_tmax. +func (x *STBox) Tmax() (int64, bool, error) { + _found, _value, _err := functions.STBOXTmax(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// TmaxInc is MEOS stbox_tmax_inc. +func (x *STBox) TmaxInc() (bool, bool, error) { + _found, _value, _err := functions.STBOXTmaxInc(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return false, false, _err + } + if !_found { + return false, false, nil + } + return _value, true, nil +} + +// Tmin is MEOS stbox_tmin. +func (x *STBox) Tmin() (int64, bool, error) { + _found, _value, _err := functions.STBOXTmin(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// TminInc is MEOS stbox_tmin_inc. +func (x *STBox) TminInc() (bool, bool, error) { + _found, _value, _err := functions.STBOXTminInc(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return false, false, _err + } + if !_found { + return false, false, nil + } + return _value, true, nil +} + +// Volume is MEOS stbox_volume. +func (x *STBox) Volume() (float64, error) { + _r0, _err := functions.STBOXVolume(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Xmax is MEOS stbox_xmax. +func (x *STBox) Xmax() (float64, bool, error) { + _found, _value, _err := functions.STBOXXmax(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Xmin is MEOS stbox_xmin. +func (x *STBox) Xmin() (float64, bool, error) { + _found, _value, _err := functions.STBOXXmin(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Ymax is MEOS stbox_ymax. +func (x *STBox) Ymax() (float64, bool, error) { + _found, _value, _err := functions.STBOXYmax(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Ymin is MEOS stbox_ymin. +func (x *STBox) Ymin() (float64, bool, error) { + _found, _value, _err := functions.STBOXYmin(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Zmax is MEOS stbox_zmax. +func (x *STBox) Zmax() (float64, bool, error) { + _found, _value, _err := functions.STBOXZmax(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Zmin is MEOS stbox_zmin. +func (x *STBox) Zmin() (float64, bool, error) { + _found, _value, _err := functions.STBOXZmin(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// ExpandSpace is MEOS stbox_expand_space. +func (x *STBox) ExpandSpace(d float64) (*STBox, error) { + _r0, _err := functions.STBOXExpandSpace(functions.STBoxFromPointer(x.Pointer()), d) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// GetSpace is MEOS stbox_get_space. +func (x *STBox) GetSpace() (*STBox, error) { + _r0, _err := functions.STBOXGetSpace(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// QuadSplit is MEOS stbox_quad_split. +func (x *STBox) QuadSplit(count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.STBOXQuadSplit(functions.STBoxFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// Round is MEOS stbox_round. +func (x *STBox) Round(maxdd int) (*STBox, error) { + _r0, _err := functions.STBOXRound(functions.STBoxFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// SetSRID is MEOS stbox_set_srid. +func (x *STBox) SetSRID(srid int32) (*STBox, error) { + _r0, _err := functions.STBOXSetSRID(functions.STBoxFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// SRID is MEOS stbox_srid. +func (x *STBox) SRID() (int32, error) { + _r0, _err := functions.STBOXSRID(functions.STBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Transform is MEOS stbox_transform. +func (x *STBox) Transform(srid int32) (*STBox, error) { + _r0, _err := functions.STBOXTransform(functions.STBoxFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// TransformPipeline is MEOS stbox_transform_pipeline. +func (x *STBox) TransformPipeline(pipelinestr string, srid int32, is_forward bool) (*STBox, error) { + _r0, _err := functions.STBOXTransformPipeline(functions.STBoxFromPointer(x.Pointer()), pipelinestr, srid, is_forward) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// Cmp is MEOS stbox_cmp. +func (x *STBox) Cmp(box2 *STBox) (int, error) { + _r0, _err := functions.STBOXCmp(functions.STBoxFromPointer(x.Pointer()), functions.STBoxFromPointer(box2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Eq is MEOS stbox_eq. +func (x *STBox) Eq(box2 *STBox) (bool, error) { + _r0, _err := functions.STBOXEq(functions.STBoxFromPointer(x.Pointer()), functions.STBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ge is MEOS stbox_ge. +func (x *STBox) Ge(box2 *STBox) (bool, error) { + _r0, _err := functions.STBOXGe(functions.STBoxFromPointer(x.Pointer()), functions.STBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Gt is MEOS stbox_gt. +func (x *STBox) Gt(box2 *STBox) (bool, error) { + _r0, _err := functions.STBOXGt(functions.STBoxFromPointer(x.Pointer()), functions.STBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Le is MEOS stbox_le. +func (x *STBox) Le(box2 *STBox) (bool, error) { + _r0, _err := functions.STBOXLe(functions.STBoxFromPointer(x.Pointer()), functions.STBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Lt is MEOS stbox_lt. +func (x *STBox) Lt(box2 *STBox) (bool, error) { + _r0, _err := functions.STBOXLt(functions.STBoxFromPointer(x.Pointer()), functions.STBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ne is MEOS stbox_ne. +func (x *STBox) Ne(box2 *STBox) (bool, error) { + _r0, _err := functions.STBOXNe(functions.STBoxFromPointer(x.Pointer()), functions.STBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// SpatialDistance is MEOS stbox_spatial_distance. +func (x *STBox) SpatialDistance(box2 *STBox) (float64, error) { + _r0, _err := functions.STBOXSpatialDistance(functions.STBoxFromPointer(x.Pointer()), functions.STBoxFromPointer(box2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// STBoxGetSpaceTile is MEOS stbox_get_space_tile. +func STBoxGetSpaceTile(point *TRGeometrySeqSet, xsize float64, ysize float64, zsize float64, sorigin *TRGeometrySeqSet) (*STBox, error) { + _r0, _err := functions.STBOXGetSpaceTile(functions.GeomFromPointer(point.Pointer()), xsize, ysize, zsize, functions.GeomFromPointer(sorigin.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// SpaceTiles is MEOS stbox_space_tiles. +func (x *STBox) SpaceTiles(xsize float64, ysize float64, zsize float64, sorigin *TRGeometrySeqSet, border_inc bool, count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.STBOXSpaceTiles(functions.STBoxFromPointer(x.Pointer()), xsize, ysize, zsize, functions.GeomFromPointer(sorigin.Pointer()), border_inc, count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} diff --git a/types/talpha.go b/types/talpha.go new file mode 100644 index 0000000..96db81c --- /dev/null +++ b/types/talpha.go @@ -0,0 +1,24 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +// TAlpha is non-numeric, non-spatial temporal types (step/discrete interpolation only). A real MEOS grouping (talpha_type) with no user-facing class name in PyMEOS — see corrections. + +type TAlpha struct { + Temporal +} + +// TAlphaFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TAlphaFromPointer(p unsafe.Pointer) *TAlpha { + if p == nil { + return nil + } + v := &TAlpha{} + v.ptr = p + return v +} diff --git a/types/tbigint.go b/types/tbigint.go new file mode 100644 index 0000000..f49e9c7 --- /dev/null +++ b/types/tbigint.go @@ -0,0 +1,192 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TBigint struct { + TNumber +} + +// TBigintFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TBigintFromPointer(p unsafe.Pointer) *TBigint { + if p == nil { + return nil + } + v := &TBigint{} + v.ptr = p + return v +} + +// TBigintFromMFJSON is MEOS tbigint_from_mfjson. +func TBigintFromMFJSON(str string) (*Temporal, error) { + _r0, _err := functions.TbigintFromMFJSON(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TBigintIn is MEOS tbigint_in. +func TBigintIn(str string) (*Temporal, error) { + _r0, _err := functions.TbigintIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tbigint_out. +func (x *TBigint) Out() (string, error) { + _r0, _err := functions.TbigintOut(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TBigintFromBaseTemp is MEOS tbigint_from_base_temp. +func TBigintFromBaseTemp(i int64, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TbigintFromBaseTemp(i, functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTint is MEOS tbigint_to_tint. +func (x *TBigint) ToTint() (*Temporal, error) { + _r0, _err := functions.TbigintToTint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTfloat is MEOS tbigint_to_tfloat. +func (x *TBigint) ToTfloat() (*Temporal, error) { + _r0, _err := functions.TbigintToTfloat(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tbigint_end_value. +func (x *TBigint) EndValue() (int64, error) { + _r0, _err := functions.TbigintEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// MaxValue is MEOS tbigint_max_value. +func (x *TBigint) MaxValue() (int64, error) { + _r0, _err := functions.TbigintMaxValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// MinValue is MEOS tbigint_min_value. +func (x *TBigint) MinValue() (int64, error) { + _r0, _err := functions.TbigintMinValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS tbigint_start_value. +func (x *TBigint) StartValue() (int64, error) { + _r0, _err := functions.TbigintStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueAtTimestamptz is MEOS tbigint_value_at_timestamptz. +func (x *TBigint) ValueAtTimestamptz(t int64, strict bool) (int64, bool, error) { + _found, _value, _err := functions.TbigintValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// ValueN is MEOS tbigint_value_n. +func (x *TBigint) ValueN(n int64) (int64, bool, error) { + _found, _value, _err := functions.TbigintValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS tbigint_values. +func (x *TBigint) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TbigintValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ScaleValue is MEOS tbigint_scale_value. +func (x *TBigint) ScaleValue(width int64) (*Temporal, error) { + _r0, _err := functions.TbigintScaleValue(functions.TemporalFromPointer(x.Pointer()), width) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ShiftScaleValue is MEOS tbigint_shift_scale_value. +func (x *TBigint) ShiftScaleValue(shift int64, width int64) (*Temporal, error) { + _r0, _err := functions.TbigintShiftScaleValue(functions.TemporalFromPointer(x.Pointer()), shift, width) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ShiftValue is MEOS tbigint_shift_value. +func (x *TBigint) ShiftValue(shift int64) (*Temporal, error) { + _r0, _err := functions.TbigintShiftValue(functions.TemporalFromPointer(x.Pointer()), shift) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTh3index is MEOS tbigint_to_th3index. +func (x *TBigint) ToTh3index() (*Temporal, error) { + _r0, _err := functions.TbigintToTh3index(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTquadbin is MEOS tbigint_to_tquadbin. +func (x *TBigint) ToTquadbin() (*Temporal, error) { + _r0, _err := functions.TbigintToTquadbin(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tbigintinst.go b/types/tbigintinst.go new file mode 100644 index 0000000..45cfe60 --- /dev/null +++ b/types/tbigintinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TBigintInst struct { + handle +} + +// TBigintInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TBigintInstFromPointer(p unsafe.Pointer) *TBigintInst { + if p == nil { + return nil + } + v := &TBigintInst{} + v.ptr = p + return v +} + +// TBigintInstMake is MEOS tbigintinst_make. +func TBigintInstMake(i int64, t int64) (*Temporal, error) { + _r0, _err := functions.TbigintinstMake(i, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tbigintseq.go b/types/tbigintseq.go new file mode 100644 index 0000000..f0becf8 --- /dev/null +++ b/types/tbigintseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TBigintSeq struct { + handle +} + +// TBigintSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TBigintSeqFromPointer(p unsafe.Pointer) *TBigintSeq { + if p == nil { + return nil + } + v := &TBigintSeq{} + v.ptr = p + return v +} + +// TBigintSeqFromBaseTstzset is MEOS tbigintseq_from_base_tstzset. +func TBigintSeqFromBaseTstzset(i int64, s *Set) (*Temporal, error) { + _r0, _err := functions.TbigintseqFromBaseTstzset(i, functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TBigintSeqFromBaseTstzspan is MEOS tbigintseq_from_base_tstzspan. +func TBigintSeqFromBaseTstzspan(i int64, s *Span) (*Temporal, error) { + _r0, _err := functions.TbigintseqFromBaseTstzspan(i, functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tbigintseqset.go b/types/tbigintseqset.go new file mode 100644 index 0000000..8114759 --- /dev/null +++ b/types/tbigintseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TBigintSeqSet struct { + handle +} + +// TBigintSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TBigintSeqSetFromPointer(p unsafe.Pointer) *TBigintSeqSet { + if p == nil { + return nil + } + v := &TBigintSeqSet{} + v.ptr = p + return v +} + +// TBigintSeqSetFromBaseTstzspanset is MEOS tbigintseqset_from_base_tstzspanset. +func TBigintSeqSetFromBaseTstzspanset(i int64, ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TbigintseqsetFromBaseTstzspanset(i, functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tbool.go b/types/tbool.go new file mode 100644 index 0000000..74ea38a --- /dev/null +++ b/types/tbool.go @@ -0,0 +1,147 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TBool struct { + TAlpha +} + +// TBoolFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TBoolFromPointer(p unsafe.Pointer) *TBool { + if p == nil { + return nil + } + v := &TBool{} + v.ptr = p + return v +} + +// TBoolFromMFJSON is MEOS tbool_from_mfjson. +func TBoolFromMFJSON(str string) (*Temporal, error) { + _r0, _err := functions.TboolFromMFJSON(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TBoolIn is MEOS tbool_in. +func TBoolIn(str string) (*Temporal, error) { + _r0, _err := functions.TboolIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tbool_out. +func (x *TBool) Out() (string, error) { + _r0, _err := functions.TboolOut(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TBoolFromBaseTemp is MEOS tbool_from_base_temp. +func TBoolFromBaseTemp(b bool, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TboolFromBaseTemp(b, functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTint is MEOS tbool_to_tint. +func (x *TBool) ToTint() (*Temporal, error) { + _r0, _err := functions.TboolToTint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tbool_end_value. +func (x *TBool) EndValue() (bool, error) { + _r0, _err := functions.TboolEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// StartValue is MEOS tbool_start_value. +func (x *TBool) StartValue() (bool, error) { + _r0, _err := functions.TboolStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// ValueAtTimestamptz is MEOS tbool_value_at_timestamptz. +func (x *TBool) ValueAtTimestamptz(t int64, strict bool) (bool, bool, error) { + _found, _value, _err := functions.TboolValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return false, false, _err + } + if !_found { + return false, false, nil + } + return _value, true, nil +} + +// ValueN is MEOS tbool_value_n. +func (x *TBool) ValueN(n int) (bool, bool, error) { + _found, _value, _err := functions.TboolValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return false, false, _err + } + if !_found { + return false, false, nil + } + return _value, true, nil +} + +// Values is MEOS tbool_values. +func (x *TBool) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TboolValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// AtValue is MEOS tbool_at_value. +func (x *TBool) AtValue(b bool) (*Temporal, error) { + _r0, _err := functions.TboolAtValue(functions.TemporalFromPointer(x.Pointer()), b) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS tbool_minus_value. +func (x *TBool) MinusValue(b bool) (*Temporal, error) { + _r0, _err := functions.TboolMinusValue(functions.TemporalFromPointer(x.Pointer()), b) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// WhenTrue is MEOS tbool_when_true. +func (x *TBool) WhenTrue() (*SpanSet, error) { + _r0, _err := functions.TboolWhenTrue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} diff --git a/types/tboolinst.go b/types/tboolinst.go new file mode 100644 index 0000000..7283456 --- /dev/null +++ b/types/tboolinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TBoolInst struct { + handle +} + +// TBoolInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TBoolInstFromPointer(p unsafe.Pointer) *TBoolInst { + if p == nil { + return nil + } + v := &TBoolInst{} + v.ptr = p + return v +} + +// TBoolInstMake is MEOS tboolinst_make. +func TBoolInstMake(b bool, t int64) (*Temporal, error) { + _r0, _err := functions.TboolinstMake(b, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tboolseq.go b/types/tboolseq.go new file mode 100644 index 0000000..04812dc --- /dev/null +++ b/types/tboolseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TBoolSeq struct { + handle +} + +// TBoolSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TBoolSeqFromPointer(p unsafe.Pointer) *TBoolSeq { + if p == nil { + return nil + } + v := &TBoolSeq{} + v.ptr = p + return v +} + +// TBoolSeqFromBaseTstzset is MEOS tboolseq_from_base_tstzset. +func TBoolSeqFromBaseTstzset(b bool, s *Set) (*Temporal, error) { + _r0, _err := functions.TboolseqFromBaseTstzset(b, functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TBoolSeqFromBaseTstzspan is MEOS tboolseq_from_base_tstzspan. +func TBoolSeqFromBaseTstzspan(b bool, s *Span) (*Temporal, error) { + _r0, _err := functions.TboolseqFromBaseTstzspan(b, functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tboolseqset.go b/types/tboolseqset.go new file mode 100644 index 0000000..d20e57f --- /dev/null +++ b/types/tboolseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TBoolSeqSet struct { + handle +} + +// TBoolSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TBoolSeqSetFromPointer(p unsafe.Pointer) *TBoolSeqSet { + if p == nil { + return nil + } + v := &TBoolSeqSet{} + v.ptr = p + return v +} + +// TBoolSeqSetFromBaseTstzspanset is MEOS tboolseqset_from_base_tstzspanset. +func TBoolSeqSetFromBaseTstzspanset(b bool, ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TboolseqsetFromBaseTstzspanset(b, functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tbox.go b/types/tbox.go new file mode 100644 index 0000000..ea24554 --- /dev/null +++ b/types/tbox.go @@ -0,0 +1,336 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TBox struct { + Box +} + +// TBoxFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TBoxFromPointer(p unsafe.Pointer) *TBox { + if p == nil { + return nil + } + v := &TBox{} + v.ptr = p + return v +} + +// AsHEXWKB is MEOS tbox_as_hexwkb. +func (x *TBox) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { + _r0, _err := functions.TBOXAsHexwkb(functions.TBoxFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsWKB is MEOS tbox_as_wkb. +func (x *TBox) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TBOXAsWKB(functions.TBoxFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// TBoxFromHEXWKB is MEOS tbox_from_hexwkb. +func TBoxFromHEXWKB(hexwkb string) (*TBox, error) { + _r0, _err := functions.TBOXFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// TBoxFromWKB is MEOS tbox_from_wkb. +func TBoxFromWKB(wkb unsafe.Pointer, size uint) (*TBox, error) { + _r0, _err := functions.TBOXFromWKB(wkb, size) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// TBoxIn is MEOS tbox_in. +func TBoxIn(str string) (*TBox, error) { + _r0, _err := functions.TBOXIn(str) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tbox_out. +func (x *TBox) Out(maxdd int) (string, error) { + _r0, _err := functions.TBOXOut(functions.TBoxFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// Copy is MEOS tbox_copy. +func (x *TBox) Copy() (*TBox, error) { + _r0, _err := functions.TBOXCopy(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// TBoxMake is MEOS tbox_make. +func TBoxMake(s *Span, p *Span) (*TBox, error) { + _r0, _err := functions.TBOXMake(functions.SpanFromPointer(s.Pointer()), functions.SpanFromPointer(p.Pointer())) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// ToIntspan is MEOS tbox_to_intspan. +func (x *TBox) ToIntspan() (*Span, error) { + _r0, _err := functions.TBOXToIntspan(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToBigintspan is MEOS tbox_to_bigintspan. +func (x *TBox) ToBigintspan() (*Span, error) { + _r0, _err := functions.TBOXToBigintspan(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToFloatspan is MEOS tbox_to_floatspan. +func (x *TBox) ToFloatspan() (*Span, error) { + _r0, _err := functions.TBOXToFloatspan(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToTstzspan is MEOS tbox_to_tstzspan. +func (x *TBox) ToTstzspan() (*Span, error) { + _r0, _err := functions.TBOXToTstzspan(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Hash is MEOS tbox_hash. +func (x *TBox) Hash() (uint32, error) { + _r0, _err := functions.TBOXHash(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS tbox_hash_extended. +func (x *TBox) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.TBOXHashExtended(functions.TBoxFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Hast is MEOS tbox_hast. +func (x *TBox) Hast() (bool, error) { + _r0, _err := functions.TBOXHast(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Hasx is MEOS tbox_hasx. +func (x *TBox) Hasx() (bool, error) { + _r0, _err := functions.TBOXHasx(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Tmax is MEOS tbox_tmax. +func (x *TBox) Tmax() (int64, bool, error) { + _found, _value, _err := functions.TBOXTmax(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// TmaxInc is MEOS tbox_tmax_inc. +func (x *TBox) TmaxInc() (bool, bool, error) { + _found, _value, _err := functions.TBOXTmaxInc(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return false, false, _err + } + if !_found { + return false, false, nil + } + return _value, true, nil +} + +// Tmin is MEOS tbox_tmin. +func (x *TBox) Tmin() (int64, bool, error) { + _found, _value, _err := functions.TBOXTmin(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// TminInc is MEOS tbox_tmin_inc. +func (x *TBox) TminInc() (bool, bool, error) { + _found, _value, _err := functions.TBOXTminInc(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return false, false, _err + } + if !_found { + return false, false, nil + } + return _value, true, nil +} + +// Xmax is MEOS tbox_xmax. +func (x *TBox) Xmax() (float64, bool, error) { + _found, _value, _err := functions.TBOXXmax(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// XmaxInc is MEOS tbox_xmax_inc. +func (x *TBox) XmaxInc() (bool, bool, error) { + _found, _value, _err := functions.TBOXXmaxInc(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return false, false, _err + } + if !_found { + return false, false, nil + } + return _value, true, nil +} + +// Xmin is MEOS tbox_xmin. +func (x *TBox) Xmin() (float64, bool, error) { + _found, _value, _err := functions.TBOXXmin(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// XminInc is MEOS tbox_xmin_inc. +func (x *TBox) XminInc() (bool, bool, error) { + _found, _value, _err := functions.TBOXXminInc(functions.TBoxFromPointer(x.Pointer())) + if _err != nil { + return false, false, _err + } + if !_found { + return false, false, nil + } + return _value, true, nil +} + +// Round is MEOS tbox_round. +func (x *TBox) Round(maxdd int) (*TBox, error) { + _r0, _err := functions.TBOXRound(functions.TBoxFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// Cmp is MEOS tbox_cmp. +func (x *TBox) Cmp(box2 *TBox) (int, error) { + _r0, _err := functions.TBOXCmp(functions.TBoxFromPointer(x.Pointer()), functions.TBoxFromPointer(box2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Eq is MEOS tbox_eq. +func (x *TBox) Eq(box2 *TBox) (bool, error) { + _r0, _err := functions.TBOXEq(functions.TBoxFromPointer(x.Pointer()), functions.TBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ge is MEOS tbox_ge. +func (x *TBox) Ge(box2 *TBox) (bool, error) { + _r0, _err := functions.TBOXGe(functions.TBoxFromPointer(x.Pointer()), functions.TBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Gt is MEOS tbox_gt. +func (x *TBox) Gt(box2 *TBox) (bool, error) { + _r0, _err := functions.TBOXGt(functions.TBoxFromPointer(x.Pointer()), functions.TBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Le is MEOS tbox_le. +func (x *TBox) Le(box2 *TBox) (bool, error) { + _r0, _err := functions.TBOXLe(functions.TBoxFromPointer(x.Pointer()), functions.TBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Lt is MEOS tbox_lt. +func (x *TBox) Lt(box2 *TBox) (bool, error) { + _r0, _err := functions.TBOXLt(functions.TBoxFromPointer(x.Pointer()), functions.TBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ne is MEOS tbox_ne. +func (x *TBox) Ne(box2 *TBox) (bool, error) { + _r0, _err := functions.TBOXNe(functions.TBoxFromPointer(x.Pointer()), functions.TBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} diff --git a/types/tcbuffer.go b/types/tcbuffer.go new file mode 100644 index 0000000..d211e97 --- /dev/null +++ b/types/tcbuffer.go @@ -0,0 +1,228 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TCbuffer struct { + TSpatial +} + +// TCbufferFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TCbufferFromPointer(p unsafe.Pointer) *TCbuffer { + if p == nil { + return nil + } + v := &TCbuffer{} + v.ptr = p + return v +} + +// TCbufferIn is MEOS tcbuffer_in. +func TCbufferIn(str string) (*Temporal, error) { + _r0, _err := functions.TcbufferIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TCbufferFromMFJSON is MEOS tcbuffer_from_mfjson. +func TCbufferFromMFJSON(mfjson string) (*Temporal, error) { + _r0, _err := functions.TcbufferFromMFJSON(mfjson) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Make is MEOS tcbuffer_make. +func (x *TCbuffer) Make(tfloat *Temporal) (*Temporal, error) { + _r0, _err := functions.TcbufferMake(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(tfloat.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TCbufferFromBaseTemp is MEOS tcbuffer_from_base_temp. +func TCbufferFromBaseTemp(cb *Cbuffer, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TcbufferFromBaseTemp(functions.CbufferFromPointer(cb.Pointer()), functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tcbuffer_end_value. +func (x *TCbuffer) EndValue() (*Cbuffer, error) { + _r0, _err := functions.TcbufferEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// Points is MEOS tcbuffer_points. +func (x *TCbuffer) Points() (*Set, error) { + _r0, _err := functions.TcbufferPoints(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Radius is MEOS tcbuffer_radius. +func (x *TCbuffer) Radius() (*Set, error) { + _r0, _err := functions.TcbufferRadius(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// TraversedArea is MEOS tcbuffer_traversed_area. +func (x *TCbuffer) TraversedArea(unary_union bool) (*TRGeometrySeqSet, error) { + _r0, _err := functions.TcbufferTraversedArea(functions.TemporalFromPointer(x.Pointer()), unary_union) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ConvexHull is MEOS tcbuffer_convex_hull. +func (x *TCbuffer) ConvexHull() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TcbufferConvexHull(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS tcbuffer_start_value. +func (x *TCbuffer) StartValue() (*Cbuffer, error) { + _r0, _err := functions.TcbufferStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return CbufferFromPointer(_r0.Pointer()), nil +} + +// ValueAtTimestamptz is MEOS tcbuffer_value_at_timestamptz. +func (x *TCbuffer) ValueAtTimestamptz(t int64, strict bool) (*Cbuffer, bool, error) { + _found, _value, _err := functions.TcbufferValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return CbufferFromPointer(_value.Pointer()), true, nil +} + +// ValueN is MEOS tcbuffer_value_n. +func (x *TCbuffer) ValueN(n int) (*Cbuffer, bool, error) { + _found, _value, _err := functions.TcbufferValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return CbufferFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS tcbuffer_values. +func (x *TCbuffer) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TcbufferValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ToTfloat is MEOS tcbuffer_to_tfloat. +func (x *TCbuffer) ToTfloat() (*Temporal, error) { + _r0, _err := functions.TcbufferToTfloat(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeompoint is MEOS tcbuffer_to_tgeompoint. +func (x *TCbuffer) ToTgeompoint() (*Temporal, error) { + _r0, _err := functions.TcbufferToTgeompoint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Expand is MEOS tcbuffer_expand. +func (x *TCbuffer) Expand(dist float64) (*Temporal, error) { + _r0, _err := functions.TcbufferExpand(functions.TemporalFromPointer(x.Pointer()), dist) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtCbuffer is MEOS tcbuffer_at_cbuffer. +func (x *TCbuffer) AtCbuffer(cb *Cbuffer) (*Temporal, error) { + _r0, _err := functions.TcbufferAtCbuffer(functions.TemporalFromPointer(x.Pointer()), functions.CbufferFromPointer(cb.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtGeom is MEOS tcbuffer_at_geom. +func (x *TCbuffer) AtGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TcbufferAtGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtStbox is MEOS tcbuffer_at_stbox. +func (x *TCbuffer) AtStbox(box *STBox, border_inc bool) (*Temporal, error) { + _r0, _err := functions.TcbufferAtSTBOX(functions.TemporalFromPointer(x.Pointer()), functions.STBoxFromPointer(box.Pointer()), border_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusCbuffer is MEOS tcbuffer_minus_cbuffer. +func (x *TCbuffer) MinusCbuffer(cb *Cbuffer) (*Temporal, error) { + _r0, _err := functions.TcbufferMinusCbuffer(functions.TemporalFromPointer(x.Pointer()), functions.CbufferFromPointer(cb.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusGeom is MEOS tcbuffer_minus_geom. +func (x *TCbuffer) MinusGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TcbufferMinusGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusStbox is MEOS tcbuffer_minus_stbox. +func (x *TCbuffer) MinusStbox(box *STBox, border_inc bool) (*Temporal, error) { + _r0, _err := functions.TcbufferMinusSTBOX(functions.TemporalFromPointer(x.Pointer()), functions.STBoxFromPointer(box.Pointer()), border_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tcbufferinst.go b/types/tcbufferinst.go new file mode 100644 index 0000000..ab617ce --- /dev/null +++ b/types/tcbufferinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TCbufferInst struct { + handle +} + +// TCbufferInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TCbufferInstFromPointer(p unsafe.Pointer) *TCbufferInst { + if p == nil { + return nil + } + v := &TCbufferInst{} + v.ptr = p + return v +} + +// TCbufferInstMake is MEOS tcbufferinst_make. +func TCbufferInstMake(cb *Cbuffer, t int64) (*Temporal, error) { + _r0, _err := functions.TcbufferinstMake(functions.CbufferFromPointer(cb.Pointer()), t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tcbufferseq.go b/types/tcbufferseq.go new file mode 100644 index 0000000..a26ef1b --- /dev/null +++ b/types/tcbufferseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TCbufferSeq struct { + handle +} + +// TCbufferSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TCbufferSeqFromPointer(p unsafe.Pointer) *TCbufferSeq { + if p == nil { + return nil + } + v := &TCbufferSeq{} + v.ptr = p + return v +} + +// TCbufferSeqFromBaseTstzset is MEOS tcbufferseq_from_base_tstzset. +func TCbufferSeqFromBaseTstzset(cb *Cbuffer, s *Set) (*Temporal, error) { + _r0, _err := functions.TcbufferseqFromBaseTstzset(functions.CbufferFromPointer(cb.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TCbufferSeqFromBaseTstzspan is MEOS tcbufferseq_from_base_tstzspan. +func TCbufferSeqFromBaseTstzspan(cb *Cbuffer, s *Span, interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TcbufferseqFromBaseTstzspan(functions.CbufferFromPointer(cb.Pointer()), functions.SpanFromPointer(s.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tcbufferseqset.go b/types/tcbufferseqset.go new file mode 100644 index 0000000..78b1845 --- /dev/null +++ b/types/tcbufferseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TCbufferSeqSet struct { + handle +} + +// TCbufferSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TCbufferSeqSetFromPointer(p unsafe.Pointer) *TCbufferSeqSet { + if p == nil { + return nil + } + v := &TCbufferSeqSet{} + v.ptr = p + return v +} + +// TCbufferSeqSetFromBaseTstzspanset is MEOS tcbufferseqset_from_base_tstzspanset. +func TCbufferSeqSetFromBaseTstzspanset(cb *Cbuffer, ss *SpanSet, interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TcbufferseqsetFromBaseTstzspanset(functions.CbufferFromPointer(cb.Pointer()), functions.SpanSetFromPointer(ss.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/temporal.go b/types/temporal.go new file mode 100644 index 0000000..feb840f --- /dev/null +++ b/types/temporal.go @@ -0,0 +1,776 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +// Temporal is superclass of every temporal type; temporal_* functions are late-bound over `subtype` and `temptype`. + +type Temporal struct { + handle +} + +// TemporalFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TemporalFromPointer(p unsafe.Pointer) *Temporal { + if p == nil { + return nil + } + v := &Temporal{} + v.ptr = p + return v +} + +// AsHEXWKB is MEOS temporal_as_hexwkb. +func (x *Temporal) AsHEXWKB(variant uint8, size_out unsafe.Pointer) (string, error) { + _r0, _err := functions.TemporalAsHexwkb(functions.TemporalFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsMFJSON is MEOS temporal_as_mfjson. +func (x *Temporal) AsMFJSON(with_bbox bool, flags int, precision int, srs string) (string, error) { + _r0, _err := functions.TemporalAsMFJSON(functions.TemporalFromPointer(x.Pointer()), with_bbox, flags, precision, srs) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsWKB is MEOS temporal_as_wkb. +func (x *Temporal) AsWKB(variant uint8, size_out unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TemporalAsWKB(functions.TemporalFromPointer(x.Pointer()), variant, size_out) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// TemporalFromHEXWKB is MEOS temporal_from_hexwkb. +func TemporalFromHEXWKB(hexwkb string) (*Temporal, error) { + _r0, _err := functions.TemporalFromHexwkb(hexwkb) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TemporalFromWKB is MEOS temporal_from_wkb. +func TemporalFromWKB(wkb unsafe.Pointer, size uint) (*Temporal, error) { + _r0, _err := functions.TemporalFromWKB(wkb, size) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Copy is MEOS temporal_copy. +func (x *Temporal) Copy() (*Temporal, error) { + _r0, _err := functions.TemporalCopy(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTstzspan is MEOS temporal_to_tstzspan. +func (x *Temporal) ToTstzspan() (*Span, error) { + _r0, _err := functions.TemporalToTstzspan(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// EndInstant is MEOS temporal_end_instant. +func (x *Temporal) EndInstant() (*Temporal, error) { + _r0, _err := functions.TemporalEndInstant(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndSequence is MEOS temporal_end_sequence. +func (x *Temporal) EndSequence() (*Temporal, error) { + _r0, _err := functions.TemporalEndSequence(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndTimestamptz is MEOS temporal_end_timestamptz. +func (x *Temporal) EndTimestamptz() (int64, error) { + _r0, _err := functions.TemporalEndTimestamptz(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Hash is MEOS temporal_hash. +func (x *Temporal) Hash() (uint32, error) { + _r0, _err := functions.TemporalHash(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HashExtended is MEOS temporal_hash_extended. +func (x *Temporal) HashExtended(seed uint64) (uint64, error) { + _r0, _err := functions.TemporalHashExtended(functions.TemporalFromPointer(x.Pointer()), seed) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// InstantN is MEOS temporal_instant_n. +func (x *Temporal) InstantN(n int) (*Temporal, error) { + _r0, _err := functions.TemporalInstantN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Instants is MEOS temporal_instants. +func (x *Temporal) Instants(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TemporalInstants(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Interp is MEOS temporal_interp. +func (x *Temporal) Interp() (string, error) { + _r0, _err := functions.TemporalInterp(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// LowerInc is MEOS temporal_lower_inc. +func (x *Temporal) LowerInc() (bool, error) { + _r0, _err := functions.TemporalLowerInc(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// MaxInstant is MEOS temporal_max_instant. +func (x *Temporal) MaxInstant() (*Temporal, error) { + _r0, _err := functions.TemporalMaxInstant(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinInstant is MEOS temporal_min_instant. +func (x *Temporal) MinInstant() (*Temporal, error) { + _r0, _err := functions.TemporalMinInstant(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// NumInstants is MEOS temporal_num_instants. +func (x *Temporal) NumInstants() (int, error) { + _r0, _err := functions.TemporalNumInstants(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// NumSequences is MEOS temporal_num_sequences. +func (x *Temporal) NumSequences() (int, error) { + _r0, _err := functions.TemporalNumSequences(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// NumTimestamps is MEOS temporal_num_timestamps. +func (x *Temporal) NumTimestamps() (int, error) { + _r0, _err := functions.TemporalNumTimestamps(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Segments is MEOS temporal_segments. +func (x *Temporal) Segments(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TemporalSegments(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// SequenceN is MEOS temporal_sequence_n. +func (x *Temporal) SequenceN(i int) (*Temporal, error) { + _r0, _err := functions.TemporalSequenceN(functions.TemporalFromPointer(x.Pointer()), i) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Sequences is MEOS temporal_sequences. +func (x *Temporal) Sequences(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TemporalSequences(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// StartInstant is MEOS temporal_start_instant. +func (x *Temporal) StartInstant() (*Temporal, error) { + _r0, _err := functions.TemporalStartInstant(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StartSequence is MEOS temporal_start_sequence. +func (x *Temporal) StartSequence() (*Temporal, error) { + _r0, _err := functions.TemporalStartSequence(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StartTimestamptz is MEOS temporal_start_timestamptz. +func (x *Temporal) StartTimestamptz() (int64, error) { + _r0, _err := functions.TemporalStartTimestamptz(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Subtype is MEOS temporal_subtype. +func (x *Temporal) Subtype() (string, error) { + _r0, _err := functions.TemporalSubtype(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// BasetypeName is MEOS temporal_basetype_name. +func (x *Temporal) BasetypeName() (string, error) { + _r0, _err := functions.TemporalBasetypeName(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// Time is MEOS temporal_time. +func (x *Temporal) Time() (*SpanSet, error) { + _r0, _err := functions.TemporalTime(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Timestamps is MEOS temporal_timestamps. +func (x *Temporal) Timestamps(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TemporalTimestamps(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// TimestamptzN is MEOS temporal_timestamptz_n. +func (x *Temporal) TimestamptzN(n int) (int64, bool, error) { + _found, _value, _err := functions.TemporalTimestamptzN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// UpperInc is MEOS temporal_upper_inc. +func (x *Temporal) UpperInc() (bool, error) { + _r0, _err := functions.TemporalUpperInc(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Round is MEOS temporal_round. +func (x *Temporal) Round(maxdd int) (*Temporal, error) { + _r0, _err := functions.TemporalRound(functions.TemporalFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// SetInterp is MEOS temporal_set_interp. +func (x *Temporal) SetInterp(interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TemporalSetInterp(functions.TemporalFromPointer(x.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AsTinstant is MEOS temporal_as_tinstant. +func (x *Temporal) AsTinstant() (*Temporal, error) { + _r0, _err := functions.TemporalAsTinstant(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AsTsequence is MEOS temporal_as_tsequence. +func (x *Temporal) AsTsequence(interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TemporalAsTsequence(functions.TemporalFromPointer(x.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AsTsequenceset is MEOS temporal_as_tsequenceset. +func (x *Temporal) AsTsequenceset(interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TemporalAsTsequenceset(functions.TemporalFromPointer(x.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AppendTsequence is MEOS temporal_append_tsequence. +func (x *Temporal) AppendTsequence(seq *Temporal, expand bool) (*Temporal, error) { + _r0, _err := functions.TemporalAppendTsequence(functions.TemporalFromPointer(x.Pointer()), functions.TSequenceFromPointer(seq.Pointer()), expand) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeleteTimestamptz is MEOS temporal_delete_timestamptz. +func (x *Temporal) DeleteTimestamptz(t int64, connect bool) (*Temporal, error) { + _r0, _err := functions.TemporalDeleteTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, connect) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeleteTstzset is MEOS temporal_delete_tstzset. +func (x *Temporal) DeleteTstzset(s *Set, connect bool) (*Temporal, error) { + _r0, _err := functions.TemporalDeleteTstzset(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(s.Pointer()), connect) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeleteTstzspan is MEOS temporal_delete_tstzspan. +func (x *Temporal) DeleteTstzspan(s *Span, connect bool) (*Temporal, error) { + _r0, _err := functions.TemporalDeleteTstzspan(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer()), connect) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeleteTstzspanset is MEOS temporal_delete_tstzspanset. +func (x *Temporal) DeleteTstzspanset(ss *SpanSet, connect bool) (*Temporal, error) { + _r0, _err := functions.TemporalDeleteTstzspanset(functions.TemporalFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss.Pointer()), connect) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Insert is MEOS temporal_insert. +func (x *Temporal) Insert(temp2 *Temporal, connect bool) (*Temporal, error) { + _r0, _err := functions.TemporalInsert(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer()), connect) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Merge is MEOS temporal_merge. +func (x *Temporal) Merge(temp2 *Temporal) (*Temporal, error) { + _r0, _err := functions.TemporalMerge(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TemporalMergeArray is MEOS temporal_merge_array. +func TemporalMergeArray(temparr unsafe.Pointer, count int) (*Temporal, error) { + _r0, _err := functions.TemporalMergeArray(temparr, count) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Update is MEOS temporal_update. +func (x *Temporal) Update(temp2 *Temporal, connect bool) (*Temporal, error) { + _r0, _err := functions.TemporalUpdate(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer()), connect) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AfterTimestamptz is MEOS temporal_after_timestamptz. +func (x *Temporal) AfterTimestamptz(t int64, strict bool) (*Temporal, error) { + _r0, _err := functions.TemporalAfterTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtMax is MEOS temporal_at_max. +func (x *Temporal) AtMax() (*Temporal, error) { + _r0, _err := functions.TemporalAtMax(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtMin is MEOS temporal_at_min. +func (x *Temporal) AtMin() (*Temporal, error) { + _r0, _err := functions.TemporalAtMin(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtTimestamptz is MEOS temporal_at_timestamptz. +func (x *Temporal) AtTimestamptz(t int64) (*Temporal, error) { + _r0, _err := functions.TemporalAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtTstzset is MEOS temporal_at_tstzset. +func (x *Temporal) AtTstzset(s *Set) (*Temporal, error) { + _r0, _err := functions.TemporalAtTstzset(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtTstzspan is MEOS temporal_at_tstzspan. +func (x *Temporal) AtTstzspan(s *Span) (*Temporal, error) { + _r0, _err := functions.TemporalAtTstzspan(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtTstzspanset is MEOS temporal_at_tstzspanset. +func (x *Temporal) AtTstzspanset(ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TemporalAtTstzspanset(functions.TemporalFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValues is MEOS temporal_at_values. +func (x *Temporal) AtValues(set *Set) (*Temporal, error) { + _r0, _err := functions.TemporalAtValues(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(set.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// BeforeTimestamptz is MEOS temporal_before_timestamptz. +func (x *Temporal) BeforeTimestamptz(t int64, strict bool) (*Temporal, error) { + _r0, _err := functions.TemporalBeforeTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusMax is MEOS temporal_minus_max. +func (x *Temporal) MinusMax() (*Temporal, error) { + _r0, _err := functions.TemporalMinusMax(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusMin is MEOS temporal_minus_min. +func (x *Temporal) MinusMin() (*Temporal, error) { + _r0, _err := functions.TemporalMinusMin(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusTimestamptz is MEOS temporal_minus_timestamptz. +func (x *Temporal) MinusTimestamptz(t int64) (*Temporal, error) { + _r0, _err := functions.TemporalMinusTimestamptz(functions.TemporalFromPointer(x.Pointer()), t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusTstzset is MEOS temporal_minus_tstzset. +func (x *Temporal) MinusTstzset(s *Set) (*Temporal, error) { + _r0, _err := functions.TemporalMinusTstzset(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusTstzspan is MEOS temporal_minus_tstzspan. +func (x *Temporal) MinusTstzspan(s *Span) (*Temporal, error) { + _r0, _err := functions.TemporalMinusTstzspan(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusTstzspanset is MEOS temporal_minus_tstzspanset. +func (x *Temporal) MinusTstzspanset(ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TemporalMinusTstzspanset(functions.TemporalFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValues is MEOS temporal_minus_values. +func (x *Temporal) MinusValues(set *Set) (*Temporal, error) { + _r0, _err := functions.TemporalMinusValues(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(set.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Cmp is MEOS temporal_cmp. +func (x *Temporal) Cmp(temp2 *Temporal) (int, error) { + _r0, _err := functions.TemporalCmp(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Eq is MEOS temporal_eq. +func (x *Temporal) Eq(temp2 *Temporal) (bool, error) { + _r0, _err := functions.TemporalEq(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ge is MEOS temporal_ge. +func (x *Temporal) Ge(temp2 *Temporal) (bool, error) { + _r0, _err := functions.TemporalGe(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Gt is MEOS temporal_gt. +func (x *Temporal) Gt(temp2 *Temporal) (bool, error) { + _r0, _err := functions.TemporalGt(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Le is MEOS temporal_le. +func (x *Temporal) Le(temp2 *Temporal) (bool, error) { + _r0, _err := functions.TemporalLe(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Lt is MEOS temporal_lt. +func (x *Temporal) Lt(temp2 *Temporal) (bool, error) { + _r0, _err := functions.TemporalLt(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ne is MEOS temporal_ne. +func (x *Temporal) Ne(temp2 *Temporal) (bool, error) { + _r0, _err := functions.TemporalNe(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Spans is MEOS temporal_spans. +func (x *Temporal) Spans(count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.TemporalSpans(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// SplitEachNSpans is MEOS temporal_split_each_n_spans. +func (x *Temporal) SplitEachNSpans(elem_count int, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.TemporalSplitEachNSpans(functions.TemporalFromPointer(x.Pointer()), elem_count, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// SplitNSpans is MEOS temporal_split_n_spans. +func (x *Temporal) SplitNSpans(span_count int, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.TemporalSplitNSpans(functions.TemporalFromPointer(x.Pointer()), span_count, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Derivative is MEOS temporal_derivative. +func (x *Temporal) Derivative() (*Temporal, error) { + _r0, _err := functions.TemporalDerivative(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// SimplifyDp is MEOS temporal_simplify_dp. +func (x *Temporal) SimplifyDp(dist float64, synchronized bool) (*Temporal, error) { + _r0, _err := functions.TemporalSimplifyDp(functions.TemporalFromPointer(x.Pointer()), dist, synchronized) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// SimplifyMaxDist is MEOS temporal_simplify_max_dist. +func (x *Temporal) SimplifyMaxDist(dist float64, synchronized bool) (*Temporal, error) { + _r0, _err := functions.TemporalSimplifyMaxDist(functions.TemporalFromPointer(x.Pointer()), dist, synchronized) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// SimplifyMinDist is MEOS temporal_simplify_min_dist. +func (x *Temporal) SimplifyMinDist(dist float64) (*Temporal, error) { + _r0, _err := functions.TemporalSimplifyMinDist(functions.TemporalFromPointer(x.Pointer()), dist) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DyntimewarpDistance is MEOS temporal_dyntimewarp_distance. +func (x *Temporal) DyntimewarpDistance(temp2 *Temporal) (float64, error) { + _r0, _err := functions.TemporalDyntimewarpDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// FrechetDistance is MEOS temporal_frechet_distance. +func (x *Temporal) FrechetDistance(temp2 *Temporal) (float64, error) { + _r0, _err := functions.TemporalFrechetDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// HausdorffDistance is MEOS temporal_hausdorff_distance. +func (x *Temporal) HausdorffDistance(temp2 *Temporal) (float64, error) { + _r0, _err := functions.TemporalHausdorffDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// AverageHausdorffDistance is MEOS temporal_average_hausdorff_distance. +func (x *Temporal) AverageHausdorffDistance(temp2 *Temporal) (float64, error) { + _r0, _err := functions.TemporalAverageHausdorffDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// LcssDistance is MEOS temporal_lcss_distance. +func (x *Temporal) LcssDistance(temp2 *Temporal, epsilon float64) (float64, error) { + _r0, _err := functions.TemporalLcssDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer()), epsilon) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ExtKalmanFilter is MEOS temporal_ext_kalman_filter. +func (x *Temporal) ExtKalmanFilter(gate float64, q float64, variance float64, to_drop bool) (*Temporal, error) { + _r0, _err := functions.TemporalExtKalmanFilter(functions.TemporalFromPointer(x.Pointer()), gate, q, variance, to_drop) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/text.go b/types/text.go new file mode 100644 index 0000000..e4f4b78 --- /dev/null +++ b/types/text.go @@ -0,0 +1,78 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type Text struct { + Value +} + +// TextFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TextFromPointer(p unsafe.Pointer) *Text { + if p == nil { + return nil + } + v := &Text{} + v.ptr = p + return v +} + +// TextIn is MEOS text_in. +func TextIn(str string) (string, error) { + _r0, _err := functions.TextIn(str) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TextOut is MEOS text_out. +func TextOut(txt string) (string, error) { + _r0, _err := functions.TextOut(txt) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TextInitcap is MEOS text_initcap. +func TextInitcap(txt string) (string, error) { + _r0, _err := functions.TextInitcap(txt) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TextLower is MEOS text_lower. +func TextLower(txt string) (string, error) { + _r0, _err := functions.TextLower(txt) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TextUpper is MEOS text_upper. +func TextUpper(txt string) (string, error) { + _r0, _err := functions.TextUpper(txt) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TextToSet is MEOS text_to_set. +func TextToSet(txt string) (*Set, error) { + _r0, _err := functions.TextToSet(txt) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/textset.go b/types/textset.go new file mode 100644 index 0000000..7688c77 --- /dev/null +++ b/types/textset.go @@ -0,0 +1,117 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TextSet struct { + Set +} + +// TextSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TextSetFromPointer(p unsafe.Pointer) *TextSet { + if p == nil { + return nil + } + v := &TextSet{} + v.ptr = p + return v +} + +// TextSetIn is MEOS textset_in. +func TextSetIn(str string) (*Set, error) { + _r0, _err := functions.TextsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS textset_out. +func (x *TextSet) Out() (string, error) { + _r0, _err := functions.TextsetOut(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TextSetMake is MEOS textset_make. +func TextSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.TextsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS textset_end_value. +func (x *TextSet) EndValue() (string, error) { + _r0, _err := functions.TextsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// StartValue is MEOS textset_start_value. +func (x *TextSet) StartValue() (string, error) { + _r0, _err := functions.TextsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ValueN is MEOS textset_value_n. +func (x *TextSet) ValueN(n int) (string, bool, error) { + _found, _value, _err := functions.TextsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return "", false, _err + } + if !_found { + return "", false, nil + } + return _value, true, nil +} + +// Values is MEOS textset_values. +func (x *TextSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TextsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Initcap is MEOS textset_initcap. +func (x *TextSet) Initcap() (*Set, error) { + _r0, _err := functions.TextsetInitcap(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Lower is MEOS textset_lower. +func (x *TextSet) Lower() (*Set, error) { + _r0, _err := functions.TextsetLower(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Upper is MEOS textset_upper. +func (x *TextSet) Upper() (*Set, error) { + _r0, _err := functions.TextsetUpper(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} diff --git a/types/tfloat.go b/types/tfloat.go new file mode 100644 index 0000000..63ac9c4 --- /dev/null +++ b/types/tfloat.go @@ -0,0 +1,309 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TFloat struct { + TNumber +} + +// TFloatFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TFloatFromPointer(p unsafe.Pointer) *TFloat { + if p == nil { + return nil + } + v := &TFloat{} + v.ptr = p + return v +} + +// TFloatFromMFJSON is MEOS tfloat_from_mfjson. +func TFloatFromMFJSON(str string) (*Temporal, error) { + _r0, _err := functions.TfloatFromMFJSON(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TFloatIn is MEOS tfloat_in. +func TFloatIn(str string) (*Temporal, error) { + _r0, _err := functions.TfloatIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tfloat_out. +func (x *TFloat) Out(maxdd int) (string, error) { + _r0, _err := functions.TfloatOut(functions.TemporalFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TFloatFromBaseTemp is MEOS tfloat_from_base_temp. +func TFloatFromBaseTemp(d float64, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TfloatFromBaseTemp(d, functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTint is MEOS tfloat_to_tint. +func (x *TFloat) ToTint() (*Temporal, error) { + _r0, _err := functions.TfloatToTint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTbigint is MEOS tfloat_to_tbigint. +func (x *TFloat) ToTbigint() (*Temporal, error) { + _r0, _err := functions.TfloatToTbigint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tfloat_end_value. +func (x *TFloat) EndValue() (float64, error) { + _r0, _err := functions.TfloatEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// MinValue is MEOS tfloat_min_value. +func (x *TFloat) MinValue() (float64, error) { + _r0, _err := functions.TfloatMinValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// MaxValue is MEOS tfloat_max_value. +func (x *TFloat) MaxValue() (float64, error) { + _r0, _err := functions.TfloatMaxValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS tfloat_start_value. +func (x *TFloat) StartValue() (float64, error) { + _r0, _err := functions.TfloatStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueAtTimestamptz is MEOS tfloat_value_at_timestamptz. +func (x *TFloat) ValueAtTimestamptz(t int64, strict bool) (float64, bool, error) { + _found, _value, _err := functions.TfloatValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// ValueN is MEOS tfloat_value_n. +func (x *TFloat) ValueN(n int) (float64, bool, error) { + _found, _value, _err := functions.TfloatValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS tfloat_values. +func (x *TFloat) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TfloatValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Ceil is MEOS tfloat_ceil. +func (x *TFloat) Ceil() (*Temporal, error) { + _r0, _err := functions.TfloatCeil(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Degrees is MEOS tfloat_degrees. +func (x *TFloat) Degrees(normalize bool) (*Temporal, error) { + _r0, _err := functions.TfloatDegrees(functions.TemporalFromPointer(x.Pointer()), normalize) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Floor is MEOS tfloat_floor. +func (x *TFloat) Floor() (*Temporal, error) { + _r0, _err := functions.TfloatFloor(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Radians is MEOS tfloat_radians. +func (x *TFloat) Radians() (*Temporal, error) { + _r0, _err := functions.TfloatRadians(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ScaleValue is MEOS tfloat_scale_value. +func (x *TFloat) ScaleValue(width float64) (*Temporal, error) { + _r0, _err := functions.TfloatScaleValue(functions.TemporalFromPointer(x.Pointer()), width) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ShiftScaleValue is MEOS tfloat_shift_scale_value. +func (x *TFloat) ShiftScaleValue(shift float64, width float64) (*Temporal, error) { + _r0, _err := functions.TfloatShiftScaleValue(functions.TemporalFromPointer(x.Pointer()), shift, width) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ShiftValue is MEOS tfloat_shift_value. +func (x *TFloat) ShiftValue(shift float64) (*Temporal, error) { + _r0, _err := functions.TfloatShiftValue(functions.TemporalFromPointer(x.Pointer()), shift) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValue is MEOS tfloat_at_value. +func (x *TFloat) AtValue(d float64) (*Temporal, error) { + _r0, _err := functions.TfloatAtValue(functions.TemporalFromPointer(x.Pointer()), d) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS tfloat_minus_value. +func (x *TFloat) MinusValue(d float64) (*Temporal, error) { + _r0, _err := functions.TfloatMinusValue(functions.TemporalFromPointer(x.Pointer()), d) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Exp is MEOS tfloat_exp. +func (x *TFloat) Exp() (*Temporal, error) { + _r0, _err := functions.TfloatExp(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Ln is MEOS tfloat_ln. +func (x *TFloat) Ln() (*Temporal, error) { + _r0, _err := functions.TfloatLn(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Log10 is MEOS tfloat_log10. +func (x *TFloat) Log10() (*Temporal, error) { + _r0, _err := functions.TfloatLog10(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Sin is MEOS tfloat_sin. +func (x *TFloat) Sin() (*Temporal, error) { + _r0, _err := functions.TfloatSin(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Cos is MEOS tfloat_cos. +func (x *TFloat) Cos() (*Temporal, error) { + _r0, _err := functions.TfloatCos(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Tan is MEOS tfloat_tan. +func (x *TFloat) Tan() (*Temporal, error) { + _r0, _err := functions.TfloatTan(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ValueBins is MEOS tfloat_value_bins. +func (x *TFloat) ValueBins(vsize float64, vorigin float64, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.TfloatValueBins(functions.TemporalFromPointer(x.Pointer()), vsize, vorigin, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ValueBoxes is MEOS tfloat_value_boxes. +func (x *TFloat) ValueBoxes(vsize float64, vorigin float64, count unsafe.Pointer) (*TBox, error) { + _r0, _err := functions.TfloatValueBoxes(functions.TemporalFromPointer(x.Pointer()), vsize, vorigin, count) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// ValueSplit is MEOS tfloat_value_split. +func (x *TFloat) ValueSplit(size float64, origin float64, bins unsafe.Pointer, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TfloatValueSplit(functions.TemporalFromPointer(x.Pointer()), size, origin, bins, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} diff --git a/types/tfloatinst.go b/types/tfloatinst.go new file mode 100644 index 0000000..c5234f7 --- /dev/null +++ b/types/tfloatinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TFloatInst struct { + handle +} + +// TFloatInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TFloatInstFromPointer(p unsafe.Pointer) *TFloatInst { + if p == nil { + return nil + } + v := &TFloatInst{} + v.ptr = p + return v +} + +// TFloatInstMake is MEOS tfloatinst_make. +func TFloatInstMake(d float64, t int64) (*Temporal, error) { + _r0, _err := functions.TfloatinstMake(d, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tfloatseq.go b/types/tfloatseq.go new file mode 100644 index 0000000..94465c5 --- /dev/null +++ b/types/tfloatseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TFloatSeq struct { + handle +} + +// TFloatSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TFloatSeqFromPointer(p unsafe.Pointer) *TFloatSeq { + if p == nil { + return nil + } + v := &TFloatSeq{} + v.ptr = p + return v +} + +// TFloatSeqFromBaseTstzset is MEOS tfloatseq_from_base_tstzset. +func TFloatSeqFromBaseTstzset(d float64, s *Set) (*Temporal, error) { + _r0, _err := functions.TfloatseqFromBaseTstzset(d, functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TFloatSeqFromBaseTstzspan is MEOS tfloatseq_from_base_tstzspan. +func TFloatSeqFromBaseTstzspan(d float64, s *Span, interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TfloatseqFromBaseTstzspan(d, functions.SpanFromPointer(s.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tfloatseqset.go b/types/tfloatseqset.go new file mode 100644 index 0000000..c273222 --- /dev/null +++ b/types/tfloatseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TFloatSeqSet struct { + handle +} + +// TFloatSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TFloatSeqSetFromPointer(p unsafe.Pointer) *TFloatSeqSet { + if p == nil { + return nil + } + v := &TFloatSeqSet{} + v.ptr = p + return v +} + +// TFloatSeqSetFromBaseTstzspanset is MEOS tfloatseqset_from_base_tstzspanset. +func TFloatSeqSetFromBaseTstzspanset(d float64, ss *SpanSet, interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TfloatseqsetFromBaseTstzspanset(d, functions.SpanSetFromPointer(ss.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tgeo.go b/types/tgeo.go new file mode 100644 index 0000000..885ca1f --- /dev/null +++ b/types/tgeo.go @@ -0,0 +1,212 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +// TGeo is all PostGIS-derived spatiotemporal types (geometry/geography-based). Authoritative parent per MobilityDB manual Ch.7 Figure 7.1 (= the broad C predicate tgeo_type_all). NOTE: the narrower C predicate tgeo_type() and most tgeo_* functions reject points — class membership (manual) is broader than tgeo_* API applicability; see correction OM-M1. + +type TGeo struct { + TSpatial +} + +// TGeoFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeoFromPointer(p unsafe.Pointer) *TGeo { + if p == nil { + return nil + } + v := &TGeo{} + v.ptr = p + return v +} + +// TGeoFromBaseTemp is MEOS tgeo_from_base_temp. +func TGeoFromBaseTemp(gs *TRGeometrySeqSet, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TgeoFromBaseTemp(functions.GeomFromPointer(gs.Pointer()), functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Centroid is MEOS tgeo_centroid. +func (x *TGeo) Centroid() (*Temporal, error) { + _r0, _err := functions.TgeoCentroid(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ConvexHull is MEOS tgeo_convex_hull. +func (x *TGeo) ConvexHull() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TgeoConvexHull(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tgeo_end_value. +func (x *TGeo) EndValue() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TgeoEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS tgeo_start_value. +func (x *TGeo) StartValue() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TgeoStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// TraversedArea is MEOS tgeo_traversed_area. +func (x *TGeo) TraversedArea(unary_union bool) (*TRGeometrySeqSet, error) { + _r0, _err := functions.TgeoTraversedArea(functions.TemporalFromPointer(x.Pointer()), unary_union) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ValueAtTimestamptz is MEOS tgeo_value_at_timestamptz. +func (x *TGeo) ValueAtTimestamptz(t int64, strict bool) (*TRGeometrySeqSet, bool, error) { + _found, _value, _err := functions.TgeoValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return TRGeometrySeqSetFromPointer(_value.Pointer()), true, nil +} + +// ValueN is MEOS tgeo_value_n. +func (x *TGeo) ValueN(n int) (*TRGeometrySeqSet, bool, error) { + _found, _value, _err := functions.TgeoValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return TRGeometrySeqSetFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS tgeo_values. +func (x *TGeo) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TgeoValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Scale is MEOS tgeo_scale. +func (x *TGeo) Scale(scale *TRGeometrySeqSet, sorigin *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TgeoScale(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(scale.Pointer()), functions.GeomFromPointer(sorigin.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtGeom is MEOS tgeo_at_geom. +func (x *TGeo) AtGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TgeoAtGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtStbox is MEOS tgeo_at_stbox. +func (x *TGeo) AtStbox(box *STBox, border_inc bool) (*Temporal, error) { + _r0, _err := functions.TgeoAtSTBOX(functions.TemporalFromPointer(x.Pointer()), functions.STBoxFromPointer(box.Pointer()), border_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValue is MEOS tgeo_at_value. +func (x *TGeo) AtValue(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TgeoAtValue(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusGeom is MEOS tgeo_minus_geom. +func (x *TGeo) MinusGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TgeoMinusGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusStbox is MEOS tgeo_minus_stbox. +func (x *TGeo) MinusStbox(box *STBox, border_inc bool) (*Temporal, error) { + _r0, _err := functions.TgeoMinusSTBOX(functions.TemporalFromPointer(x.Pointer()), functions.STBoxFromPointer(box.Pointer()), border_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS tgeo_minus_value. +func (x *TGeo) MinusValue(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TgeoMinusValue(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Stboxes is MEOS tgeo_stboxes. +func (x *TGeo) Stboxes(count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.TgeoStboxes(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// SpaceBoxes is MEOS tgeo_space_boxes. +func (x *TGeo) SpaceBoxes(xsize float64, ysize float64, zsize float64, sorigin *TRGeometrySeqSet, bitmatrix bool, border_inc bool, count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.TgeoSpaceBoxes(functions.TemporalFromPointer(x.Pointer()), xsize, ysize, zsize, functions.GeomFromPointer(sorigin.Pointer()), bitmatrix, border_inc, count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// SplitEachNStboxes is MEOS tgeo_split_each_n_stboxes. +func (x *TGeo) SplitEachNStboxes(elem_count int, count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.TgeoSplitEachNStboxes(functions.TemporalFromPointer(x.Pointer()), elem_count, count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// SplitNStboxes is MEOS tgeo_split_n_stboxes. +func (x *TGeo) SplitNStboxes(box_count int, count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.TgeoSplitNStboxes(functions.TemporalFromPointer(x.Pointer()), box_count, count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} diff --git a/types/tgeogpoint.go b/types/tgeogpoint.go new file mode 100644 index 0000000..00974ca --- /dev/null +++ b/types/tgeogpoint.go @@ -0,0 +1,69 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TGeogPoint struct { + TPoint +} + +// TGeogPointFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeogPointFromPointer(p unsafe.Pointer) *TGeogPoint { + if p == nil { + return nil + } + v := &TGeogPoint{} + v.ptr = p + return v +} + +// TGeogPointFromMFJSON is MEOS tgeogpoint_from_mfjson. +func TGeogPointFromMFJSON(str string) (*Temporal, error) { + _r0, _err := functions.TgeogpointFromMFJSON(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TGeogPointIn is MEOS tgeogpoint_in. +func TGeogPointIn(str string) (*Temporal, error) { + _r0, _err := functions.TgeogpointIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeography is MEOS tgeogpoint_to_tgeography. +func (x *TGeogPoint) ToTgeography() (*Temporal, error) { + _r0, _err := functions.TgeogpointToTgeography(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTh3index is MEOS tgeogpoint_to_th3index. +func (x *TGeogPoint) ToTh3index(resolution int32) (*Temporal, error) { + _r0, _err := functions.TgeogpointToTh3index(functions.TemporalFromPointer(x.Pointer()), resolution) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// GreatCircleDistance is MEOS tgeogpoint_great_circle_distance. +func (x *TGeogPoint) GreatCircleDistance(b *Temporal) (*Temporal, error) { + _r0, _err := functions.TgeogpointGreatCircleDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(b.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tgeogpointinst.go b/types/tgeogpointinst.go new file mode 100644 index 0000000..d753a8b --- /dev/null +++ b/types/tgeogpointinst.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeogPointInst struct { + handle +} + +// TGeogPointInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeogPointInstFromPointer(p unsafe.Pointer) *TGeogPointInst { + if p == nil { + return nil + } + v := &TGeogPointInst{} + v.ptr = p + return v +} diff --git a/types/tgeogpointseq.go b/types/tgeogpointseq.go new file mode 100644 index 0000000..7c1f95c --- /dev/null +++ b/types/tgeogpointseq.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeogPointSeq struct { + handle +} + +// TGeogPointSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeogPointSeqFromPointer(p unsafe.Pointer) *TGeogPointSeq { + if p == nil { + return nil + } + v := &TGeogPointSeq{} + v.ptr = p + return v +} diff --git a/types/tgeogpointseqset.go b/types/tgeogpointseqset.go new file mode 100644 index 0000000..54b493b --- /dev/null +++ b/types/tgeogpointseqset.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeogPointSeqSet struct { + handle +} + +// TGeogPointSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeogPointSeqSetFromPointer(p unsafe.Pointer) *TGeogPointSeqSet { + if p == nil { + return nil + } + v := &TGeogPointSeqSet{} + v.ptr = p + return v +} diff --git a/types/tgeography.go b/types/tgeography.go new file mode 100644 index 0000000..95b2b5a --- /dev/null +++ b/types/tgeography.go @@ -0,0 +1,60 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TGeography struct { + TGeo +} + +// TGeographyFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeographyFromPointer(p unsafe.Pointer) *TGeography { + if p == nil { + return nil + } + v := &TGeography{} + v.ptr = p + return v +} + +// TGeographyFromMFJSON is MEOS tgeography_from_mfjson. +func TGeographyFromMFJSON(mfjson string) (*Temporal, error) { + _r0, _err := functions.TgeographyFromMFJSON(mfjson) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TGeographyIn is MEOS tgeography_in. +func TGeographyIn(str string) (*Temporal, error) { + _r0, _err := functions.TgeographyIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeogpoint is MEOS tgeography_to_tgeogpoint. +func (x *TGeography) ToTgeogpoint() (*Temporal, error) { + _r0, _err := functions.TgeographyToTgeogpoint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeometry is MEOS tgeography_to_tgeometry. +func (x *TGeography) ToTgeometry() (*Temporal, error) { + _r0, _err := functions.TgeographyToTgeometry(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tgeographyinst.go b/types/tgeographyinst.go new file mode 100644 index 0000000..a8f83c8 --- /dev/null +++ b/types/tgeographyinst.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeographyInst struct { + handle +} + +// TGeographyInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeographyInstFromPointer(p unsafe.Pointer) *TGeographyInst { + if p == nil { + return nil + } + v := &TGeographyInst{} + v.ptr = p + return v +} diff --git a/types/tgeographyseq.go b/types/tgeographyseq.go new file mode 100644 index 0000000..0876949 --- /dev/null +++ b/types/tgeographyseq.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeographySeq struct { + handle +} + +// TGeographySeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeographySeqFromPointer(p unsafe.Pointer) *TGeographySeq { + if p == nil { + return nil + } + v := &TGeographySeq{} + v.ptr = p + return v +} diff --git a/types/tgeographyseqset.go b/types/tgeographyseqset.go new file mode 100644 index 0000000..68c4a8d --- /dev/null +++ b/types/tgeographyseqset.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeographySeqSet struct { + handle +} + +// TGeographySeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeographySeqSetFromPointer(p unsafe.Pointer) *TGeographySeqSet { + if p == nil { + return nil + } + v := &TGeographySeqSet{} + v.ptr = p + return v +} diff --git a/types/tgeometry.go b/types/tgeometry.go new file mode 100644 index 0000000..f155a72 --- /dev/null +++ b/types/tgeometry.go @@ -0,0 +1,69 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TGeometry struct { + TGeo +} + +// TGeometryFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeometryFromPointer(p unsafe.Pointer) *TGeometry { + if p == nil { + return nil + } + v := &TGeometry{} + v.ptr = p + return v +} + +// TGeometryFromMFJSON is MEOS tgeometry_from_mfjson. +func TGeometryFromMFJSON(str string) (*Temporal, error) { + _r0, _err := functions.TgeometryFromMFJSON(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TGeometryIn is MEOS tgeometry_in. +func TGeometryIn(str string) (*Temporal, error) { + _r0, _err := functions.TgeometryIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeography is MEOS tgeometry_to_tgeography. +func (x *TGeometry) ToTgeography() (*Temporal, error) { + _r0, _err := functions.TgeometryToTgeography(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeompoint is MEOS tgeometry_to_tgeompoint. +func (x *TGeometry) ToTgeompoint() (*Temporal, error) { + _r0, _err := functions.TgeometryToTgeompoint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTcbuffer is MEOS tgeometry_to_tcbuffer. +func (x *TGeometry) ToTcbuffer() (*Temporal, error) { + _r0, _err := functions.TgeometryToTcbuffer(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tgeometryinst.go b/types/tgeometryinst.go new file mode 100644 index 0000000..e9531c1 --- /dev/null +++ b/types/tgeometryinst.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeometryInst struct { + handle +} + +// TGeometryInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeometryInstFromPointer(p unsafe.Pointer) *TGeometryInst { + if p == nil { + return nil + } + v := &TGeometryInst{} + v.ptr = p + return v +} diff --git a/types/tgeometryseq.go b/types/tgeometryseq.go new file mode 100644 index 0000000..f97adc6 --- /dev/null +++ b/types/tgeometryseq.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeometrySeq struct { + handle +} + +// TGeometrySeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeometrySeqFromPointer(p unsafe.Pointer) *TGeometrySeq { + if p == nil { + return nil + } + v := &TGeometrySeq{} + v.ptr = p + return v +} diff --git a/types/tgeometryseqset.go b/types/tgeometryseqset.go new file mode 100644 index 0000000..2216ea5 --- /dev/null +++ b/types/tgeometryseqset.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeometrySeqSet struct { + handle +} + +// TGeometrySeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeometrySeqSetFromPointer(p unsafe.Pointer) *TGeometrySeqSet { + if p == nil { + return nil + } + v := &TGeometrySeqSet{} + v.ptr = p + return v +} diff --git a/types/tgeompoint.go b/types/tgeompoint.go new file mode 100644 index 0000000..a0a4914 --- /dev/null +++ b/types/tgeompoint.go @@ -0,0 +1,69 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TGeomPoint struct { + TPoint +} + +// TGeomPointFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeomPointFromPointer(p unsafe.Pointer) *TGeomPoint { + if p == nil { + return nil + } + v := &TGeomPoint{} + v.ptr = p + return v +} + +// TGeomPointFromMFJSON is MEOS tgeompoint_from_mfjson. +func TGeomPointFromMFJSON(str string) (*Temporal, error) { + _r0, _err := functions.TgeompointFromMFJSON(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TGeomPointIn is MEOS tgeompoint_in. +func TGeomPointIn(str string) (*Temporal, error) { + _r0, _err := functions.TgeompointIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeometry is MEOS tgeompoint_to_tgeometry. +func (x *TGeomPoint) ToTgeometry() (*Temporal, error) { + _r0, _err := functions.TgeompointToTgeometry(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTh3index is MEOS tgeompoint_to_th3index. +func (x *TGeomPoint) ToTh3index(resolution int32) (*Temporal, error) { + _r0, _err := functions.TgeompointToTh3index(functions.TemporalFromPointer(x.Pointer()), resolution) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTnpoint is MEOS tgeompoint_to_tnpoint. +func (x *TGeomPoint) ToTnpoint() (*Temporal, error) { + _r0, _err := functions.TgeompointToTnpoint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tgeompointinst.go b/types/tgeompointinst.go new file mode 100644 index 0000000..63ff788 --- /dev/null +++ b/types/tgeompointinst.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeomPointInst struct { + handle +} + +// TGeomPointInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeomPointInstFromPointer(p unsafe.Pointer) *TGeomPointInst { + if p == nil { + return nil + } + v := &TGeomPointInst{} + v.ptr = p + return v +} diff --git a/types/tgeompointseq.go b/types/tgeompointseq.go new file mode 100644 index 0000000..08544b6 --- /dev/null +++ b/types/tgeompointseq.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeomPointSeq struct { + handle +} + +// TGeomPointSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeomPointSeqFromPointer(p unsafe.Pointer) *TGeomPointSeq { + if p == nil { + return nil + } + v := &TGeomPointSeq{} + v.ptr = p + return v +} diff --git a/types/tgeompointseqset.go b/types/tgeompointseqset.go new file mode 100644 index 0000000..b9017fb --- /dev/null +++ b/types/tgeompointseqset.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TGeomPointSeqSet struct { + handle +} + +// TGeomPointSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TGeomPointSeqSetFromPointer(p unsafe.Pointer) *TGeomPointSeqSet { + if p == nil { + return nil + } + v := &TGeomPointSeqSet{} + v.ptr = p + return v +} diff --git a/types/tinstant.go b/types/tinstant.go new file mode 100644 index 0000000..72b2c3a --- /dev/null +++ b/types/tinstant.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type TInstant struct { + Temporal +} + +// TInstantFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TInstantFromPointer(p unsafe.Pointer) *TInstant { + if p == nil { + return nil + } + v := &TInstant{} + v.ptr = p + return v +} diff --git a/types/tint.go b/types/tint.go new file mode 100644 index 0000000..0883ed5 --- /dev/null +++ b/types/tint.go @@ -0,0 +1,219 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TInt struct { + TNumber +} + +// TIntFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TIntFromPointer(p unsafe.Pointer) *TInt { + if p == nil { + return nil + } + v := &TInt{} + v.ptr = p + return v +} + +// TIntFromMFJSON is MEOS tint_from_mfjson. +func TIntFromMFJSON(str string) (*Temporal, error) { + _r0, _err := functions.TintFromMFJSON(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TIntIn is MEOS tint_in. +func TIntIn(str string) (*Temporal, error) { + _r0, _err := functions.TintIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tint_out. +func (x *TInt) Out() (string, error) { + _r0, _err := functions.TintOut(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TIntFromBaseTemp is MEOS tint_from_base_temp. +func TIntFromBaseTemp(i int, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TintFromBaseTemp(i, functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTfloat is MEOS tint_to_tfloat. +func (x *TInt) ToTfloat() (*Temporal, error) { + _r0, _err := functions.TintToTfloat(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTbigint is MEOS tint_to_tbigint. +func (x *TInt) ToTbigint() (*Temporal, error) { + _r0, _err := functions.TintToTbigint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tint_end_value. +func (x *TInt) EndValue() (int, error) { + _r0, _err := functions.TintEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// MaxValue is MEOS tint_max_value. +func (x *TInt) MaxValue() (int, error) { + _r0, _err := functions.TintMaxValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// MinValue is MEOS tint_min_value. +func (x *TInt) MinValue() (int, error) { + _r0, _err := functions.TintMinValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS tint_start_value. +func (x *TInt) StartValue() (int, error) { + _r0, _err := functions.TintStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueAtTimestamptz is MEOS tint_value_at_timestamptz. +func (x *TInt) ValueAtTimestamptz(t int64, strict bool) (int, bool, error) { + _found, _value, _err := functions.TintValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// ValueN is MEOS tint_value_n. +func (x *TInt) ValueN(n int) (int, bool, error) { + _found, _value, _err := functions.TintValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS tint_values. +func (x *TInt) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TintValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ScaleValue is MEOS tint_scale_value. +func (x *TInt) ScaleValue(width int) (*Temporal, error) { + _r0, _err := functions.TintScaleValue(functions.TemporalFromPointer(x.Pointer()), width) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ShiftScaleValue is MEOS tint_shift_scale_value. +func (x *TInt) ShiftScaleValue(shift int, width int) (*Temporal, error) { + _r0, _err := functions.TintShiftScaleValue(functions.TemporalFromPointer(x.Pointer()), shift, width) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ShiftValue is MEOS tint_shift_value. +func (x *TInt) ShiftValue(shift int) (*Temporal, error) { + _r0, _err := functions.TintShiftValue(functions.TemporalFromPointer(x.Pointer()), shift) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValue is MEOS tint_at_value. +func (x *TInt) AtValue(i int) (*Temporal, error) { + _r0, _err := functions.TintAtValue(functions.TemporalFromPointer(x.Pointer()), i) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS tint_minus_value. +func (x *TInt) MinusValue(i int) (*Temporal, error) { + _r0, _err := functions.TintMinusValue(functions.TemporalFromPointer(x.Pointer()), i) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ValueBins is MEOS tint_value_bins. +func (x *TInt) ValueBins(vsize int, vorigin int, count unsafe.Pointer) (*Span, error) { + _r0, _err := functions.TintValueBins(functions.TemporalFromPointer(x.Pointer()), vsize, vorigin, count) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ValueBoxes is MEOS tint_value_boxes. +func (x *TInt) ValueBoxes(vsize int, vorigin int, count unsafe.Pointer) (*TBox, error) { + _r0, _err := functions.TintValueBoxes(functions.TemporalFromPointer(x.Pointer()), vsize, vorigin, count) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// ValueSplit is MEOS tint_value_split. +func (x *TInt) ValueSplit(vsize int, vorigin int, bins unsafe.Pointer, count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TintValueSplit(functions.TemporalFromPointer(x.Pointer()), vsize, vorigin, bins, count) + if _err != nil { + return nil, _err + } + return _r0, nil +} diff --git a/types/tintinst.go b/types/tintinst.go new file mode 100644 index 0000000..4df7898 --- /dev/null +++ b/types/tintinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TIntInst struct { + handle +} + +// TIntInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TIntInstFromPointer(p unsafe.Pointer) *TIntInst { + if p == nil { + return nil + } + v := &TIntInst{} + v.ptr = p + return v +} + +// TIntInstMake is MEOS tintinst_make. +func TIntInstMake(i int, t int64) (*Temporal, error) { + _r0, _err := functions.TintinstMake(i, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tintseq.go b/types/tintseq.go new file mode 100644 index 0000000..dcf503c --- /dev/null +++ b/types/tintseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TIntSeq struct { + handle +} + +// TIntSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TIntSeqFromPointer(p unsafe.Pointer) *TIntSeq { + if p == nil { + return nil + } + v := &TIntSeq{} + v.ptr = p + return v +} + +// TIntSeqFromBaseTstzset is MEOS tintseq_from_base_tstzset. +func TIntSeqFromBaseTstzset(i int, s *Set) (*Temporal, error) { + _r0, _err := functions.TintseqFromBaseTstzset(i, functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TIntSeqFromBaseTstzspan is MEOS tintseq_from_base_tstzspan. +func TIntSeqFromBaseTstzspan(i int, s *Span) (*Temporal, error) { + _r0, _err := functions.TintseqFromBaseTstzspan(i, functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tintseqset.go b/types/tintseqset.go new file mode 100644 index 0000000..95e28ad --- /dev/null +++ b/types/tintseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TIntSeqSet struct { + handle +} + +// TIntSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TIntSeqSetFromPointer(p unsafe.Pointer) *TIntSeqSet { + if p == nil { + return nil + } + v := &TIntSeqSet{} + v.ptr = p + return v +} + +// TIntSeqSetFromBaseTstzspanset is MEOS tintseqset_from_base_tstzspanset. +func TIntSeqSetFromBaseTstzspanset(i int, ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TintseqsetFromBaseTstzspanset(i, functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tjsonb.go b/types/tjsonb.go new file mode 100644 index 0000000..8f5da67 --- /dev/null +++ b/types/tjsonb.go @@ -0,0 +1,354 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TJsonb struct { + TAlpha +} + +// TJsonbFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TJsonbFromPointer(p unsafe.Pointer) *TJsonb { + if p == nil { + return nil + } + v := &TJsonb{} + v.ptr = p + return v +} + +// TJsonbFromMFJSON is MEOS tjsonb_from_mfjson. +func TJsonbFromMFJSON(str string) (*Temporal, error) { + _r0, _err := functions.TjsonbFromMFJSON(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TJsonbIn is MEOS tjsonb_in. +func TJsonbIn(str string) (*Temporal, error) { + _r0, _err := functions.TjsonbIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tjsonb_out. +func (x *TJsonb) Out() (string, error) { + _r0, _err := functions.TjsonbOut(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TJsonbFromBaseTemp is MEOS tjsonb_from_base_temp. +func TJsonbFromBaseTemp(jsonb *Jsonb, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TjsonbFromBaseTemp(functions.JsonbFromPointer(jsonb.Pointer()), functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTtext is MEOS tjsonb_to_ttext. +func (x *TJsonb) ToTtext() (*Temporal, error) { + _r0, _err := functions.TjsonbToTtext(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tjsonb_end_value. +func (x *TJsonb) EndValue() (*Jsonb, error) { + _r0, _err := functions.TjsonbEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS tjsonb_start_value. +func (x *TJsonb) StartValue() (*Jsonb, error) { + _r0, _err := functions.TjsonbStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return JsonbFromPointer(_r0.Pointer()), nil +} + +// ValueAtTimestamptz is MEOS tjsonb_value_at_timestamptz. +func (x *TJsonb) ValueAtTimestamptz(t int64, strict bool) (*Jsonb, bool, error) { + _found, _value, _err := functions.TjsonbValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return JsonbFromPointer(_value.Pointer()), true, nil +} + +// ValueN is MEOS tjsonb_value_n. +func (x *TJsonb) ValueN(n int) (*Jsonb, bool, error) { + _found, _value, _err := functions.TjsonbValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return JsonbFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS tjsonb_values. +func (x *TJsonb) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TjsonbValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ArrayElement is MEOS tjsonb_array_element. +func (x *TJsonb) ArrayElement(idx int, astext bool, null_handle functions.NullHandleType) (*Temporal, error) { + _r0, _err := functions.TjsonbArrayElement(functions.TemporalFromPointer(x.Pointer()), idx, astext, null_handle) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ArrayLength is MEOS tjsonb_array_length. +func (x *TJsonb) ArrayLength() (*Temporal, error) { + _r0, _err := functions.TjsonbArrayLength(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Delete is MEOS tjsonb_delete. +func (x *TJsonb) Delete(key string) (*Temporal, error) { + _r0, _err := functions.TjsonbDelete(functions.TemporalFromPointer(x.Pointer()), key) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeleteArray is MEOS tjsonb_delete_array. +func (x *TJsonb) DeleteArray(keys unsafe.Pointer, count int) (*Temporal, error) { + _r0, _err := functions.TjsonbDeleteArray(functions.TemporalFromPointer(x.Pointer()), keys, count) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeleteIndex is MEOS tjsonb_delete_index. +func (x *TJsonb) DeleteIndex(idx int) (*Temporal, error) { + _r0, _err := functions.TjsonbDeleteIndex(functions.TemporalFromPointer(x.Pointer()), idx) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeletePath is MEOS tjsonb_delete_path. +func (x *TJsonb) DeletePath(path_elems unsafe.Pointer, path_len int) (*Temporal, error) { + _r0, _err := functions.TjsonbDeletePath(functions.TemporalFromPointer(x.Pointer()), path_elems, path_len) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Exists is MEOS tjsonb_exists. +func (x *TJsonb) Exists(key string) (*Temporal, error) { + _r0, _err := functions.TjsonbExists(functions.TemporalFromPointer(x.Pointer()), key) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ExistsAll is MEOS tjsonb_exists_all. +func (x *TJsonb) ExistsAll(keys unsafe.Pointer, count int) (*Temporal, error) { + _r0, _err := functions.TjsonbExistsAll(functions.TemporalFromPointer(x.Pointer()), keys, count) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ExistsAny is MEOS tjsonb_exists_any. +func (x *TJsonb) ExistsAny(keys unsafe.Pointer, count int) (*Temporal, error) { + _r0, _err := functions.TjsonbExistsAny(functions.TemporalFromPointer(x.Pointer()), keys, count) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ExistsArray is MEOS tjsonb_exists_array. +func (x *TJsonb) ExistsArray(keys unsafe.Pointer, count int, any bool) (*Temporal, error) { + _r0, _err := functions.TjsonbExistsArray(functions.TemporalFromPointer(x.Pointer()), keys, count, any) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ExtractPath is MEOS tjsonb_extract_path. +func (x *TJsonb) ExtractPath(path_elems unsafe.Pointer, path_len int, astext bool, null_handle functions.NullHandleType) (*Temporal, error) { + _r0, _err := functions.TjsonbExtractPath(functions.TemporalFromPointer(x.Pointer()), path_elems, path_len, astext, null_handle) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Insert is MEOS tjsonb_insert. +func (x *TJsonb) Insert(keys unsafe.Pointer, count int, newjb *Jsonb, after bool) (*Temporal, error) { + _r0, _err := functions.TjsonbInsert(functions.TemporalFromPointer(x.Pointer()), keys, count, functions.JsonbFromPointer(newjb.Pointer()), after) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ObjectField is MEOS tjsonb_object_field. +func (x *TJsonb) ObjectField(key string, astext bool, null_handle functions.NullHandleType) (*Temporal, error) { + _r0, _err := functions.TjsonbObjectField(functions.TemporalFromPointer(x.Pointer()), key, astext, null_handle) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// PathExists is MEOS tjsonb_path_exists. +func (x *TJsonb) PathExists(jp *JsonPath, vars *Jsonb, silent bool, tz bool) (*Temporal, error) { + _r0, _err := functions.TjsonbPathExists(functions.TemporalFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// PathMatch is MEOS tjsonb_path_match. +func (x *TJsonb) PathMatch(jp *JsonPath, vars *Jsonb, silent bool, tz bool) (*Temporal, error) { + _r0, _err := functions.TjsonbPathMatch(functions.TemporalFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// PathQueryArray is MEOS tjsonb_path_query_array. +func (x *TJsonb) PathQueryArray(jp *JsonPath, vars *Jsonb, silent bool, tz bool) (*Temporal, error) { + _r0, _err := functions.TjsonbPathQueryArray(functions.TemporalFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// PathQueryFirst is MEOS tjsonb_path_query_first. +func (x *TJsonb) PathQueryFirst(jp *JsonPath, vars *Jsonb, silent bool, tz bool) (*Temporal, error) { + _r0, _err := functions.TjsonbPathQueryFirst(functions.TemporalFromPointer(x.Pointer()), functions.JsonPathFromPointer(jp.Pointer()), functions.JsonbFromPointer(vars.Pointer()), silent, tz) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Pretty is MEOS tjsonb_pretty. +func (x *TJsonb) Pretty() (*Temporal, error) { + _r0, _err := functions.TjsonbPretty(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Set is MEOS tjsonb_set. +func (x *TJsonb) Set(keys unsafe.Pointer, count int, newjb *Jsonb, create bool, handle_null string, lax bool) (*Temporal, error) { + _r0, _err := functions.TjsonbSet(functions.TemporalFromPointer(x.Pointer()), keys, count, functions.JsonbFromPointer(newjb.Pointer()), create, handle_null, lax) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StripNulls is MEOS tjsonb_strip_nulls. +func (x *TJsonb) StripNulls(strip_in_arrays bool) (*Temporal, error) { + _r0, _err := functions.TjsonbStripNulls(functions.TemporalFromPointer(x.Pointer()), strip_in_arrays) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTbool is MEOS tjsonb_to_tbool. +func (x *TJsonb) ToTbool(key string, null_handle functions.NullHandleType) (*Temporal, error) { + _r0, _err := functions.TjsonbToTbool(functions.TemporalFromPointer(x.Pointer()), key, null_handle) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTfloat is MEOS tjsonb_to_tfloat. +func (x *TJsonb) ToTfloat(key string, interp functions.Interpolation, null_handle functions.NullHandleType) (*Temporal, error) { + _r0, _err := functions.TjsonbToTfloat(functions.TemporalFromPointer(x.Pointer()), key, interp, null_handle) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTint is MEOS tjsonb_to_tint. +func (x *TJsonb) ToTint(key string, null_handle functions.NullHandleType) (*Temporal, error) { + _r0, _err := functions.TjsonbToTint(functions.TemporalFromPointer(x.Pointer()), key, null_handle) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTtextKey is MEOS tjsonb_to_ttext_key. +func (x *TJsonb) ToTtextKey(key string, null_handle functions.NullHandleType) (*Temporal, error) { + _r0, _err := functions.TjsonbToTtextKey(functions.TemporalFromPointer(x.Pointer()), key, null_handle) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValue is MEOS tjsonb_at_value. +func (x *TJsonb) AtValue(jsb *Jsonb) (*Temporal, error) { + _r0, _err := functions.TjsonbAtValue(functions.TemporalFromPointer(x.Pointer()), functions.JsonbFromPointer(jsb.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS tjsonb_minus_value. +func (x *TJsonb) MinusValue(jsb *Jsonb) (*Temporal, error) { + _r0, _err := functions.TjsonbMinusValue(functions.TemporalFromPointer(x.Pointer()), functions.JsonbFromPointer(jsb.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tjsonbinst.go b/types/tjsonbinst.go new file mode 100644 index 0000000..8323647 --- /dev/null +++ b/types/tjsonbinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TJsonbInst struct { + handle +} + +// TJsonbInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TJsonbInstFromPointer(p unsafe.Pointer) *TJsonbInst { + if p == nil { + return nil + } + v := &TJsonbInst{} + v.ptr = p + return v +} + +// TJsonbInstMake is MEOS tjsonbinst_make. +func TJsonbInstMake(jsonb *Jsonb, t int64) (*Temporal, error) { + _r0, _err := functions.TjsonbinstMake(functions.JsonbFromPointer(jsonb.Pointer()), t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tjsonbseq.go b/types/tjsonbseq.go new file mode 100644 index 0000000..cbea172 --- /dev/null +++ b/types/tjsonbseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TJsonbSeq struct { + handle +} + +// TJsonbSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TJsonbSeqFromPointer(p unsafe.Pointer) *TJsonbSeq { + if p == nil { + return nil + } + v := &TJsonbSeq{} + v.ptr = p + return v +} + +// TJsonbSeqFromBaseTstzset is MEOS tjsonbseq_from_base_tstzset. +func TJsonbSeqFromBaseTstzset(jsonb *Jsonb, s *Set) (*Temporal, error) { + _r0, _err := functions.TjsonbseqFromBaseTstzset(functions.JsonbFromPointer(jsonb.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TJsonbSeqFromBaseTstzspan is MEOS tjsonbseq_from_base_tstzspan. +func TJsonbSeqFromBaseTstzspan(jsonb *Jsonb, sp *Span) (*Temporal, error) { + _r0, _err := functions.TjsonbseqFromBaseTstzspan(functions.JsonbFromPointer(jsonb.Pointer()), functions.SpanFromPointer(sp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tjsonbseqset.go b/types/tjsonbseqset.go new file mode 100644 index 0000000..e54b689 --- /dev/null +++ b/types/tjsonbseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TJsonbSeqSet struct { + handle +} + +// TJsonbSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TJsonbSeqSetFromPointer(p unsafe.Pointer) *TJsonbSeqSet { + if p == nil { + return nil + } + v := &TJsonbSeqSet{} + v.ptr = p + return v +} + +// TJsonbSeqSetFromBaseTstzspanset is MEOS tjsonbseqset_from_base_tstzspanset. +func TJsonbSeqSetFromBaseTstzspanset(jsonb *Jsonb, ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TjsonbseqsetFromBaseTstzspanset(functions.JsonbFromPointer(jsonb.Pointer()), functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tnpoint.go b/types/tnpoint.go new file mode 100644 index 0000000..6782993 --- /dev/null +++ b/types/tnpoint.go @@ -0,0 +1,264 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TNpoint struct { + TSpatial +} + +// TNpointFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TNpointFromPointer(p unsafe.Pointer) *TNpoint { + if p == nil { + return nil + } + v := &TNpoint{} + v.ptr = p + return v +} + +// TNpointIn is MEOS tnpoint_in. +func TNpointIn(str string) (*Temporal, error) { + _r0, _err := functions.TnpointIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TNpointFromMFJSON is MEOS tnpoint_from_mfjson. +func TNpointFromMFJSON(mfjson string) (*Temporal, error) { + _r0, _err := functions.TnpointFromMFJSON(mfjson) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tnpoint_out. +func (x *TNpoint) Out(maxdd int) (string, error) { + _r0, _err := functions.TnpointOut(functions.TemporalFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TNpointFromBaseTemp is MEOS tnpoint_from_base_temp. +func TNpointFromBaseTemp(np *Npoint, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TnpointFromBaseTemp(functions.NpointFromPointer(np.Pointer()), functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeompoint is MEOS tnpoint_to_tgeompoint. +func (x *TNpoint) ToTgeompoint() (*Temporal, error) { + _r0, _err := functions.TnpointToTgeompoint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CumulativeLength is MEOS tnpoint_cumulative_length. +func (x *TNpoint) CumulativeLength() (*Temporal, error) { + _r0, _err := functions.TnpointCumulativeLength(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tnpoint_end_value. +func (x *TNpoint) EndValue() (*Npoint, error) { + _r0, _err := functions.TnpointEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return NpointFromPointer(_r0.Pointer()), nil +} + +// Length is MEOS tnpoint_length. +func (x *TNpoint) Length() (float64, error) { + _r0, _err := functions.TnpointLength(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Positions is MEOS tnpoint_positions. +func (x *TNpoint) Positions(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TnpointPositions(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Route is MEOS tnpoint_route. +func (x *TNpoint) Route() (int64, error) { + _r0, _err := functions.TnpointRoute(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Routes is MEOS tnpoint_routes. +func (x *TNpoint) Routes() (*Set, error) { + _r0, _err := functions.TnpointRoutes(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Speed is MEOS tnpoint_speed. +func (x *TNpoint) Speed() (*Temporal, error) { + _r0, _err := functions.TnpointSpeed(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS tnpoint_start_value. +func (x *TNpoint) StartValue() (*Npoint, error) { + _r0, _err := functions.TnpointStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return NpointFromPointer(_r0.Pointer()), nil +} + +// Trajectory is MEOS tnpoint_trajectory. +func (x *TNpoint) Trajectory() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TnpointTrajectory(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ValueAtTimestamptz is MEOS tnpoint_value_at_timestamptz. +func (x *TNpoint) ValueAtTimestamptz(t int64, strict bool) (*Npoint, bool, error) { + _found, _value, _err := functions.TnpointValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return NpointFromPointer(_value.Pointer()), true, nil +} + +// ValueN is MEOS tnpoint_value_n. +func (x *TNpoint) ValueN(n int) (*Npoint, bool, error) { + _found, _value, _err := functions.TnpointValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return NpointFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS tnpoint_values. +func (x *TNpoint) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TnpointValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Twcentroid is MEOS tnpoint_twcentroid. +func (x *TNpoint) Twcentroid() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TnpointTwcentroid(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// AtGeom is MEOS tnpoint_at_geom. +func (x *TNpoint) AtGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TnpointAtGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtNpoint is MEOS tnpoint_at_npoint. +func (x *TNpoint) AtNpoint(np *Npoint) (*Temporal, error) { + _r0, _err := functions.TnpointAtNpoint(functions.TemporalFromPointer(x.Pointer()), functions.NpointFromPointer(np.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtNpointset is MEOS tnpoint_at_npointset. +func (x *TNpoint) AtNpointset(s *Set) (*Temporal, error) { + _r0, _err := functions.TnpointAtNpointset(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtStbox is MEOS tnpoint_at_stbox. +func (x *TNpoint) AtStbox(box *STBox, border_inc bool) (*Temporal, error) { + _r0, _err := functions.TnpointAtSTBOX(functions.TemporalFromPointer(x.Pointer()), functions.STBoxFromPointer(box.Pointer()), border_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusGeom is MEOS tnpoint_minus_geom. +func (x *TNpoint) MinusGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TnpointMinusGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusNpoint is MEOS tnpoint_minus_npoint. +func (x *TNpoint) MinusNpoint(np *Npoint) (*Temporal, error) { + _r0, _err := functions.TnpointMinusNpoint(functions.TemporalFromPointer(x.Pointer()), functions.NpointFromPointer(np.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusNpointset is MEOS tnpoint_minus_npointset. +func (x *TNpoint) MinusNpointset(s *Set) (*Temporal, error) { + _r0, _err := functions.TnpointMinusNpointset(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusStbox is MEOS tnpoint_minus_stbox. +func (x *TNpoint) MinusStbox(box *STBox, border_inc bool) (*Temporal, error) { + _r0, _err := functions.TnpointMinusSTBOX(functions.TemporalFromPointer(x.Pointer()), functions.STBoxFromPointer(box.Pointer()), border_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tnpointinst.go b/types/tnpointinst.go new file mode 100644 index 0000000..dbe55ac --- /dev/null +++ b/types/tnpointinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TNpointInst struct { + handle +} + +// TNpointInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TNpointInstFromPointer(p unsafe.Pointer) *TNpointInst { + if p == nil { + return nil + } + v := &TNpointInst{} + v.ptr = p + return v +} + +// TNpointInstMake is MEOS tnpointinst_make. +func TNpointInstMake(np *Npoint, t int64) (*Temporal, error) { + _r0, _err := functions.TnpointinstMake(functions.NpointFromPointer(np.Pointer()), t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tnpointseq.go b/types/tnpointseq.go new file mode 100644 index 0000000..69ef39a --- /dev/null +++ b/types/tnpointseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TNpointSeq struct { + handle +} + +// TNpointSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TNpointSeqFromPointer(p unsafe.Pointer) *TNpointSeq { + if p == nil { + return nil + } + v := &TNpointSeq{} + v.ptr = p + return v +} + +// TNpointSeqFromBaseTstzset is MEOS tnpointseq_from_base_tstzset. +func TNpointSeqFromBaseTstzset(np *Npoint, s *Set) (*Temporal, error) { + _r0, _err := functions.TnpointseqFromBaseTstzset(functions.NpointFromPointer(np.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TNpointSeqFromBaseTstzspan is MEOS tnpointseq_from_base_tstzspan. +func TNpointSeqFromBaseTstzspan(np *Npoint, s *Span, interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TnpointseqFromBaseTstzspan(functions.NpointFromPointer(np.Pointer()), functions.SpanFromPointer(s.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tnpointseqset.go b/types/tnpointseqset.go new file mode 100644 index 0000000..a8478a9 --- /dev/null +++ b/types/tnpointseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TNpointSeqSet struct { + handle +} + +// TNpointSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TNpointSeqSetFromPointer(p unsafe.Pointer) *TNpointSeqSet { + if p == nil { + return nil + } + v := &TNpointSeqSet{} + v.ptr = p + return v +} + +// TNpointSeqSetFromBaseTstzspanset is MEOS tnpointseqset_from_base_tstzspanset. +func TNpointSeqSetFromBaseTstzspanset(np *Npoint, ss *SpanSet, interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TnpointseqsetFromBaseTstzspanset(functions.NpointFromPointer(np.Pointer()), functions.SpanSetFromPointer(ss.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tnumber.go b/types/tnumber.go new file mode 100644 index 0000000..01fef91 --- /dev/null +++ b/types/tnumber.go @@ -0,0 +1,188 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +// TNumber is temporal numbers; supports linear interpolation. + +type TNumber struct { + Temporal +} + +// TNumberFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TNumberFromPointer(p unsafe.Pointer) *TNumber { + if p == nil { + return nil + } + v := &TNumber{} + v.ptr = p + return v +} + +// ToSpan is MEOS tnumber_to_span. +func (x *TNumber) ToSpan() (*Span, error) { + _r0, _err := functions.TnumberToSpan(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToTbox is MEOS tnumber_to_tbox. +func (x *TNumber) ToTbox() (*TBox, error) { + _r0, _err := functions.TnumberToTBOX(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// Integral is MEOS tnumber_integral. +func (x *TNumber) Integral() (float64, error) { + _r0, _err := functions.TnumberIntegral(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Twavg is MEOS tnumber_twavg. +func (x *TNumber) Twavg() (float64, error) { + _r0, _err := functions.TnumberTwavg(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Valuespans is MEOS tnumber_valuespans. +func (x *TNumber) Valuespans() (*SpanSet, error) { + _r0, _err := functions.TnumberValuespans(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// AtSpan is MEOS tnumber_at_span. +func (x *TNumber) AtSpan(span *Span) (*Temporal, error) { + _r0, _err := functions.TnumberAtSpan(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(span.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtSpanset is MEOS tnumber_at_spanset. +func (x *TNumber) AtSpanset(ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TnumberAtSpanset(functions.TemporalFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtTbox is MEOS tnumber_at_tbox. +func (x *TNumber) AtTbox(box *TBox) (*Temporal, error) { + _r0, _err := functions.TnumberAtTBOX(functions.TemporalFromPointer(x.Pointer()), functions.TBoxFromPointer(box.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusSpan is MEOS tnumber_minus_span. +func (x *TNumber) MinusSpan(span *Span) (*Temporal, error) { + _r0, _err := functions.TnumberMinusSpan(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(span.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusSpanset is MEOS tnumber_minus_spanset. +func (x *TNumber) MinusSpanset(ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TnumberMinusSpanset(functions.TemporalFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusTbox is MEOS tnumber_minus_tbox. +func (x *TNumber) MinusTbox(box *TBox) (*Temporal, error) { + _r0, _err := functions.TnumberMinusTBOX(functions.TemporalFromPointer(x.Pointer()), functions.TBoxFromPointer(box.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// SplitEachNTboxes is MEOS tnumber_split_each_n_tboxes. +func (x *TNumber) SplitEachNTboxes(elem_count int, count unsafe.Pointer) (*TBox, error) { + _r0, _err := functions.TnumberSplitEachNTboxes(functions.TemporalFromPointer(x.Pointer()), elem_count, count) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// SplitNTboxes is MEOS tnumber_split_n_tboxes. +func (x *TNumber) SplitNTboxes(box_count int, count unsafe.Pointer) (*TBox, error) { + _r0, _err := functions.TnumberSplitNTboxes(functions.TemporalFromPointer(x.Pointer()), box_count, count) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// Tboxes is MEOS tnumber_tboxes. +func (x *TNumber) Tboxes(count unsafe.Pointer) (*TBox, error) { + _r0, _err := functions.TnumberTboxes(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return TBoxFromPointer(_r0.Pointer()), nil +} + +// Abs is MEOS tnumber_abs. +func (x *TNumber) Abs() (*Temporal, error) { + _r0, _err := functions.TnumberAbs(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Trend is MEOS tnumber_trend. +func (x *TNumber) Trend() (*Temporal, error) { + _r0, _err := functions.TnumberTrend(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AngularDifference is MEOS tnumber_angular_difference. +func (x *TNumber) AngularDifference() (*Temporal, error) { + _r0, _err := functions.TnumberAngularDifference(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeltaValue is MEOS tnumber_delta_value. +func (x *TNumber) DeltaValue() (*Temporal, error) { + _r0, _err := functions.TnumberDeltaValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tpcbox.go b/types/tpcbox.go new file mode 100644 index 0000000..6229934 --- /dev/null +++ b/types/tpcbox.go @@ -0,0 +1,324 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPCBox struct { + Box +} + +// TPCBoxFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPCBoxFromPointer(p unsafe.Pointer) *TPCBox { + if p == nil { + return nil + } + v := &TPCBox{} + v.ptr = p + return v +} + +// TPCBoxIn is MEOS tpcbox_in. +func TPCBoxIn(str string) (*TPCBox, error) { + _r0, _err := functions.TpcboxIn(str) + if _err != nil { + return nil, _err + } + return TPCBoxFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tpcbox_out. +func (x *TPCBox) Out(maxdd int) (string, error) { + _r0, _err := functions.TpcboxOut(functions.TPCBoxFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TPCBoxMake is MEOS tpcbox_make. +func TPCBoxMake(hasx bool, hasz bool, hast bool, geodetic bool, srid int32, pcid uint32, xmin float64, xmax float64, ymin float64, ymax float64, zmin float64, zmax float64, period *Span) (*TPCBox, error) { + _r0, _err := functions.TpcboxMake(hasx, hasz, hast, geodetic, srid, pcid, xmin, xmax, ymin, ymax, zmin, zmax, functions.SpanFromPointer(period.Pointer())) + if _err != nil { + return nil, _err + } + return TPCBoxFromPointer(_r0.Pointer()), nil +} + +// Copy is MEOS tpcbox_copy. +func (x *TPCBox) Copy() (*TPCBox, error) { + _r0, _err := functions.TpcboxCopy(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TPCBoxFromPointer(_r0.Pointer()), nil +} + +// Hasx is MEOS tpcbox_hasx. +func (x *TPCBox) Hasx() (bool, error) { + _r0, _err := functions.TpcboxHasx(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Hasz is MEOS tpcbox_hasz. +func (x *TPCBox) Hasz() (bool, error) { + _r0, _err := functions.TpcboxHasz(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Hast is MEOS tpcbox_hast. +func (x *TPCBox) Hast() (bool, error) { + _r0, _err := functions.TpcboxHast(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Geodetic is MEOS tpcbox_geodetic. +func (x *TPCBox) Geodetic() (bool, error) { + _r0, _err := functions.TpcboxGeodetic(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Xmin is MEOS tpcbox_xmin. +func (x *TPCBox) Xmin() (float64, bool, error) { + _found, _value, _err := functions.TpcboxXmin(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Xmax is MEOS tpcbox_xmax. +func (x *TPCBox) Xmax() (float64, bool, error) { + _found, _value, _err := functions.TpcboxXmax(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Ymin is MEOS tpcbox_ymin. +func (x *TPCBox) Ymin() (float64, bool, error) { + _found, _value, _err := functions.TpcboxYmin(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Ymax is MEOS tpcbox_ymax. +func (x *TPCBox) Ymax() (float64, bool, error) { + _found, _value, _err := functions.TpcboxYmax(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Zmin is MEOS tpcbox_zmin. +func (x *TPCBox) Zmin() (float64, bool, error) { + _found, _value, _err := functions.TpcboxZmin(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Zmax is MEOS tpcbox_zmax. +func (x *TPCBox) Zmax() (float64, bool, error) { + _found, _value, _err := functions.TpcboxZmax(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Tmin is MEOS tpcbox_tmin. +func (x *TPCBox) Tmin() (int64, bool, error) { + _found, _value, _err := functions.TpcboxTmin(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// TminInc is MEOS tpcbox_tmin_inc. +func (x *TPCBox) TminInc() (bool, bool, error) { + _found, _value, _err := functions.TpcboxTminInc(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return false, false, _err + } + if !_found { + return false, false, nil + } + return _value, true, nil +} + +// Tmax is MEOS tpcbox_tmax. +func (x *TPCBox) Tmax() (int64, bool, error) { + _found, _value, _err := functions.TpcboxTmax(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// TmaxInc is MEOS tpcbox_tmax_inc. +func (x *TPCBox) TmaxInc() (bool, bool, error) { + _found, _value, _err := functions.TpcboxTmaxInc(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return false, false, _err + } + if !_found { + return false, false, nil + } + return _value, true, nil +} + +// SRID is MEOS tpcbox_srid. +func (x *TPCBox) SRID() (int32, error) { + _r0, _err := functions.TpcboxSRID(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Pcid is MEOS tpcbox_pcid. +func (x *TPCBox) Pcid() (uint32, error) { + _r0, _err := functions.TpcboxPcid(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ToStbox is MEOS tpcbox_to_stbox. +func (x *TPCBox) ToStbox() (*STBox, error) { + _r0, _err := functions.TpcboxToSTBOX(functions.TPCBoxFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// Round is MEOS tpcbox_round. +func (x *TPCBox) Round(maxdd int) (*TPCBox, error) { + _r0, _err := functions.TpcboxRound(functions.TPCBoxFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return TPCBoxFromPointer(_r0.Pointer()), nil +} + +// SetSRID is MEOS tpcbox_set_srid. +func (x *TPCBox) SetSRID(srid int32) (*TPCBox, error) { + _r0, _err := functions.TpcboxSetSRID(functions.TPCBoxFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return TPCBoxFromPointer(_r0.Pointer()), nil +} + +// Cmp is MEOS tpcbox_cmp. +func (x *TPCBox) Cmp(box2 *TPCBox) (int, error) { + _r0, _err := functions.TpcboxCmp(functions.TPCBoxFromPointer(x.Pointer()), functions.TPCBoxFromPointer(box2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Eq is MEOS tpcbox_eq. +func (x *TPCBox) Eq(box2 *TPCBox) (bool, error) { + _r0, _err := functions.TpcboxEq(functions.TPCBoxFromPointer(x.Pointer()), functions.TPCBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ne is MEOS tpcbox_ne. +func (x *TPCBox) Ne(box2 *TPCBox) (bool, error) { + _r0, _err := functions.TpcboxNe(functions.TPCBoxFromPointer(x.Pointer()), functions.TPCBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Lt is MEOS tpcbox_lt. +func (x *TPCBox) Lt(box2 *TPCBox) (bool, error) { + _r0, _err := functions.TpcboxLt(functions.TPCBoxFromPointer(x.Pointer()), functions.TPCBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Le is MEOS tpcbox_le. +func (x *TPCBox) Le(box2 *TPCBox) (bool, error) { + _r0, _err := functions.TpcboxLe(functions.TPCBoxFromPointer(x.Pointer()), functions.TPCBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Gt is MEOS tpcbox_gt. +func (x *TPCBox) Gt(box2 *TPCBox) (bool, error) { + _r0, _err := functions.TpcboxGt(functions.TPCBoxFromPointer(x.Pointer()), functions.TPCBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Ge is MEOS tpcbox_ge. +func (x *TPCBox) Ge(box2 *TPCBox) (bool, error) { + _r0, _err := functions.TpcboxGe(functions.TPCBoxFromPointer(x.Pointer()), functions.TPCBoxFromPointer(box2.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} diff --git a/types/tpoint.go b/types/tpoint.go new file mode 100644 index 0000000..087c21f --- /dev/null +++ b/types/tpoint.go @@ -0,0 +1,221 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +// TPoint is temporal points. API-level intermediate (C predicate tpoint_type + the tpoint_* method family); NOT drawn in the manual Figure 7.1 (a conceptual diagram) but required so the tpoint_* methods bind to a class — see correction OM-M6. + +type TPoint struct { + TGeo +} + +// TPointFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPointFromPointer(p unsafe.Pointer) *TPoint { + if p == nil { + return nil + } + v := &TPoint{} + v.ptr = p + return v +} + +// TPointFromBaseTemp is MEOS tpoint_from_base_temp. +func TPointFromBaseTemp(gs *TRGeometrySeqSet, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TpointFromBaseTemp(functions.GeomFromPointer(gs.Pointer()), functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TfloatToGeomeas is MEOS tpoint_tfloat_to_geomeas. +func (x *TPoint) TfloatToGeomeas(measure *Temporal, segmentize bool) (*TRGeometrySeqSet, bool, error) { + _found, _value, _err := functions.TpointTfloatToGeomeas(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(measure.Pointer()), segmentize) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return TRGeometrySeqSetFromPointer(_value.Pointer()), true, nil +} + +// AngularDifference is MEOS tpoint_angular_difference. +func (x *TPoint) AngularDifference() (*Temporal, error) { + _r0, _err := functions.TpointAngularDifference(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Azimuth is MEOS tpoint_azimuth. +func (x *TPoint) Azimuth() (*Temporal, error) { + _r0, _err := functions.TpointAzimuth(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// CumulativeLength is MEOS tpoint_cumulative_length. +func (x *TPoint) CumulativeLength() (*Temporal, error) { + _r0, _err := functions.TpointCumulativeLength(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Direction is MEOS tpoint_direction. +func (x *TPoint) Direction() (float64, bool, error) { + _found, _value, _err := functions.TpointDirection(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// GetX is MEOS tpoint_get_x. +func (x *TPoint) GetX() (*Temporal, error) { + _r0, _err := functions.TpointGetX(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// GetY is MEOS tpoint_get_y. +func (x *TPoint) GetY() (*Temporal, error) { + _r0, _err := functions.TpointGetY(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// GetZ is MEOS tpoint_get_z. +func (x *TPoint) GetZ() (*Temporal, error) { + _r0, _err := functions.TpointGetZ(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// IsSimple is MEOS tpoint_is_simple. +func (x *TPoint) IsSimple() (bool, error) { + _r0, _err := functions.TpointIsSimple(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return false, _err + } + return _r0, nil +} + +// Length is MEOS tpoint_length. +func (x *TPoint) Length() (float64, error) { + _r0, _err := functions.TpointLength(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Speed is MEOS tpoint_speed. +func (x *TPoint) Speed() (*Temporal, error) { + _r0, _err := functions.TpointSpeed(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Trajectory is MEOS tpoint_trajectory. +func (x *TPoint) Trajectory(unary_union bool) (*TRGeometrySeqSet, error) { + _r0, _err := functions.TpointTrajectory(functions.TemporalFromPointer(x.Pointer()), unary_union) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// Twcentroid is MEOS tpoint_twcentroid. +func (x *TPoint) Twcentroid() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TpointTwcentroid(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// MakeSimple is MEOS tpoint_make_simple. +func (x *TPoint) MakeSimple(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TpointMakeSimple(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// AtElevation is MEOS tpoint_at_elevation. +func (x *TPoint) AtElevation(s *Span) (*Temporal, error) { + _r0, _err := functions.TpointAtElevation(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtGeom is MEOS tpoint_at_geom. +func (x *TPoint) AtGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TpointAtGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValue is MEOS tpoint_at_value. +func (x *TPoint) AtValue(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TpointAtValue(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusElevation is MEOS tpoint_minus_elevation. +func (x *TPoint) MinusElevation(s *Span) (*Temporal, error) { + _r0, _err := functions.TpointMinusElevation(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusGeom is MEOS tpoint_minus_geom. +func (x *TPoint) MinusGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TpointMinusGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS tpoint_minus_value. +func (x *TPoint) MinusValue(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TpointMinusValue(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tpose.go b/types/tpose.go new file mode 100644 index 0000000..b07c651 --- /dev/null +++ b/types/tpose.go @@ -0,0 +1,327 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPose struct { + TSpatial +} + +// TPoseFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPoseFromPointer(p unsafe.Pointer) *TPose { + if p == nil { + return nil + } + v := &TPose{} + v.ptr = p + return v +} + +// TPoseFromGeopose is MEOS tpose_from_geopose. +func TPoseFromGeopose(json string) (*Temporal, error) { + _r0, _err := functions.TposeFromGeopose(json) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AsGeopose is MEOS tpose_as_geopose. +func (x *TPose) AsGeopose(conformance int, precision int) (string, error) { + _r0, _err := functions.TposeAsGeopose(functions.TemporalFromPointer(x.Pointer()), conformance, precision) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsGeoposeStreamElement is MEOS tpose_as_geopose_stream_element. +func (x *TPose) AsGeoposeStreamElement(inst *Temporal, precision int) (string, error) { + _r0, _err := functions.TposeAsGeoposeStreamElement(functions.TemporalFromPointer(x.Pointer()), functions.TInstantFromPointer(inst.Pointer()), precision) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsGeoposeStream is MEOS tpose_as_geopose_stream. +func (x *TPose) AsGeoposeStream(precision int) (string, error) { + _r0, _err := functions.TposeAsGeoposeStream(functions.TemporalFromPointer(x.Pointer()), precision) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ApplyGeo is MEOS tpose_apply_geo. +func (x *TPose) ApplyGeo(body *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TposeApplyGeo(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(body.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ComposePose is MEOS tpose_compose_pose. +func (x *TPose) ComposePose(frame *Pose) (*Temporal, error) { + _r0, _err := functions.TposeComposePose(functions.TemporalFromPointer(x.Pointer()), functions.PoseFromPointer(frame.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ComposeTpose is MEOS tpose_compose_tpose. +func (x *TPose) ComposeTpose(frame *Temporal) (*Temporal, error) { + _r0, _err := functions.TposeComposeTpose(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(frame.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Inverse is MEOS tpose_inverse. +func (x *TPose) Inverse() (*Temporal, error) { + _r0, _err := functions.TposeInverse(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPoseFromMFJSON is MEOS tpose_from_mfjson. +func TPoseFromMFJSON(str string) (*Temporal, error) { + _r0, _err := functions.TposeFromMFJSON(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPoseIn is MEOS tpose_in. +func TPoseIn(str string) (*Temporal, error) { + _r0, _err := functions.TposeIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPoseFromBaseTemp is MEOS tpose_from_base_temp. +func TPoseFromBaseTemp(pose *Pose, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TposeFromBaseTemp(functions.PoseFromPointer(pose.Pointer()), functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Make is MEOS tpose_make. +func (x *TPose) Make(ttheta *Temporal) (*Temporal, error) { + _r0, _err := functions.TposeMake(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(ttheta.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTpoint is MEOS tpose_to_tpoint. +func (x *TPose) ToTpoint() (*Temporal, error) { + _r0, _err := functions.TposeToTpoint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tpose_end_value. +func (x *TPose) EndValue() (*Pose, error) { + _r0, _err := functions.TposeEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// Points is MEOS tpose_points. +func (x *TPose) Points() (*Set, error) { + _r0, _err := functions.TposePoints(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Yaw is MEOS tpose_yaw. +func (x *TPose) Yaw() (*Temporal, error) { + _r0, _err := functions.TposeYaw(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Pitch is MEOS tpose_pitch. +func (x *TPose) Pitch() (*Temporal, error) { + _r0, _err := functions.TposePitch(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Roll is MEOS tpose_roll. +func (x *TPose) Roll() (*Temporal, error) { + _r0, _err := functions.TposeRoll(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Speed is MEOS tpose_speed. +func (x *TPose) Speed() (*Temporal, error) { + _r0, _err := functions.TposeSpeed(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AngularSpeed is MEOS tpose_angular_speed. +func (x *TPose) AngularSpeed() (*Temporal, error) { + _r0, _err := functions.TposeAngularSpeed(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS tpose_start_value. +func (x *TPose) StartValue() (*Pose, error) { + _r0, _err := functions.TposeStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return PoseFromPointer(_r0.Pointer()), nil +} + +// Trajectory is MEOS tpose_trajectory. +func (x *TPose) Trajectory() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TposeTrajectory(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ValueAtTimestamptz is MEOS tpose_value_at_timestamptz. +func (x *TPose) ValueAtTimestamptz(t int64, strict bool) (*Pose, bool, error) { + _found, _value, _err := functions.TposeValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return PoseFromPointer(_value.Pointer()), true, nil +} + +// ValueN is MEOS tpose_value_n. +func (x *TPose) ValueN(n int) (*Pose, bool, error) { + _found, _value, _err := functions.TposeValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return PoseFromPointer(_value.Pointer()), true, nil +} + +// Values is MEOS tpose_values. +func (x *TPose) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TposeValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// AtElevation is MEOS tpose_at_elevation. +func (x *TPose) AtElevation(s *Span) (*Temporal, error) { + _r0, _err := functions.TposeAtElevation(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtGeom is MEOS tpose_at_geom. +func (x *TPose) AtGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TposeAtGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtStbox is MEOS tpose_at_stbox. +func (x *TPose) AtStbox(box *STBox, border_inc bool) (*Temporal, error) { + _r0, _err := functions.TposeAtSTBOX(functions.TemporalFromPointer(x.Pointer()), functions.STBoxFromPointer(box.Pointer()), border_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtPose is MEOS tpose_at_pose. +func (x *TPose) AtPose(pose *Pose) (*Temporal, error) { + _r0, _err := functions.TposeAtPose(functions.TemporalFromPointer(x.Pointer()), functions.PoseFromPointer(pose.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusElevation is MEOS tpose_minus_elevation. +func (x *TPose) MinusElevation(s *Span) (*Temporal, error) { + _r0, _err := functions.TposeMinusElevation(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusGeom is MEOS tpose_minus_geom. +func (x *TPose) MinusGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TposeMinusGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusPose is MEOS tpose_minus_pose. +func (x *TPose) MinusPose(pose *Pose) (*Temporal, error) { + _r0, _err := functions.TposeMinusPose(functions.TemporalFromPointer(x.Pointer()), functions.PoseFromPointer(pose.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusStbox is MEOS tpose_minus_stbox. +func (x *TPose) MinusStbox(box *STBox, border_inc bool) (*Temporal, error) { + _r0, _err := functions.TposeMinusSTBOX(functions.TemporalFromPointer(x.Pointer()), functions.STBoxFromPointer(box.Pointer()), border_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tposeinst.go b/types/tposeinst.go new file mode 100644 index 0000000..ec3675a --- /dev/null +++ b/types/tposeinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPoseInst struct { + handle +} + +// TPoseInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPoseInstFromPointer(p unsafe.Pointer) *TPoseInst { + if p == nil { + return nil + } + v := &TPoseInst{} + v.ptr = p + return v +} + +// TPoseInstMake is MEOS tposeinst_make. +func TPoseInstMake(pose *Pose, t int64) (*Temporal, error) { + _r0, _err := functions.TposeinstMake(functions.PoseFromPointer(pose.Pointer()), t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tposeseq.go b/types/tposeseq.go new file mode 100644 index 0000000..257ad2b --- /dev/null +++ b/types/tposeseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPoseSeq struct { + handle +} + +// TPoseSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPoseSeqFromPointer(p unsafe.Pointer) *TPoseSeq { + if p == nil { + return nil + } + v := &TPoseSeq{} + v.ptr = p + return v +} + +// TPoseSeqFromBaseTstzset is MEOS tposeseq_from_base_tstzset. +func TPoseSeqFromBaseTstzset(pose *Pose, s *Set) (*Temporal, error) { + _r0, _err := functions.TposeseqFromBaseTstzset(functions.PoseFromPointer(pose.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TPoseSeqFromBaseTstzspan is MEOS tposeseq_from_base_tstzspan. +func TPoseSeqFromBaseTstzspan(pose *Pose, s *Span, interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TposeseqFromBaseTstzspan(functions.PoseFromPointer(pose.Pointer()), functions.SpanFromPointer(s.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tposeseqset.go b/types/tposeseqset.go new file mode 100644 index 0000000..0884325 --- /dev/null +++ b/types/tposeseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TPoseSeqSet struct { + handle +} + +// TPoseSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TPoseSeqSetFromPointer(p unsafe.Pointer) *TPoseSeqSet { + if p == nil { + return nil + } + v := &TPoseSeqSet{} + v.ptr = p + return v +} + +// TPoseSeqSetFromBaseTstzspanset is MEOS tposeseqset_from_base_tstzspanset. +func TPoseSeqSetFromBaseTstzspanset(pose *Pose, ss *SpanSet, interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TposeseqsetFromBaseTstzspanset(functions.PoseFromPointer(pose.Pointer()), functions.SpanSetFromPointer(ss.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/trgeometry.go b/types/trgeometry.go new file mode 100644 index 0000000..0ac0392 --- /dev/null +++ b/types/trgeometry.go @@ -0,0 +1,684 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TRGeometry struct { + TSpatial +} + +// TRGeometryFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TRGeometryFromPointer(p unsafe.Pointer) *TRGeometry { + if p == nil { + return nil + } + v := &TRGeometry{} + v.ptr = p + return v +} + +// TRGeometryIn is MEOS trgeometry_in. +func TRGeometryIn(str string) (*Temporal, error) { + _r0, _err := functions.TrgeometryIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TRGeometryFromMFJSON is MEOS trgeometry_from_mfjson. +func TRGeometryFromMFJSON(mfjson string) (*Temporal, error) { + _r0, _err := functions.TrgeometryFromMFJSON(mfjson) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS trgeometry_out. +func (x *TRGeometry) Out() (string, error) { + _r0, _err := functions.TrgeometryOut(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsText is MEOS trgeometry_as_text. +func (x *TRGeometry) AsText(maxdd int) (string, error) { + _r0, _err := functions.TrgeometryAsText(functions.TemporalFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsEWKT is MEOS trgeometry_as_ewkt. +func (x *TRGeometry) AsEWKT(maxdd int) (string, error) { + _r0, _err := functions.TrgeometryAsEWKT(functions.TemporalFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ToTpose is MEOS trgeometry_to_tpose. +func (x *TRGeometry) ToTpose() (*Temporal, error) { + _r0, _err := functions.TrgeometryToTpose(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeompoint is MEOS trgeometry_to_tgeompoint. +func (x *TRGeometry) ToTgeompoint() (*Temporal, error) { + _r0, _err := functions.TrgeometryToTgeompoint(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTgeometry is MEOS trgeometry_to_tgeometry. +func (x *TRGeometry) ToTgeometry() (*Temporal, error) { + _r0, _err := functions.TrgeometryToTgeometry(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndInstant is MEOS trgeometry_end_instant. +func (x *TRGeometry) EndInstant() (*Temporal, error) { + _r0, _err := functions.TrgeometryEndInstant(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndSequence is MEOS trgeometry_end_sequence. +func (x *TRGeometry) EndSequence() (*Temporal, error) { + _r0, _err := functions.TrgeometryEndSequence(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS trgeometry_end_value. +func (x *TRGeometry) EndValue() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TrgeometryEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// Geom is MEOS trgeometry_geom. +func (x *TRGeometry) Geom() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TrgeometryGeom(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// InstantN is MEOS trgeometry_instant_n. +func (x *TRGeometry) InstantN(n int) (*Temporal, error) { + _r0, _err := functions.TrgeometryInstantN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Instants is MEOS trgeometry_instants. +func (x *TRGeometry) Instants(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TrgeometryInstants(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// Points is MEOS trgeometry_points. +func (x *TRGeometry) Points() (*Set, error) { + _r0, _err := functions.TrgeometryPoints(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Yaw is MEOS trgeometry_yaw. +func (x *TRGeometry) Yaw() (*Temporal, error) { + _r0, _err := functions.TrgeometryYaw(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Pitch is MEOS trgeometry_pitch. +func (x *TRGeometry) Pitch() (*Temporal, error) { + _r0, _err := functions.TrgeometryPitch(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Roll is MEOS trgeometry_roll. +func (x *TRGeometry) Roll() (*Temporal, error) { + _r0, _err := functions.TrgeometryRoll(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Segments is MEOS trgeometry_segments. +func (x *TRGeometry) Segments(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TrgeometrySegments(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// SequenceN is MEOS trgeometry_sequence_n. +func (x *TRGeometry) SequenceN(i int) (*Temporal, error) { + _r0, _err := functions.TrgeometrySequenceN(functions.TemporalFromPointer(x.Pointer()), i) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Sequences is MEOS trgeometry_sequences. +func (x *TRGeometry) Sequences(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TrgeometrySequences(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// StartInstant is MEOS trgeometry_start_instant. +func (x *TRGeometry) StartInstant() (*Temporal, error) { + _r0, _err := functions.TrgeometryStartInstant(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StartSequence is MEOS trgeometry_start_sequence. +func (x *TRGeometry) StartSequence() (*Temporal, error) { + _r0, _err := functions.TrgeometryStartSequence(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// StartValue is MEOS trgeometry_start_value. +func (x *TRGeometry) StartValue() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TrgeometryStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// ValueN is MEOS trgeometry_value_n. +func (x *TRGeometry) ValueN(n int) (*TRGeometrySeqSet, bool, error) { + _found, _value, _err := functions.TrgeometryValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return nil, false, _err + } + if !_found { + return nil, false, nil + } + return TRGeometrySeqSetFromPointer(_value.Pointer()), true, nil +} + +// TraversedArea is MEOS trgeometry_traversed_area. +func (x *TRGeometry) TraversedArea(unary_union bool) (*TRGeometrySeqSet, error) { + _r0, _err := functions.TrgeometryTraversedArea(functions.TemporalFromPointer(x.Pointer()), unary_union) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// Centroid is MEOS trgeometry_centroid. +func (x *TRGeometry) Centroid() (*Temporal, error) { + _r0, _err := functions.TrgeometryCentroid(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ConvexHull is MEOS trgeometry_convex_hull. +func (x *TRGeometry) ConvexHull() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TrgeometryConvexHull(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// BodyPointTrajectory is MEOS trgeometry_body_point_trajectory. +func (x *TRGeometry) BodyPointTrajectory(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TrgeometryBodyPointTrajectory(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// SpaceBoxes is MEOS trgeometry_space_boxes. +func (x *TRGeometry) SpaceBoxes(xsize float64, ysize float64, zsize float64, sorigin *TRGeometrySeqSet, bitmatrix bool, border_inc bool, count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.TrgeometrySpaceBoxes(functions.TemporalFromPointer(x.Pointer()), xsize, ysize, zsize, functions.GeomFromPointer(sorigin.Pointer()), bitmatrix, border_inc, count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// Stboxes is MEOS trgeometry_stboxes. +func (x *TRGeometry) Stboxes(count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.TrgeometryStboxes(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// SplitNStboxes is MEOS trgeometry_split_n_stboxes. +func (x *TRGeometry) SplitNStboxes(box_count int, count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.TrgeometrySplitNStboxes(functions.TemporalFromPointer(x.Pointer()), box_count, count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// SplitEachNStboxes is MEOS trgeometry_split_each_n_stboxes. +func (x *TRGeometry) SplitEachNStboxes(elem_count int, count unsafe.Pointer) (*STBox, error) { + _r0, _err := functions.TrgeometrySplitEachNStboxes(functions.TemporalFromPointer(x.Pointer()), elem_count, count) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// HausdorffDistance is MEOS trgeometry_hausdorff_distance. +func (x *TRGeometry) HausdorffDistance(temp2 *Temporal) (float64, error) { + _r0, _err := functions.TrgeometryHausdorffDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// FrechetDistance is MEOS trgeometry_frechet_distance. +func (x *TRGeometry) FrechetDistance(temp2 *Temporal) (float64, error) { + _r0, _err := functions.TrgeometryFrechetDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// DyntimewarpDistance is MEOS trgeometry_dyntimewarp_distance. +func (x *TRGeometry) DyntimewarpDistance(temp2 *Temporal) (float64, error) { + _r0, _err := functions.TrgeometryDyntimewarpDistance(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Length is MEOS trgeometry_length. +func (x *TRGeometry) Length() (float64, error) { + _r0, _err := functions.TrgeometryLength(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// CumulativeLength is MEOS trgeometry_cumulative_length. +func (x *TRGeometry) CumulativeLength() (*Temporal, error) { + _r0, _err := functions.TrgeometryCumulativeLength(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AngularSpeed is MEOS trgeometry_angular_speed. +func (x *TRGeometry) AngularSpeed() (*Temporal, error) { + _r0, _err := functions.TrgeometryAngularSpeed(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Speed is MEOS trgeometry_speed. +func (x *TRGeometry) Speed() (*Temporal, error) { + _r0, _err := functions.TrgeometrySpeed(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Twcentroid is MEOS trgeometry_twcentroid. +func (x *TRGeometry) Twcentroid() (*TRGeometrySeqSet, error) { + _r0, _err := functions.TrgeometryTwcentroid(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TRGeometrySeqSetFromPointer(_r0.Pointer()), nil +} + +// AppendTsequence is MEOS trgeometry_append_tsequence. +func (x *TRGeometry) AppendTsequence(seq *Temporal, expand bool) (*Temporal, error) { + _r0, _err := functions.TrgeometryAppendTsequence(functions.TemporalFromPointer(x.Pointer()), functions.TSequenceFromPointer(seq.Pointer()), expand) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeleteTimestamptz is MEOS trgeometry_delete_timestamptz. +func (x *TRGeometry) DeleteTimestamptz(t int64, connect bool) (*Temporal, error) { + _r0, _err := functions.TrgeometryDeleteTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, connect) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeleteTstzset is MEOS trgeometry_delete_tstzset. +func (x *TRGeometry) DeleteTstzset(s *Set, connect bool) (*Temporal, error) { + _r0, _err := functions.TrgeometryDeleteTstzset(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(s.Pointer()), connect) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeleteTstzspan is MEOS trgeometry_delete_tstzspan. +func (x *TRGeometry) DeleteTstzspan(s *Span, connect bool) (*Temporal, error) { + _r0, _err := functions.TrgeometryDeleteTstzspan(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer()), connect) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// DeleteTstzspanset is MEOS trgeometry_delete_tstzspanset. +func (x *TRGeometry) DeleteTstzspanset(ss *SpanSet, connect bool) (*Temporal, error) { + _r0, _err := functions.TrgeometryDeleteTstzspanset(functions.TemporalFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss.Pointer()), connect) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Merge is MEOS trgeometry_merge. +func (x *TRGeometry) Merge(temp2 *Temporal) (*Temporal, error) { + _r0, _err := functions.TrgeometryMerge(functions.TemporalFromPointer(x.Pointer()), functions.TemporalFromPointer(temp2.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TRGeometryMergeArray is MEOS trgeometry_merge_array. +func TRGeometryMergeArray(temparr unsafe.Pointer, count int) (*Temporal, error) { + _r0, _err := functions.TrgeometryMergeArray(temparr, count) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Round is MEOS trgeometry_round. +func (x *TRGeometry) Round(maxdd int) (*Temporal, error) { + _r0, _err := functions.TrgeometryRound(functions.TemporalFromPointer(x.Pointer()), maxdd) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// SetInterp is MEOS trgeometry_set_interp. +func (x *TRGeometry) SetInterp(interp functions.Interpolation) (*Temporal, error) { + _r0, _err := functions.TrgeometrySetInterp(functions.TemporalFromPointer(x.Pointer()), interp) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AsTinstant is MEOS trgeometry_as_tinstant. +func (x *TRGeometry) AsTinstant() (*Temporal, error) { + _r0, _err := functions.TrgeometryAsTinstant(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AsTsequence is MEOS trgeometry_as_tsequence. +func (x *TRGeometry) AsTsequence(interp_str string) (*Temporal, error) { + _r0, _err := functions.TrgeometryAsTsequence(functions.TemporalFromPointer(x.Pointer()), interp_str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AsTsequenceset is MEOS trgeometry_as_tsequenceset. +func (x *TRGeometry) AsTsequenceset(interp_str string) (*Temporal, error) { + _r0, _err := functions.TrgeometryAsTsequenceset(functions.TemporalFromPointer(x.Pointer()), interp_str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AfterTimestamptz is MEOS trgeometry_after_timestamptz. +func (x *TRGeometry) AfterTimestamptz(t int64, strict bool) (*Temporal, error) { + _r0, _err := functions.TrgeometryAfterTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// BeforeTimestamptz is MEOS trgeometry_before_timestamptz. +func (x *TRGeometry) BeforeTimestamptz(t int64, strict bool) (*Temporal, error) { + _r0, _err := functions.TrgeometryBeforeTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtGeom is MEOS trgeometry_at_geom. +func (x *TRGeometry) AtGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TrgeometryAtGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusGeom is MEOS trgeometry_minus_geom. +func (x *TRGeometry) MinusGeom(gs *TRGeometrySeqSet) (*Temporal, error) { + _r0, _err := functions.TrgeometryMinusGeom(functions.TemporalFromPointer(x.Pointer()), functions.GeomFromPointer(gs.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtStbox is MEOS trgeometry_at_stbox. +func (x *TRGeometry) AtStbox(box *STBox, border_inc bool) (*Temporal, error) { + _r0, _err := functions.TrgeometryAtSTBOX(functions.TemporalFromPointer(x.Pointer()), functions.STBoxFromPointer(box.Pointer()), border_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusStbox is MEOS trgeometry_minus_stbox. +func (x *TRGeometry) MinusStbox(box *STBox, border_inc bool) (*Temporal, error) { + _r0, _err := functions.TrgeometryMinusSTBOX(functions.TemporalFromPointer(x.Pointer()), functions.STBoxFromPointer(box.Pointer()), border_inc) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValue is MEOS trgeometry_at_value. +func (x *TRGeometry) AtValue(pose *Pose) (*Temporal, error) { + _r0, _err := functions.TrgeometryAtValue(functions.TemporalFromPointer(x.Pointer()), functions.PoseFromPointer(pose.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS trgeometry_minus_value. +func (x *TRGeometry) MinusValue(pose *Pose) (*Temporal, error) { + _r0, _err := functions.TrgeometryMinusValue(functions.TemporalFromPointer(x.Pointer()), functions.PoseFromPointer(pose.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtValues is MEOS trgeometry_at_values. +func (x *TRGeometry) AtValues(s *Set) (*Temporal, error) { + _r0, _err := functions.TrgeometryAtValues(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValues is MEOS trgeometry_minus_values. +func (x *TRGeometry) MinusValues(s *Set) (*Temporal, error) { + _r0, _err := functions.TrgeometryMinusValues(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtTimestamptz is MEOS trgeometry_at_timestamptz. +func (x *TRGeometry) AtTimestamptz(t int64) (*Temporal, error) { + _r0, _err := functions.TrgeometryAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusTimestamptz is MEOS trgeometry_minus_timestamptz. +func (x *TRGeometry) MinusTimestamptz(t int64) (*Temporal, error) { + _r0, _err := functions.TrgeometryMinusTimestamptz(functions.TemporalFromPointer(x.Pointer()), t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtTstzset is MEOS trgeometry_at_tstzset. +func (x *TRGeometry) AtTstzset(s *Set) (*Temporal, error) { + _r0, _err := functions.TrgeometryAtTstzset(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusTstzset is MEOS trgeometry_minus_tstzset. +func (x *TRGeometry) MinusTstzset(s *Set) (*Temporal, error) { + _r0, _err := functions.TrgeometryMinusTstzset(functions.TemporalFromPointer(x.Pointer()), functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtTstzspan is MEOS trgeometry_at_tstzspan. +func (x *TRGeometry) AtTstzspan(s *Span) (*Temporal, error) { + _r0, _err := functions.TrgeometryAtTstzspan(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusTstzspan is MEOS trgeometry_minus_tstzspan. +func (x *TRGeometry) MinusTstzspan(s *Span) (*Temporal, error) { + _r0, _err := functions.TrgeometryMinusTstzspan(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtTstzspanset is MEOS trgeometry_at_tstzspanset. +func (x *TRGeometry) AtTstzspanset(ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TrgeometryAtTstzspanset(functions.TemporalFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusTstzspanset is MEOS trgeometry_minus_tstzspanset. +func (x *TRGeometry) MinusTstzspanset(ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TrgeometryMinusTstzspanset(functions.TemporalFromPointer(x.Pointer()), functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// AtElevation is MEOS trgeometry_at_elevation. +func (x *TRGeometry) AtElevation(s *Span) (*Temporal, error) { + _r0, _err := functions.TrgeometryAtElevation(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusElevation is MEOS trgeometry_minus_elevation. +func (x *TRGeometry) MinusElevation(s *Span) (*Temporal, error) { + _r0, _err := functions.TrgeometryMinusElevation(functions.TemporalFromPointer(x.Pointer()), functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/trgeometryinst.go b/types/trgeometryinst.go new file mode 100644 index 0000000..3af8965 --- /dev/null +++ b/types/trgeometryinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TRGeometryInst struct { + handle +} + +// TRGeometryInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TRGeometryInstFromPointer(p unsafe.Pointer) *TRGeometryInst { + if p == nil { + return nil + } + v := &TRGeometryInst{} + v.ptr = p + return v +} + +// TRGeometryInstMake is MEOS trgeometryinst_make. +func TRGeometryInstMake(geom *TRGeometrySeqSet, pose *Pose, t int64) (*Temporal, error) { + _r0, _err := functions.TrgeometryinstMake(functions.GeomFromPointer(geom.Pointer()), functions.PoseFromPointer(pose.Pointer()), t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/trgeometryseq.go b/types/trgeometryseq.go new file mode 100644 index 0000000..5ad2c22 --- /dev/null +++ b/types/trgeometryseq.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TRGeometrySeq struct { + handle +} + +// TRGeometrySeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TRGeometrySeqFromPointer(p unsafe.Pointer) *TRGeometrySeq { + if p == nil { + return nil + } + v := &TRGeometrySeq{} + v.ptr = p + return v +} + +// TRGeometrySeqMake is MEOS trgeometryseq_make. +func TRGeometrySeqMake(geom *TRGeometrySeqSet, instants unsafe.Pointer, count int, lower_inc bool, upper_inc bool, interp functions.Interpolation, normalize bool) (*Temporal, error) { + _r0, _err := functions.TrgeometryseqMake(functions.GeomFromPointer(geom.Pointer()), instants, count, lower_inc, upper_inc, interp, normalize) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/trgeometryseqset.go b/types/trgeometryseqset.go new file mode 100644 index 0000000..62a8870 --- /dev/null +++ b/types/trgeometryseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TRGeometrySeqSet struct { + handle +} + +// TRGeometrySeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TRGeometrySeqSetFromPointer(p unsafe.Pointer) *TRGeometrySeqSet { + if p == nil { + return nil + } + v := &TRGeometrySeqSet{} + v.ptr = p + return v +} + +// Make is MEOS trgeometryseqset_make. +func (x *TRGeometrySeqSet) Make(sequences unsafe.Pointer, count int, normalize bool) (*Temporal, error) { + _r0, _err := functions.TrgeometryseqsetMake(functions.GeomFromPointer(x.Pointer()), sequences, count, normalize) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tsequence.go b/types/tsequence.go new file mode 100644 index 0000000..06475b3 --- /dev/null +++ b/types/tsequence.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TSequence struct { + Temporal +} + +// TSequenceFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TSequenceFromPointer(p unsafe.Pointer) *TSequence { + if p == nil { + return nil + } + v := &TSequence{} + v.ptr = p + return v +} + +// TSequenceMake is MEOS tsequence_make. +func TSequenceMake(instants unsafe.Pointer, count int, lower_inc bool, upper_inc bool, interp functions.Interpolation, normalize bool) (*Temporal, error) { + _r0, _err := functions.TsequenceMake(instants, count, lower_inc, upper_inc, interp, normalize) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tsequenceset.go b/types/tsequenceset.go new file mode 100644 index 0000000..f84319f --- /dev/null +++ b/types/tsequenceset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TSequenceSet struct { + Temporal +} + +// TSequenceSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TSequenceSetFromPointer(p unsafe.Pointer) *TSequenceSet { + if p == nil { + return nil + } + v := &TSequenceSet{} + v.ptr = p + return v +} + +// TSequenceSetMake is MEOS tsequenceset_make. +func TSequenceSetMake(sequences unsafe.Pointer, count int, normalize bool) (*Temporal, error) { + _r0, _err := functions.TsequencesetMake(sequences, count, normalize) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tspatial.go b/types/tspatial.go new file mode 100644 index 0000000..2c1641a --- /dev/null +++ b/types/tspatial.go @@ -0,0 +1,98 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +// TSpatial is temporal types carrying an STBox spatial bounding box. + +type TSpatial struct { + Temporal +} + +// TSpatialFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TSpatialFromPointer(p unsafe.Pointer) *TSpatial { + if p == nil { + return nil + } + v := &TSpatial{} + v.ptr = p + return v +} + +// Out is MEOS tspatial_out. +func (x *TSpatial) Out(maxdd int) (string, error) { + _r0, _err := functions.TspatialOut(functions.TemporalFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsEWKT is MEOS tspatial_as_ewkt. +func (x *TSpatial) AsEWKT(maxdd int) (string, error) { + _r0, _err := functions.TspatialAsEWKT(functions.TemporalFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// AsText is MEOS tspatial_as_text. +func (x *TSpatial) AsText(maxdd int) (string, error) { + _r0, _err := functions.TspatialAsText(functions.TemporalFromPointer(x.Pointer()), maxdd) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ToStbox is MEOS tspatial_to_stbox. +func (x *TSpatial) ToStbox() (*STBox, error) { + _r0, _err := functions.TspatialToSTBOX(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} + +// SRID is MEOS tspatial_srid. +func (x *TSpatial) SRID() (int32, error) { + _r0, _err := functions.TspatialSRID(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// SetSRID is MEOS tspatial_set_srid. +func (x *TSpatial) SetSRID(srid int32) (*Temporal, error) { + _r0, _err := functions.TspatialSetSRID(functions.TemporalFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Transform is MEOS tspatial_transform. +func (x *TSpatial) Transform(srid int32) (*Temporal, error) { + _r0, _err := functions.TspatialTransform(functions.TemporalFromPointer(x.Pointer()), srid) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TransformPipeline is MEOS tspatial_transform_pipeline. +func (x *TSpatial) TransformPipeline(pipelinestr string, srid int32, is_forward bool) (*Temporal, error) { + _r0, _err := functions.TspatialTransformPipeline(functions.TemporalFromPointer(x.Pointer()), pipelinestr, srid, is_forward) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/tstzset.go b/types/tstzset.go new file mode 100644 index 0000000..8264052 --- /dev/null +++ b/types/tstzset.go @@ -0,0 +1,108 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TsTzSet struct { + Set +} + +// TsTzSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TsTzSetFromPointer(p unsafe.Pointer) *TsTzSet { + if p == nil { + return nil + } + v := &TsTzSet{} + v.ptr = p + return v +} + +// TsTzSetIn is MEOS tstzset_in. +func TsTzSetIn(str string) (*Set, error) { + _r0, _err := functions.TstzsetIn(str) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tstzset_out. +func (x *TsTzSet) Out() (string, error) { + _r0, _err := functions.TstzsetOut(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TsTzSetMake is MEOS tstzset_make. +func TsTzSetMake(values unsafe.Pointer, count int) (*Set, error) { + _r0, _err := functions.TstzsetMake(values, count) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// ToDateset is MEOS tstzset_to_dateset. +func (x *TsTzSet) ToDateset() (*Set, error) { + _r0, _err := functions.TstzsetToDateset(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS tstzset_end_value. +func (x *TsTzSet) EndValue() (int64, error) { + _r0, _err := functions.TstzsetEndValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartValue is MEOS tstzset_start_value. +func (x *TsTzSet) StartValue() (int64, error) { + _r0, _err := functions.TstzsetStartValue(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ValueN is MEOS tstzset_value_n. +func (x *TsTzSet) ValueN(n int) (int64, bool, error) { + _found, _value, _err := functions.TstzsetValueN(functions.SetFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Values is MEOS tstzset_values. +func (x *TsTzSet) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TstzsetValues(functions.SetFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// ToStbox is MEOS tstzset_to_stbox. +func (x *TsTzSet) ToStbox() (*STBox, error) { + _r0, _err := functions.TstzsetToSTBOX(functions.SetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} diff --git a/types/tstzspan.go b/types/tstzspan.go new file mode 100644 index 0000000..6924128 --- /dev/null +++ b/types/tstzspan.go @@ -0,0 +1,87 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TsTzSpan struct { + Span +} + +// TsTzSpanFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TsTzSpanFromPointer(p unsafe.Pointer) *TsTzSpan { + if p == nil { + return nil + } + v := &TsTzSpan{} + v.ptr = p + return v +} + +// TsTzSpanIn is MEOS tstzspan_in. +func TsTzSpanIn(str string) (*Span, error) { + _r0, _err := functions.TstzspanIn(str) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tstzspan_out. +func (x *TsTzSpan) Out() (string, error) { + _r0, _err := functions.TstzspanOut(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TsTzSpanMake is MEOS tstzspan_make. +func TsTzSpanMake(lower int64, upper int64, lower_inc bool, upper_inc bool) (*Span, error) { + _r0, _err := functions.TstzspanMake(lower, upper, lower_inc, upper_inc) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// ToDatespan is MEOS tstzspan_to_datespan. +func (x *TsTzSpan) ToDatespan() (*Span, error) { + _r0, _err := functions.TstzspanToDatespan(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanFromPointer(_r0.Pointer()), nil +} + +// Lower is MEOS tstzspan_lower. +func (x *TsTzSpan) Lower() (int64, error) { + _r0, _err := functions.TstzspanLower(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Upper is MEOS tstzspan_upper. +func (x *TsTzSpan) Upper() (int64, error) { + _r0, _err := functions.TstzspanUpper(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ToStbox is MEOS tstzspan_to_stbox. +func (x *TsTzSpan) ToStbox() (*STBox, error) { + _r0, _err := functions.TstzspanToSTBOX(functions.SpanFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} diff --git a/types/tstzspanset.go b/types/tstzspanset.go new file mode 100644 index 0000000..696b7bf --- /dev/null +++ b/types/tstzspanset.go @@ -0,0 +1,126 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TsTzSpanSet struct { + SpanSet +} + +// TsTzSpanSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TsTzSpanSetFromPointer(p unsafe.Pointer) *TsTzSpanSet { + if p == nil { + return nil + } + v := &TsTzSpanSet{} + v.ptr = p + return v +} + +// TsTzSpanSetIn is MEOS tstzspanset_in. +func TsTzSpanSetIn(str string) (*SpanSet, error) { + _r0, _err := functions.TstzspansetIn(str) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS tstzspanset_out. +func (x *TsTzSpanSet) Out() (string, error) { + _r0, _err := functions.TstzspansetOut(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ToDatespanset is MEOS tstzspanset_to_datespanset. +func (x *TsTzSpanSet) ToDatespanset() (*SpanSet, error) { + _r0, _err := functions.TstzspansetToDatespanset(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SpanSetFromPointer(_r0.Pointer()), nil +} + +// EndTimestamptz is MEOS tstzspanset_end_timestamptz. +func (x *TsTzSpanSet) EndTimestamptz() (int64, error) { + _r0, _err := functions.TstzspansetEndTimestamptz(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Lower is MEOS tstzspanset_lower. +func (x *TsTzSpanSet) Lower() (int64, error) { + _r0, _err := functions.TstzspansetLower(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// NumTimestamps is MEOS tstzspanset_num_timestamps. +func (x *TsTzSpanSet) NumTimestamps() (int, error) { + _r0, _err := functions.TstzspansetNumTimestamps(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// StartTimestamptz is MEOS tstzspanset_start_timestamptz. +func (x *TsTzSpanSet) StartTimestamptz() (int64, error) { + _r0, _err := functions.TstzspansetStartTimestamptz(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// Timestamps is MEOS tstzspanset_timestamps. +func (x *TsTzSpanSet) Timestamps() (*Set, error) { + _r0, _err := functions.TstzspansetTimestamps(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return SetFromPointer(_r0.Pointer()), nil +} + +// TimestamptzN is MEOS tstzspanset_timestamptz_n. +func (x *TsTzSpanSet) TimestamptzN(n int) (int64, bool, error) { + _found, _value, _err := functions.TstzspansetTimestamptzN(functions.SpanSetFromPointer(x.Pointer()), n) + if _err != nil { + return 0, false, _err + } + if !_found { + return 0, false, nil + } + return _value, true, nil +} + +// Upper is MEOS tstzspanset_upper. +func (x *TsTzSpanSet) Upper() (int64, error) { + _r0, _err := functions.TstzspansetUpper(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return 0, _err + } + return _r0, nil +} + +// ToStbox is MEOS tstzspanset_to_stbox. +func (x *TsTzSpanSet) ToStbox() (*STBox, error) { + _r0, _err := functions.TstzspansetToSTBOX(functions.SpanSetFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return STBoxFromPointer(_r0.Pointer()), nil +} diff --git a/types/ttext.go b/types/ttext.go new file mode 100644 index 0000000..641aaf1 --- /dev/null +++ b/types/ttext.go @@ -0,0 +1,183 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TText struct { + TAlpha +} + +// TTextFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TTextFromPointer(p unsafe.Pointer) *TText { + if p == nil { + return nil + } + v := &TText{} + v.ptr = p + return v +} + +// TTextFromMFJSON is MEOS ttext_from_mfjson. +func TTextFromMFJSON(str string) (*Temporal, error) { + _r0, _err := functions.TtextFromMFJSON(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TTextIn is MEOS ttext_in. +func TTextIn(str string) (*Temporal, error) { + _r0, _err := functions.TtextIn(str) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Out is MEOS ttext_out. +func (x *TText) Out() (string, error) { + _r0, _err := functions.TtextOut(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// TTextFromBaseTemp is MEOS ttext_from_base_temp. +func TTextFromBaseTemp(txt string, temp *Temporal) (*Temporal, error) { + _r0, _err := functions.TtextFromBaseTemp(txt, functions.TemporalFromPointer(temp.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// EndValue is MEOS ttext_end_value. +func (x *TText) EndValue() (string, error) { + _r0, _err := functions.TtextEndValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// MaxValue is MEOS ttext_max_value. +func (x *TText) MaxValue() (string, error) { + _r0, _err := functions.TtextMaxValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// MinValue is MEOS ttext_min_value. +func (x *TText) MinValue() (string, error) { + _r0, _err := functions.TtextMinValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// StartValue is MEOS ttext_start_value. +func (x *TText) StartValue() (string, error) { + _r0, _err := functions.TtextStartValue(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return "", _err + } + return _r0, nil +} + +// ValueAtTimestamptz is MEOS ttext_value_at_timestamptz. +func (x *TText) ValueAtTimestamptz(t int64, strict bool) (string, bool, error) { + _found, _value, _err := functions.TtextValueAtTimestamptz(functions.TemporalFromPointer(x.Pointer()), t, strict) + if _err != nil { + return "", false, _err + } + if !_found { + return "", false, nil + } + return _value, true, nil +} + +// ValueN is MEOS ttext_value_n. +func (x *TText) ValueN(n int) (string, bool, error) { + _found, _value, _err := functions.TtextValueN(functions.TemporalFromPointer(x.Pointer()), n) + if _err != nil { + return "", false, _err + } + if !_found { + return "", false, nil + } + return _value, true, nil +} + +// Values is MEOS ttext_values. +func (x *TText) Values(count unsafe.Pointer) (unsafe.Pointer, error) { + _r0, _err := functions.TtextValues(functions.TemporalFromPointer(x.Pointer()), count) + if _err != nil { + return nil, _err + } + return _r0, nil +} + +// AtValue is MEOS ttext_at_value. +func (x *TText) AtValue(txt string) (*Temporal, error) { + _r0, _err := functions.TtextAtValue(functions.TemporalFromPointer(x.Pointer()), txt) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// MinusValue is MEOS ttext_minus_value. +func (x *TText) MinusValue(txt string) (*Temporal, error) { + _r0, _err := functions.TtextMinusValue(functions.TemporalFromPointer(x.Pointer()), txt) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Initcap is MEOS ttext_initcap. +func (x *TText) Initcap() (*Temporal, error) { + _r0, _err := functions.TtextInitcap(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Upper is MEOS ttext_upper. +func (x *TText) Upper() (*Temporal, error) { + _r0, _err := functions.TtextUpper(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// Lower is MEOS ttext_lower. +func (x *TText) Lower() (*Temporal, error) { + _r0, _err := functions.TtextLower(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// ToTjsonb is MEOS ttext_to_tjsonb. +func (x *TText) ToTjsonb() (*Temporal, error) { + _r0, _err := functions.TtextToTjsonb(functions.TemporalFromPointer(x.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/ttextinst.go b/types/ttextinst.go new file mode 100644 index 0000000..c51aacd --- /dev/null +++ b/types/ttextinst.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TTextInst struct { + handle +} + +// TTextInstFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TTextInstFromPointer(p unsafe.Pointer) *TTextInst { + if p == nil { + return nil + } + v := &TTextInst{} + v.ptr = p + return v +} + +// TTextInstMake is MEOS ttextinst_make. +func TTextInstMake(txt string, t int64) (*Temporal, error) { + _r0, _err := functions.TtextinstMake(txt, t) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/ttextseq.go b/types/ttextseq.go new file mode 100644 index 0000000..810fa58 --- /dev/null +++ b/types/ttextseq.go @@ -0,0 +1,42 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TTextSeq struct { + handle +} + +// TTextSeqFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TTextSeqFromPointer(p unsafe.Pointer) *TTextSeq { + if p == nil { + return nil + } + v := &TTextSeq{} + v.ptr = p + return v +} + +// TTextSeqFromBaseTstzset is MEOS ttextseq_from_base_tstzset. +func TTextSeqFromBaseTstzset(txt string, s *Set) (*Temporal, error) { + _r0, _err := functions.TtextseqFromBaseTstzset(txt, functions.SetFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} + +// TTextSeqFromBaseTstzspan is MEOS ttextseq_from_base_tstzspan. +func TTextSeqFromBaseTstzspan(txt string, s *Span) (*Temporal, error) { + _r0, _err := functions.TtextseqFromBaseTstzspan(txt, functions.SpanFromPointer(s.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/ttextseqset.go b/types/ttextseqset.go new file mode 100644 index 0000000..7ddb239 --- /dev/null +++ b/types/ttextseqset.go @@ -0,0 +1,33 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" + + "github.com/MobilityDB/GoMEOS/functions" +) + +type TTextSeqSet struct { + handle +} + +// TTextSeqSetFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func TTextSeqSetFromPointer(p unsafe.Pointer) *TTextSeqSet { + if p == nil { + return nil + } + v := &TTextSeqSet{} + v.ptr = p + return v +} + +// TTextSeqSetFromBaseTstzspanset is MEOS ttextseqset_from_base_tstzspanset. +func TTextSeqSetFromBaseTstzspanset(txt string, ss *SpanSet) (*Temporal, error) { + _r0, _err := functions.TtextseqsetFromBaseTstzspanset(txt, functions.SpanSetFromPointer(ss.Pointer())) + if _err != nil { + return nil, _err + } + return TemporalFromPointer(_r0.Pointer()), nil +} diff --git a/types/value.go b/types/value.go new file mode 100644 index 0000000..4cb9b0e --- /dev/null +++ b/types/value.go @@ -0,0 +1,22 @@ +package types + +// Code generated by tools/objectgen.py from meos-idl.json. DO NOT EDIT. + +import ( + "unsafe" +) + +type Value struct { + handle +} + +// ValueFromPointer wraps a MEOS pointer, answering nil for nil so an +// absent MEOS result stays absent rather than becoming a live handle. +func ValueFromPointer(p unsafe.Pointer) *Value { + if p == nil { + return nil + } + v := &Value{} + v.ptr = p + return v +}