Overpass API regression suite coverage (Saxony) / overpass_api/data/set_comparison.h

overpass_api/data/set_comparison.h

1 of 3 instrumented lines run by the suite (33.3%) at 8edf11b0419c (this file on GitHub).

runnever runcolumns: line, executions, queries (click for the queries that run the line)

1/** Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Roland Olbricht et al.
2 *
3 * This file is part of Overpass_API.
4 *
5 * Overpass_API is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * Overpass_API is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.
17 */
19#ifndef DE__OSM3S___OVERPASS_API__DATA__SET_COMPARISON_H
20#define DE__OSM3S___OVERPASS_API__DATA__SET_COMPARISON_H
23#include "collect_members.h"
24#include "diff_set.h"
25#include "geometry_from_quad_coords.h"
26#include "meta_collector.h"
27#include "relation_geometry_store.h"
28#include "tag_store.h"
29#include "way_geometry_store.h"
31#include <map>
32#include <string>
33#include <utility>
34#include <vector>
37struct Extra_Data_For_Diff
39 Extra_Data_For_Diff(
40 Resource_Manager& rman, const Statement& stmt, const Set& to_print, unsigned int mode_,
41 double south, double north, double west, double east);
42 ~Extra_Data_For_Diff();
44 const std::map< uint32, std::string >* get_users() const;
46 unsigned int mode;
47 Way_Bbox_Geometry_Store* way_geometry_store;
48 Way_Bbox_Geometry_Store* attic_way_geometry_store;
49 Relation_Geometry_Store* relation_geometry_store;
50 Relation_Geometry_Store* attic_relation_geometry_store;
51 const std::map< uint32, std::string >* roles;
52 const std::map< uint32, std::string >* users;
53};
56struct Evaluator;
59class Set_Comparison
61public:
62 Set_Comparison(Transaction& transaction, const Set& lhs_set, uint64 lhs_timestamp)
6350081 q : final_target(0), lhs_set_(lhs_set), lhs_timestamp_(lhs_timestamp) {}
65 Diff_Set compare_to_lhs(Resource_Manager& rman, const Statement& stmt, const Set& input_set,
66 double south, double north, double west, double east, bool add_deletion_information);
67 Diff_Set compare_to_lhs(Resource_Manager& rman, const Statement& stmt, const Set& input_set,
68 Evaluator* evaluator, bool add_deletion_information);
70private:
71 void print_item(Extra_Data_For_Diff& extra_data, uint32 ll_upper, const Node_Skeleton& skel,
72 const std::vector< std::pair< std::string, std::string > >* tags,
73 const OSM_Element_Metadata_Skeleton< Node_Skeleton::Id_Type >* meta,
74 const std::map< uint32, std::string >* users);
75 void print_item(Extra_Data_For_Diff& extra_data, uint32 ll_upper, const Attic< Node_Skeleton >& skel,
76 const std::vector< std::pair< std::string, std::string > >* tags,
77 const OSM_Element_Metadata_Skeleton< Node_Skeleton::Id_Type >* meta,
78 const std::map< uint32, std::string >* users);
79 void store_item(uint32 ll_upper, const Node_Skeleton& skel,
80 const std::vector< std::pair< std::string, std::string > >* tags,
81 uint64 timestamp, const OSM_Element_Metadata_Skeleton< Node::Id_Type >* meta = 0,
82 const std::map< uint32, std::string >* users = 0,
83 const Output_Handler::Feature_Action& action = Output_Handler::keep,
84 const OSM_Element_Metadata_Skeleton< Node::Id_Type >* new_meta = 0);
85 void compare_item(uint32 ll_upper, const Node_Skeleton& skel,
86 const std::vector< std::pair< std::string, std::string > >* tags,
87 uint64 timestamp, const OSM_Element_Metadata_Skeleton< Node::Id_Type >* meta = 0,
88 const std::map< uint32, std::string >* users = 0,
89 const Output_Handler::Feature_Action& action = Output_Handler::keep,
90 const OSM_Element_Metadata_Skeleton< Node::Id_Type >* new_meta = 0);
92 void print_item(Extra_Data_For_Diff& extra_data, uint32 ll_upper, const Way_Skeleton& skel,
93 const std::vector< std::pair< std::string, std::string > >* tags,
94 const OSM_Element_Metadata_Skeleton< Way_Skeleton::Id_Type >* meta,
95 const std::map< uint32, std::string >* users);
96 void print_item(Extra_Data_For_Diff& extra_data, uint32 ll_upper, const Attic< Way_Skeleton >& skel,
97 const std::vector< std::pair< std::string, std::string > >* tags,
98 const OSM_Element_Metadata_Skeleton< Way_Skeleton::Id_Type >* meta,
99 const std::map< uint32, std::string >* users);
100 void store_item(uint32 ll_upper, const Way_Skeleton& skel,
101 const std::vector< std::pair< std::string, std::string > >* tags,
102 const std::pair< Quad_Coord, Quad_Coord* >* bounds,
103 const std::vector< Quad_Coord >* geometry,
104 uint64 timestamp, const OSM_Element_Metadata_Skeleton< Way::Id_Type >* meta = 0,
105 const std::map< uint32, std::string >* users = 0,
106 const Output_Handler::Feature_Action& action = Output_Handler::keep,
107 const OSM_Element_Metadata_Skeleton< Way::Id_Type >* new_meta = 0);
108 void compare_item(uint32 ll_upper, const Way_Skeleton& skel,
109 const std::vector< std::pair< std::string, std::string > >* tags,
110 const std::pair< Quad_Coord, Quad_Coord* >* bounds,
111 const std::vector< Quad_Coord >* geometry,
112 uint64 timestamp, const OSM_Element_Metadata_Skeleton< Way::Id_Type >* meta = 0,
113 const std::map< uint32, std::string >* users = 0,
114 const Output_Handler::Feature_Action& action = Output_Handler::keep,
115 const OSM_Element_Metadata_Skeleton< Way::Id_Type >* new_meta = 0);
117 void print_item(Extra_Data_For_Diff& extra_data, uint32 ll_upper, const Relation_Skeleton& skel,
118 const std::vector< std::pair< std::string, std::string > >* tags,
119 const OSM_Element_Metadata_Skeleton< Relation_Skeleton::Id_Type >* meta,
120 const std::map< uint32, std::string >* users);
121 void print_item(Extra_Data_For_Diff& extra_data, uint32 ll_upper, const Attic< Relation_Skeleton >& skel,
122 const std::vector< std::pair< std::string, std::string > >* tags,
123 const OSM_Element_Metadata_Skeleton< Relation_Skeleton::Id_Type >* meta,
124 const std::map< uint32, std::string >* users);
125 void store_item(uint32 ll_upper, const Relation_Skeleton& skel,
126 const std::vector< std::pair< std::string, std::string > >* tags,
127 const std::pair< Quad_Coord, Quad_Coord* >* bounds,
128 const std::vector< std::vector< Quad_Coord > >* geometry,
129 uint64 timestamp, const OSM_Element_Metadata_Skeleton< Relation::Id_Type >* meta = 0,
130 const std::map< uint32, std::string >* users = 0,
131 const Output_Handler::Feature_Action& action = Output_Handler::keep,
132 const OSM_Element_Metadata_Skeleton< Relation::Id_Type >* new_meta = 0);
133 void compare_item(uint32 ll_upper, const Relation_Skeleton& skel,
134 const std::vector< std::pair< std::string, std::string > >* tags,
135 const std::pair< Quad_Coord, Quad_Coord* >* bounds,
136 const std::vector< std::vector< Quad_Coord > >* geometry,
137 uint64 timestamp, const OSM_Element_Metadata_Skeleton< Relation::Id_Type >* meta = 0,
138 const std::map< uint32, std::string >* users = 0,
139 const Output_Handler::Feature_Action& action = Output_Handler::keep,
140 const OSM_Element_Metadata_Skeleton< Relation::Id_Type >* new_meta = 0);
142 void set_target(bool target);
144 void clear_nodes(Resource_Manager& rman, bool add_deletion_information = false);
145 void clear_ways(Resource_Manager& rman, bool add_deletion_information = false);
146 void clear_relations(Resource_Manager& rman, bool add_deletion_information = false);
148 void compute_deriveds(std::map< Uint31_Index, std::vector< Derived_Structure > > rhs_deriveds);
1500 const Set& lhs_set() const { return lhs_set_; }
1510 uint64 lhs_timestamp() const { return lhs_timestamp_; }
153 template< class Index, class Object >
154 void tags_quadtile
155 (Extra_Data_For_Diff& extra_data, const std::map< Index, std::vector< Object > >& items,
156 Resource_Manager& rman);
157 template< class Index, class Object >
158 void tags_quadtile_attic
159 (Extra_Data_For_Diff& extra_data, const std::map< Index, std::vector< Attic< Object > > >& items,
160 Resource_Manager& rman);
161 template< class Index, class Object >
162 void tags_quadtile
163 (Extra_Data_For_Diff& extra_data, const std::map< Index, std::vector< Object > >& items,
164 const std::vector< typename Object::Id_Type >& id_list,
165 Resource_Manager& rman);
166 template< class Index, class Object >
167 void tags_quadtile_attic
168 (Extra_Data_For_Diff& extra_data, const std::map< Index, std::vector< Attic< Object > > >& items,
169 const std::vector< typename Object::Id_Type >& id_list,
170 Resource_Manager& rman);
172 bool final_target;
174 std::vector< Node_With_Context > nodes;
175 std::vector< Way_With_Context > ways;
176 std::vector< Relation_With_Context > relations;
178 std::vector< std::pair< Node_Skeleton::Id_Type, std::string > > node_values;
179 std::vector< std::pair< Way_Skeleton::Id_Type, std::string > > way_values;
180 std::vector< std::pair< Relation_Skeleton::Id_Type, std::string > > relation_values;
182 Set lhs_set_;
183 uint64 lhs_timestamp_;
185 Diff_Set result;
186};
189#endif