diff --git a/src/command-line-parser.cpp b/src/command-line-parser.cpp index 8d6b1791f..ca7200d38 100644 --- a/src/command-line-parser.cpp +++ b/src/command-line-parser.cpp @@ -392,7 +392,8 @@ options_t parse_command_line(int argc, char *argv[]) app.add_flag_function("-l,--latlong", [&](int64_t) { options.projection = - reprojection::create_projection(PROJ_LATLONG); + reprojection_t::create_projection( + PROJ_LATLONG); }) ->description("Store data in degrees of latitude & longitude (WGS84).") ->group("Pgsql output options"); @@ -401,7 +402,7 @@ options_t parse_command_line(int argc, char *argv[]) app.add_flag_function("-m,--merc", [&](int64_t) { options.projection = - reprojection::create_projection( + reprojection_t::create_projection( PROJ_SPHERE_MERC); }) ->description("Store data in Web Mercator [EPSG 3857]. This is the " @@ -425,7 +426,7 @@ options_t parse_command_line(int argc, char *argv[]) #ifdef HAVE_GENERIC_PROJ [&](int arg) { options.projection = - reprojection::create_projection(arg); + reprojection_t::create_projection(arg); #else [&](int) { throw std::runtime_error{ @@ -665,7 +666,8 @@ options_t parse_command_line(int argc, char *argv[]) } if (!options.projection) { - options.projection = reprojection::create_projection(PROJ_SPHERE_MERC); + options.projection = + reprojection_t::create_projection(PROJ_SPHERE_MERC); } check_options_expire(&options); diff --git a/src/expire-tiles.cpp b/src/expire-tiles.cpp index 45700396b..d9578cd89 100644 --- a/src/expire-tiles.cpp +++ b/src/expire-tiles.cpp @@ -26,13 +26,13 @@ #include "tile.hpp" #include "wkb.hpp" -expire_tiles::expire_tiles(uint32_t max_zoom, - std::shared_ptr projection) +expire_tiles_t::expire_tiles_t(uint32_t max_zoom, + std::shared_ptr projection) : m_projection(std::move(projection)), m_maxzoom(max_zoom), m_map_width(static_cast(1U << m_maxzoom)) {} -void expire_tiles::expire_tile(uint32_t x, uint32_t y) +void expire_tiles_t::expire_tile(uint32_t x, uint32_t y) { // Only try to insert to tile into the set if the last inserted tile // is different from this tile. @@ -43,7 +43,7 @@ void expire_tiles::expire_tile(uint32_t x, uint32_t y) } } -uint32_t expire_tiles::normalise_tile_x_coord(int x) const +uint32_t expire_tiles_t::normalise_tile_x_coord(int x) const { x %= m_map_width; if (x < 0) { @@ -52,7 +52,7 @@ uint32_t expire_tiles::normalise_tile_x_coord(int x) const return static_cast(x); } -geom::point_t expire_tiles::coords_to_tile(geom::point_t const &point) +geom::point_t expire_tiles_t::coords_to_tile(geom::point_t const &point) { auto const c = m_projection->target_to_tile(point); @@ -60,29 +60,29 @@ geom::point_t expire_tiles::coords_to_tile(geom::point_t const &point) m_map_width * (0.5 - c.y() / tile_t::EARTH_CIRCUMFERENCE)}; } -void expire_tiles::from_point_list(geom::point_list_t const &list, - expire_config_t const &expire_config) +void expire_tiles_t::from_point_list(geom::point_list_t const &list, + expire_config_t const &expire_config) { for_each_segment(list, [&](geom::point_t const &a, geom::point_t const &b) { from_line_segment(a, b, expire_config); }); } -void expire_tiles::from_geometry(geom::point_t const &geom, - expire_config_t const &expire_config) +void expire_tiles_t::from_geometry(geom::point_t const &geom, + expire_config_t const &expire_config) { geom::box_t const box = geom::envelope(geom); from_bbox(box, expire_config); } -void expire_tiles::from_geometry(geom::linestring_t const &geom, - expire_config_t const &expire_config) +void expire_tiles_t::from_geometry(geom::linestring_t const &geom, + expire_config_t const &expire_config) { from_point_list(geom, expire_config); } -void expire_tiles::from_polygon_boundary(geom::polygon_t const &geom, - expire_config_t const &expire_config) +void expire_tiles_t::from_polygon_boundary(geom::polygon_t const &geom, + expire_config_t const &expire_config) { from_point_list(geom.outer(), expire_config); for (auto const &inner : geom.inners()) { @@ -90,8 +90,8 @@ void expire_tiles::from_polygon_boundary(geom::polygon_t const &geom, } } -void expire_tiles::from_geometry(geom::polygon_t const &geom, - expire_config_t const &expire_config) +void expire_tiles_t::from_geometry(geom::polygon_t const &geom, + expire_config_t const &expire_config) { if (expire_config.mode == expire_mode::boundary_only) { from_polygon_boundary(geom, expire_config); @@ -105,16 +105,16 @@ void expire_tiles::from_geometry(geom::polygon_t const &geom, } } -void expire_tiles::from_polygon_boundary(geom::multipolygon_t const &geom, - expire_config_t const &expire_config) +void expire_tiles_t::from_polygon_boundary(geom::multipolygon_t const &geom, + expire_config_t const &expire_config) { for (auto const &sgeom : geom) { from_polygon_boundary(sgeom, expire_config); } } -void expire_tiles::from_geometry(geom::multipolygon_t const &geom, - expire_config_t const &expire_config) +void expire_tiles_t::from_geometry(geom::multipolygon_t const &geom, + expire_config_t const &expire_config) { if (expire_config.mode == expire_mode::boundary_only) { from_polygon_boundary(geom, expire_config); @@ -130,14 +130,14 @@ void expire_tiles::from_geometry(geom::multipolygon_t const &geom, // False positive: Apparently clang-tidy can not see through the visit() // NOLINTNEXTLINE(readability-convert-member-functions-to-static) -void expire_tiles::from_geometry(geom::geometry_t const &geom, - expire_config_t const &expire_config) +void expire_tiles_t::from_geometry(geom::geometry_t const &geom, + expire_config_t const &expire_config) { geom.visit([&](auto const &g) { from_geometry(g, expire_config); }); } -void expire_tiles::from_geometry_if_3857(geom::geometry_t const &geom, - expire_config_t const &expire_config) +void expire_tiles_t::from_geometry_if_3857(geom::geometry_t const &geom, + expire_config_t const &expire_config) { if (geom.srid() == PROJ_SPHERE_MERC) { from_geometry(geom, expire_config); @@ -147,9 +147,9 @@ void expire_tiles::from_geometry_if_3857(geom::geometry_t const &geom, /* * Expire tiles that a line crosses */ -void expire_tiles::from_line_segment(geom::point_t const &a, - geom::point_t const &b, - expire_config_t const &expire_config) +void expire_tiles_t::from_line_segment(geom::point_t const &a, + geom::point_t const &b, + expire_config_t const &expire_config) { auto tilec_a = coords_to_tile(a); auto tilec_b = coords_to_tile(b); @@ -207,8 +207,8 @@ void expire_tiles::from_line_segment(geom::point_t const &a, /* * Expire tiles within a bounding box */ -int expire_tiles::from_bbox(geom::box_t const &box, - expire_config_t const &expire_config) +int expire_tiles_t::from_bbox(geom::box_t const &box, + expire_config_t const &expire_config) { if (!enabled()) { return 0; @@ -257,7 +257,7 @@ int expire_tiles::from_bbox(geom::box_t const &box, return 0; } -quadkey_list_t expire_tiles::get_tiles() +quadkey_list_t expire_tiles_t::get_tiles() { quadkey_list_t tiles; tiles.reserve(m_dirty_tiles.size()); @@ -267,7 +267,7 @@ quadkey_list_t expire_tiles::get_tiles() return tiles; } -void expire_tiles::merge_and_destroy(expire_tiles *other) +void expire_tiles_t::merge_and_destroy(expire_tiles_t *other) { if (m_map_width != other->m_map_width) { throw fmt_error("Unable to merge tile expiry sets when " @@ -285,7 +285,7 @@ void expire_tiles::merge_and_destroy(expire_tiles *other) } } -int expire_from_result(expire_tiles *expire, pg_result_t const &result, +int expire_from_result(expire_tiles_t *expire, pg_result_t const &result, expire_config_t const &expire_config) { auto const num_tuples = result.num_tuples(); diff --git a/src/expire-tiles.hpp b/src/expire-tiles.hpp index eefa3f997..ef5bf4c78 100644 --- a/src/expire-tiles.hpp +++ b/src/expire-tiles.hpp @@ -25,12 +25,13 @@ #include "pgsql.hpp" #include "tile.hpp" -class reprojection; +class reprojection_t; -class expire_tiles +class expire_tiles_t { public: - expire_tiles(uint32_t max_zoom, std::shared_ptr projection); + expire_tiles_t(uint32_t max_zoom, + std::shared_ptr projection); bool empty() const noexcept { return m_dirty_tiles.empty(); } @@ -76,7 +77,7 @@ class expire_tiles int from_bbox(geom::box_t const &box, expire_config_t const &expire_config); /** - * Get tiles as a vector of quadkeys and remove them from the expire_tiles + * Get tiles as a vector of quadkeys and remove them from the expire_tiles_t * object. */ quadkey_list_t get_tiles(); @@ -85,7 +86,7 @@ class expire_tiles * Merge the list of expired tiles in the other object into this * object, destroying the list in the other object. */ - void merge_and_destroy(expire_tiles *other); + void merge_and_destroy(expire_tiles_t *other); private: /** @@ -115,12 +116,12 @@ class expire_tiles /// The tile which has been added last to the unordered set. tile_t m_prev_tile; - std::shared_ptr m_projection; + std::shared_ptr m_projection; uint32_t m_maxzoom; int m_map_width; -}; // class expire_tiles +}; // class expire_tiles_t /** * Expire tiles based on an osm id. @@ -132,7 +133,7 @@ class expire_tiles * \param expire_config Configuration for expiry. * \return The number of tuples in the result or -1 if expire is disabled. */ -int expire_from_result(expire_tiles *expire, pg_result_t const &result, +int expire_from_result(expire_tiles_t *expire, pg_result_t const &result, expire_config_t const &expire_config); #endif // OSM2PGSQL_EXPIRE_TILES_HPP diff --git a/src/flex-table-column.cpp b/src/flex-table-column.cpp index 9fea319bc..353d55e0a 100644 --- a/src/flex-table-column.cpp +++ b/src/flex-table-column.cpp @@ -203,7 +203,7 @@ void flex_table_column_t::add_expire(expire_config_t const &config) } void flex_table_column_t::do_expire(geom::geometry_t const &geom, - std::vector *expire) const + std::vector *expire) const { assert(expire); for (auto const &expire_config : m_expires) { diff --git a/src/flex-table-column.hpp b/src/flex-table-column.hpp index d19edef5b..38f0d43d3 100644 --- a/src/flex-table-column.hpp +++ b/src/flex-table-column.hpp @@ -132,7 +132,7 @@ class flex_table_column_t } void do_expire(geom::geometry_t const &geom, - std::vector *expire) const; + std::vector *expire) const; private: std::vector m_expires; diff --git a/src/flex-table.hpp b/src/flex-table.hpp index 3616d8393..06fe48804 100644 --- a/src/flex-table.hpp +++ b/src/flex-table.hpp @@ -278,7 +278,7 @@ class table_connection_t public: table_connection_t(flex_table_t *table, std::shared_ptr const ©_thread) - : m_proj(reprojection::create_projection(table->srid())), m_table(table), + : m_proj(reprojection_t::create_projection(table->srid())), m_table(table), m_target(std::make_shared( table->schema(), table->name(), table->id_column_names(), table->build_sql_column_list())), @@ -314,7 +314,7 @@ class table_connection_t void delete_rows_with(osmium::item_type type, osmid_t id); - reprojection const &proj() const noexcept + reprojection_t const &proj() const noexcept { assert(m_proj); return *m_proj; @@ -335,7 +335,7 @@ class table_connection_t } private: - std::shared_ptr m_proj; + std::shared_ptr m_proj; flex_table_t *m_table; diff --git a/src/flex-write.cpp b/src/flex-write.cpp index 7fcf46510..562d325eb 100644 --- a/src/flex-write.cpp +++ b/src/flex-write.cpp @@ -39,7 +39,7 @@ void write_null(db_copy_mgr_t *copy_mgr, flex_table_column_t const &column) { if (column.not_null()) { - throw not_null_exception{ + throw not_null_exception_t{ fmt::format("Can not add NULL to column '{}' declared NOT NULL.", column.name()), &column}; @@ -258,7 +258,7 @@ bool is_compatible(geom::geometry_t const &geom, void flex_write_column(lua_State *lua_state, db_copy_mgr_t *copy_mgr, flex_table_column_t const &column, - std::vector *expire) + std::vector *expire) { lua_getfield(lua_state, -1, column.name().c_str()); int const ltype = lua_type(lua_state, -1); diff --git a/src/flex-write.hpp b/src/flex-write.hpp index e726310fa..8c23d8b5e 100644 --- a/src/flex-write.hpp +++ b/src/flex-write.hpp @@ -18,12 +18,12 @@ #include #include -class expire_tiles; +class expire_tiles_t; -class not_null_exception : public std::runtime_error +class not_null_exception_t : public std::runtime_error { public: - not_null_exception(std::string const &message, + not_null_exception_t(std::string const &message, flex_table_column_t const *column) : std::runtime_error(message), m_column(column) {} @@ -32,11 +32,11 @@ class not_null_exception : public std::runtime_error private: flex_table_column_t const *m_column; -}; // class not_null_exception +}; // class not_null_exception_t void flex_write_column(lua_State *lua_state, db_copy_mgr_t *copy_mgr, flex_table_column_t const &column, - std::vector *expire); + std::vector *expire); #endif // OSM2PGSQL_FLEX_WRITE_HPP diff --git a/src/gen/gen-rivers.cpp b/src/gen/gen-rivers.cpp index 111291738..54314ad5b 100644 --- a/src/gen/gen-rivers.cpp +++ b/src/gen/gen-rivers.cpp @@ -345,7 +345,8 @@ SELECT "{id_column}", "{width_column}", "{name_column}", "{geom_column}" geom::geometry_t const geom{std::move(edge.points), PROJ_SPHERE_MERC}; auto const wkb = geom_to_ewkb(geom); connection().exec_prepared("ins", edge.id, edge.width, - get_name(names, edge.id), binary_param(wkb)); + get_name(names, edge.id), + binary_param_t(wkb)); } connection().exec("COMMIT"); timer(m_timer_write).stop(); diff --git a/src/gen/gen-tile-raster.cpp b/src/gen/gen-tile-raster.cpp index c0720ad63..b22e929e5 100644 --- a/src/gen/gen-tile-raster.cpp +++ b/src/gen/gen-tile-raster.cpp @@ -237,7 +237,7 @@ void gen_tile_raster_union_t::process(tile_t const &tile) timer(m_timer_write).start(); for (auto const &geom : geometries) { auto const wkb = geom_to_ewkb(geom); - connection().exec_prepared("insert_geoms", binary_param{wkb}, + connection().exec_prepared("insert_geoms", binary_param_t{wkb}, tile.x(), tile.y(), param); } timer(m_timer_write).stop(); diff --git a/src/gen/osm2pgsql-gen.cpp b/src/gen/osm2pgsql-gen.cpp index 6faf1912a..e5fb2541b 100644 --- a/src/gen/osm2pgsql-gen.cpp +++ b/src/gen/osm2pgsql-gen.cpp @@ -224,7 +224,7 @@ void run_tile_gen(std::atomic_flag *error_flag, std::mutex *mut, unsigned int n) { try { - logger::init_thread(n); + logger_t::init_thread(n); log_debug("Started generalizer thread for '{}'.", master_generalizer->strategy()); diff --git a/src/geom-functions.cpp b/src/geom-functions.cpp index f59cbf740..3ea2e64c2 100644 --- a/src/geom-functions.cpp +++ b/src/geom-functions.cpp @@ -134,7 +134,7 @@ class transform_visitor_t { public: explicit transform_visitor_t(geometry_t *output, - reprojection const *reprojection) + reprojection_t const *reprojection) : m_output(output), m_reprojection(reprojection) {} @@ -220,14 +220,14 @@ class transform_visitor_t } geometry_t *m_output; - reprojection const *m_reprojection; + reprojection_t const *m_reprojection; }; // class transform_visitor_t } // anonymous namespace void transform(geometry_t *output, geometry_t const &input, - reprojection const &reprojection) + reprojection_t const &reprojection) { assert(input.srid() == PROJ_LATLONG); @@ -236,7 +236,8 @@ void transform(geometry_t *output, geometry_t const &input, input.visit(transform_visitor_t{output, &reprojection}); } -geometry_t transform(geometry_t const &input, reprojection const &reprojection) +geometry_t transform(geometry_t const &input, + reprojection_t const &reprojection) { geometry_t output; transform(&output, input, reprojection); diff --git a/src/geom-functions.hpp b/src/geom-functions.hpp index 56ace587d..08e26b348 100644 --- a/src/geom-functions.hpp +++ b/src/geom-functions.hpp @@ -100,7 +100,7 @@ geometry_t geometry_n(geometry_t const &input, std::size_t n); * \pre \code geom.srid() == 4326 \endcode */ void transform(geometry_t *output, geometry_t const &input, - reprojection const &reprojection); + reprojection_t const &reprojection); /** * Transform a geometry in 4326 into some other projection. @@ -111,7 +111,8 @@ void transform(geometry_t *output, geometry_t const &input, * * \pre \code geom.srid() == 4326 \endcode */ -geometry_t transform(geometry_t const &input, reprojection const &reprojection); +geometry_t transform(geometry_t const &input, + reprojection_t const &reprojection); /** * Returns a modified geometry having no segment longer than the given diff --git a/src/logging.cpp b/src/logging.cpp index d30c1c5be..9d58b5035 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -16,15 +16,16 @@ namespace { thread_local unsigned int this_thread_num = 0; /// Global logger singleton -logger the_logger{}; +logger_t the_logger{}; } // anonymous namespace /// Access the global logger singleton -logger &get_logger() noexcept { return the_logger; } +logger_t &get_logger() noexcept { return the_logger; } -void logger::generate_common_prefix(std::string *str, fmt::text_style const &ts, - char const *prefix) const +void logger_t::generate_common_prefix(std::string *str, + fmt::text_style const &ts, + char const *prefix) const { *str += fmt::format("{:%Y-%m-%d %H:%M:%S} ", fmt::localtime(std::time(nullptr))); @@ -38,7 +39,7 @@ void logger::generate_common_prefix(std::string *str, fmt::text_style const &ts, } } -void logger::init_thread(unsigned int num) +void logger_t::init_thread(unsigned int num) { // Store thread number in thread local variable this_thread_num = num; diff --git a/src/logging.hpp b/src/logging.hpp index f1542b67f..9b116685e 100644 --- a/src/logging.hpp +++ b/src/logging.hpp @@ -34,7 +34,7 @@ enum class log_level : uint8_t * This class contains the logging state and code. It is intended as a * singleton class. Its use is mostly wrapped in the log_*() free functions. */ -class logger +class logger_t { public: template @@ -107,9 +107,9 @@ class logger bool m_use_color = osmium::util::isatty(2); #endif -}; // class logger +}; // class logger_t -logger &get_logger() noexcept; +logger_t &get_logger() noexcept; template void log_debug(fmt::format_string format_str, TArgs &&...args) diff --git a/src/middle-pgsql.cpp b/src/middle-pgsql.cpp index b1cbbb0b5..0a7204b55 100644 --- a/src/middle-pgsql.cpp +++ b/src/middle-pgsql.cpp @@ -73,8 +73,8 @@ void load_id_list(pg_conn_t const &db_connection, std::string const &table, } // anonymous namespace -middle_pgsql_t::table_desc::table_desc(options_t const &options, - std::string_view name) +middle_pgsql_t::table_desc_t::table_desc_t(options_t const &options, + std::string_view name) : m_copy_target(std::make_shared( options.middle_dbschema, fmt::format("{}_{}", options.prefix, name), "id")) @@ -99,7 +99,7 @@ void middle_query_pgsql_t::prepare(std::string const &stmt, m_db_connection.prepare(stmt, fmt::runtime(sql_cmd)); } -void middle_pgsql_t::table_desc::drop_table( +void middle_pgsql_t::table_desc_t::drop_table( pg_conn_t const &db_connection) const { util::timer_t timer; @@ -110,7 +110,7 @@ void middle_pgsql_t::table_desc::drop_table( util::human_readable_duration(timer.stop())); } -void middle_pgsql_t::table_desc::init_max_id(pg_conn_t const &db_connection) +void middle_pgsql_t::table_desc_t::init_max_id(pg_conn_t const &db_connection) { auto const qual_name = qualified_name(schema(), name()); auto const res = db_connection.exec("SELECT max(id) FROM {}", qual_name); @@ -987,7 +987,7 @@ void middle_pgsql_t::after_relations() middle_query_pgsql_t::middle_query_pgsql_t( connection_params_t const &connection_params, std::shared_ptr cache, - std::shared_ptr persistent_cache, + std::shared_ptr persistent_cache, middle_pgsql_options const &options) : m_db_connection(connection_params, "middle.query"), m_cache(std::move(cache)), m_persistent_cache(std::move(persistent_cache)), m_store_options(options) @@ -1249,7 +1249,7 @@ middle_pgsql_t::middle_pgsql_t(std::shared_ptr thread_pool, m_store_options.untagged_nodes = true; } else { m_store_options.use_flat_node_file = true; - m_persistent_cache = std::make_shared( + m_persistent_cache = std::make_shared( options->flat_node_file, !options->append, options->droptemp); } @@ -1257,9 +1257,9 @@ middle_pgsql_t::middle_pgsql_t(std::shared_ptr thread_pool, init_params(&m_params, *options); - m_tables.nodes() = table_desc{*options, "nodes"}; - m_tables.ways() = table_desc{*options, "ways"}; - m_tables.relations() = table_desc{*options, "rels"}; + m_tables.nodes() = table_desc_t{*options, "nodes"}; + m_tables.ways() = table_desc_t{*options, "ways"}; + m_tables.relations() = table_desc_t{*options, "rels"}; } void middle_pgsql_t::set_requirements( diff --git a/src/middle-pgsql.hpp b/src/middle-pgsql.hpp index 2ef73c887..b8ff8e863 100644 --- a/src/middle-pgsql.hpp +++ b/src/middle-pgsql.hpp @@ -30,7 +30,7 @@ #include "pgsql.hpp" class node_locations_t; -class node_persistent_cache; +class node_persistent_cache_t; struct middle_pgsql_options { @@ -53,7 +53,7 @@ class middle_query_pgsql_t : public middle_query_t middle_query_pgsql_t( connection_params_t const &connection_params, std::shared_ptr cache, - std::shared_ptr persistent_cache, + std::shared_ptr persistent_cache, middle_pgsql_options const &options); osmium::Location get_node_location(osmid_t id) const override; @@ -81,7 +81,7 @@ class middle_query_pgsql_t : public middle_query_t pg_conn_t m_db_connection; std::shared_ptr m_cache; - std::shared_ptr m_persistent_cache; + std::shared_ptr m_persistent_cache; middle_pgsql_options m_store_options; }; @@ -110,11 +110,11 @@ struct middle_pgsql_t : public middle_t void get_way_parents(idlist_t const &changed_ways, idlist_t *parent_relations) const override; - class table_desc + class table_desc_t { public: - table_desc() = default; - table_desc(options_t const &options, std::string_view name); + table_desc_t() = default; + table_desc_t(options_t const &options, std::string_view name); std::string const &schema() const noexcept { @@ -180,12 +180,12 @@ struct middle_pgsql_t : public middle_t void build_relation_member_indexes(); std::map m_users; - osmium::nwr_array m_tables; + osmium::nwr_array m_tables; options_t const *m_options; std::shared_ptr m_cache; - std::shared_ptr m_persistent_cache; + std::shared_ptr m_persistent_cache; pg_conn_t m_db_connection; diff --git a/src/middle-ram.cpp b/src/middle-ram.cpp index 54c87bc23..de1af0107 100644 --- a/src/middle-ram.cpp +++ b/src/middle-ram.cpp @@ -79,7 +79,7 @@ middle_ram_t::middle_ram_t(std::shared_ptr thread_pool, } if (!options->flat_node_file.empty()) { - m_persistent_cache = std::make_shared( + m_persistent_cache = std::make_shared( options->flat_node_file, !options->append, options->droptemp); } } diff --git a/src/middle-ram.hpp b/src/middle-ram.hpp index 488eb60e5..e7355f836 100644 --- a/src/middle-ram.hpp +++ b/src/middle-ram.hpp @@ -25,7 +25,7 @@ #include #include -class node_persistent_cache; +class node_persistent_cache_t; class thread_pool_t; /** @@ -130,7 +130,7 @@ class middle_ram_t : public middle_t, public middle_query_t middle_ram_options m_store_options; /// File cache - std::shared_ptr m_persistent_cache; + std::shared_ptr m_persistent_cache; }; // class middle_ram_t diff --git a/src/node-persistent-cache.cpp b/src/node-persistent-cache.cpp index 5b918b54e..9b1b3a824 100644 --- a/src/node-persistent-cache.cpp +++ b/src/node-persistent-cache.cpp @@ -17,19 +17,20 @@ #include #include -void node_persistent_cache::set(osmid_t id, osmium::Location location) +void node_persistent_cache_t::set(osmid_t id, osmium::Location location) { m_index->set(static_cast(id), location); } -osmium::Location node_persistent_cache::get(osmid_t id) const noexcept +osmium::Location node_persistent_cache_t::get(osmid_t id) const noexcept { return m_index->get_noexcept( static_cast(id)); } -node_persistent_cache::node_persistent_cache(std::string file_name, - bool create_file, bool remove_file) +node_persistent_cache_t::node_persistent_cache_t(std::string file_name, + bool create_file, + bool remove_file) : m_file_name(std::move(file_name)), m_remove_file(remove_file) { assert(!m_file_name.empty()); @@ -65,7 +66,7 @@ node_persistent_cache::node_persistent_cache(std::string file_name, } } -node_persistent_cache::~node_persistent_cache() noexcept +node_persistent_cache_t::~node_persistent_cache_t() noexcept { m_index.reset(); if (m_fd >= 0) { diff --git a/src/node-persistent-cache.hpp b/src/node-persistent-cache.hpp index 936771723..4ebe25ebf 100644 --- a/src/node-persistent-cache.hpp +++ b/src/node-persistent-cache.hpp @@ -18,18 +18,19 @@ #include "osmtypes.hpp" -class node_persistent_cache +class node_persistent_cache_t { public: - node_persistent_cache(std::string file_name, bool create_file, - bool remove_file); - ~node_persistent_cache() noexcept; + node_persistent_cache_t(std::string file_name, bool create_file, + bool remove_file); + ~node_persistent_cache_t() noexcept; - node_persistent_cache(node_persistent_cache const &) = delete; - node_persistent_cache &operator=(node_persistent_cache const &) = delete; + node_persistent_cache_t(node_persistent_cache_t const &) = delete; + node_persistent_cache_t & + operator=(node_persistent_cache_t const &) = delete; - node_persistent_cache(node_persistent_cache &&) = delete; - node_persistent_cache &operator=(node_persistent_cache &&) = delete; + node_persistent_cache_t(node_persistent_cache_t &&) = delete; + node_persistent_cache_t &operator=(node_persistent_cache_t &&) = delete; void set(osmid_t id, osmium::Location location); osmium::Location get(osmid_t id) const noexcept; @@ -49,6 +50,6 @@ class node_persistent_cache int m_fd = -1; std::unique_ptr m_index; bool m_remove_file; -}; +}; // class node_persistent_cache_t #endif // OSM2PGSQL_NODE_PERSISTENT_CACHE_HPP diff --git a/src/options.hpp b/src/options.hpp index f81d3e1f3..f15139be4 100644 --- a/src/options.hpp +++ b/src/options.hpp @@ -19,7 +19,7 @@ #include #include -class reprojection; +class reprojection_t; enum class command_t : uint8_t { @@ -93,7 +93,7 @@ struct options_t std::vector input_files; - std::shared_ptr projection; ///< SRS of projection + std::shared_ptr projection; ///< SRS of projection /// Max bbox size in either dimension to expire full bbox for a polygon double expire_tiles_max_bbox = 20000.0; diff --git a/src/output-flex.cpp b/src/output-flex.cpp index f29ff5f15..4da3b59f6 100644 --- a/src/output-flex.cpp +++ b/src/output-flex.cpp @@ -778,7 +778,7 @@ int output_flex_t::table_insert() } } table_connection.increment_insert_counter(); - } catch (not_null_exception const &e) { + } catch (not_null_exception_t const &e) { copy_mgr->rollback_line(); lua_pushboolean(lua_state(), false); lua_pushliteral(lua_state(), "null value in not null column."); @@ -1207,7 +1207,7 @@ output_flex_t::output_flex_t(output_flex_t const *other, for (auto &expire_output : *m_expire_outputs) { m_expire_tiles.emplace_back( expire_output.maxzoom(), - reprojection::create_projection(PROJ_SPHERE_MERC)); + reprojection_t::create_projection(PROJ_SPHERE_MERC)); } } @@ -1273,7 +1273,7 @@ output_flex_t::output_flex_t(std::shared_ptr const &mid, for (auto const &expire_output : *m_expire_outputs) { m_expire_tiles.emplace_back( expire_output.maxzoom(), - reprojection::create_projection(PROJ_SPHERE_MERC)); + reprojection_t::create_projection(PROJ_SPHERE_MERC)); } create_expire_tables(*m_expire_outputs, get_options()->connection_params); diff --git a/src/output-flex.hpp b/src/output-flex.hpp index 5af451c3a..235b579e6 100644 --- a/src/output-flex.hpp +++ b/src/output-flex.hpp @@ -291,7 +291,7 @@ class output_flex_t : public output_t // accessed while protected using the lua_mutex. std::shared_ptr m_lua_state; - std::vector m_expire_tiles; + std::vector m_expire_tiles; way_cache_t m_way_cache; relation_cache_t m_relation_cache; diff --git a/src/output-pgsql.cpp b/src/output-pgsql.cpp index e0756bff0..874d5f30b 100644 --- a/src/output-pgsql.cpp +++ b/src/output-pgsql.cpp @@ -52,7 +52,7 @@ double calculate_area(bool reproject_area, geom::geometry_t const &geom4326, geom::geometry_t const &projected_geom) { static thread_local auto const proj3857 = - reprojection::create_projection(PROJ_SPHERE_MERC); + reprojection_t::create_projection(PROJ_SPHERE_MERC); if (reproject_area) { auto const ogeom = geom::transform(geom4326, *proj3857); @@ -105,7 +105,7 @@ void output_pgsql_t::pgsql_out_way(osmium::Way const &way, taglist_t *tags, if (m_enable_way_area) { double const area = calculate_area( get_options()->reproject_area, geom, projected_geom); - util::double_to_buffer const tmp{area}; + util::double_to_buffer_t const tmp{area}; tags->set("way_area", tmp.c_str()); } m_tables[t_poly]->write_row(way.id(), *tags, wkb); @@ -316,7 +316,7 @@ void output_pgsql_t::pgsql_process_relation(osmium::Relation const &rel) if (m_enable_way_area) { double const area = calculate_area( get_options()->reproject_area, sgeom, projected_geom); - util::double_to_buffer const tmp{area}; + util::double_to_buffer_t const tmp{area}; outtags.set("way_area", tmp.c_str()); } m_tables[t_poly]->write_row(-rel.id(), outtags, wkb); @@ -469,7 +469,7 @@ output_pgsql_t::output_pgsql_t(std::shared_ptr const &mid, log_debug("Using projection SRS {} ({})", options.projection->target_srs(), options.projection->target_desc()); - export_list exlist; + export_list_t exlist; m_enable_way_area = read_style_file(options.style, &exlist); diff --git a/src/output-pgsql.hpp b/src/output-pgsql.hpp index 39cde4c5d..f35aac778 100644 --- a/src/output-pgsql.hpp +++ b/src/output-pgsql.hpp @@ -106,9 +106,9 @@ class output_pgsql_t : public output_t std::array, t_MAX> m_tables; - std::shared_ptr m_proj; + std::shared_ptr m_proj; expire_config_t m_expire_config; - expire_tiles m_expire; + expire_tiles_t m_expire; osmium::memory::Buffer m_buffer; osmium::memory::Buffer m_rels_buffer; diff --git a/src/pgsql.hpp b/src/pgsql.hpp index 0638a5532..5a8e8c677 100644 --- a/src/pgsql.hpp +++ b/src/pgsql.hpp @@ -138,12 +138,12 @@ class pg_result_t * Wrapper class for query parameters that should be sent to the database * as binary parameter. */ -class binary_param : public std::string_view +class binary_param_t : public std::string_view { public: using std::string_view::string_view; - explicit binary_param(std::string const &str) + explicit binary_param_t(std::string const &str) : std::string_view(str.data(), str.size()) {} }; @@ -272,7 +272,7 @@ class pg_conn_t { if constexpr (std::is_same_v || std::is_same_v || - std::is_same_v) { + std::is_same_v) { return 0; } return 1; @@ -293,7 +293,7 @@ class pg_conn_t } else if constexpr (std::is_same_v) { *length = static_cast(param.size()); return param.c_str(); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { *length = static_cast(param.size()); *bin = 1; return param.data(); diff --git a/src/reprojection-generic-none.cpp b/src/reprojection-generic-none.cpp index 690363a93..803e8c9de 100644 --- a/src/reprojection-generic-none.cpp +++ b/src/reprojection-generic-none.cpp @@ -11,7 +11,7 @@ #include "reprojection.hpp" -std::shared_ptr reprojection::make_generic_projection(int) +std::shared_ptr reprojection_t::make_generic_projection(int) { throw std::runtime_error{"No generic projection library available."}; } diff --git a/src/reprojection-generic-proj6.cpp b/src/reprojection-generic-proj6.cpp index 6efbf56ce..febfbe1a3 100644 --- a/src/reprojection-generic-proj6.cpp +++ b/src/reprojection-generic-proj6.cpp @@ -11,7 +11,7 @@ namespace { /** * Generic projection using proj library (version 6 and above). */ -class generic_reprojection_t : public reprojection +class generic_reprojection_t : public reprojection_t { public: explicit generic_reprojection_t(int srs) @@ -110,7 +110,7 @@ class generic_reprojection_t : public reprojection } // anonymous namespace -std::shared_ptr reprojection::make_generic_projection(int srs) +std::shared_ptr reprojection_t::make_generic_projection(int srs) { return std::make_shared(srs); } diff --git a/src/reprojection.cpp b/src/reprojection.cpp index d7229b748..d2b512f64 100644 --- a/src/reprojection.cpp +++ b/src/reprojection.cpp @@ -28,7 +28,7 @@ geom::point_t lonlat2merc(geom::point_t point) return {c.x, c.y}; } -class latlon_reprojection_t : public reprojection +class latlon_reprojection_t : public reprojection_t { public: geom::point_t reproject(geom::point_t point) const noexcept override @@ -46,7 +46,7 @@ class latlon_reprojection_t : public reprojection char const *target_desc() const noexcept override { return "Latlong"; } }; -class merc_reprojection_t : public reprojection +class merc_reprojection_t : public reprojection_t { public: geom::point_t reproject(geom::point_t coords) const noexcept override @@ -69,7 +69,7 @@ class merc_reprojection_t : public reprojection } // anonymous namespace -std::shared_ptr reprojection::create_projection(int srs) +std::shared_ptr reprojection_t::create_projection(int srs) { switch (srs) { case PROJ_LATLONG: @@ -87,11 +87,11 @@ std::shared_ptr reprojection::create_projection(int srs) return make_generic_projection(srs); } -reprojection const &get_projection(int srs) +reprojection_t const &get_projection(int srs) { // In almost all cases there will be only one or two projections used, so // storing them in a vector and doing linear search is totally fine. - static std::vector> projections; + static std::vector> projections; for (auto const &p : projections) { if (p->target_srs() == srs) { @@ -99,5 +99,5 @@ reprojection const &get_projection(int srs) } } - return *projections.emplace_back(reprojection::create_projection(srs)); + return *projections.emplace_back(reprojection_t::create_projection(srs)); } diff --git a/src/reprojection.hpp b/src/reprojection.hpp index e1de8c90f..8893eef8a 100644 --- a/src/reprojection.hpp +++ b/src/reprojection.hpp @@ -28,18 +28,18 @@ * the coordinates into Spherical Mercator coordinates used in common web * tiles. */ -class reprojection +class reprojection_t { public: - reprojection() = default; + reprojection_t() = default; - reprojection(reprojection const &) = delete; - reprojection &operator=(reprojection const &) = delete; + reprojection_t(reprojection_t const &) = delete; + reprojection_t &operator=(reprojection_t const &) = delete; - reprojection(reprojection &&) = delete; - reprojection &operator=(reprojection &&) = delete; + reprojection_t(reprojection_t &&) = delete; + reprojection_t &operator=(reprojection_t &&) = delete; - virtual ~reprojection() = default; + virtual ~reprojection_t() = default; /** * Reproject from the source projection lat/lon (EPSG:4326) @@ -65,10 +65,10 @@ class reprojection * The target projection (used in the PostGIS tables). * Controlled by the -l/-m/-E options. */ - static std::shared_ptr create_projection(int srs); + static std::shared_ptr create_projection(int srs); private: - static std::shared_ptr make_generic_projection(int srs); + static std::shared_ptr make_generic_projection(int srs); }; std::string get_proj_version(); @@ -77,6 +77,6 @@ std::string get_proj_version(); * Get projection object for given srs. Objects are only created once and * then cached. */ -reprojection const &get_projection(int srs); +reprojection_t const &get_projection(int srs); #endif // OSM2PGSQL_REPROJECTION_HPP diff --git a/src/taginfo-impl.hpp b/src/taginfo-impl.hpp index 484e5df8a..a6fdea2fb 100644 --- a/src/taginfo-impl.hpp +++ b/src/taginfo-impl.hpp @@ -53,7 +53,7 @@ struct taginfo }; /* list of exported tags */ -class export_list +class export_list_t { public: void add(osmium::item_type type, taginfo const &info); @@ -76,6 +76,6 @@ unsigned parse_tag_flags(std::string const &flags, int lineno); * Returns `true` if the 'way_area' column should (implicitly) exist, or * `false` if it should be suppressed. */ -bool read_style_file(std::string const &filename, export_list *exlist); +bool read_style_file(std::string const &filename, export_list_t *exlist); #endif // OSM2PGSQL_TAGINFO_IMPL_HPP diff --git a/src/taginfo.cpp b/src/taginfo.cpp index 78d5c2bda..6b98323a9 100644 --- a/src/taginfo.cpp +++ b/src/taginfo.cpp @@ -19,18 +19,18 @@ #include -void export_list::add(osmium::item_type type, taginfo const &info) +void export_list_t::add(osmium::item_type type, taginfo const &info) { m_export_list(type).push_back(info); } std::vector const & -export_list::get(osmium::item_type type) const noexcept +export_list_t::get(osmium::item_type type) const noexcept { return m_export_list(type); } -columns_t export_list::normal_columns(osmium::item_type type) const +columns_t export_list_t::normal_columns(osmium::item_type type) const { columns_t columns; @@ -89,7 +89,7 @@ unsigned get_tag_type(std::string const &tag) // NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) // This is legacy code which will be removed anyway. -bool read_style_file(std::string const &filename, export_list *exlist) +bool read_style_file(std::string const &filename, export_list_t *exlist) { bool enable_way_area = true; diff --git a/src/tagtransform-c.cpp b/src/tagtransform-c.cpp index dd98a1014..7adb5564a 100644 --- a/src/tagtransform-c.cpp +++ b/src/tagtransform-c.cpp @@ -96,7 +96,8 @@ bool starts_with(char const *input, std::string const &test) noexcept } // anonymous namespace -c_tagtransform_t::c_tagtransform_t(options_t const *options, export_list exlist) +c_tagtransform_t::c_tagtransform_t(options_t const *options, + export_list_t exlist) : m_options(options), m_export_list(std::move(exlist)) {} diff --git a/src/tagtransform-c.hpp b/src/tagtransform-c.hpp index 190260753..235ff4902 100644 --- a/src/tagtransform-c.hpp +++ b/src/tagtransform-c.hpp @@ -16,7 +16,7 @@ class c_tagtransform_t : public tagtransform_t { public: - c_tagtransform_t(options_t const *options, export_list exlist); + c_tagtransform_t(options_t const *options, export_list_t exlist); std::unique_ptr clone() const override; @@ -34,7 +34,7 @@ class c_tagtransform_t : public tagtransform_t bool *filter, unsigned int *flags); options_t const *m_options; - export_list m_export_list; + export_list_t m_export_list; }; #endif // OSM2PGSQL_TAGTRANSFORM_C_HPP diff --git a/src/tagtransform.cpp b/src/tagtransform.cpp index 18428bccf..d5cd1adbc 100644 --- a/src/tagtransform.cpp +++ b/src/tagtransform.cpp @@ -19,7 +19,7 @@ std::unique_ptr tagtransform_t::make_tagtransform(options_t const *options, - export_list const &exlist) + export_list_t const &exlist) { if (!options->tag_transform_script.empty()) { log_debug("Using lua based tag transformations with script {}", diff --git a/src/tagtransform.hpp b/src/tagtransform.hpp index b431848fc..e74c9e5d7 100644 --- a/src/tagtransform.hpp +++ b/src/tagtransform.hpp @@ -16,14 +16,14 @@ #include "osmtypes.hpp" -class export_list; +class export_list_t; struct options_t; class tagtransform_t { public: static std::unique_ptr - make_tagtransform(options_t const *options, export_list const &exlist); + make_tagtransform(options_t const *options, export_list_t const &exlist); tagtransform_t() noexcept = default; diff --git a/src/thread-pool.cpp b/src/thread-pool.cpp index aa8a430e9..d4bd67750 100644 --- a/src/thread-pool.cpp +++ b/src/thread-pool.cpp @@ -50,7 +50,7 @@ void thread_pool_t::shutdown_all_workers() void thread_pool_t::worker_thread(unsigned int thread_num) { - logger::init_thread(thread_num + 1); + logger_t::init_thread(thread_num + 1); while (true) { osmium::thread::function_wrapper task; diff --git a/src/thread-pool.hpp b/src/thread-pool.hpp index 0b66f115e..212d33b68 100644 --- a/src/thread-pool.hpp +++ b/src/thread-pool.hpp @@ -124,23 +124,24 @@ class thread_pool_t * This class makes sure all pool threads will be joined when * the pool is destructed. */ - class thread_joiner + class thread_joiner_t { std::vector *m_threads; public: - explicit thread_joiner(std::vector *threads) + explicit thread_joiner_t(std::vector *threads) : m_threads(threads) - {} + { + } - thread_joiner(thread_joiner const &) = delete; - thread_joiner &operator=(thread_joiner const &) = delete; + thread_joiner_t(thread_joiner_t const &) = delete; + thread_joiner_t &operator=(thread_joiner_t const &) = delete; - thread_joiner(thread_joiner &&) = delete; - thread_joiner &operator=(thread_joiner &&) = delete; + thread_joiner_t(thread_joiner_t &&) = delete; + thread_joiner_t &operator=(thread_joiner_t &&) = delete; - ~thread_joiner() + ~thread_joiner_t() { for (auto &thread : *m_threads) { if (thread.joinable()) { @@ -149,13 +150,13 @@ class thread_pool_t } } - }; // class thread_joiner + }; // class thread_joiner_t static constexpr std::size_t MAX_QUEUE_SIZE = 32; osmium::thread::Queue m_work_queue; std::vector m_threads; - thread_joiner m_joiner; + thread_joiner_t m_joiner; /** * This is the function run in each worker thread. It will loop over diff --git a/src/util.hpp b/src/util.hpp index 3ea12f6af..67df33019 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -25,12 +25,12 @@ namespace util { -class double_to_buffer +class double_to_buffer_t { static constexpr std::size_t BUFFER_SIZE = 32; public: - explicit double_to_buffer(double value) + explicit double_to_buffer_t(double value) { auto const result = fmt::format_to_n(m_buffer.begin(), BUFFER_SIZE - 1, "{:g}", value); diff --git a/tests/common-options.hpp b/tests/common-options.hpp index 58adb8ea2..4eefe4800 100644 --- a/tests/common-options.hpp +++ b/tests/common-options.hpp @@ -28,7 +28,7 @@ class opt_t m_opt.num_procs = 1; m_opt.cache = 2; m_opt.append = false; - m_opt.projection = reprojection::create_projection(PROJ_SPHERE_MERC); + m_opt.projection = reprojection_t::create_projection(PROJ_SPHERE_MERC); m_opt.middle_dbschema = "public"; m_opt.output_dbschema = "public"; } @@ -79,7 +79,7 @@ class opt_t opt_t &srs(int srs) { - m_opt.projection = reprojection::create_projection(srs); + m_opt.projection = reprojection_t::create_projection(srs); return *this; } diff --git a/tests/test-expire-from-geometry.cpp b/tests/test-expire-from-geometry.cpp index 90623ae68..abe4a2ca3 100644 --- a/tests/test-expire-from-geometry.cpp +++ b/tests/test-expire-from-geometry.cpp @@ -20,8 +20,8 @@ namespace { -std::shared_ptr defproj{ - reprojection::create_projection(PROJ_SPHERE_MERC)}; +std::shared_ptr defproj{ + reprojection_t::create_projection(PROJ_SPHERE_MERC)}; // We are using zoom level 12 here, because at that level a tile is about // 10,000 units wide/high which gives us easy numbers to work with. @@ -32,7 +32,7 @@ constexpr uint32_t ZOOM = 12; TEST_CASE("expire null geometry does nothing", "[NoDB]") { expire_config_t const expire_config; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; SECTION("geom") { @@ -53,7 +53,7 @@ TEST_CASE("expire null geometry does nothing", "[NoDB]") TEST_CASE("expire point at tile boundary", "[NoDB]") { expire_config_t const expire_config; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; geom::point_t const pt{0.0, 0.0}; @@ -83,7 +83,7 @@ TEST_CASE("expire point at tile boundary", "[NoDB]") TEST_CASE("expire point away from tile boundary", "[NoDB]") { expire_config_t const expire_config; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; geom::point_t const pt{5000.0, 5000.0}; @@ -110,7 +110,7 @@ TEST_CASE("expire point away from tile boundary", "[NoDB]") TEST_CASE("expire linestring away from tile boundary", "[NoDB]") { expire_config_t const expire_config; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; SECTION("line") { @@ -141,7 +141,7 @@ TEST_CASE("expire linestring away from tile boundary", "[NoDB]") TEST_CASE("expire linestring crossing tile boundary", "[NoDB]") { expire_config_t const expire_config; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; SECTION("line") { @@ -173,7 +173,7 @@ TEST_CASE("expire linestring crossing tile boundary", "[NoDB]") TEST_CASE("expire small polygon", "[NoDB]") { expire_config_t const expire_config; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; SECTION("polygon") { @@ -218,7 +218,7 @@ TEST_CASE("expire large polygon as bbox", "[NoDB]") expire_config_t expire_config; expire_config.mode = expire_mode::hybrid; expire_config.full_area_limit = 40000; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; SECTION("polygon") { @@ -273,7 +273,7 @@ TEST_CASE("expire large polygon as boundary", "[NoDB]") expire_config_t expire_config; expire_config.mode = expire_mode::hybrid; expire_config.full_area_limit = 10000; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; SECTION("polygon") { @@ -335,7 +335,7 @@ TEST_CASE("expire large polygon as boundary", "[NoDB]") TEST_CASE("expire multipoint geometry", "[NoDB]") { expire_config_t const expire_config; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; geom::point_t const p1{0.0, 0.0}; geom::point_t const p2{15000.0, 15000.0}; @@ -379,7 +379,7 @@ TEST_CASE("expire multipoint geometry", "[NoDB]") TEST_CASE("expire multilinestring geometry", "[NoDB]") { expire_config_t const expire_config; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; geom::linestring_t l1{{2000.0, 2000.0}, {3000.0, 3000.0}}; geom::linestring_t l2{{15000.0, 15000.0}, {25000.0, 15000.0}}; @@ -407,7 +407,7 @@ TEST_CASE("expire multipolygon geometry", "[NoDB]") expire_config_t expire_config; expire_config.mode = expire_mode::hybrid; expire_config.full_area_limit = 10000; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; geom::polygon_t p1{{{2000.0, 2000.0}, {2000.0, 3000.0}, @@ -460,7 +460,7 @@ TEST_CASE("expire multipolygon geometry", "[NoDB]") TEST_CASE("expire geometry collection", "[NoDB]") { expire_config_t const expire_config; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; geom::collection_t collection; collection.add_geometry(geom::geometry_t{geom::point_t{0.0, 0.0}}); @@ -483,7 +483,7 @@ TEST_CASE("expire geometry collection", "[NoDB]") TEST_CASE("expire works if in 3857", "[NoDB]") { expire_config_t const expire_config; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; geom::geometry_t geom{geom::point_t{0.0, 0.0}}; geom.set_srid(PROJ_SPHERE_MERC); @@ -496,7 +496,7 @@ TEST_CASE("expire works if in 3857", "[NoDB]") TEST_CASE("expire doesn't do anything if not in 3857", "[NoDB]") { expire_config_t const expire_config; - expire_tiles et{ZOOM, defproj}; + expire_tiles_t et{ZOOM, defproj}; geom::geometry_t geom{geom::point_t{0.0, 0.0}}; geom.set_srid(1234); diff --git a/tests/test-expire-tiles.cpp b/tests/test-expire-tiles.cpp index 72717ec87..844bc49eb 100644 --- a/tests/test-expire-tiles.cpp +++ b/tests/test-expire-tiles.cpp @@ -19,8 +19,8 @@ namespace { -std::shared_ptr defproj{ - reprojection::create_projection(PROJ_SPHERE_MERC)}; +std::shared_ptr defproj{ + reprojection_t::create_projection(PROJ_SPHERE_MERC)}; std::set generate_random(uint32_t zoom, size_t count) { @@ -41,7 +41,7 @@ std::set generate_random(uint32_t zoom, size_t count) return set; } -void expire_centroids(expire_tiles *et, std::set const &tiles) +void expire_centroids(expire_tiles_t *et, std::set const &tiles) { for (auto const &t : tiles) { auto const p = t.center(); @@ -56,7 +56,7 @@ void check_quadkey(quadkey_t quadkey_expected, tile_t const &tile) noexcept CHECK(t == tile); } -std::vector get_tiles_ordered(expire_tiles *et, uint32_t minzoom, +std::vector get_tiles_ordered(expire_tiles_t *et, uint32_t minzoom, uint32_t maxzoom) { std::vector tiles; @@ -67,7 +67,7 @@ std::vector get_tiles_ordered(expire_tiles *et, uint32_t minzoom, return tiles; } -std::set get_tiles_unordered(expire_tiles *et, uint32_t zoom) +std::set get_tiles_unordered(expire_tiles_t *et, uint32_t zoom) { std::set tiles; @@ -91,7 +91,7 @@ TEST_CASE("simple expire z1", "[NoDB]") { uint32_t const minzoom = 1; uint32_t const maxzoom = 1; - expire_tiles et{minzoom, defproj}; + expire_tiles_t et{minzoom, defproj}; // as big a bbox as possible at the origin to dirty all four // quadrants of the world. @@ -111,7 +111,7 @@ TEST_CASE("simple expire z3", "[NoDB]") { uint32_t const minzoom = 3; uint32_t const maxzoom = 3; - expire_tiles et{minzoom, defproj}; + expire_tiles_t et{minzoom, defproj}; // as big a bbox as possible at the origin to dirty all four // quadrants of the world. @@ -131,7 +131,7 @@ TEST_CASE("simple expire z18", "[NoDB]") { uint32_t const minzoom = 18; uint32_t const maxzoom = 18; - expire_tiles et{minzoom, defproj}; + expire_tiles_t et{minzoom, defproj}; // dirty a smaller bbox this time, as at z18 the scale is // pretty small. @@ -151,7 +151,7 @@ TEST_CASE("simple expire z10 bounds 0, 0", "[NoDB]") { uint32_t const minzoom = 10; uint32_t const maxzoom = 10; - expire_tiles et{minzoom, defproj}; + expire_tiles_t et{minzoom, defproj}; et.from_geometry(geom::point_t{-20037508.34, 20037508.34}, expire_config_t{}); @@ -167,7 +167,7 @@ TEST_CASE("simple expire z10 bounds 0, 1023", "[NoDB]") { uint32_t const minzoom = 10; uint32_t const maxzoom = 10; - expire_tiles et{minzoom, defproj}; + expire_tiles_t et{minzoom, defproj}; et.from_geometry(geom::point_t{-20037508.34, -20037508.34}, expire_config_t{}); @@ -183,7 +183,7 @@ TEST_CASE("simple expire z10 bounds 1023, 0", "[NoDB]") { uint32_t const minzoom = 10; uint32_t const maxzoom = 10; - expire_tiles et{minzoom, defproj}; + expire_tiles_t et{minzoom, defproj}; et.from_geometry(geom::point_t{20037508.34, 20037508.34}, expire_config_t{}); @@ -199,7 +199,7 @@ TEST_CASE("simple expire z10 bounds 1023, 1023", "[NoDB]") { uint32_t const minzoom = 10; uint32_t const maxzoom = 10; - expire_tiles et{minzoom, defproj}; + expire_tiles_t et{minzoom, defproj}; et.from_geometry(geom::point_t{20037508.34, -20037508.34}, expire_config_t{}); @@ -214,7 +214,7 @@ TEST_CASE("simple expire z10 bounds 1023, 1023", "[NoDB]") TEST_CASE("expire a simple line", "[NoDB]") { uint32_t const zoom = 18; - expire_tiles et{zoom, defproj}; + expire_tiles_t et{zoom, defproj}; et.from_geometry( geom::linestring_t{{1398725.0, 7493354.0}, {1399030.0, 7493354.0}}, @@ -232,7 +232,7 @@ TEST_CASE("expire a simple line", "[NoDB]") TEST_CASE("expire a line near the tile border", "[NoDB]") { uint32_t const zoom = 18; - expire_tiles et{zoom, defproj}; + expire_tiles_t et{zoom, defproj}; et.from_geometry( geom::linestring_t{{1398945.0, 7493267.0}, {1398960.0, 7493282.0}}, @@ -251,7 +251,7 @@ TEST_CASE("expire a line near the tile border", "[NoDB]") TEST_CASE("expire a u-shaped linestring", "[NoDB]") { uint32_t const zoom = 18; - expire_tiles et{zoom, defproj}; + expire_tiles_t et{zoom, defproj}; et.from_geometry(geom::linestring_t{{1398586.0, 7493485.0}, {1398575.0, 7493347.0}, @@ -273,7 +273,7 @@ TEST_CASE("expire a u-shaped linestring", "[NoDB]") TEST_CASE("expire longer horizontal line", "[NoDB]") { uint32_t const zoom = 18; - expire_tiles et{zoom, defproj}; + expire_tiles_t et{zoom, defproj}; et.from_geometry( geom::linestring_t{{1397815.0, 7493800.0}, {1399316.0, 7493780.0}}, @@ -290,7 +290,7 @@ TEST_CASE("expire longer horizontal line", "[NoDB]") TEST_CASE("expire longer diagonal line", "[NoDB]") { uint32_t const zoom = 18; - expire_tiles et{zoom, defproj}; + expire_tiles_t et{zoom, defproj}; et.from_geometry( geom::linestring_t{{1398427.0, 7494118.0}, {1398869.0, 7493189.0}}, @@ -322,7 +322,7 @@ TEST_CASE("simple expire z17 and z18", "[NoDB]") { uint32_t const minzoom = 17; uint32_t const maxzoom = 18; - expire_tiles et{maxzoom, defproj}; + expire_tiles_t et{maxzoom, defproj}; // dirty a smaller bbox this time, as at z18 the scale is // pretty small. @@ -350,7 +350,7 @@ TEST_CASE("simple expire z17 and z18 in one superior tile", "[NoDB]") { uint32_t const minzoom = 17; uint32_t const maxzoom = 18; - expire_tiles et{maxzoom, defproj}; + expire_tiles_t et{maxzoom, defproj}; et.from_bbox({-163, 140, -140, 164}, expire_config_t{}); auto const tiles = get_tiles_ordered(&et, minzoom, maxzoom); @@ -372,7 +372,7 @@ TEST_CASE("expire centroids", "[NoDB]") uint32_t const zoom = 18; for (int i = 0; i < 100; ++i) { - expire_tiles et{zoom, defproj}; + expire_tiles_t et{zoom, defproj}; auto check_set = generate_random(zoom, 100); expire_centroids(&et, check_set); @@ -383,7 +383,7 @@ TEST_CASE("expire centroids", "[NoDB]") } /** - * After expiring a random set of tiles in one expire_tiles object + * After expiring a random set of tiles in one expire_tiles_t object * and a different set in another, when they are merged together they are the * same as if the union of the sets of tiles had been expired. */ @@ -392,9 +392,9 @@ TEST_CASE("merge expire sets", "[NoDB]") uint32_t const zoom = 18; for (int i = 0; i < 100; ++i) { - expire_tiles et{zoom, defproj}; - expire_tiles et1{zoom, defproj}; - expire_tiles et2{zoom, defproj}; + expire_tiles_t et{zoom, defproj}; + expire_tiles_t et1{zoom, defproj}; + expire_tiles_t et2{zoom, defproj}; auto check_set1 = generate_random(zoom, 100); expire_centroids(&et1, check_set1); @@ -423,9 +423,9 @@ TEST_CASE("merge identical expire sets", "[NoDB]") uint32_t const zoom = 18; for (int i = 0; i < 100; ++i) { - expire_tiles et{zoom, defproj}; - expire_tiles et1{zoom, defproj}; - expire_tiles et2{zoom, defproj}; + expire_tiles_t et{zoom, defproj}; + expire_tiles_t et1{zoom, defproj}; + expire_tiles_t et2{zoom, defproj}; auto const check_set = generate_random(zoom, 100); expire_centroids(&et1, check_set); @@ -448,9 +448,9 @@ TEST_CASE("merge overlapping expire sets", "[NoDB]") uint32_t const zoom = 18; for (int i = 0; i < 100; ++i) { - expire_tiles et{zoom, defproj}; - expire_tiles et1{zoom, defproj}; - expire_tiles et2{zoom, defproj}; + expire_tiles_t et{zoom, defproj}; + expire_tiles_t et1{zoom, defproj}; + expire_tiles_t et2{zoom, defproj}; auto check_set1 = generate_random(zoom, 100); expire_centroids(&et1, check_set1); @@ -482,10 +482,10 @@ TEST_CASE("merge with complete flag", "[NoDB]") { uint32_t const zoom = 18; - expire_tiles et{zoom, defproj}; - expire_tiles et0{zoom, defproj}; - expire_tiles et1{zoom, defproj}; - expire_tiles et2{zoom, defproj}; + expire_tiles_t et{zoom, defproj}; + expire_tiles_t et0{zoom, defproj}; + expire_tiles_t et1{zoom, defproj}; + expire_tiles_t et2{zoom, defproj}; // et1&2 are two halves of et0's box et0.from_bbox({-10000, -10000, 10000, 10000}, expire_config_t{}); diff --git a/tests/test-geom-transform.cpp b/tests/test-geom-transform.cpp index 10a7ed775..60ac0eb3a 100644 --- a/tests/test-geom-transform.cpp +++ b/tests/test-geom-transform.cpp @@ -43,7 +43,7 @@ double const Y09 = 100191.66201561989; // lat 0.9 TEST_CASE("Transform geom::null_t", "[NoDB]") { auto const &reprojection = - reprojection::create_projection(PROJ_SPHERE_MERC); + reprojection_t::create_projection(PROJ_SPHERE_MERC); geom::geometry_t const geom{}; auto const result = geom::transform(geom, *reprojection); @@ -54,7 +54,7 @@ TEST_CASE("Transform geom::null_t", "[NoDB]") TEST_CASE("Transform geom::point_t", "[NoDB]") { auto const &reprojection = - reprojection::create_projection(PROJ_SPHERE_MERC); + reprojection_t::create_projection(PROJ_SPHERE_MERC); geom::geometry_t const geom{geom::point_t{5.5, 4.4}}; auto const result = geom::transform(geom, *reprojection); @@ -68,7 +68,7 @@ TEST_CASE("Transform geom::point_t", "[NoDB]") TEST_CASE("Transform geom::linestring_t", "[NoDB]") { auto const &reprojection = - reprojection::create_projection(PROJ_SPHERE_MERC); + reprojection_t::create_projection(PROJ_SPHERE_MERC); geom::geometry_t const geom{geom::linestring_t{{5.5, 4.4}, {3.3, 2.2}}}; auto const result = geom::transform(geom, *reprojection); @@ -83,7 +83,7 @@ TEST_CASE("Transform geom::linestring_t", "[NoDB]") TEST_CASE("Transform geom::polygon_t", "[NoDB]") { auto const &reprojection = - reprojection::create_projection(PROJ_SPHERE_MERC); + reprojection_t::create_projection(PROJ_SPHERE_MERC); geom::geometry_t geom{ geom::polygon_t{geom::ring_t{{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}}}}; @@ -117,7 +117,7 @@ TEST_CASE("Transform geom::polygon_t", "[NoDB]") TEST_CASE("Transform geom::multipoint_t", "[NoDB]") { auto const &reprojection = - reprojection::create_projection(PROJ_SPHERE_MERC); + reprojection_t::create_projection(PROJ_SPHERE_MERC); geom::geometry_t geom{geom::multipoint_t{}}; auto &mp = geom.get(); @@ -137,7 +137,7 @@ TEST_CASE("Transform geom::multipoint_t", "[NoDB]") TEST_CASE("Transform geom::multilinestring_t", "[NoDB]") { auto const &reprojection = - reprojection::create_projection(PROJ_SPHERE_MERC); + reprojection_t::create_projection(PROJ_SPHERE_MERC); geom::geometry_t geom{geom::multilinestring_t{}}; auto &ml = geom.get(); @@ -163,7 +163,7 @@ TEST_CASE("Transform geom::multilinestring_t", "[NoDB]") TEST_CASE("Transform geom::multipolygon_t", "[NoDB]") { auto const &reprojection = - reprojection::create_projection(PROJ_SPHERE_MERC); + reprojection_t::create_projection(PROJ_SPHERE_MERC); geom::geometry_t geom{geom::multipolygon_t{}}; auto &mp = geom.get(); @@ -199,7 +199,7 @@ TEST_CASE("Transform geom::multipolygon_t", "[NoDB]") TEST_CASE("Transform geom::collection_t", "[NoDB]") { auto const &reprojection = - reprojection::create_projection(PROJ_SPHERE_MERC); + reprojection_t::create_projection(PROJ_SPHERE_MERC); geom::geometry_t geom{geom::collection_t{}}; auto &c = geom.get(); diff --git a/tests/test-output-pgsql-style-file.cpp b/tests/test-output-pgsql-style-file.cpp index 38eec63d8..6586aaa81 100644 --- a/tests/test-output-pgsql-style-file.cpp +++ b/tests/test-output-pgsql-style-file.cpp @@ -14,7 +14,7 @@ TEST_CASE("Parse default style file") { - export_list exlist; + export_list_t exlist; auto const enable_way_area = read_style_file(OSM2PGSQLDATA_DIR "default.style", &exlist); @@ -26,7 +26,7 @@ TEST_CASE("Parse default style file") TEST_CASE("Parse empty style file") { - export_list exlist; + export_list_t exlist; REQUIRE_THROWS_WITH( read_style_file(OSM2PGSQLDATA_DIR "tests/style/empty.style", &exlist), @@ -35,7 +35,7 @@ TEST_CASE("Parse empty style file") TEST_CASE("Parse style file with invalid osm type") { - export_list exlist; + export_list_t exlist; REQUIRE_THROWS(read_style_file( OSM2PGSQLDATA_DIR "tests/style/invalid-osm-type.style", &exlist)); @@ -43,7 +43,7 @@ TEST_CASE("Parse style file with invalid osm type") TEST_CASE("Parse style file with comments only") { - export_list exlist; + export_list_t exlist; REQUIRE_THROWS_WITH( read_style_file(OSM2PGSQLDATA_DIR "tests/style/comments.style", @@ -53,7 +53,7 @@ TEST_CASE("Parse style file with comments only") TEST_CASE("Parse style file with single node entry") { - export_list exlist; + export_list_t exlist; auto const enable_way_area = read_style_file(OSM2PGSQLDATA_DIR "tests/style/node.style", &exlist); @@ -71,7 +71,7 @@ TEST_CASE("Parse style file with single node entry") TEST_CASE("Parse style file with a few valid entries") { - export_list exlist; + export_list_t exlist; auto const enable_way_area = read_style_file(OSM2PGSQLDATA_DIR "tests/style/valid.style", &exlist); @@ -109,7 +109,7 @@ TEST_CASE("Parse style file with a few valid entries") TEST_CASE("Parse style file with missing fields") { - export_list exlist; + export_list_t exlist; auto const enable_way_area = read_style_file(OSM2PGSQLDATA_DIR "tests/style/missing.style", &exlist); @@ -138,7 +138,7 @@ TEST_CASE("Parse style file with missing fields") TEST_CASE("Parse style file with way_area") { - export_list exlist; + export_list_t exlist; auto const enable_way_area = read_style_file( OSM2PGSQLDATA_DIR "tests/style/way-area.style", &exlist); @@ -168,7 +168,7 @@ TEST_CASE("Parse style file with way_area") TEST_CASE("Parse style file with different data types") { - export_list exlist; + export_list_t exlist; auto const enable_way_area = read_style_file( OSM2PGSQLDATA_DIR "tests/style/data-types.style", &exlist); @@ -211,7 +211,7 @@ TEST_CASE("Parse style file with different data types") TEST_CASE("Parse style file with invalid data types") { - export_list exlist; + export_list_t exlist; auto const enable_way_area = read_style_file( OSM2PGSQLDATA_DIR "tests/style/invalid-data-type.style", &exlist); diff --git a/tests/test-persistent-cache.cpp b/tests/test-persistent-cache.cpp index 4cdccdd9d..a250511fc 100644 --- a/tests/test-persistent-cache.cpp +++ b/tests/test-persistent-cache.cpp @@ -15,20 +15,20 @@ namespace { -void write_and_read_location(node_persistent_cache *cache, osmid_t id, double x, - double y) +void write_and_read_location(node_persistent_cache_t *cache, osmid_t id, + double x, double y) { cache->set(id, osmium::Location{x, y}); REQUIRE(osmium::Location(x, y) == cache->get(id)); } -void read_location(node_persistent_cache const &cache, osmid_t id, double x, +void read_location(node_persistent_cache_t const &cache, osmid_t id, double x, double y) { REQUIRE(osmium::Location(x, y) == cache.get(id)); } -void delete_location(node_persistent_cache *cache, osmid_t id) +void delete_location(node_persistent_cache_t *cache, osmid_t id) { cache->set(id, osmium::Location{}); REQUIRE(osmium::Location{} == cache->get(id)); @@ -43,7 +43,7 @@ TEST_CASE("Persistent cache", "[NoDB]") // create a new cache { - node_persistent_cache cache{flat_node_file, true, false}; + node_persistent_cache_t cache{flat_node_file, true, false}; // write in order write_and_read_location(&cache, 10, 10.01, -45.3); @@ -66,7 +66,7 @@ TEST_CASE("Persistent cache", "[NoDB]") // reopen the cache { - node_persistent_cache cache{flat_node_file, false, false}; + node_persistent_cache_t cache{flat_node_file, false, false}; // read all previously written locations read_location(cache, 10, 10.01, -45.3); @@ -115,5 +115,5 @@ TEST_CASE("Opening non-existent persistent cache should fail in append mode", "test_middle_flat.nonexistent.flat.nodes.bin"; testing::cleanup::file_t const flatnode_cleaner{flat_node_file}; - REQUIRE_THROWS(node_persistent_cache(flat_node_file, false, false)); + REQUIRE_THROWS(node_persistent_cache_t(flat_node_file, false, false)); } diff --git a/tests/test-pgsql.cpp b/tests/test-pgsql.cpp index dc0855209..d00b5d42a 100644 --- a/tests/test-pgsql.cpp +++ b/tests/test-pgsql.cpp @@ -105,7 +105,7 @@ TEST_CASE("exec_prepared with binary parameter should work") auto const conn = db.db().connect(); conn.exec("PREPARE test(bytea) AS SELECT length($1)"); - binary_param const p{"foo \x01 bar"}; + binary_param_t const p{"foo \x01 bar"}; auto const result = conn.exec_prepared("test", p); REQUIRE(result.status() == PGRES_TUPLES_OK); REQUIRE(result.num_fields() == 1); @@ -120,7 +120,7 @@ TEST_CASE("exec_prepared with mixed parameter types should work") " SELECT length($1) + length($2) + $3"); std::string const p1{"foo bar"}; - binary_param const p2{"foo \x01 bar"}; + binary_param_t const p2{"foo \x01 bar"}; int const p3 = 17; auto const result = conn.exec_prepared("test", p1, p2, p3); REQUIRE(result.status() == PGRES_TUPLES_OK); diff --git a/tests/test-reprojection.cpp b/tests/test-reprojection.cpp index 0818d477c..f3778bd68 100644 --- a/tests/test-reprojection.cpp +++ b/tests/test-reprojection.cpp @@ -17,7 +17,7 @@ TEST_CASE("projection 4326", "[NoDB]") osmium::Location const loc{10.0, 53.0}; int const srs = PROJ_LATLONG; - auto const reprojection = reprojection::create_projection(srs); + auto const reprojection = reprojection_t::create_projection(srs); REQUIRE(reprojection->target_srs() == srs); REQUIRE(reprojection->target_latlon()); @@ -35,7 +35,7 @@ TEST_CASE("projection 3857", "[NoDB]") osmium::Location const loc{10.0, 53.0}; int const srs = PROJ_SPHERE_MERC; - auto const reprojection = reprojection::create_projection(srs); + auto const reprojection = reprojection_t::create_projection(srs); REQUIRE(reprojection->target_srs() == srs); REQUIRE_FALSE(reprojection->target_latlon()); @@ -54,7 +54,7 @@ TEST_CASE("projection 3857 bounds", "[NoDB]") osmium::Location const loc2{-180.0, -85.0511288}; osmium::Location const loc3{180.0, 85.0511288}; int const srs = PROJ_SPHERE_MERC; - auto const reprojection = reprojection::create_projection(srs); + auto const reprojection = reprojection_t::create_projection(srs); { auto const c = reprojection->reproject(geom::point_t{loc1}); @@ -91,7 +91,7 @@ TEST_CASE("projection 5651", "[NoDB]") osmium::Location const loc{10.0, 53.0}; int const srs = 5651; // ETRS89 / UTM zone 31N (N-zE) - auto const reprojection = reprojection::create_projection(srs); + auto const reprojection = reprojection_t::create_projection(srs); REQUIRE(reprojection->target_srs() == srs); REQUIRE_FALSE(reprojection->target_latlon()); diff --git a/tests/test-util.cpp b/tests/test-util.cpp index 210cf7be6..b9a143c89 100644 --- a/tests/test-util.cpp +++ b/tests/test-util.cpp @@ -16,15 +16,15 @@ #include #include -TEST_CASE("double_to_buffer 0", "[NoDB]") +TEST_CASE("double_to_buffer_t 0", "[NoDB]") { - util::double_to_buffer const buffer{0.0}; + util::double_to_buffer_t const buffer{0.0}; REQUIRE(std::strcmp(buffer.c_str(), "0") == 0); } -TEST_CASE("double_to_buffer 3.141", "[NoDB]") +TEST_CASE("double_to_buffer_t 3.141", "[NoDB]") { - util::double_to_buffer const buffer{3.141}; + util::double_to_buffer_t const buffer{3.141}; REQUIRE(std::strcmp(buffer.c_str(), "3.141") == 0); }