From 4c3a835ace21a3d8b4b7e81e4c2323402d7fb2b7 Mon Sep 17 00:00:00 2001 From: Olga Khlopkova Date: Wed, 25 Mar 2020 17:34:21 +0300 Subject: [PATCH] [routing] Feature ids interval for guides. --- routing/fake_feature_ids.cpp | 2 ++ routing/fake_feature_ids.hpp | 30 +++++++++++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/routing/fake_feature_ids.cpp b/routing/fake_feature_ids.cpp index 6d8ae98526..a7f0b690ea 100644 --- a/routing/fake_feature_ids.cpp +++ b/routing/fake_feature_ids.cpp @@ -8,4 +8,6 @@ uint32_t constexpr FakeFeatureIds::kIndexGraphStarterId; uint32_t constexpr FakeFeatureIds::k24BitsOffset; // static uint32_t constexpr FakeFeatureIds::kTransitGraphFeaturesStart; +// static +uint32_t constexpr FakeFeatureIds::kGuidesGraphFeaturesStart; } // namespace routing diff --git a/routing/fake_feature_ids.hpp b/routing/fake_feature_ids.hpp index 8556aa1853..268f223faa 100644 --- a/routing/fake_feature_ids.hpp +++ b/routing/fake_feature_ids.hpp @@ -15,20 +15,36 @@ struct FakeFeatureIds !feature::FakeFeatureIds::IsEditorCreatedFeature(id); } + static bool IsGuidesFeature(uint32_t id) + { + return id >= kGuidesGraphFeaturesStart && id < kTransitGraphFeaturesStart; + } + static uint32_t constexpr kIndexGraphStarterId = std::numeric_limits::max(); - // It's important that |kTransitGraphFeaturesStart| is greater than maximum number of real road - // feature id. Also transit fake feature id should not overlap with real feature id and editor - // feature ids. + // It's important that |kGuidesGraphFeaturesStart| is greater than maximum number of real road + // feature id. Also transit and guides fake feature id should not overlap with real feature id + // and editor feature ids. static uint32_t constexpr k24BitsOffset = 0xffffff; static uint32_t constexpr kTransitGraphFeaturesStart = std::numeric_limits::max() - k24BitsOffset; + static uint32_t constexpr kGuidesGraphFeaturesStart = kTransitGraphFeaturesStart - k24BitsOffset; }; static_assert(feature::FakeFeatureIds::kEditorCreatedFeaturesStart > - FakeFeatureIds::kTransitGraphFeaturesStart && - feature::FakeFeatureIds::kEditorCreatedFeaturesStart - - FakeFeatureIds::kTransitGraphFeaturesStart >= - FakeFeatureIds::k24BitsOffset - feature::FakeFeatureIds::k20BitsOffset, + FakeFeatureIds::kTransitGraphFeaturesStart, + "routing::FakeFeatureIds::kTransitGraphFeaturesStart or " + "feature::FakeFeatureIds::kEditorCreatedFeaturesStart was changed. " + "Interval for transit fake features may be too small."); + +static_assert(FakeFeatureIds::kTransitGraphFeaturesStart > + FakeFeatureIds::kGuidesGraphFeaturesStart, + "routing::FakeFeatureIds::kTransitGraphFeaturesStart or " + "feature::FakeFeatureIds::kGuidesGraphFeaturesStart was changed. " + "Interval for guides fake features may be too small."); + +static_assert(feature::FakeFeatureIds::kEditorCreatedFeaturesStart - + FakeFeatureIds::kTransitGraphFeaturesStart >= + FakeFeatureIds::k24BitsOffset - feature::FakeFeatureIds::k20BitsOffset, "routing::FakeFeatureIds::kTransitGraphFeaturesStart or " "feature::FakeFeatureIds::kEditorCreatedFeaturesStart was changed. " "Interval for transit fake features may be too small.");