osrm-backend/include/extractor/extractor_callbacks.hpp

78 lines
2.5 KiB
C++
Raw Normal View History

#ifndef EXTRACTOR_CALLBACKS_HPP
#define EXTRACTOR_CALLBACKS_HPP
#include "extractor/class_data.hpp"
#include "extractor/turn_lane_types.hpp"
#include "util/std_hash.hpp"
2016-07-26 09:00:58 -04:00
#include "util/typedefs.hpp"
#include <string>
2014-08-26 11:50:34 -04:00
#include <unordered_map>
namespace osmium
{
class Node;
class Way;
class Relation;
} // namespace osmium
namespace osrm::extractor
2016-01-05 10:51:13 -05:00
{
class ExtractionContainers;
struct ExtractionNode;
struct ExtractionWay;
struct ExtractionRelation;
struct ProfileProperties;
struct InputTurnRestriction;
2018-02-09 13:32:09 -05:00
struct InputManeuverOverride;
2016-01-05 10:51:13 -05:00
/**
2016-09-05 09:01:51 -04:00
* This class is used 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, refs, destinations, pronunciation, exits:
// actually maps to name ids
using MapKey = std::tuple<std::string, std::string, std::string, std::string, std::string>;
2016-05-26 18:47:46 -04:00
using MapVal = unsigned;
2017-10-13 12:05:04 -04:00
using StringMap = std::unordered_map<MapKey, MapVal>;
StringMap string_map;
2014-05-09 10:17:31 -04:00
ExtractionContainers &external_memory;
std::unordered_map<std::string, ClassData> &classes_map;
LaneDescriptionMap &lane_description_map;
bool fallback_to_duration;
2017-03-29 17:48:57 -04:00
bool force_split_edges;
2014-05-09 10:17:31 -04:00
public:
using ClassesMap = std::unordered_map<std::string, ClassData>;
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers,
std::unordered_map<std::string, ClassData> &classes_map,
LaneDescriptionMap &lane_description_map,
const ProfileProperties &properties);
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 InputTurnRestriction &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);
2018-02-09 13:32:09 -05:00
// warning: caller needs to take care of synchronization!
void ProcessManeuverOverride(const InputManeuverOverride &override);
};
2022-12-20 12:00:11 -05:00
} // namespace osrm::extractor
2016-01-05 10:51:13 -05:00
#endif /* EXTRACTOR_CALLBACKS_HPP */