1 /*
2 
3 Copyright (c) 2017, Project OSRM contributors
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without modification,
7 are permitted provided that the following conditions are met:
8 
9 Redistributions of source code must retain the above copyright notice, this list
10 of conditions and the following disclaimer.
11 Redistributions in binary form must reproduce the above copyright notice, this
12 list of conditions and the following disclaimer in the documentation and/or
13 other materials provided with the distribution.
14 
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
19 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 */
27 
28 #ifndef CONTRACTOR_OPTIONS_HPP
29 #define CONTRACTOR_OPTIONS_HPP
30 
31 #include "storage/io_config.hpp"
32 #include "updater/updater_config.hpp"
33 
34 #include <boost/filesystem/path.hpp>
35 
36 #include <string>
37 
38 namespace osrm
39 {
40 namespace contractor
41 {
42 
43 struct ContractorConfig final : storage::IOConfig
44 {
ContractorConfigosrm::contractor::ContractorConfig45     ContractorConfig()
46         : IOConfig({".osrm.ebg", ".osrm.ebg_nodes", ".osrm.properties"},
47                    {},
48                    {".osrm.hsgr", ".osrm.enw"}),
49           requested_num_threads(0)
50     {
51     }
52 
53     // Infer the output names from the path of the .osrm file
UseDefaultOutputNamesosrm::contractor::ContractorConfig54     void UseDefaultOutputNames(const boost::filesystem::path &base)
55     {
56         IOConfig::UseDefaultOutputNames(base);
57         updater_config.UseDefaultOutputNames(base);
58     }
59 
IsValidosrm::contractor::ContractorConfig60     bool IsValid() const { return IOConfig::IsValid() && updater_config.IsValid(); }
61 
62     updater::UpdaterConfig updater_config;
63 
64     // DEPRECATED to be removed in v6.0
65     bool use_cached_priority;
66 
67     unsigned requested_num_threads;
68 
69     // DEPRECATED to be removed in v6.0
70     // A percentage of vertices that will be contracted for the hierarchy.
71     // Offers a trade-off between preprocessing and query time.
72     // The remaining vertices form the core of the hierarchy
73     //(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%)
74     double core_factor;
75 };
76 } // namespace contractor
77 } // namespace osrm
78 
79 #endif // EXTRACTOR_OPTIONS_HPP
80