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:
authorMaxim Pimenov <m@maps.me>2016-01-27 15:38:02 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:16:43 +0300
commita038f7cc6b468603d4aa329af830fe45c896fe63 (patch)
treeb54ded608148db6bb685c732855cc0e97d36fb52 /platform
parent669636ec86cfbcab4e0a49ebe5716cfad2ed17ae (diff)
Moved mwm_traits from search to platform.
Diffstat (limited to 'platform')
-rw-r--r--platform/mwm_traits.cpp44
-rw-r--r--platform/mwm_traits.hpp53
-rw-r--r--platform/platform.pro2
3 files changed, 99 insertions, 0 deletions
diff --git a/platform/mwm_traits.cpp b/platform/mwm_traits.cpp
new file mode 100644
index 0000000000..3d9cdc47df
--- /dev/null
+++ b/platform/mwm_traits.cpp
@@ -0,0 +1,44 @@
+#include "mwm_traits.hpp"
+
+#include "base/logging.hpp"
+
+namespace version
+{
+MwmTraits::MwmTraits(version::Format versionFormat) : m_versionFormat(versionFormat) {}
+
+MwmTraits::SearchIndexFormat MwmTraits::GetSearchIndexFormat() const
+{
+ if (m_versionFormat < version::Format::v7)
+ return SearchIndexFormat::FeaturesWithRankAndCenter;
+ return SearchIndexFormat::CompressedBitVector;
+}
+
+MwmTraits::HouseToStreetTableFormat MwmTraits::GetHouseToStreetTableFormat() const
+{
+ if (m_versionFormat < version::Format::v7)
+ return HouseToStreetTableFormat::Unknown;
+ return HouseToStreetTableFormat::Fixed3BitsDDVector;
+}
+
+string DebugPrint(MwmTraits::SearchIndexFormat format)
+{
+ switch (format)
+ {
+ case MwmTraits::SearchIndexFormat::FeaturesWithRankAndCenter:
+ return "FeaturesWithRankAndCenter";
+ case MwmTraits::SearchIndexFormat::CompressedBitVector:
+ return "CompressedBitVector";
+ }
+}
+
+string DebugPrint(MwmTraits::HouseToStreetTableFormat format)
+{
+ switch (format)
+ {
+ case MwmTraits::HouseToStreetTableFormat::Fixed3BitsDDVector:
+ return "Fixed3BitsDDVector";
+ case MwmTraits::HouseToStreetTableFormat::Unknown:
+ return "Unknown";
+ }
+}
+} // namespace version
diff --git a/platform/mwm_traits.hpp b/platform/mwm_traits.hpp
new file mode 100644
index 0000000000..8f559018b8
--- /dev/null
+++ b/platform/mwm_traits.hpp
@@ -0,0 +1,53 @@
+#pragma once
+
+#include "platform/mwm_version.hpp"
+
+#include "std/string.hpp"
+
+namespace version
+{
+// This is a wrapper around mwm's version. Allows users to get
+// information about versions of some data structures in mwm.
+class MwmTraits
+{
+public:
+ enum class SearchIndexFormat
+ {
+ // A list of features with their ranks and centers
+ // is stored behind every node of the search trie.
+ // This format corresponds to ValueList<FeatureWithRankAndCenter>.
+ FeaturesWithRankAndCenter,
+
+ // A compressed bit vector of feature indices is
+ // stored behind every node of the search trie.
+ // This format corresponds to ValueList<FeatureIndexValue>.
+ CompressedBitVector,
+ };
+
+ enum class HouseToStreetTableFormat
+ {
+ // An array of elements where i-th element is an index of a street
+ // in a vector returned by ReverseGeocoder::GetNearbyStreets() for
+ // the i-th feature. Each element normally fits into 3 bits, but
+ // there can be exceptions, and these exceptions are stored in a
+ // separate table. See ReverseGeocoder and FixedBitsDDVector for
+ // details.
+ Fixed3BitsDDVector,
+
+ // The format of relation is unknown. Most likely, an error has occured.
+ Unknown
+ };
+
+ MwmTraits(version::Format versionFormat);
+
+ SearchIndexFormat GetSearchIndexFormat() const;
+
+ HouseToStreetTableFormat GetHouseToStreetTableFormat() const;
+
+private:
+ version::Format m_versionFormat;
+};
+
+string DebugPrint(MwmTraits::SearchIndexFormat format);
+string DebugPrint(MwmTraits::HouseToStreetTableFormat format);
+} // namespace version
diff --git a/platform/platform.pro b/platform/platform.pro
index b3e4954d45..24ff9fb2d6 100644
--- a/platform/platform.pro
+++ b/platform/platform.pro
@@ -70,6 +70,7 @@ HEADERS += \
local_country_file_utils.hpp \
location.hpp \
measurement_utils.hpp \
+ mwm_traits.hpp \
mwm_version.hpp \
platform.hpp \
preferred_languages.hpp \
@@ -86,6 +87,7 @@ SOURCES += \
local_country_file.cpp \
local_country_file_utils.cpp \
measurement_utils.cpp \
+ mwm_traits.cpp \
mwm_version.cpp \
platform.cpp \
preferred_languages.cpp \