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:
authorgorshenin <y.gorshenin@corp.mail.ru>2015-07-01 16:48:58 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:53:27 +0300
commita7bcdb5ae8b8e75c1a3806b00b19f3b80c72c5b3 (patch)
treee24caedef110b579fcedc15d29c62cc43e3f6d9c /map/feature_vec_model.hpp
parente0470160313b3ed0bc396ffec72b16fded6b8520 (diff)
Revert "[storage, framework, index] Storage redesign. Plain strings are replaced to CountryFile and LocalCountryFile."
Diffstat (limited to 'map/feature_vec_model.hpp')
-rw-r--r--map/feature_vec_model.hpp60
1 files changed, 31 insertions, 29 deletions
diff --git a/map/feature_vec_model.hpp b/map/feature_vec_model.hpp
index 9698d5a745..b671ba0721 100644
--- a/map/feature_vec_model.hpp
+++ b/map/feature_vec_model.hpp
@@ -15,7 +15,7 @@ namespace model
{
//#define USE_BUFFER_READER
-class FeaturesFetcher : public Index::Observer
+ class FeaturesFetcher
{
public:
#ifdef USE_BUFFER_READER
@@ -24,56 +24,58 @@ class FeaturesFetcher : public Index::Observer
typedef ModelReaderPtr ReaderT;
#endif
- typedef function<void(platform::LocalCountryFile const &)> TMapDeregisteredCallback;
-
private:
m2::RectD m_rect;
Index m_multiIndex;
- TMapDeregisteredCallback m_onMapDeregistered;
-
public:
- FeaturesFetcher();
-
- virtual ~FeaturesFetcher();
-
void InitClassificator();
- inline void SetOnMapDeregisteredCallback(TMapDeregisteredCallback const & callback)
- {
- m_onMapDeregistered = callback;
- }
-
/// Registers a new map.
///
- /// \return A pair of an MwmLock and a flag. There are three cases:
- /// * the map is newer than the newest registered - returns
- /// active lock and set flag
- /// * the map is older than the newest registered - returns inactive lock and
- /// unset flag.
- /// * the version of the map equals to the version of the newest registered -
- /// returns active lock and unset flag.
- WARN_UNUSED_RESULT pair<MwmSet::MwmLock, bool> RegisterMap(
- platform::LocalCountryFile const & localFile);
+ /// \return A pair of an MwmLock and a flag. MwmLock is locked iff the
+ /// map with fileName was created or already exists. Flag
+ /// is set when the map was registered for a first
+ /// time. Thus, there are three main cases:
+ ///
+ /// * the map already exists - returns active lock and unset flag
+ /// * the map was already registered - returns active lock and set flag
+ /// * the map can't be registered - returns inactive lock and unset flag
+ WARN_UNUSED_RESULT pair<MwmSet::MwmLock, bool> RegisterMap(string const & file);
/// Deregisters a map denoted by file from internal records.
- bool DeregisterMap(platform::CountryFile const & countryFile);
+ void DeregisterMap(string const & file);
/// Deregisters all registered maps.
void DeregisterAllMaps();
+ /// Deletes all files related to map denoted by file.
+ ///
+ /// \return True if a map was successfully deleted.
+ bool DeleteMap(string const & file);
+
+ /// Replaces a map file corresponding to fileName with a new one, when
+ /// it's possible - no clients of the map file. Otherwise, update
+ /// will be delayed.
+ ///
+ /// \return * the map file have been updated - returns active lock and
+ /// UPDATE_STATUS_OK
+ /// * update is delayed because the map is busy - returns active lock and
+ /// UPDATE_STATUS_UPDATE_DELAYED
+ /// * the file isn't suitable for update - returns inactive lock and
+ /// UPDATE_STATUS_BAD_FILE
+ WARN_UNUSED_RESULT pair<MwmSet::MwmLock, Index::UpdateStatus> UpdateMap(string const & file);
+ //@}
+
//void Clean();
void ClearCaches();
- inline bool IsLoaded(string const & countryFileName) const
+ inline bool IsLoaded(string const & fName) const
{
- return m_multiIndex.IsLoaded(platform::CountryFile(countryFileName));
+ return m_multiIndex.IsLoaded(fName);
}
- // Index::Observer overrides:
- void OnMapDeregistered(platform::LocalCountryFile const & localFile) override;
-
//bool IsLoaded(m2::PointD const & pt) const;
/// @name Features enumeration.