Apply clang-format

This commit is contained in:
Patrick Niklaus
2016-01-05 12:04:04 +01:00
parent 552cdbfe20
commit 028ca5c9d9
84 changed files with 988 additions and 903 deletions
@@ -26,7 +26,7 @@ class CompressedEdgeContainer
void PrintStatistics() const;
void SerializeInternalVector(const std::string &path) const;
unsigned GetPositionForID(const EdgeID edge_id) const;
const EdgeBucket& GetBucketReference(const EdgeID edge_id) const;
const EdgeBucket &GetBucketReference(const EdgeID edge_id) const;
NodeID GetFirstEdgeTargetID(const EdgeID edge_id) const;
NodeID GetLastEdgeSourceID(const EdgeID edge_id) const;
@@ -63,27 +63,29 @@ class EdgeBasedGraphFactory
unsigned GetHighestEdgeID();
TurnInstruction AnalyzeTurn(const NodeID u, const NodeID v, const NodeID w, const double angle) const;
TurnInstruction
AnalyzeTurn(const NodeID u, const NodeID v, const NodeID w, const double angle) const;
int GetTurnPenalty(double angle, lua_State *lua_state) const;
private:
using EdgeData = NodeBasedDynamicGraph::EdgeData;
//! maps index from m_edge_based_node_list to ture/false if the node is an entry point to the graph
//! maps index from m_edge_based_node_list to ture/false if the node is an entry point to the
//! graph
std::vector<bool> m_edge_based_node_is_startpoint;
//! list of edge based nodes (compressed segments)
std::vector<EdgeBasedNode> m_edge_based_node_list;
DeallocatingVector<EdgeBasedEdge> m_edge_based_edge_list;
unsigned m_max_edge_id;
const std::vector<QueryNode>& m_node_info_list;
const std::vector<QueryNode> &m_node_info_list;
std::shared_ptr<NodeBasedDynamicGraph> m_node_based_graph;
std::shared_ptr<RestrictionMap const> m_restriction_map;
const std::unordered_set<NodeID>& m_barrier_nodes;
const std::unordered_set<NodeID>& m_traffic_lights;
const CompressedEdgeContainer& m_compressed_edge_container;
const std::unordered_set<NodeID> &m_barrier_nodes;
const std::unordered_set<NodeID> &m_traffic_lights;
const CompressedEdgeContainer &m_compressed_edge_container;
SpeedProfileProperties speed_profile;
@@ -103,13 +105,12 @@ class EdgeBasedGraphFactory
const std::string &edge_segment_lookup_filename,
const std::string &edge_fixed_penalties_filename,
const bool generate_edge_lookup);
#endif
#endif
void InsertEdgeBasedNode(const NodeID u, const NodeID v);
void FlushVectorToStream(std::ofstream &edge_data_file,
std::vector<OriginalEdgeData> &original_edge_data_vector) const;
};
#endif /* EDGE_BASED_GRAPH_FACTORY_HPP_ */
+4 -2
View File
@@ -19,7 +19,8 @@ struct EdgeBasedNode
u(SPECIAL_NODEID), v(SPECIAL_NODEID), name_id(0),
forward_weight(INVALID_EDGE_WEIGHT >> 1), reverse_weight(INVALID_EDGE_WEIGHT >> 1),
forward_offset(0), reverse_offset(0), packed_geometry_id(SPECIAL_EDGEID),
component{INVALID_COMPONENTID, false}, fwd_segment_position(std::numeric_limits<unsigned short>::max()),
component{INVALID_COMPONENTID, false},
fwd_segment_position(std::numeric_limits<unsigned short>::max()),
forward_travel_mode(TRAVEL_MODE_INACCESSIBLE),
backward_travel_mode(TRAVEL_MODE_INACCESSIBLE)
{
@@ -74,7 +75,8 @@ struct EdgeBasedNode
int forward_offset; // prefix sum of the weight up the edge TODO: short must suffice
int reverse_offset; // prefix sum of the weight from the edge TODO: short must suffice
unsigned packed_geometry_id; // if set, then the edge represents a packed geometry
struct {
struct
{
unsigned id : 31;
bool is_tiny : 1;
} component;
+5 -4
View File
@@ -29,10 +29,11 @@ class ExtractionContainers
void PrepareRestrictions();
void PrepareEdges(lua_State *segment_state);
void WriteNodes(std::ofstream& file_out_stream) const;
void WriteRestrictions(const std::string& restrictions_file_name) const;
void WriteEdges(std::ofstream& file_out_stream) const;
void WriteNames(const std::string& names_file_name) const;
void WriteNodes(std::ofstream &file_out_stream) const;
void WriteRestrictions(const std::string &restrictions_file_name) const;
void WriteEdges(std::ofstream &file_out_stream) const;
void WriteNames(const std::string &names_file_name) const;
public:
using STXXLNodeIDVector = stxxl::vector<OSMNodeID>;
using STXXLNodeVector = stxxl::vector<ExternalMemoryNode>;
@@ -16,10 +16,8 @@ struct FirstAndLastSegmentOfWay
OSMNodeID last_segment_target_id;
FirstAndLastSegmentOfWay()
: way_id(SPECIAL_OSM_WAYID),
first_segment_source_id(SPECIAL_OSM_NODEID),
first_segment_target_id(SPECIAL_OSM_NODEID),
last_segment_source_id(SPECIAL_OSM_NODEID),
: way_id(SPECIAL_OSM_WAYID), first_segment_source_id(SPECIAL_OSM_NODEID),
first_segment_target_id(SPECIAL_OSM_NODEID), last_segment_source_id(SPECIAL_OSM_NODEID),
last_segment_target_id(SPECIAL_OSM_NODEID)
{
}
@@ -32,19 +30,11 @@ struct FirstAndLastSegmentOfWay
static FirstAndLastSegmentOfWay min_value()
{
return {MIN_OSM_WAYID,
MIN_OSM_NODEID,
MIN_OSM_NODEID,
MIN_OSM_NODEID,
MIN_OSM_NODEID};
return {MIN_OSM_WAYID, MIN_OSM_NODEID, MIN_OSM_NODEID, MIN_OSM_NODEID, MIN_OSM_NODEID};
}
static FirstAndLastSegmentOfWay max_value()
{
return {MAX_OSM_WAYID,
MAX_OSM_NODEID,
MAX_OSM_NODEID,
MAX_OSM_NODEID,
MAX_OSM_NODEID};
return {MAX_OSM_WAYID, MAX_OSM_NODEID, MAX_OSM_NODEID, MAX_OSM_NODEID, MAX_OSM_NODEID};
}
};
+11 -11
View File
@@ -16,19 +16,19 @@ class GraphCompressor
{
using EdgeData = NodeBasedDynamicGraph::EdgeData;
public:
GraphCompressor(SpeedProfileProperties speed_profile);
public:
GraphCompressor(SpeedProfileProperties speed_profile);
void Compress(const std::unordered_set<NodeID>& barrier_nodes,
const std::unordered_set<NodeID>& traffic_lights,
RestrictionMap& restriction_map,
NodeBasedDynamicGraph& graph,
CompressedEdgeContainer& geometry_compressor);
private:
void Compress(const std::unordered_set<NodeID> &barrier_nodes,
const std::unordered_set<NodeID> &traffic_lights,
RestrictionMap &restriction_map,
NodeBasedDynamicGraph &graph,
CompressedEdgeContainer &geometry_compressor);
void PrintStatistics(unsigned original_number_of_nodes,
unsigned original_number_of_edges,
const NodeBasedDynamicGraph& graph) const;
private:
void PrintStatistics(unsigned original_number_of_nodes,
unsigned original_number_of_edges,
const NodeBasedDynamicGraph &graph) const;
SpeedProfileProperties speed_profile;
};
+24 -12
View File
@@ -37,18 +37,30 @@ struct NodeBasedEdge
struct NodeBasedEdgeWithOSM : NodeBasedEdge
{
explicit NodeBasedEdgeWithOSM(OSMNodeID source,
OSMNodeID target,
NodeID name_id,
EdgeWeight weight,
bool forward,
bool backward,
bool roundabout,
bool access_restricted,
bool startpoint,
TravelMode travel_mode,
bool is_split)
: NodeBasedEdge(SPECIAL_NODEID, SPECIAL_NODEID, name_id, weight, forward, backward, roundabout, access_restricted, startpoint, travel_mode, is_split),
osm_source_id(source), osm_target_id(target) {}
OSMNodeID target,
NodeID name_id,
EdgeWeight weight,
bool forward,
bool backward,
bool roundabout,
bool access_restricted,
bool startpoint,
TravelMode travel_mode,
bool is_split)
: NodeBasedEdge(SPECIAL_NODEID,
SPECIAL_NODEID,
name_id,
weight,
forward,
backward,
roundabout,
access_restricted,
startpoint,
travel_mode,
is_split),
osm_source_id(source), osm_target_id(target)
{
}
OSMNodeID osm_source_id;
OSMNodeID osm_target_id;
+21 -15
View File
@@ -13,7 +13,8 @@
struct InternalExtractorEdge
{
// specify the type of the weight data
enum class WeightType : char {
enum class WeightType : char
{
INVALID,
SPEED,
EDGE_DURATION,
@@ -23,9 +24,7 @@ struct InternalExtractorEdge
struct WeightData
{
WeightData() : duration(0.0), type(WeightType::INVALID)
{
}
WeightData() : duration(0.0), type(WeightType::INVALID) {}
union
{
@@ -36,8 +35,17 @@ struct InternalExtractorEdge
};
explicit InternalExtractorEdge()
: result(MIN_OSM_NODEID, MIN_OSM_NODEID, 0, 0, false, false, false, false, true,
TRAVEL_MODE_INACCESSIBLE, false)
: result(MIN_OSM_NODEID,
MIN_OSM_NODEID,
0,
0,
false,
false,
false,
false,
true,
TRAVEL_MODE_INACCESSIBLE,
false)
{
}
@@ -74,17 +82,16 @@ struct InternalExtractorEdge
// coordinate of the source node
FixedPointCoordinate source_coordinate;
// necessary static util functions for stxxl's sorting
static InternalExtractorEdge min_osm_value()
{
return InternalExtractorEdge(MIN_OSM_NODEID, MIN_OSM_NODEID, 0, WeightData(), false, false, false,
false, true, TRAVEL_MODE_INACCESSIBLE, false);
return InternalExtractorEdge(MIN_OSM_NODEID, MIN_OSM_NODEID, 0, WeightData(), false, false,
false, false, true, TRAVEL_MODE_INACCESSIBLE, false);
}
static InternalExtractorEdge max_osm_value()
{
return InternalExtractorEdge(MAX_OSM_NODEID, MAX_OSM_NODEID, 0, WeightData(), false,
false, false, false, true, TRAVEL_MODE_INACCESSIBLE, false);
return InternalExtractorEdge(MAX_OSM_NODEID, MAX_OSM_NODEID, 0, WeightData(), false, false,
false, false, true, TRAVEL_MODE_INACCESSIBLE, false);
}
static InternalExtractorEdge min_internal_value()
@@ -101,7 +108,6 @@ struct InternalExtractorEdge
v.result.target = std::numeric_limits<NodeID>::max();
return v;
}
};
struct CmpEdgeByInternalStartThenInternalTargetID
@@ -109,9 +115,9 @@ struct CmpEdgeByInternalStartThenInternalTargetID
using value_type = InternalExtractorEdge;
bool operator()(const InternalExtractorEdge &lhs, const InternalExtractorEdge &rhs) const
{
return (lhs.result.source < rhs.result.source) ||
((lhs.result.source == rhs.result.source) &&
(lhs.result.target < rhs.result.target));
return (lhs.result.source < rhs.result.source) ||
((lhs.result.source == rhs.result.source) &&
(lhs.result.target < rhs.result.target));
}
value_type max_value() { return InternalExtractorEdge::max_internal_value(); }
+6 -6
View File
@@ -12,9 +12,11 @@
struct QueryNode
{
using key_type = OSMNodeID; // type of NodeID
using value_type = int; // type of lat,lons
using value_type = int; // type of lat,lons
explicit QueryNode(int lat, int lon, OSMNodeID node_id) : lat(lat), lon(lon), node_id(node_id) {}
explicit QueryNode(int lat, int lon, OSMNodeID node_id) : lat(lat), lon(lon), node_id(node_id)
{
}
QueryNode()
: lat(std::numeric_limits<int>::max()), lon(std::numeric_limits<int>::max()),
node_id(SPECIAL_OSM_NODEID)
@@ -28,15 +30,13 @@ struct QueryNode
static QueryNode min_value()
{
return QueryNode(static_cast<int>(-90 * COORDINATE_PRECISION),
static_cast<int>(-180 * COORDINATE_PRECISION),
MIN_OSM_NODEID);
static_cast<int>(-180 * COORDINATE_PRECISION), MIN_OSM_NODEID);
}
static QueryNode max_value()
{
return QueryNode(static_cast<int>(90 * COORDINATE_PRECISION),
static_cast<int>(180 * COORDINATE_PRECISION),
MAX_OSM_NODEID);
static_cast<int>(180 * COORDINATE_PRECISION), MAX_OSM_NODEID);
}
value_type operator[](const std::size_t n) const
+1 -1
View File
@@ -52,7 +52,7 @@ struct TurnRestriction
/**
* This is just a wrapper around TurnRestriction used in the extractor.
*
*
* Could be merged with TurnRestriction. For now the type-destiction makes sense
* as the format in which the restriction is presented in the extractor and in the
* preprocessing is different. (see restriction_parser.cpp)
+1 -1
View File
@@ -64,7 +64,7 @@ template <> struct hash<RestrictionTarget>
class RestrictionMap
{
public:
RestrictionMap() : m_count(0) {};
RestrictionMap() : m_count(0){};
RestrictionMap(const std::vector<TurnRestriction> &restriction_list);
// Replace end v with w in each turn restriction containing u as via node
+7 -7
View File
@@ -3,14 +3,14 @@
struct SpeedProfileProperties
{
SpeedProfileProperties()
: traffic_signal_penalty(0), u_turn_penalty(0), has_turn_penalty_function(false)
{
}
SpeedProfileProperties()
: traffic_signal_penalty(0), u_turn_penalty(0), has_turn_penalty_function(false)
{
}
int traffic_signal_penalty;
int u_turn_penalty;
bool has_turn_penalty_function;
int traffic_signal_penalty;
int u_turn_penalty;
bool has_turn_penalty_function;
};
#endif