replace hashmap with a dummy vector based implementation as the number of tags per object is tiny

This commit is contained in:
Dennis Luxen
2014-06-23 13:21:56 +02:00
parent f99f194927
commit b06a73e893
4 changed files with 36 additions and 19 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ struct ExtractionWay
id = SPECIAL_NODEID;
nameID = INVALID_NAMEID;
path.clear();
keyVals.clear();
keyVals.Clear();
direction = ExtractionWay::notSure;
speed = -1;
backward_speed = -1;
+6 -4
View File
@@ -40,7 +40,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <osrm/Coordinate.h>
XMLParser::XMLParser(const char *filename, ExtractorCallbacks *extractor_callbacks, ScriptingEnvironment &scripting_environment)
XMLParser::XMLParser(const char *filename,
ExtractorCallbacks *extractor_callbacks,
ScriptingEnvironment &scripting_environment)
: BaseParser(extractor_callbacks, scripting_environment)
{
inputReader = inputReaderFactory(filename);
@@ -81,7 +83,8 @@ bool XMLParser::Parse()
if (use_turn_restrictions && xmlStrEqual(currentName, (const xmlChar *)"relation") == 1)
{
InputRestrictionContainer current_restriction = ReadXMLRestriction();
if ((UINT_MAX != current_restriction.fromWay) && !extractor_callbacks->ProcessRestriction(current_restriction))
if ((UINT_MAX != current_restriction.fromWay) &&
!extractor_callbacks->ProcessRestriction(current_restriction))
{
std::cerr << "[XMLParser] restriction not parsed" << std::endl;
}
@@ -135,7 +138,7 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
if (key != NULL && value != NULL)
{
if (xmlStrEqual(key, (const xmlChar *)"restriction") &&
StringStartsWith((const char*)value, "only_") )
StringStartsWith((const char *)value, "only_"))
{
restriction.restriction.flags.isOnly = true;
}
@@ -195,7 +198,6 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
xmlFree(child_name);
}
if (ShouldIgnoreRestriction(except_tag_string))
{
restriction.fromWay = UINT_MAX; // workaround to ignore the restriction
+3 -1
View File
@@ -38,7 +38,9 @@ class ExtractorCallbacks;
class XMLParser : public BaseParser
{
public:
XMLParser(const char *filename, ExtractorCallbacks *extractor_callbacks, ScriptingEnvironment &scripting_environment);
XMLParser(const char *filename,
ExtractorCallbacks *extractor_callbacks,
ScriptingEnvironment &scripting_environment);
bool ReadHeader();
bool Parse();