MySQL 8.0.30
Source Code Documentation
wkb_size_visitor.h
Go to the documentation of this file.
1#ifndef SQL_GIS_WKB_SIZE_VISITOR_H_INCLUDED
2#define SQL_GIS_WKB_SIZE_VISITOR_H_INCLUDED
3
4// Copyright (c) 2018, 2022, Oracle and/or its affiliates.
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License, version 2.0,
8// as published by the Free Software Foundation.
9//
10// This program is also distributed with certain software (including
11// but not limited to OpenSSL) that is licensed under separate terms,
12// as designated in a particular file or component or in included license
13// documentation. The authors of MySQL hereby grant you an additional
14// permission to link the program and your derivative works with the
15// separately licensed software that they have included with MySQL.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License, version 2.0, for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program; if not, write to the Free Software
24// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25
27
28#include <cstddef> // std::size_t
29
30namespace gis {
31
32/// A visitor that computes the size of a WKB representation of a geometry.
34 private:
35 /// The size of the geometry.
36 std::size_t m_size;
37
38 public:
39 /// Construct a new WKB visitor.
41 std::size_t size() const { return m_size; }
42
44 bool visit_enter(Geometry *g) override;
45 bool visit_enter(Linestring *ls) override;
46 bool visit_enter(Linearring *lr) override;
47 bool visit_enter(Polygon *py) override;
48 bool visit_enter(Geometrycollection *gc) override;
49
51 bool visit(Point *pt) override;
52};
53
54} // namespace gis
55
56#endif // SQL_GIS_WKB_SIZE_VISITOR_H_INCLUDED
Abstract superclass for all geometric objects.
Definition: geometries.h:99
A collection of geometries.
Definition: geometries.h:409
A ring-shaped linestring.
Definition: geometries.h:319
A string of connected line segments.
Definition: geometries.h:255
A visitor that implements the entire interface and does nothing.
Definition: geometry_visitor.h:121
bool visit_enter(Geometry *) override
Enters a compound geometry.
Definition: geometry_visitor.h:123
bool visit(Geometry *) override
Visits a geometry.
Definition: geometry_visitor.h:158
A 2d point.
Definition: geometries.h:149
A polygon consisting of an outer ring and zero or more interior rings defining holes in the polygon.
Definition: geometries.h:348
A visitor that computes the size of a WKB representation of a geometry.
Definition: wkb_size_visitor.h:33
bool visit_enter(Geometry *g) override
Enters a compound geometry.
Definition: wkb_size_visitor.cc:30
Wkb_size_visitor()
Construct a new WKB visitor.
Definition: wkb_size_visitor.h:40
bool visit(Point *pt) override
Definition: wkb_size_visitor.cc:65
std::size_t m_size
The size of the geometry.
Definition: wkb_size_visitor.h:36
std::size_t size() const
Definition: wkb_size_visitor.h:41
The geometries implement a hierarchical visitor pattern.
Definition: area.cc:46