mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-29 17:23:47 +00:00
committed by
Konstantin Pastbin
parent
c9cbb64f12
commit
76ffc99abd
27
libs/search/feature_loader.cpp
Normal file
27
libs/search/feature_loader.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "search/feature_loader.hpp"
|
||||
|
||||
#include "editor/editable_data_source.hpp"
|
||||
|
||||
#include "indexer/feature.hpp"
|
||||
#include "indexer/feature_decl.hpp"
|
||||
|
||||
namespace search
|
||||
{
|
||||
FeatureLoader::FeatureLoader(DataSource const & dataSource) : m_dataSource(dataSource) {}
|
||||
|
||||
std::unique_ptr<FeatureType> FeatureLoader::Load(FeatureID const & id)
|
||||
{
|
||||
ASSERT(m_checker.CalledOnOriginalThread(), ());
|
||||
|
||||
auto const & mwmId = id.m_mwmId;
|
||||
if (!m_guard || m_guard->GetId() != mwmId)
|
||||
m_guard = std::make_unique<FeaturesLoaderGuard>(m_dataSource, mwmId);
|
||||
return m_guard->GetFeatureByIndex(id.m_index);
|
||||
}
|
||||
|
||||
void FeatureLoader::Reset()
|
||||
{
|
||||
ASSERT(m_checker.CalledOnOriginalThread(), ());
|
||||
m_guard.reset();
|
||||
}
|
||||
} // namespace search
|
||||
Reference in New Issue
Block a user