2012-08-29 12:33:18 -04:00
|
|
|
/*
|
2013-10-14 07:42:28 -04:00
|
|
|
|
2015-02-19 03:19:51 -05:00
|
|
|
Copyright (c) 2014, Project OSRM contributors
|
2013-10-14 07:42:28 -04:00
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
Redistributions of source code must retain the above copyright notice, this list
|
|
|
|
of conditions and the following disclaimer.
|
|
|
|
Redistributions in binary form must reproduce the above copyright notice, this
|
|
|
|
list of conditions and the following disclaimer in the documentation and/or
|
|
|
|
other materials provided with the distribution.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
|
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
*/
|
2012-08-29 12:33:18 -04:00
|
|
|
|
2014-11-28 09:00:48 -05:00
|
|
|
#ifndef EXTRACTOR_CALLBACKS_HPP
|
|
|
|
#define EXTRACTOR_CALLBACKS_HPP
|
2012-08-29 12:33:18 -04:00
|
|
|
|
2014-11-28 09:00:48 -05:00
|
|
|
#include "extraction_way.hpp"
|
2014-01-09 10:13:35 -05:00
|
|
|
#include "../typedefs.h"
|
2013-08-11 17:01:15 -04:00
|
|
|
|
2014-08-26 11:50:34 -04:00
|
|
|
#include <osmium/osm.hpp>
|
|
|
|
|
2014-08-29 05:27:51 -04:00
|
|
|
#include <variant/optional.hpp>
|
|
|
|
|
2014-01-09 10:13:35 -05:00
|
|
|
#include <string>
|
2014-08-26 11:50:34 -04:00
|
|
|
#include <unordered_map>
|
2012-08-29 12:33:18 -04:00
|
|
|
|
2014-03-06 12:07:55 -05:00
|
|
|
struct ExternalMemoryNode;
|
2013-12-16 05:29:38 -05:00
|
|
|
class ExtractionContainers;
|
2014-01-09 10:13:35 -05:00
|
|
|
struct InputRestrictionContainer;
|
2014-08-26 11:50:34 -04:00
|
|
|
struct ExtractionNode;
|
2014-01-09 10:13:35 -05:00
|
|
|
|
2015-04-10 06:35:24 -04:00
|
|
|
/**
|
|
|
|
* This class is uses by the extractor with the results of the
|
|
|
|
* osmium based parsing and the customization through the lua profile.
|
|
|
|
*
|
|
|
|
* It mediates between the multi-threaded extraction process and the external memory containers.
|
|
|
|
* Thus the synchronization is handled inside of the extractor.
|
|
|
|
*/
|
2014-05-09 10:17:31 -04:00
|
|
|
class ExtractorCallbacks
|
|
|
|
{
|
|
|
|
private:
|
2015-04-10 06:40:30 -04:00
|
|
|
// used to deduplicate street names: actually maps to name ids
|
|
|
|
std::unordered_map<std::string, NodeID> string_map;
|
2014-05-09 10:17:31 -04:00
|
|
|
ExtractionContainers &external_memory;
|
2014-01-09 10:13:35 -05:00
|
|
|
|
2014-05-09 10:17:31 -04:00
|
|
|
public:
|
|
|
|
ExtractorCallbacks() = delete;
|
|
|
|
ExtractorCallbacks(const ExtractorCallbacks &) = delete;
|
2015-04-10 06:40:30 -04:00
|
|
|
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers);
|
2012-08-29 12:33:18 -04:00
|
|
|
|
2014-05-09 10:17:31 -04:00
|
|
|
// warning: caller needs to take care of synchronization!
|
2014-10-13 07:53:06 -04:00
|
|
|
void ProcessNode(const osmium::Node ¤t_node, const ExtractionNode &result_node);
|
2012-08-29 12:33:18 -04:00
|
|
|
|
2014-05-09 10:17:31 -04:00
|
|
|
// warning: caller needs to take care of synchronization!
|
2014-08-29 05:27:51 -04:00
|
|
|
void ProcessRestriction(const mapbox::util::optional<InputRestrictionContainer> &restriction);
|
2012-08-29 12:33:18 -04:00
|
|
|
|
2014-05-09 10:17:31 -04:00
|
|
|
// warning: caller needs to take care of synchronization!
|
2014-10-13 07:53:06 -04:00
|
|
|
void ProcessWay(const osmium::Way ¤t_way, const ExtractionWay &result_way);
|
2012-08-29 12:33:18 -04:00
|
|
|
};
|
|
|
|
|
2014-11-28 09:00:48 -05:00
|
|
|
#endif /* EXTRACTOR_CALLBACKS_HPP */
|