use a return value in Prepare::BuildEdgeExpandedGraph instead of parameter re-assignment

This commit is contained in:
Dennis Luxen 2014-08-08 13:00:39 +02:00
parent d408a64c8c
commit 27d729baf0
2 changed files with 14 additions and 15 deletions

View File

@ -161,12 +161,11 @@ int Prepare::Process(int argc, char *argv[])
DeallocatingVector<EdgeBasedEdge> edge_based_edge_list; DeallocatingVector<EdgeBasedEdge> edge_based_edge_list;
// init node_based_edge_list, edge_based_edge_list by edgeList // init node_based_edge_list, edge_based_edge_list by edgeList
BuildEdgeExpandedGraph(lua_state, number_of_edge_based_nodes = BuildEdgeExpandedGraph(lua_state,
number_of_node_based_nodes, number_of_node_based_nodes,
number_of_edge_based_nodes, node_based_edge_list,
node_based_edge_list, edge_based_edge_list,
edge_based_edge_list, speed_profile);
speed_profile);
lua_close(lua_state); lua_close(lua_state);
TIMER_STOP(expansion); TIMER_STOP(expansion);
@ -483,9 +482,8 @@ Prepare::SetupScriptingEnvironment(lua_State *lua_state,
/** /**
\brief Building an edge-expanded graph from node-based input and turn restrictions \brief Building an edge-expanded graph from node-based input and turn restrictions
*/ */
void Prepare::BuildEdgeExpandedGraph(lua_State *lua_state, std::size_t Prepare::BuildEdgeExpandedGraph(lua_State *lua_state,
NodeID number_of_node_based_nodes, NodeID number_of_node_based_nodes,
unsigned &number_of_edge_based_nodes,
std::vector<EdgeBasedNode> &node_based_edge_list, std::vector<EdgeBasedNode> &node_based_edge_list,
DeallocatingVector<EdgeBasedEdge> &edge_based_edge_list, DeallocatingVector<EdgeBasedEdge> &edge_based_edge_list,
EdgeBasedGraphFactory::SpeedProfileProperties &speed_profile) EdgeBasedGraphFactory::SpeedProfileProperties &speed_profile)
@ -514,7 +512,7 @@ void Prepare::BuildEdgeExpandedGraph(lua_State *lua_state,
traffic_light_list.clear(); traffic_light_list.clear();
traffic_light_list.shrink_to_fit(); traffic_light_list.shrink_to_fit();
number_of_edge_based_nodes = edge_based_graph_factory->GetNumberOfEdgeBasedNodes(); const std::size_t number_of_edge_based_nodes = edge_based_graph_factory->GetNumberOfEdgeBasedNodes();
BOOST_ASSERT(number_of_edge_based_nodes != std::numeric_limits<unsigned>::max()); BOOST_ASSERT(number_of_edge_based_nodes != std::numeric_limits<unsigned>::max());
#ifndef WIN32 #ifndef WIN32
@ -527,6 +525,8 @@ void Prepare::BuildEdgeExpandedGraph(lua_State *lua_state,
edge_based_graph_factory.reset(); edge_based_graph_factory.reset();
node_based_graph.reset(); node_based_graph.reset();
return number_of_edge_based_nodes;
} }
/** /**

View File

@ -33,12 +33,11 @@ class Prepare
void CheckRestrictionsFile(FingerPrint &fingerprint_orig); void CheckRestrictionsFile(FingerPrint &fingerprint_orig);
bool SetupScriptingEnvironment(lua_State *myLuaState, bool SetupScriptingEnvironment(lua_State *myLuaState,
EdgeBasedGraphFactory::SpeedProfileProperties &speed_profile); EdgeBasedGraphFactory::SpeedProfileProperties &speed_profile);
void BuildEdgeExpandedGraph(lua_State *myLuaState, std::size_t BuildEdgeExpandedGraph(lua_State *myLuaState,
NodeID nodeBasedNodeNumber, NodeID nodeBasedNodeNumber,
unsigned &nodeBasedEdgesNumber, std::vector<EdgeBasedNode> &nodeBasedEdgeList,
std::vector<EdgeBasedNode> &nodeBasedEdgeList, DeallocatingVector<EdgeBasedEdge> &edgeBasedEdgeList,
DeallocatingVector<EdgeBasedEdge> &edgeBasedEdgeList, EdgeBasedGraphFactory::SpeedProfileProperties &speed_profile);
EdgeBasedGraphFactory::SpeedProfileProperties &speed_profile);
void WriteNodeMapping(); void WriteNodeMapping();
void BuildRTree(std::vector<EdgeBasedNode> &node_based_edge_list); void BuildRTree(std::vector<EdgeBasedNode> &node_based_edge_list);