street name list is now a char array /w indices array

This commit is contained in:
Dennis Luxen
2013-08-20 17:05:36 +02:00
parent d0db09cb92
commit fb9822b507
10 changed files with 185 additions and 138 deletions
+7 -14
View File
@@ -20,14 +20,10 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "SearchEngine.h"
SearchEngine::SearchEngine(
QueryGraph * g,
NodeInformationHelpDesk * nh,
std::vector<std::string> & n
) :
_queryData(g, nh, n),
shortestPath(_queryData),
alternativePaths(_queryData)
SearchEngine::SearchEngine( QueryObjectsStorage * query_objects ) :
_queryData(query_objects),
shortestPath(_queryData),
alternativePaths(_queryData)
{}
SearchEngine::~SearchEngine() {}
@@ -73,12 +69,9 @@ NodeID SearchEngine::GetNameIDForOriginDestinationNodeID(
}
std::string SearchEngine::GetEscapedNameForNameID(const unsigned nameID) const {
bool is_name_invalid = (nameID >= _queryData.names.size() || nameID == 0);
if (is_name_invalid) {
return std::string("");
}
return HTMLEntitize(_queryData.names.at(nameID));
std::string result;
_queryData.query_objects->GetName(nameID, result);
return HTMLEntitize(result);
}
SearchEngineHeapPtr SearchEngineData::forwardHeap;
+2 -5
View File
@@ -28,6 +28,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "SearchEngineData.h"
#include "../RoutingAlgorithms/AlternativePathRouting.h"
#include "../RoutingAlgorithms/ShortestPathRouting.h"
#include "../Server/DataStructures/QueryObjectsStorage.h"
#include "../Util/StringUtil.h"
#include "../typedefs.h"
@@ -44,11 +45,7 @@ public:
ShortestPathRouting<SearchEngineData> shortestPath;
AlternativeRouting<SearchEngineData> alternativePaths;
SearchEngine(
QueryGraph * g,
NodeInformationHelpDesk * nh,
std::vector<std::string> & n
);
SearchEngine( QueryObjectsStorage * query_objects );
~SearchEngine();
void GetCoordinatesForNodeID(NodeID id, FixedPointCoordinate& result) const;
+12 -5
View File
@@ -20,8 +20,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "BinaryHeap.h"
#include "QueryEdge.h"
#include "NodeInformationHelpDesk.h"
#include "StaticGraph.h"
#include "../Server/DataStructures/QueryObjectsStorage.h"
#include "../typedefs.h"
@@ -41,10 +41,17 @@ typedef boost::thread_specific_ptr<QueryHeapType> SearchEngineHeapPtr;
struct SearchEngineData {
typedef QueryGraph Graph;
typedef QueryHeapType QueryHeap;
SearchEngineData(QueryGraph * g, NodeInformationHelpDesk * nh, std::vector<std::string> & n) :graph(g), nodeHelpDesk(nh), names(n) {}
const QueryGraph * graph;
NodeInformationHelpDesk * nodeHelpDesk;
std::vector<std::string> & names;
SearchEngineData(QueryObjectsStorage * query_objects)
:
query_objects(query_objects),
graph(query_objects->graph),
nodeHelpDesk(query_objects->nodeHelpDesk)
{}
const QueryObjectsStorage * query_objects;
const QueryGraph * graph;
const NodeInformationHelpDesk * nodeHelpDesk;
static SearchEngineHeapPtr forwardHeap;
static SearchEngineHeapPtr backwardHeap;
static SearchEngineHeapPtr forwardHeap2;