2014-11-28 09:00:48 -05:00
|
|
|
#ifndef EXTRACTOR_CALLBACKS_HPP
|
|
|
|
#define EXTRACTOR_CALLBACKS_HPP
|
2012-08-29 12:33:18 -04:00
|
|
|
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "util/typedefs.hpp"
|
2015-09-18 08:26:32 -04:00
|
|
|
#include <boost/optional/optional_fwd.hpp>
|
2014-08-29 05:27:51 -04:00
|
|
|
|
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
|
|
|
|
2015-09-18 08:26:32 -04:00
|
|
|
namespace osmium
|
|
|
|
{
|
|
|
|
class Node;
|
|
|
|
class Way;
|
|
|
|
}
|
2014-01-09 10:13:35 -05:00
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace extractor
|
|
|
|
{
|
|
|
|
|
|
|
|
class ExtractionContainers;
|
|
|
|
struct InputRestrictionContainer;
|
|
|
|
struct ExtractionNode;
|
|
|
|
struct ExtractionWay;
|
|
|
|
|
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!
|
2015-09-18 08:26:32 -04:00
|
|
|
void ProcessRestriction(const boost::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
|
|
|
};
|
2016-01-05 10:51:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-28 09:00:48 -05:00
|
|
|
#endif /* EXTRACTOR_CALLBACKS_HPP */
|