From c906283f65820431aae4ea92d2f4bb01a1656cc2 Mon Sep 17 00:00:00 2001 From: Lev Dragunov Date: Thu, 2 Jul 2015 10:33:32 +0300 Subject: [PATCH] kInvalidFid constant extraction --- routing/osrm2feature_map.cpp | 2 +- routing/osrm2feature_map.hpp | 4 ++-- routing/osrm_engine.cpp | 4 ++-- routing/osrm_router.cpp | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/routing/osrm2feature_map.cpp b/routing/osrm2feature_map.cpp index eecf720126..98b05367eb 100644 --- a/routing/osrm2feature_map.cpp +++ b/routing/osrm2feature_map.cpp @@ -281,7 +281,7 @@ void OsrmFtSegMappingBuilder::Append(TOsrmNodeId nodeId, FtSegVectorT const & da size_t const count = data.size(); if (count == 0) - m_buffer.emplace_back(OsrmMappingTypes::FtSeg(OsrmMappingTypes::FtSeg::INVALID_FID, 0, 1).Store()); + m_buffer.emplace_back(OsrmMappingTypes::FtSeg(kInvalidFid, 0, 1).Store()); else { for (size_t i = 0; i < count; ++i) diff --git a/routing/osrm2feature_map.hpp b/routing/osrm2feature_map.hpp index c3c599a9bd..3e592a8949 100644 --- a/routing/osrm2feature_map.hpp +++ b/routing/osrm2feature_map.hpp @@ -26,6 +26,7 @@ namespace routing typedef uint32_t TOsrmNodeId; typedef vector TNodesList; extern TOsrmNodeId const INVALID_NODE_ID; +constexpr uint32_t kInvalidFid = numeric_limits::max(); namespace OsrmMappingTypes { #pragma pack (push, 1) @@ -35,7 +36,6 @@ namespace OsrmMappingTypes { uint16_t m_pointStart; uint16_t m_pointEnd; - static constexpr uint32_t INVALID_FID = numeric_limits::max(); // No need to initialize something her (for vector). FtSeg() {} @@ -57,7 +57,7 @@ namespace OsrmMappingTypes { bool IsValid() const { - return m_fid != INVALID_FID; + return m_fid != kInvalidFid; } void Swap(FtSeg & other) diff --git a/routing/osrm_engine.cpp b/routing/osrm_engine.cpp index 83b8e282fa..f6b47914e6 100644 --- a/routing/osrm_engine.cpp +++ b/routing/osrm_engine.cpp @@ -101,7 +101,7 @@ FeatureGraphNode::FeatureGraphNode(NodeID const nodeId, bool const isStartNode, node.forward_offset = 0; node.reverse_offset = 0; node.name_id = 1; - segment.m_fid = OsrmMappingTypes::FtSeg::INVALID_FID; + segment.m_fid = kInvalidFid; } FeatureGraphNode::FeatureGraphNode() @@ -113,7 +113,7 @@ FeatureGraphNode::FeatureGraphNode() node.forward_offset = 0; node.reverse_offset = 0; node.name_id = 1; - segment.m_fid = OsrmMappingTypes::FtSeg::INVALID_FID; + segment.m_fid = kInvalidFid; segmentPoint = m2::PointD::Zero(); } diff --git a/routing/osrm_router.cpp b/routing/osrm_router.cpp index 174bc08315..10d451365a 100644 --- a/routing/osrm_router.cpp +++ b/routing/osrm_router.cpp @@ -98,7 +98,7 @@ public: uint32_t m_fid; m2::PointD m_point; - Candidate() : m_dist(numeric_limits::max()), m_fid(OsrmMappingTypes::FtSeg::INVALID_FID) {} + Candidate() : m_dist(numeric_limits::max()), m_fid(kInvalidFid) {} }; static void FindNearestSegment(FeatureType const & ft, m2::PointD const & point, Candidate & res) @@ -149,7 +149,7 @@ public: m_mwmId = ft.GetID().m_mwmId; ASSERT_EQUAL(m_mwmId, ft.GetID().m_mwmId, ()); - if (res.m_fid != OsrmMappingTypes::FtSeg::INVALID_FID) + if (res.m_fid != kInvalidFid) m_candidates.push_back(res); } @@ -424,7 +424,7 @@ void FindGraphNodeOffsets(size_t const nodeId, m2::PointD const & point, best = mappedSeg; } - CHECK(best.m_fid != OsrmMappingTypes::FtSeg::INVALID_FID, ()); + CHECK_NOT_EQUAL(best.m_fid, kInvalidFid, ()); graphNode.segment.m_fid = best.m_fid; graphNode.segment.m_pointStart = best.m_segIdx;