Skip to content

Commit

Permalink
Merge pull request #2251 from joto/misc-cleanup
Browse files Browse the repository at this point in the history
Misc cleanup
  • Loading branch information
lonvia authored Sep 17, 2024
2 parents 2d61139 + 48299da commit 55d1592
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 36 deletions.
3 changes: 2 additions & 1 deletion src/expire-config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* For a full list of authors see the git log.
*/

#include <cstdint>
#include <cstdlib>

enum class expire_mode
enum class expire_mode : uint8_t
{
full_area, // Expire all tiles covered by polygon.
boundary_only, // Expire only tiles covered by polygon boundary.
Expand Down
5 changes: 3 additions & 2 deletions src/flex-table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <cassert>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <future>
#include <limits>
#include <memory>
Expand All @@ -35,7 +36,7 @@
* output. This is not a real primary key, because the values are not
* necessarily unique.
*/
enum class flex_table_index_type {
enum class flex_table_index_type : uint8_t {
no_index,
node, // index by node id
way, // index by way id
Expand All @@ -57,7 +58,7 @@ class flex_table_t
* Table creation type: interim tables are created as UNLOGGED and with
* autovacuum disabled.
*/
enum class table_type {
enum class table_type : uint8_t {
interim,
permanent
};
Expand Down
6 changes: 3 additions & 3 deletions src/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ class data_source_t
using iterator = osmium::memory::Buffer::t_iterator<osmium::OSMObject>;

std::unique_ptr<osmium::io::Reader> m_reader;
osmium::memory::Buffer m_buffer{};
iterator m_it{};
iterator m_end{};
osmium::memory::Buffer m_buffer;
iterator m_it;
iterator m_end;
type_id m_last = {osmium::item_type::node, 0};

}; // class data_source_t
Expand Down
4 changes: 2 additions & 2 deletions src/input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ struct type_id

struct file_info
{
osmium::io::Header header{};
osmium::Timestamp last_timestamp{};
osmium::io::Header header;
osmium::Timestamp last_timestamp;
};

/**
Expand Down
3 changes: 2 additions & 1 deletion src/logging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
#include <fmt/color.h>

#include <atomic>
#include <cstdint>
#include <cstdio>
#include <utility>

enum class log_level
enum class log_level : uint8_t
{
debug = 1,
info = 2,
Expand Down
4 changes: 4 additions & 0 deletions src/middle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include "middle.hpp"
#include "options.hpp"

middle_query_t::~middle_query_t() = default;

middle_t::~middle_t() = default;

std::shared_ptr<middle_t>
create_middle(std::shared_ptr<thread_pool_t> thread_pool,
options_t const &options)
Expand Down
7 changes: 2 additions & 5 deletions src/middle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <osmium/memory/buffer.hpp>
#include <osmium/osm/entity_bits.hpp>

#include <cstdint>
#include <memory>

#include "osmtypes.hpp"
Expand Down Expand Up @@ -89,8 +90,6 @@ struct middle_query_t : std::enable_shared_from_this<middle_query_t>
osmium::memory::Buffer *buffer) const = 0;
};

inline middle_query_t::~middle_query_t() = default;

/**
* Interface for storing "raw" OSM data in an intermediate object store and
* getting it back.
Expand Down Expand Up @@ -173,7 +172,7 @@ class middle_t
}

#ifndef NDEBUG
enum class middle_state
enum class middle_state : uint8_t
{
constructed,
started,
Expand All @@ -191,8 +190,6 @@ class middle_t
std::shared_ptr<thread_pool_t> m_thread_pool;
}; // class middle_t

inline middle_t::~middle_t() = default;

/// Factory function: Instantiate the middle based on the command line options.
std::shared_ptr<middle_t>
create_middle(std::shared_ptr<thread_pool_t> thread_pool,
Expand Down
18 changes: 9 additions & 9 deletions src/options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class reprojection;

enum class command_t
enum class command_t : uint8_t
{
help,
version,
Expand Down Expand Up @@ -53,30 +53,30 @@ struct options_t
bool prefix_is_set = false;

/// Pg Tablespace to store indexes on main tables (no default TABLESPACE)
std::string tblsmain_index{};
std::string tblsmain_index;

/// Pg Tablespace to store indexes on slim tables (no default TABLESPACE)
std::string tblsslim_index{};
std::string tblsslim_index;

/// Pg Tablespace to store main tables (no default TABLESPACE)
std::string tblsmain_data{};
std::string tblsmain_data;

/// Pg Tablespace to store slim tables (no default TABLESPACE)
std::string tblsslim_data{};
std::string tblsslim_data;

/// Default Pg schema.
std::string dbschema{"public"};

/// Pg schema to store middle tables in.
std::string middle_dbschema{};
std::string middle_dbschema;

/// Pg schema to store output tables in.
std::string output_dbschema{};
std::string output_dbschema;

std::string style{}; ///< style file to use
std::string style; ///< style file to use

/// Name of the flat node file used. Empty if flat node file is not enabled.
std::string flat_node_file{};
std::string flat_node_file;

std::string tag_transform_script;

Expand Down
20 changes: 10 additions & 10 deletions src/output-flex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,19 +298,19 @@ class output_flex_t : public output_t

osmium::memory::Buffer m_area_buffer;

prepared_lua_function_t m_process_node{};
prepared_lua_function_t m_process_way{};
prepared_lua_function_t m_process_relation{};
prepared_lua_function_t m_process_node;
prepared_lua_function_t m_process_way;
prepared_lua_function_t m_process_relation;

prepared_lua_function_t m_process_untagged_node{};
prepared_lua_function_t m_process_untagged_way{};
prepared_lua_function_t m_process_untagged_relation{};
prepared_lua_function_t m_process_untagged_node;
prepared_lua_function_t m_process_untagged_way;
prepared_lua_function_t m_process_untagged_relation;

prepared_lua_function_t m_select_relation_members{};
prepared_lua_function_t m_select_relation_members;

prepared_lua_function_t m_after_nodes{};
prepared_lua_function_t m_after_ways{};
prepared_lua_function_t m_after_relations{};
prepared_lua_function_t m_after_nodes;
prepared_lua_function_t m_after_ways;
prepared_lua_function_t m_after_relations;

calling_context m_calling_context = calling_context::main;

Expand Down
3 changes: 2 additions & 1 deletion src/properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ bool properties_t::get_bool(std::string const &property,
property);
}

void properties_t::set_string(std::string property, std::string value)
void properties_t::set_string(std::string const &property,
std::string const &value)
{
m_properties[property] = value;
m_to_update[property] = value;
Expand Down
2 changes: 1 addition & 1 deletion src/properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class properties_t
* \param property Name of the property
* \param value Value of the property
*/
void set_string(std::string property, std::string value);
void set_string(std::string const &property, std::string const &value);

/**
* Set property to integer value. The integer will be converted to a string
Expand Down
2 changes: 1 addition & 1 deletion src/thread-pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class task_result_t
std::chrono::microseconds runtime() const noexcept { return m_result; }

private:
std::future<std::chrono::microseconds> m_future{};
std::future<std::chrono::microseconds> m_future;
std::chrono::microseconds m_result{};
}; // class task_result_t

Expand Down

0 comments on commit 55d1592

Please sign in to comment.