break out OriginalEdgeData class into its own include
This commit is contained in:
parent
dd104a49f6
commit
ca17efd764
@ -36,6 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "../DataStructures/EdgeBasedNode.h"
|
#include "../DataStructures/EdgeBasedNode.h"
|
||||||
#include "../DataStructures/HashTable.h"
|
#include "../DataStructures/HashTable.h"
|
||||||
#include "../DataStructures/ImportEdge.h"
|
#include "../DataStructures/ImportEdge.h"
|
||||||
|
#include "../DataStructures/OriginalEdgeData.h"
|
||||||
#include "../DataStructures/Percent.h"
|
#include "../DataStructures/Percent.h"
|
||||||
#include "../DataStructures/QueryEdge.h"
|
#include "../DataStructures/QueryEdge.h"
|
||||||
#include "../DataStructures/TurnInstructions.h"
|
#include "../DataStructures/TurnInstructions.h"
|
||||||
|
@ -28,32 +28,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef QUERYEDGE_H_
|
#ifndef QUERYEDGE_H_
|
||||||
#define QUERYEDGE_H_
|
#define QUERYEDGE_H_
|
||||||
|
|
||||||
#include "TurnInstructions.h"
|
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
struct OriginalEdgeData{
|
|
||||||
explicit OriginalEdgeData(
|
|
||||||
NodeID viaNode,
|
|
||||||
unsigned nameID,
|
|
||||||
TurnInstruction turnInstruction
|
|
||||||
) : viaNode(viaNode), nameID(nameID), turnInstruction(turnInstruction) {}
|
|
||||||
OriginalEdgeData() : viaNode(UINT_MAX), nameID(UINT_MAX), turnInstruction(UCHAR_MAX) {}
|
|
||||||
NodeID viaNode;
|
|
||||||
unsigned nameID;
|
|
||||||
TurnInstruction turnInstruction;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct QueryEdge {
|
struct QueryEdge {
|
||||||
NodeID source;
|
NodeID source;
|
||||||
NodeID target;
|
NodeID target;
|
||||||
struct EdgeData {
|
struct EdgeData {
|
||||||
NodeID id:31;
|
NodeID id:31;
|
||||||
bool shortcut:1;
|
bool shortcut:1;
|
||||||
int distance:30;
|
int distance:30;
|
||||||
bool forward:1;
|
bool forward:1;
|
||||||
bool backward:1;
|
bool backward:1;
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
bool operator<( const QueryEdge& right ) const {
|
bool operator<( const QueryEdge& right ) const {
|
||||||
@ -64,9 +51,14 @@ struct QueryEdge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool operator== ( const QueryEdge& right ) const {
|
bool operator== ( const QueryEdge& right ) const {
|
||||||
return ( source == right.source && target == right.target && data.distance == right.data.distance &&
|
return (
|
||||||
data.shortcut == right.data.shortcut && data.forward == right.data.forward && data.backward == right.data.backward
|
source == right.source &&
|
||||||
&& data.id == right.data.id
|
target == right.target &&
|
||||||
|
data.distance == right.data.distance &&
|
||||||
|
data.shortcut == right.data.shortcut &&
|
||||||
|
data.forward == right.data.forward &&
|
||||||
|
data.backward == right.data.backward &&
|
||||||
|
data.id == right.data.id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "BaseDataFacade.h"
|
#include "BaseDataFacade.h"
|
||||||
|
|
||||||
#include "../../DataStructures/Coordinate.h"
|
#include "../../DataStructures/Coordinate.h"
|
||||||
|
#include "../../DataStructures/OriginalEdgeData.h"
|
||||||
#include "../../DataStructures/QueryNode.h"
|
#include "../../DataStructures/QueryNode.h"
|
||||||
#include "../../DataStructures/QueryEdge.h"
|
#include "../../DataStructures/QueryEdge.h"
|
||||||
#include "../../DataStructures/SharedMemoryVectorWrapper.h"
|
#include "../../DataStructures/SharedMemoryVectorWrapper.h"
|
||||||
@ -154,9 +155,9 @@ private:
|
|||||||
(char*)&(current_edge_data),
|
(char*)&(current_edge_data),
|
||||||
sizeof(OriginalEdgeData)
|
sizeof(OriginalEdgeData)
|
||||||
);
|
);
|
||||||
m_via_node_list[i] = current_edge_data.viaNode;
|
m_via_node_list[i] = current_edge_data.via_node;
|
||||||
m_name_ID_list[i] = current_edge_data.nameID;
|
m_name_ID_list[i] = current_edge_data.name_id;
|
||||||
m_turn_instruction_list[i] = current_edge_data.turnInstruction;
|
m_turn_instruction_list[i] = current_edge_data.turn_instruction;
|
||||||
}
|
}
|
||||||
edges_input_stream.close();
|
edges_input_stream.close();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
|
||||||
|
|
||||||
RequestHandler::RequestHandler() : routing_machine(NULL) { }
|
RequestHandler::RequestHandler() : routing_machine(NULL) { }
|
||||||
|
|
||||||
@ -60,14 +59,14 @@ void RequestHandler::handle_request(const http::Request& req, http::Reply& rep){
|
|||||||
req.referrer << ( 0 == req.referrer.length() ? "- " :" ") <<
|
req.referrer << ( 0 == req.referrer.length() ? "- " :" ") <<
|
||||||
req.agent << ( 0 == req.agent.length() ? "- " :" ") << req.uri;
|
req.agent << ( 0 == req.agent.length() ? "- " :" ") << req.uri;
|
||||||
|
|
||||||
RouteParameters routeParameters;
|
RouteParameters route_parameters;
|
||||||
APIGrammarParser apiParser(&routeParameters);
|
APIGrammarParser api_parser(&route_parameters);
|
||||||
|
|
||||||
std::string::iterator it = request.begin();
|
std::string::iterator it = request.begin();
|
||||||
const bool result = boost::spirit::qi::parse(
|
const bool result = boost::spirit::qi::parse(
|
||||||
it,
|
it,
|
||||||
request.end(),
|
request.end(),
|
||||||
apiParser
|
api_parser
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( !result || (it != request.end()) ) {
|
if ( !result || (it != request.end()) ) {
|
||||||
@ -93,10 +92,10 @@ void RequestHandler::handle_request(const http::Request& req, http::Reply& rep){
|
|||||||
routing_machine != NULL,
|
routing_machine != NULL,
|
||||||
"pointer not init'ed"
|
"pointer not init'ed"
|
||||||
);
|
);
|
||||||
routing_machine->RunQuery(routeParameters, rep);
|
routing_machine->RunQuery(route_parameters, rep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch(std::exception& e) {
|
} catch(const std::exception& e) {
|
||||||
rep = http::Reply::StockReply(http::Reply::internalServerError);
|
rep = http::Reply::StockReply(http::Reply::internalServerError);
|
||||||
SimpleLogger().Write(logWARNING) <<
|
SimpleLogger().Write(logWARNING) <<
|
||||||
"[server error] code: " << e.what() << ", uri: " << req.uri;
|
"[server error] code: " << e.what() << ", uri: " << req.uri;
|
||||||
|
@ -25,6 +25,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "DataStructures/OriginalEdgeData.h"
|
||||||
#include "DataStructures/QueryEdge.h"
|
#include "DataStructures/QueryEdge.h"
|
||||||
#include "DataStructures/SharedMemoryFactory.h"
|
#include "DataStructures/SharedMemoryFactory.h"
|
||||||
#include "DataStructures/SharedMemoryVectorWrapper.h"
|
#include "DataStructures/SharedMemoryVectorWrapper.h"
|
||||||
@ -324,9 +325,9 @@ int main( const int argc, const char * argv[] ) {
|
|||||||
(char*)&(current_edge_data),
|
(char*)&(current_edge_data),
|
||||||
sizeof(OriginalEdgeData)
|
sizeof(OriginalEdgeData)
|
||||||
);
|
);
|
||||||
via_node_ptr[i] = current_edge_data.viaNode;
|
via_node_ptr[i] = current_edge_data.via_node;
|
||||||
name_id_ptr[i] = current_edge_data.nameID;
|
name_id_ptr[i] = current_edge_data.name_id;
|
||||||
turn_instructions_ptr[i] = current_edge_data.turnInstruction;
|
turn_instructions_ptr[i] = current_edge_data.turn_instruction;
|
||||||
}
|
}
|
||||||
edges_input_stream.close();
|
edges_input_stream.close();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user