MySQL 8.0.40
Source Code Documentation
|
#include <assert.h>
#include <float.h>
#include <string.h>
#include <sys/types.h>
#include <algorithm>
#include <cstddef>
#include <iterator>
#include "lex_string.h"
#include "my_byteorder.h"
#include "my_compiler.h"
#include "my_inttypes.h"
#include "mysql/components/services/bits/psi_bits.h"
#include "mysql/service_mysql_alloc.h"
#include "sql/gis/srid.h"
#include "sql/inplace_vector.h"
#include "sql_string.h"
#include "unsafe_string_append.h"
Go to the source code of this file.
Classes | |
class | point_xy |
Point with coordinates X and Y. More... | |
struct | wkb_header_st |
struct | MBR |
class | Geometry |
class | Geometry::wkb_container |
Constant storage for WKB. More... | |
class | Geometry::wkb_parser |
WKB parser, designed to traverse through WKB data from beginning of the buffer towards the end using a set of scan_xxx(), get_xxx() and skip_xxx() routines, with safety tests to avoid going beyond the buffer end. More... | |
class | Geometry::Class_info |
class | Geometry::Flags_t |
Highest byte is stores byte order, dimension, nomem and geotype as follows: bo: byte order, 1 for little endian(ndr), 0 for big endian(xdr); Currently it must be always wkb_ndr since it is MySQL's portable geometry format. More... | |
class | Gis_point |
class | Gis_wkb_vector_const_iterator< T > |
Gis_wkb_vector_const_iterator is const_iterator class for Gis_wkb_vector, and base class of Gis_wkb_vector_iterator – iterator class for Gis_wkb_vector. More... | |
class | Gis_wkb_vector_iterator< T > |
This class is the iterator class for Gis_wkb_vector, its instances can be used to mutate their referenced data element. More... | |
class | Geometry_vector< T > |
Geometry vector class. More... | |
class | Gis_wkb_vector< T > |
Gis_wkb_vector class template definition. More... | |
class | Gis_line_string |
class | Gis_polygon_ring |
class | Gis_polygon |
class | Gis_multi_point |
class | Gis_multi_line_string |
class | Gis_multi_polygon |
class | Gis_geometry_collection |
struct | Geometry_buffer |
Gis_polygon objects and Gis_wkb_vector<> objects are of same size, and Gis_point and Geometry objects are smaller. More... | |
class | WKB_scanner_event_handler |
Typedefs | |
typedef struct wkb_header_st | wkb_header |
Functions | |
void * | gis_wkb_alloc (size_t sz) |
void * | gis_wkb_fixed_alloc (size_t sz) |
void * | gis_wkb_realloc (void *p, size_t sz) |
void | gis_wkb_free (void *p) |
void | gis_wkb_raw_free (void *p) |
Geometry::wkbByteOrder | get_byte_order (const void *p0) |
void | set_byte_order (void *p0, Geometry::wkbByteOrder bo) |
Geometry::wkbType | get_wkb_geotype (const void *p0) |
Get wkbType value from WKB, the WKB is always little endian, so need platform specific conversion. More... | |
char * | write_wkb_header (void *p0, Geometry::wkbType geotype) |
char * | write_wkb_header (void *p0, Geometry::wkbType geotype, uint32 obj_count) |
char * | write_geometry_header (void *p0, gis::srid_t srid, Geometry::wkbType geotype) |
char * | write_geometry_header (void *p0, gis::srid_t srid, Geometry::wkbType geotype, uint32 obj_count) |
void | write_wkb_header (String *str, Geometry::wkbType geotype) |
void | write_wkb_header (String *str, Geometry::wkbType geotype, uint32 obj_count) |
void | write_geometry_header (String *str, gis::srid_t srid, Geometry::wkbType geotype) |
void | write_geometry_header (String *str, gis::srid_t srid, Geometry::wkbType geotype, uint32 obj_count) |
template<typename T > | |
Gis_wkb_vector_const_iterator< T > | operator+ (typename Gis_wkb_vector_const_iterator< T >::difference_type n, const Gis_wkb_vector_const_iterator< T > &itr) |
template<typename T > | |
Gis_wkb_vector_iterator< T > | operator+ (typename Gis_wkb_vector_iterator< T >::difference_type n, const Gis_wkb_vector_iterator< T > &itr) |
void * | get_packed_ptr (const Geometry *geo, size_t *pnbytes) |
Packup a polygon's outer ring and inner rings into a single chunk of memory as result. More... | |
const char * | get_packed_ptr (Geometry *geo) |
Get a polygon's WKB string's starting address. More... | |
bool | polygon_is_packed (Geometry *plgn, Geometry *mplgn) |
Check whether plgn is packed into its owner mplgn's WKB buffer. More... | |
void | own_rings (Geometry *geo) |
void | parse_wkb_data (Geometry *geom, const char *p, size_t num_geoms=0) |
Parse the wkb buffer to build the component vector m_geo_vect for geom. More... | |
Gis_polygon_ring * | outer_ring (const Geometry *g) |
const char * | wkb_scanner (THD *thd, const char *wkb, uint32 *len, uint32 geotype, bool has_hdr, WKB_scanner_event_handler *handler) |
Scan WKB byte string and notify WKB events by calling registered callbacks. More... | |
Variables | |
const uint | GEOM_DIM = 2 |
const uint | SRID_SIZE = 4 |
const uint | SIZEOF_STORED_DOUBLE = 8 |
const uint | POINT_DATA_SIZE = (SIZEOF_STORED_DOUBLE * 2) |
const uint | WKB_HEADER_SIZE = (1 + 4) |
const uint | GEOM_HEADER_SIZE = (SRID_SIZE + WKB_HEADER_SIZE) |
const uint32 | GET_SIZE_ERROR = 0xFFFFFFFFU |
typedef struct wkb_header_st wkb_header |
|
inline |
void * get_packed_ptr | ( | const Geometry * | geo0, |
size_t * | pnbytes | ||
) |
Packup a polygon's outer ring and inner rings into a single chunk of memory as result.
nbytes returns the number of bytes in WKB data. The returned WKB has no WKB header. Never call get_ptr to obtain a polygon's WKB data.
geo0 | The polygon whose WKB data we want to pack up. | |
[out] | pnbytes | Takes back the number of bytes of the packed WKB string. |
const char * get_packed_ptr | ( | Geometry * | geo0 | ) |
Get a polygon's WKB string's starting address.
The polygon is already packed so that its outer ring and inner rings point to different locations of a continuous chunk of WKB buffer.
geo0 | The already packed polygon, we want to get its data address. |
|
inline |
Get wkbType value from WKB, the WKB is always little endian, so need platform specific conversion.
p0 | WKB geometry type field address. |
void * gis_wkb_alloc | ( | size_t | sz | ) |
|
inline |
|
inline |
|
inline |
void * gis_wkb_realloc | ( | void * | p, |
size_t | sz | ||
) |
Gis_wkb_vector_const_iterator< T > operator+ | ( | typename Gis_wkb_vector_const_iterator< T >::difference_type | n, |
const Gis_wkb_vector_const_iterator< T > & | itr | ||
) |
Gis_wkb_vector_iterator< T > operator+ | ( | typename Gis_wkb_vector_iterator< T >::difference_type | n, |
const Gis_wkb_vector_iterator< T > & | itr | ||
) |
|
inline |
void own_rings | ( | Geometry * | geo | ) |
void parse_wkb_data | ( | Geometry * | geom, |
const char * | p, | ||
size_t | num_geoms | ||
) |
Parse the wkb buffer to build the component vector m_geo_vect for geom.
Set each geometry's wkb pointer into the Geometry objects inside m_geo_vect. Make it a standalone function in order to be able to access classes defined after class template Gis_wkb_vector.
geom | the geometry to analyze and parse. |
p | points to the geometry's wkb data's 1st byte, right after its wkb header if any. |
num_geoms | number of following geometries, to be used only when parsing the WKB of a polygon's inner rings because there is no WKB header for the inner rings only. |
Check whether plgn is packed into its owner mplgn's WKB buffer.
plgn | the polygon to be checked |
mplgn | the multipolygon, owner/holder of plgn. |
|
inline |
const char * wkb_scanner | ( | THD * | thd, |
const char * | wkb, | ||
uint32 * | len, | ||
uint32 | geotype, | ||
bool | has_hdr, | ||
WKB_scanner_event_handler * | handler | ||
) |
Scan WKB byte string and notify WKB events by calling registered callbacks.
wkb | a little endian WKB byte string of 'len' bytes, with or without WKB header. | |
[in] | thd | Thread context. |
[in,out] | len | remaining number of bytes of the wkb string. |
geotype | the type of the geometry to be scanned. | |
has_hdr | whether the 'wkb' point to a WKB header or right after the header. If it is true, the 'geotype' should be the same as the type in the header; otherwise, and we will use the type specified in WKB header. | |
handler | the registered WKB_scanner_event_handler object to be notified. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
const uint GEOM_DIM = 2 |
const uint GEOM_HEADER_SIZE = (SRID_SIZE + WKB_HEADER_SIZE) |
const uint32 GET_SIZE_ERROR = 0xFFFFFFFFU |
const uint POINT_DATA_SIZE = (SIZEOF_STORED_DOUBLE * 2) |
const uint SIZEOF_STORED_DOUBLE = 8 |
const uint SRID_SIZE = 4 |
const uint WKB_HEADER_SIZE = (1 + 4) |