26 result = col.
getItem(index, output_srid);
48 #define EXPOSE_isNull(RowType) \
49 extern "C" DEVICE RUNTIME_EXPORT bool Column##RowType##_isNull(Column<RowType>& col, \
51 return col.isNull(index); \
54 #define EXPOSE_setNull(RowType) \
55 extern "C" DEVICE RUNTIME_EXPORT void Column##RowType##_setNull(Column<RowType>& col, \
61 #define EXPOSE_getItem(RowType, TypeName) \
62 extern "C" DEVICE RUNTIME_EXPORT void Column##RowType##_getItem( \
63 Column<RowType>& col, int64_t index, TypeName& rhs) { \
64 TypeName out = col.getItem(index); \
65 rhs.flatbuffer_ = out.flatbuffer_; \
67 for (int i = 0; i < NESTED_ARRAY_NDIM; i++) \
68 rhs.index_[i] = out.index_[i]; \
71 #define EXPOSE_setItem(RowType, TypeName) \
72 extern "C" DEVICE RUNTIME_EXPORT void Column##RowType##_setItem( \
73 Column<RowType>& col, int64_t index, TypeName& rhs) { \
74 col.setItem(index, rhs); \
77 #define EXPOSE_getNofValues(RowType) \
78 extern "C" DEVICE RUNTIME_EXPORT int64_t Column##RowType##_getNofValues( \
79 Column<RowType>& col) { \
80 return col.getNofValues(); \
83 #define EXPOSE(RowType, TypeName) \
84 EXPOSE_isNull(RowType); \
85 EXPOSE_setNull(RowType); \
86 EXPOSE_getNofValues(RowType); \
87 EXPOSE_getItem(RowType, TypeName); \
88 EXPOSE_setItem(RowType, TypeName);
100 #define EXPOSE_Geo_isNull(BaseType) \
101 extern "C" DEVICE RUNTIME_EXPORT bool Geo##BaseType##_isNull(Geo::BaseType& base) { \
102 return base.isNull(); \
105 #define EXPOSE_Geo_size(BaseType) \
106 extern "C" DEVICE RUNTIME_EXPORT size_t Geo##BaseType##_size(Geo::BaseType& base) { \
107 return base.size(); \
115 int64_t size_dim_y) {
116 std::vector<std::vector<std::vector<double>>> coords(size_dim_x);
118 for (
int i = 0; i < size_dim_x; i++) {
119 coords[i].resize(size_dim_y);
120 for (
int j = 0; j < size_dim_y; j++) {
121 coords[i][j].resize(dim_y[j]);
122 for (
int k = 0; k < dim_y[j]; k++) {
123 coords[i][j][k] = data[l++];
130 #define EXPOSE_Geo_fromCoords_vec2(BaseType) \
131 extern "C" DEVICE RUNTIME_EXPORT void Geo##BaseType##_fromCoords( \
132 Geo::BaseType& base, double* data, int64_t* indices, int64_t nrows) { \
133 std::vector<std::vector<double>> coords; \
134 int64_t offset = 0; \
135 for (int64_t i = 0; i < nrows; i++) { \
136 int64_t size = indices[i]; \
137 std::vector<double> row(data + offset, data + offset + size); \
138 coords.push_back(row); \
141 base.fromCoords(coords); \
145 #define EXPOSE_Geo_fromCoords_vec(BaseType) \
146 extern "C" DEVICE RUNTIME_EXPORT void Geo##BaseType##_fromCoords( \
147 Geo::BaseType& base, double* lst, int64_t size) { \
148 std::vector<double> coords(lst, lst + size); \
149 base.fromCoords(coords); \
152 #define EXPOSE_Geo_toCoords_vec(BaseType) \
153 extern "C" DEVICE RUNTIME_EXPORT double Geo##BaseType##_toCoords_get_value( \
154 Geo::BaseType& base, int64_t index) { \
155 Geo::Point2D p = base[index / 2]; \
156 return (index % 2 == 0) ? p.x : p.y; \
159 #define EXPOSE_Geo_toCoords_vec2(BaseType) \
160 extern "C" DEVICE RUNTIME_EXPORT double Geo##BaseType##_toCoords_get_value( \
161 const Geo::BaseType& base, int64_t ring_index, int64_t coord_index) { \
162 Geo::Point2D p = base[ring_index][coord_index / 2]; \
163 return (coord_index % 2 == 0) ? p.x : p.y; \
166 #define EXPOSE_Geo_getItem_Point2D(BaseType, ItemType) \
167 extern "C" DEVICE RUNTIME_EXPORT void Geo##BaseType##_getItem( \
168 Geo::BaseType& base, int64_t index, Geo::ItemType& result) { \
169 Geo::ItemType out = base.getItem(index); \
174 #define EXPOSE_Geo_getItem(BaseType, ItemType) \
175 extern "C" DEVICE RUNTIME_EXPORT void Geo##BaseType##_getItem( \
176 Geo::BaseType& base, int64_t index, Geo::ItemType& result) { \
177 Geo::ItemType out = base.getItem(index); \
178 result.flatbuffer_ = out.flatbuffer_; \
179 result.n_ = out.n_; \
180 for (int i = 0; i < NESTED_ARRAY_NDIM; i++) \
181 result.index_[i] = out.index_[i]; \
184 #define EXPOSE_Geo_Point2D(BaseType, ItemType) \
185 EXPOSE_Geo_isNull(BaseType); \
186 EXPOSE_Geo_size(BaseType); \
187 EXPOSE_Geo_getItem_Point2D(BaseType, ItemType);
189 #define EXPOSE_Geo(BaseType, ItemType) \
190 EXPOSE_Geo_isNull(BaseType); \
191 EXPOSE_Geo_size(BaseType); \
192 EXPOSE_Geo_getItem(BaseType, ItemType);
219 col.
setItem(index, *(reinterpret_cast<TextEncodingNone*>(rhs)));
239 return address !=
nullptr;
242 #define LIST_FUNCTION_W_SUFFIX(RowType, Suffix) \
243 avoid_opt_address_geo(reinterpret_cast<void*>(Column##RowType##_##Suffix))
245 #define LIST_GEO_fromCoords(RowType) \
246 avoid_opt_address_geo(reinterpret_cast<void*>(RowType##_fromCoords))
248 #define LIST_Geo_toCoords_vec(RowType) \
249 avoid_opt_address_geo(reinterpret_cast<void*>(RowType##_toCoords_get_value))
251 #define LIST_Geo_toCoords_vec2(RowType) \
252 avoid_opt_address_geo(reinterpret_cast<void*>(RowType##_toCoords_get_value))
254 #define LIST_FUNCTIONS(RowType) \
255 LIST_FUNCTION_W_SUFFIX(RowType, getItem) && \
256 LIST_FUNCTION_W_SUFFIX(RowType, setItem) && \
257 LIST_FUNCTION_W_SUFFIX(RowType, isNull) && \
258 LIST_FUNCTION_W_SUFFIX(RowType, setNull) && \
259 LIST_FUNCTION_W_SUFFIX(RowType, getNofValues)
DEVICE RUNTIME_EXPORT bool ColumnGeoPoint_isNull(const Column< GeoPoint > &col, int64_t index)
#define EXPOSE_Geo(BaseType, ItemType)
Simplified core of GeoJSON Polygon coordinates definition.
#define LIST_Geo_toCoords_vec(RowType)
#define LIST_GEO_fromCoords(RowType)
DEVICE void setNull(int64_t index)
Simplified core of GeoJSON MultiPolygon coordinates definition.
#define LIST_Geo_toCoords_vec2(RowType)
DEVICE Geo::Point2D getItem(const int64_t index, const int32_t output_srid=0) const
#define LIST_FUNCTIONS(RowType)
#define EXPOSE_Geo_fromCoords_vec(BaseType)
DEVICE RUNTIME_EXPORT void ColumnGeoPoint_setItem(Column< GeoPoint > &col, int64_t index, const Geo::Point2D &other)
DEVICE RUNTIME_EXPORT void ColumnTextEncodingNone_concatItem(Column< TextEncodingNone > &col, int64_t index, int8_t *rhs)
DEVICE RUNTIME_EXPORT void ColumnTextEncodingNone_setItem_fromBuffer(Column< TextEncodingNone > &col, int64_t index, int8_t *rhs)
DEVICE RUNTIME_EXPORT void ColumnGeoPoint_setNull(Column< GeoPoint > &col, int64_t index)
DEVICE RUNTIME_EXPORT void GeoMultiPolygon_fromCoords(Geo::MultiPolygon &base, double *data, int64_t *dim_x, int64_t *dim_y, int64_t size_dim_x, int64_t size_dim_y)
DEVICE bool isNull(int64_t index) const
DEVICE RUNTIME_EXPORT void ColumnTextEncodingNone_concatItem_fromBuffer(Column< TextEncodingNone > &col, int64_t index, int8_t *rhs)
DEVICE RUNTIME_EXPORT void ColumnGeoPoint_getItem(const Column< GeoPoint > &col, int64_t index, int32_t output_srid, Geo::Point2D &result)
FlatBufferManager::Status fromCoords(const std::vector< CT > &coords)
volatile bool avoid_opt_address_geo(void *address)
#define EXPOSE_Geo_toCoords_vec(BaseType)
DEVICE void setItem(int64_t index, const Geo::Point2D &other)
#define EXPOSE_Geo_fromCoords_vec2(BaseType)
#define EXPOSE_Geo_Point2D(BaseType, ItemType)
bool functions_exist_geo_column()
DEVICE void setItem(int64_t index, const RowType &item)
#define EXPOSE(RowType, TypeName)
#define EXPOSE_Geo_toCoords_vec2(BaseType)