xref: /sqlite-3.40.0/ext/rtree/sqlite3rtree.h (revision 50f79f56)
1 /*
2 ** 2010 August 30
3 **
4 ** The author disclaims copyright to this source code.  In place of
5 ** a legal notice, here is a blessing:
6 **
7 **    May you do good and not evil.
8 **    May you find forgiveness for yourself and forgive others.
9 **    May you share freely, never taking more than you give.
10 **
11 *************************************************************************
12 */
13 
14 #ifndef _SQLITE3RTREE_H_
15 #define _SQLITE3RTREE_H_
16 
17 #include <sqlite3.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;
24 
25 /*
26 ** Register a geometry callback named zGeom that can be used as part of an
27 ** R-Tree geometry query as follows:
28 **
29 **   SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
30 */
31 int sqlite3_rtree_geometry_callback(
32   sqlite3 *db,
33   const char *zGeom,
34 #ifdef SQLITE_RTREE_INT_ONLY
35   int (*xGeom)(sqlite3_rtree_geometry*, int n, sqlite3_int64 *a, int *pRes),
36 #else
37   int (*xGeom)(sqlite3_rtree_geometry*, int n, double *a, int *pRes),
38 #endif
39   void *pContext
40 );
41 
42 
43 /*
44 ** A pointer to a structure of the following type is passed as the first
45 ** argument to callbacks registered using rtree_geometry_callback().
46 */
47 struct sqlite3_rtree_geometry {
48   void *pContext;                 /* Copy of pContext passed to s_r_g_c() */
49   int nParam;                     /* Size of array aParam[] */
50   double *aParam;                 /* Parameters passed to SQL geom function */
51   void *pUser;                    /* Callback implementation user data */
52   void (*xDelUser)(void *);       /* Called by SQLite to clean up pUser */
53 };
54 
55 
56 #ifdef __cplusplus
57 }  /* end of the 'extern "C"' block */
58 #endif
59 
60 #endif  /* ifndef _SQLITE3RTREE_H_ */
61