Overpass API regression suite coverage (Saxony) / overpass_api/data/meta_collector.h
overpass_api/data/meta_collector.h
104 of 128 instrumented lines run by the suite (81.2%) 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 modify6 * it under the terms of the GNU Affero General Public License as7 * published by the Free Software Foundation, either version 3 of the8 * 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 of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU Affero General Public License16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.17 */19#ifndef DE__OSM3S___OVERPASS_API__STATEMENTS__META_COLLECTOR_H20#define DE__OSM3S___OVERPASS_API__STATEMENTS__META_COLLECTOR_H22#include <map>23#include <set>24#include <vector>26#include "../../template_db/block_backend.h"27#include "../../template_db/random_file.h"28#include "../../template_db/transaction.h"29#include "../core/datatypes.h"30#include "../core/settings.h"31#include "filenames.h"34template< typename Index, typename Id_Type >35struct Meta_Collector36{37public:38 template< typename Object >39 Meta_Collector(const std::map< Index, std::vector< Object > >& items,40 Transaction& transaction, const File_Properties* meta_file_prop = 0);42 Meta_Collector(const Ranges< Index >& used_ranges,43 Transaction& transaction, const File_Properties* meta_file_prop = 0);45 void reset();46 const OSM_Element_Metadata_Skeleton< Id_Type >* get47 (const Index& index, Id_Type ref);48 const OSM_Element_Metadata_Skeleton< Id_Type >* get49 (const Index& index, Id_Type ref, uint64 timestamp);51 ~Meta_Collector()60private:61 std::set< Index > used_indices;62 Ranges< Index > used_ranges;63 Block_Backend< Index, OSM_Element_Metadata_Skeleton< Id_Type >, typename std::set< Index >::const_iterator >* meta_db;64 typename Block_Backend< Index, OSM_Element_Metadata_Skeleton< Id_Type >, typename std::set< Index >::const_iterator >65 ::Discrete_Iterator* db_it;66 typename Block_Backend< Index, OSM_Element_Metadata_Skeleton< Id_Type >, typename std::set< Index >::const_iterator >67 ::Range_Iterator* range_it;68 Index* current_index;69 Index* last_index;70 std::set< OSM_Element_Metadata_Skeleton< Id_Type > > current_objects;72 void update_current_objects(const Index&);73};76template< typename Index, typename Object >77struct Attic_Meta_Collector78{79public:80 Attic_Meta_Collector(const std::map< Index, std::vector< Attic< Object > > >& items,81 Transaction& transaction, bool turn_on);83 const OSM_Element_Metadata_Skeleton< typename Object::Id_Type >* get84 (const Index& index, typename Object::Id_Type ref, uint64 timestamp = NOW);86private:87 Meta_Collector< Index, typename Object::Id_Type > current;88 Meta_Collector< Index, typename Object::Id_Type > attic;89};92/** Implementation --------------------------------------------------------- */94template< typename Index, typename Object >95void generate_index_query96 (std::set< Index >& indices,97 const std::map< Index, std::vector< Object > >& items)104template< typename Index, typename Id_Type >105template< typename Object >106Meta_Collector< Index, Id_Type >::Meta_Collector107 (const std::map< Index, std::vector< Object > >& items,108 Transaction& transaction, const File_Properties* meta_file_prop)1157274216 q meta_db = new Block_Backend< Index, OSM_Element_Metadata_Skeleton< Id_Type >, typename std::set< Index >::const_iterator >122template< typename Index, typename Id_Type >123Meta_Collector< Index, Id_Type >::Meta_Collector124 (const Ranges< Index >& used_ranges_,125 Transaction& transaction, const File_Properties* meta_file_prop)126 : used_ranges(used_ranges_), meta_db(0), db_it(0), range_it(0), current_index(0), last_index(0)127{128 if (!meta_file_prop)129 return;131 meta_db = new Block_Backend< Index, OSM_Element_Metadata_Skeleton< Id_Type >, typename std::set< Index >::const_iterator >132 (transaction.data_index(meta_file_prop));134 reset();135}138template< typename Index, typename Id_Type >139void Meta_Collector< Index, Id_Type >::reset()1587365216 q db_it = new typename Block_Backend< Index, OSM_Element_Metadata_Skeleton< Id_Type >, typename std::set< Index >::const_iterator >1597365216 q ::Discrete_Iterator(meta_db->discrete_begin(used_indices.begin(), used_indices.end()));185template< typename Index, typename Id_Type >186void Meta_Collector< Index, Id_Type >::update_current_objects(const Index& index)219template< typename Index, typename Id_Type >220const OSM_Element_Metadata_Skeleton< Id_Type >* Meta_Collector< Index, Id_Type >::get221 (const Index& index, Id_Type ref)240template< typename Index, typename Id_Type >241const OSM_Element_Metadata_Skeleton< Id_Type >* Meta_Collector< Index, Id_Type >::get242 (const Index& index, Id_Type ref, uint64 timestamp)25353775188 q = current_objects.lower_bound(OSM_Element_Metadata_Skeleton< Id_Type >(ref, timestamp));264template< typename Index, typename Object >265Attic_Meta_Collector< Index, Object >::Attic_Meta_Collector(266 const std::map< Index, std::vector< Attic< Object > > >& items, Transaction& transaction, bool turn_on)272template< typename Index, typename Object >273const OSM_Element_Metadata_Skeleton< typename Object::Id_Type >* Attic_Meta_Collector< Index, Object >::get(274 const Index& index, typename Object::Id_Type ref, uint64 timestamp)284#endif