diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-10-05 11:27:00 +0300 |
---|---|---|
committer | Yuri Gorshenin <mipt.vi002@gmail.com> | 2017-10-10 16:32:21 +0300 |
commit | 385f1affebc11910c85178be2d60e858c2da8376 (patch) | |
tree | 2d1bca7ebd9e321e778233f29769c6bdc0cc8ebd /ugc/api.cpp | |
parent | a316f65f1a1c224189aecd7ff82f5ffec8872b0d (diff) |
[ugc] Deserialization + combining with serialization. And review fixes
Diffstat (limited to 'ugc/api.cpp')
-rw-r--r-- | ugc/api.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/ugc/api.cpp b/ugc/api.cpp index 076df47507..523f47fc4d 100644 --- a/ugc/api.cpp +++ b/ugc/api.cpp @@ -1,5 +1,7 @@ #include "ugc/api.hpp" +#include "indexer/feature.hpp" + #include "platform/platform.hpp" #include <chrono> @@ -9,7 +11,11 @@ using namespace ugc; namespace ugc { -Api::Api(Index const & index, std::string const & filename) : m_index(index), m_storage(filename) {} +Api::Api(Index const & index, std::string const & filename) + : m_storage(filename) +, m_loader(index) +{ +} void Api::GetUGC(FeatureID const & id, UGCCallback callback) { @@ -23,17 +29,18 @@ void Api::SetUGCUpdate(FeatureID const & id, UGCUpdate const & ugc) void Api::GetUGCImpl(FeatureID const & id, UGCCallback callback) { - // TODO (@y, @mgsergio): retrieve static UGC - UGC ugc; - UGCUpdate update; - if (!id.IsValid()) { - GetPlatform().RunOnGuiThread([ugc, update, callback] { callback(ugc, update); }); + GetPlatform().RunOnGuiThread([callback] { callback({}, {}); }); return; } - // ugc = MakeTestUGC1(); + UGC ugc; + UGCUpdate update; + + m_storage.GetUGCUpdate(id, update); + m_loader.GetUGC(id, ugc); + GetPlatform().RunOnGuiThread([ugc, update, callback] { callback(ugc, update); }); } |