Move string_map inside external_callbacks
It is not referenced outside this calls, thus the lifetime can be safely handled by it.
This commit is contained in:
parent
34031aab1b
commit
5ff95dc32d
@ -101,13 +101,8 @@ int extractor::run(const ExtractorConfig &extractor_config)
|
|||||||
// setup scripting environment
|
// setup scripting environment
|
||||||
ScriptingEnvironment scripting_environment(extractor_config.profile_path.string().c_str());
|
ScriptingEnvironment scripting_environment(extractor_config.profile_path.string().c_str());
|
||||||
|
|
||||||
// used to deduplicate street names: actually maps to name ids
|
|
||||||
std::unordered_map<std::string, NodeID> string_map;
|
|
||||||
string_map[""] = 0;
|
|
||||||
|
|
||||||
ExtractionContainers extraction_containers;
|
ExtractionContainers extraction_containers;
|
||||||
auto extractor_callbacks =
|
auto extractor_callbacks = osrm::make_unique<ExtractorCallbacks>(extraction_containers);
|
||||||
osrm::make_unique<ExtractorCallbacks>(extraction_containers, string_map);
|
|
||||||
|
|
||||||
const osmium::io::File input_file(extractor_config.input_path.string());
|
const osmium::io::File input_file(extractor_config.input_path.string());
|
||||||
osmium::io::Reader reader(input_file);
|
osmium::io::Reader reader(input_file);
|
||||||
|
@ -41,10 +41,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containers,
|
ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containers)
|
||||||
std::unordered_map<std::string, NodeID> &string_map)
|
: external_memory(extraction_containers)
|
||||||
: string_map(string_map), external_memory(extraction_containers)
|
|
||||||
{
|
{
|
||||||
|
string_map[""] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,14 +53,14 @@ struct ExtractionNode;
|
|||||||
class ExtractorCallbacks
|
class ExtractorCallbacks
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::unordered_map<std::string, NodeID> &string_map;
|
// used to deduplicate street names: actually maps to name ids
|
||||||
|
std::unordered_map<std::string, NodeID> string_map;
|
||||||
ExtractionContainers &external_memory;
|
ExtractionContainers &external_memory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExtractorCallbacks() = delete;
|
ExtractorCallbacks() = delete;
|
||||||
ExtractorCallbacks(const ExtractorCallbacks &) = delete;
|
ExtractorCallbacks(const ExtractorCallbacks &) = delete;
|
||||||
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers,
|
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers);
|
||||||
std::unordered_map<std::string, NodeID> &string_map);
|
|
||||||
|
|
||||||
// warning: caller needs to take care of synchronization!
|
// warning: caller needs to take care of synchronization!
|
||||||
void ProcessNode(const osmium::Node ¤t_node, const ExtractionNode &result_node);
|
void ProcessNode(const osmium::Node ¤t_node, const ExtractionNode &result_node);
|
||||||
|
Loading…
Reference in New Issue
Block a user