Order ServerPaths members by memory size, pass ServerPaths by ref

This commit is contained in:
Frederic Rodrigo 2015-01-06 15:33:57 +00:00
parent 598f5519d1
commit 12f2acc9ff
4 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2014, Project OSRM, Dennis Luxen, others
Copyright (c) 2015, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@ -33,19 +33,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
struct ServerConfig
{
ServerConfig()
: use_shared_memory(false)
, max_locations_distance_table(100)
: max_locations_distance_table(100)
, use_shared_memory(false)
{}
ServerConfig(const ServerPaths paths, const bool flag, const int max)
ServerConfig(const ServerPaths &paths, const bool flag, const int max)
: server_paths(paths)
, use_shared_memory(flag)
, max_locations_distance_table(max)
, use_shared_memory(flag)
{}
ServerPaths server_paths;
bool use_shared_memory;
int max_locations_distance_table;
bool use_shared_memory;
};
#endif // SERVER_CONFIG_H

View File

@ -57,7 +57,7 @@ namespace boost { namespace interprocess { class named_mutex; } }
#include <utility>
#include <vector>
OSRM_impl::OSRM_impl(ServerConfig serverConfig)
OSRM_impl::OSRM_impl(ServerConfig &serverConfig)
{
if (serverConfig.use_shared_memory)
{

View File

@ -49,7 +49,7 @@ class OSRM_impl
using PluginMap = std::unordered_map<std::string, BasePlugin *>;
public:
OSRM_impl(ServerConfig serverConfig);
OSRM_impl(ServerConfig &serverConfig);
OSRM_impl(const OSRM_impl &) = delete;
virtual ~OSRM_impl();
void RunQuery(RouteParameters &route_parameters, http::Reply &reply);

View File

@ -278,7 +278,7 @@ inline unsigned GenerateServerProgramOptions(const int argc,
}
if (1 > max_locations_distance_table)
{
throw OSRMException("Max location for distance table must be a positive number");
throw osrm::exception("Max location for distance table must be a positive number");
}
SimpleLogger().Write() << visible_options;