Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2016-01-21 19:10:25 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:14:23 +0300
commit5d2b838aa1d98c62b530a074db35007f788cd350 (patch)
treed1b9cf199fd374af243db2a9be0adeaa66708326 /indexer/ftypes_matcher.cpp
parentd1cdbcd973ad357e92308c5c5c23714545473ef7 (diff)
IsBuildingPartChecker optimization.
Diffstat (limited to 'indexer/ftypes_matcher.cpp')
-rw-r--r--indexer/ftypes_matcher.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp
index 968062f41a..4a990d15e0 100644
--- a/indexer/ftypes_matcher.cpp
+++ b/indexer/ftypes_matcher.cpp
@@ -224,8 +224,9 @@ IsLocalityChecker::IsLocalityChecker()
m_types.push_back(c.GetTypeByPath(vector<string>(arr[i], arr[i] + 2)));
}
-IsBuildingPartChecker::IsBuildingPartChecker() : BaseChecker(3)
+IsBuildingPartChecker::IsBuildingPartChecker() : BaseChecker(1)
{
+ m_types.push_back(classif().GetTypeByPath({"building:part"}));
}
IsBuildingPartChecker const & IsBuildingPartChecker::Instance()
@@ -234,11 +235,6 @@ IsBuildingPartChecker const & IsBuildingPartChecker::Instance()
return inst;
}
-bool IsBuildingPartChecker::IsMatched(uint32_t type) const
-{
- return IsTypeConformed(type, {"building:part"});
-}
-
IsBridgeChecker::IsBridgeChecker() : BaseChecker(3)
{
}
@@ -333,23 +329,24 @@ uint32_t GetPopulationByRadius(double r)
return my::rounds(pow(r / 550.0, 3.6));
}
-bool IsTypeConformed(uint32_t type, vector<string> const & path)
+bool IsTypeConformed(uint32_t type, StringIL const & path)
{
- Classificator const & c = classif();
- ClassifObject const * p = c.GetRoot();
+ ClassifObject const * p = classif().GetRoot();
ASSERT(p, ());
uint8_t val = 0, i = 0;
- for (auto const & n : path)
+ for (char const * s : path)
{
if (!ftype::GetValue(type, i, val))
return false;
+
p = p->GetObject(val);
if (p == 0)
return false;
- string const name = p->GetName();
- if (n != name && n != "*")
+
+ if (p->GetName() != s && strcmp(s, "*") != 0)
return false;
+
++i;
}
return true;