osrm-backend/include/extractor/extractor_callbacks.hpp

51 lines
1.5 KiB
C++
Raw Normal View History

#ifndef EXTRACTOR_CALLBACKS_HPP
#define EXTRACTOR_CALLBACKS_HPP
2016-01-02 11:13:44 -05:00
#include "util/typedefs.hpp"
#include <boost/optional/optional_fwd.hpp>
#include <string>
2014-08-26 11:50:34 -04:00
#include <unordered_map>
2014-03-06 12:07:55 -05:00
struct ExternalMemoryNode;
2013-12-16 05:29:38 -05:00
class ExtractionContainers;
struct InputRestrictionContainer;
2014-08-26 11:50:34 -04:00
struct ExtractionNode;
struct ExtractionWay;
namespace osmium
{
class Node;
class Way;
}
/**
* 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:
// 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-05-09 10:17:31 -04:00
public:
ExtractorCallbacks() = delete;
ExtractorCallbacks(const ExtractorCallbacks &) = delete;
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers);
2014-05-09 10:17:31 -04:00
// warning: caller needs to take care of synchronization!
void ProcessNode(const osmium::Node &current_node, const ExtractionNode &result_node);
2014-05-09 10:17:31 -04:00
// warning: caller needs to take care of synchronization!
void ProcessRestriction(const boost::optional<InputRestrictionContainer> &restriction);
2014-05-09 10:17:31 -04:00
// warning: caller needs to take care of synchronization!
void ProcessWay(const osmium::Way &current_way, const ExtractionWay &result_way);
};
#endif /* EXTRACTOR_CALLBACKS_HPP */