From 3e6f27d1736f66caee08fca43fae6802bd6df9d1 Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Sat, 9 Aug 2014 11:23:41 +0200 Subject: [PATCH] rename contra_flow to travel_mode, use unsigned char --- Contractor/EdgeBasedGraphFactory.cpp | 4 ++-- DataStructures/ImportEdge.cpp | 4 ++-- DataStructures/ImportEdge.h | 4 ++-- DataStructures/NodeBasedGraph.h | 8 ++++---- Extractor/ExtractionContainers.cpp | 2 +- Extractor/InternalExtractorEdge.h | 8 ++++---- Util/GraphLoader.h | 13 +++++++------ 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Contractor/EdgeBasedGraphFactory.cpp b/Contractor/EdgeBasedGraphFactory.cpp index 0eeaeced7..3adea2a97 100644 --- a/Contractor/EdgeBasedGraphFactory.cpp +++ b/Contractor/EdgeBasedGraphFactory.cpp @@ -718,11 +718,11 @@ TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID node_u, const EdgeData &data1 = m_node_based_graph->GetEdgeData(edge1); const EdgeData &data2 = m_node_based_graph->GetEdgeData(edge2); - if (!data1.contraFlow && data2.contraFlow) + if (!data1.travel_mode && data2.travel_mode) { return TurnInstruction::EnterAgainstAllowedDirection; } - if (data1.contraFlow && !data2.contraFlow) + if (data1.travel_mode && !data2.travel_mode) { return TurnInstruction::LeaveAgainstAllowedDirection; } diff --git a/DataStructures/ImportEdge.cpp b/DataStructures/ImportEdge.cpp index 0d04b9fb0..b8c157dff 100644 --- a/DataStructures/ImportEdge.cpp +++ b/DataStructures/ImportEdge.cpp @@ -56,11 +56,11 @@ NodeBasedEdge::NodeBasedEdge(NodeID source, bool roundabout, bool in_tiny_cc, bool access_restricted, - bool contra_flow, + TravelMode travel_mode, bool is_split) : source(source), target(target), name_id(name_id), weight(weight), type(type), forward(forward), backward(backward), roundabout(roundabout), in_tiny_cc(in_tiny_cc), - access_restricted(access_restricted), contra_flow(contra_flow), is_split(is_split) + access_restricted(access_restricted), travel_mode(travel_mode), is_split(is_split) { BOOST_ASSERT_MSG(type > 0, "negative edge type"); } diff --git a/DataStructures/ImportEdge.h b/DataStructures/ImportEdge.h index ecaffc97c..d8ddf49ae 100644 --- a/DataStructures/ImportEdge.h +++ b/DataStructures/ImportEdge.h @@ -44,7 +44,7 @@ struct NodeBasedEdge bool roundabout, bool in_tiny_cc, bool access_restricted, - bool contra_flow, + TravelMode travel_mode, bool is_split); NodeID source; @@ -57,7 +57,7 @@ struct NodeBasedEdge bool roundabout : 1; bool in_tiny_cc : 1; bool access_restricted : 1; - bool contra_flow : 1; + TravelMode travel_mode : 1; bool is_split : 1; NodeBasedEdge() = delete; diff --git a/DataStructures/NodeBasedGraph.h b/DataStructures/NodeBasedGraph.h index 580c71d86..464c31605 100644 --- a/DataStructures/NodeBasedGraph.h +++ b/DataStructures/NodeBasedGraph.h @@ -15,7 +15,7 @@ struct NodeBasedEdgeData : distance(INVALID_EDGE_WEIGHT), edgeBasedNodeID(SPECIAL_NODEID), nameID(std::numeric_limits::max()), type(std::numeric_limits::max()), isAccessRestricted(false), shortcut(false), forward(false), backward(false), - roundabout(false), ignore_in_grid(false), contraFlow(false) + roundabout(false), ignore_in_grid(false), travel_mode(false) { } @@ -29,7 +29,7 @@ struct NodeBasedEdgeData bool backward : 1; bool roundabout : 1; bool ignore_in_grid : 1; - bool contraFlow : 1; + TravelMode travel_mode : 1; void SwapDirectionFlags() { @@ -42,7 +42,7 @@ struct NodeBasedEdgeData { return (forward == other.forward) && (backward == other.backward) && (nameID == other.nameID) && (ignore_in_grid == other.ignore_in_grid) && - (contraFlow == other.contraFlow); + (travel_mode == other.travel_mode); } }; @@ -93,7 +93,7 @@ NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vectoris_roundabout, sizeof(bool)); file_out_stream.write((char *)&edge_iterator->is_in_tiny_cc, sizeof(bool)); file_out_stream.write((char *)&edge_iterator->is_access_restricted, sizeof(bool)); - file_out_stream.write((char *)&edge_iterator->is_contra_flow, sizeof(bool)); + file_out_stream.write((char *)&edge_iterator->travel_mode, sizeof(TravelMode)); file_out_stream.write((char *)&edge_iterator->is_split, sizeof(bool)); ++number_of_used_edges; } diff --git a/Extractor/InternalExtractorEdge.h b/Extractor/InternalExtractorEdge.h index 852f9f929..0e3e7dfd7 100644 --- a/Extractor/InternalExtractorEdge.h +++ b/Extractor/InternalExtractorEdge.h @@ -38,7 +38,7 @@ struct InternalExtractorEdge InternalExtractorEdge() : start(0), target(0), type(0), direction(0), speed(0), name_id(0), is_roundabout(false), is_in_tiny_cc(false), is_duration_set(false), is_access_restricted(false), - is_contra_flow(false), is_split(false) + travel_mode(0), is_split(false) { } @@ -52,12 +52,12 @@ struct InternalExtractorEdge bool is_in_tiny_cc, bool is_duration_set, bool is_access_restricted, - bool is_contra_flow, + TravelMode travel_mode, bool is_split) : start(start), target(target), type(type), direction(direction), speed(speed), name_id(name_id), is_roundabout(is_roundabout), is_in_tiny_cc(is_in_tiny_cc), is_duration_set(is_duration_set), is_access_restricted(is_access_restricted), - is_contra_flow(is_contra_flow), is_split(is_split) + travel_mode(travel_mode), is_split(is_split) { BOOST_ASSERT(0 <= type); } @@ -83,7 +83,7 @@ struct InternalExtractorEdge bool is_in_tiny_cc; bool is_duration_set; bool is_access_restricted; - bool is_contra_flow; + TravelMode travel_mode; bool is_split; FixedPointCoordinate source_coordinate; diff --git a/Util/GraphLoader.h b/Util/GraphLoader.h index c943b789c..6a61676cb 100644 --- a/Util/GraphLoader.h +++ b/Util/GraphLoader.h @@ -129,8 +129,8 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream, short type; NodeID nameID; int length; - bool is_roundabout, ignore_in_grid, is_access_restricted, is_contra_flow, is_split; - + bool is_roundabout, ignore_in_grid, is_access_restricted, is_split; + TravelMode travel_mode; for (EdgeID i = 0; i < m; ++i) { input_stream.read((char *)&source, sizeof(unsigned)); @@ -143,7 +143,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream, input_stream.read((char *)&is_roundabout, sizeof(bool)); input_stream.read((char *)&ignore_in_grid, sizeof(bool)); input_stream.read((char *)&is_access_restricted, sizeof(bool)); - input_stream.read((char *)&is_contra_flow, sizeof(bool)); + input_stream.read((char *)&travel_mode, sizeof(TravelMode)); input_stream.read((char *)&is_split, sizeof(bool)); BOOST_ASSERT_MSG(length > 0, "loaded null length edge"); @@ -200,7 +200,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream, is_roundabout, ignore_in_grid, is_access_restricted, - is_contra_flow, + travel_mode, is_split); } @@ -306,7 +306,8 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream, short type; NodeID nameID; int length; - bool is_roundabout, ignore_in_grid, is_access_restricted, is_contra_flow, is_split; + bool is_roundabout, ignore_in_grid, is_access_restricted, is_split; + TravelMode travel_mode; for (EdgeID i = 0; i < m; ++i) { @@ -320,7 +321,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream, input_stream.read((char *)&is_roundabout, sizeof(bool)); input_stream.read((char *)&ignore_in_grid, sizeof(bool)); input_stream.read((char *)&is_access_restricted, sizeof(bool)); - input_stream.read((char *)&is_contra_flow, sizeof(bool)); + input_stream.read((char *)&travel_mode, sizeof(TravelMode)); input_stream.read((char *)&is_split, sizeof(bool)); BOOST_ASSERT_MSG(length > 0, "loaded null length edge");