osrm-backend/include/extractor/extractor_callbacks.hpp

63 lines
1.8 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"
2016-05-26 18:47:46 -04:00
#include <boost/functional/hash.hpp>
2016-06-02 07:14:33 -04:00
#include <boost/optional/optional_fwd.hpp>
#include <string>
2014-08-26 11:50:34 -04:00
#include <unordered_map>
namespace osmium
{
class Node;
class Way;
}
2016-01-05 10:51:13 -05:00
namespace osrm
{
namespace extractor
{
class ExtractionContainers;
struct InputRestrictionContainer;
struct ExtractionNode;
struct ExtractionWay;
/**
* 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:
2016-05-04 11:19:55 -04:00
// used to deduplicate street names and street destinations: actually maps to name ids
2016-05-26 18:47:46 -04:00
using MapKey = std::pair<std::string, std::string>;
using MapVal = unsigned;
std::unordered_map<MapKey, MapVal, boost::hash<MapKey>> string_map;
2016-05-13 13:18:00 -04:00
std::unordered_map<std::string, LaneStringID> lane_map;
2014-05-09 10:17:31 -04:00
ExtractionContainers &external_memory;
2014-05-09 10:17:31 -04:00
public:
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers);
ExtractorCallbacks(const ExtractorCallbacks &) = delete;
ExtractorCallbacks &operator=(const ExtractorCallbacks &) = delete;
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);
};
2016-01-05 10:51:13 -05:00
}
}
#endif /* EXTRACTOR_CALLBACKS_HPP */