MySQL 8.0.40
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, 2024, 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 designed to work 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 either included with
16// the program or referenced in the documentation.
17//
18// This program is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License, version 2.0, for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with this program; if not, write to the Free Software
25// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26
28
29#include <cstddef> // std::size_t
30
31namespace gis {
32
33/// A visitor that computes the size of a WKB representation of a geometry.
35 private:
36 /// The size of the geometry.
37 std::size_t m_size;
38
39 public:
40 /// Construct a new WKB visitor.
42 std::size_t size() const { return m_size; }
43
45 bool visit_enter(Geometry *g) override;
46 bool visit_enter(Linestring *ls) override;
47 bool visit_enter(Linearring *lr) override;
48 bool visit_enter(Polygon *py) override;
49 bool visit_enter(Geometrycollection *gc) override;
50
52 bool visit(Point *pt) override;
53};
54
55} // namespace gis
56
57#endif // SQL_GIS_WKB_SIZE_VISITOR_H_INCLUDED
Abstract superclass for all geometric objects.
Definition: geometries.h:100
A collection of geometries.
Definition: geometries.h:410
A ring-shaped linestring.
Definition: geometries.h:320
A string of connected line segments.
Definition: geometries.h:256
A visitor that implements the entire interface and does nothing.
Definition: geometry_visitor.h:122
bool visit_enter(Geometry *) override
Enters a compound geometry.
Definition: geometry_visitor.h:124
bool visit(Geometry *) override
Visits a geometry.
Definition: geometry_visitor.h:159
A 2d point.
Definition: geometries.h:150
A polygon consisting of an outer ring and zero or more interior rings defining holes in the polygon.
Definition: geometries.h:349
A visitor that computes the size of a WKB representation of a geometry.
Definition: wkb_size_visitor.h:34
bool visit_enter(Geometry *g) override
Enters a compound geometry.
Definition: wkb_size_visitor.cc:31
Wkb_size_visitor()
Construct a new WKB visitor.
Definition: wkb_size_visitor.h:41
bool visit(Point *pt) override
Definition: wkb_size_visitor.cc:66
std::size_t m_size
The size of the geometry.
Definition: wkb_size_visitor.h:37
std::size_t size() const
Definition: wkb_size_visitor.h:42
The geometries implement a hierarchical visitor pattern.
Definition: area.cc:47