#ifndef OSRM_CUSTOMIZE_EDGE_BASED_GRAPH_HPP #define OSRM_CUSTOMIZE_EDGE_BASED_GRAPH_HPP #include "extractor/edge_based_edge.hpp" #include "partitioner/edge_based_graph.hpp" #include "partitioner/multi_level_graph.hpp" #include "util/static_graph.hpp" #include "util/typedefs.hpp" #include "storage/shared_memory_ownership.hpp" #include namespace osrm { namespace customizer { // TODO: Change to turn_id only using EdgeBasedGraphEdgeData = partitioner::EdgeBasedGraphEdgeData; template class MultiLevelGraph; namespace serialization { template void read(storage::tar::FileReader &reader, const std::string &name, MultiLevelGraph &graph); template void write(storage::tar::FileWriter &writer, const std::string &name, const MultiLevelGraph &graph); } template class MultiLevelGraph : public partitioner::MultiLevelGraph { private: using SuperT = partitioner::MultiLevelGraph; using SuperC = partitioner::MultiLevelGraph; template using Vector = util::ViewOrVector; public: MultiLevelGraph() = default; MultiLevelGraph(MultiLevelGraph &&) = default; MultiLevelGraph(const MultiLevelGraph &) = default; MultiLevelGraph &operator=(MultiLevelGraph &&) = default; MultiLevelGraph &operator=(const MultiLevelGraph &) = default; // TODO: add constructor for EdgeBasedGraphEdgeData MultiLevelGraph(SuperC &&graph, Vector node_weights_, Vector node_durations_) : node_weights(std::move(node_weights_)), node_durations(std::move(node_durations_)) { std::tie(SuperT::node_array, SuperT::edge_array, SuperT::node_to_edge_offset, SuperT::connectivity_checksum) = std::move(graph).data(); // TODO: add EdgeArrayEntry shaving } MultiLevelGraph(Vector node_array_, Vector edge_array_, Vector node_to_edge_offset_, Vector node_weights_, Vector node_durations_) : SuperT(std::move(node_array_), std::move(edge_array_), std::move(node_to_edge_offset_)), node_weights(std::move(node_weights_)), node_durations(std::move(node_durations_)) { // TODO: add EdgeArrayEntry shaving } EdgeWeight GetNodeWeight(NodeID node) const { return node_weights[node]; } friend void serialization::read(storage::tar::FileReader &reader, const std::string &name, MultiLevelGraph &graph); friend void serialization::write(storage::tar::FileWriter &writer, const std::string &name, const MultiLevelGraph &graph); protected: Vector node_weights; Vector node_durations; }; using MultiLevelEdgeBasedGraph = MultiLevelGraph; using MultiLevelEdgeBasedGraphView = MultiLevelGraph; } } #endif