mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -38,13 +38,15 @@ std::string DebugPrint(WeightsLoadState state);
|
||||
} // namespace connector
|
||||
|
||||
/// @param CrossMwmId Encoded OSM feature (way) ID that should be equal and unique in all MWMs.
|
||||
template <typename CrossMwmId> class CrossMwmConnector final
|
||||
template <typename CrossMwmId>
|
||||
class CrossMwmConnector final
|
||||
{
|
||||
public:
|
||||
/// Should initialize with some valid mwm id here not to conflict with @see JointSegment::IsFake().
|
||||
explicit CrossMwmConnector(NumMwmId mwmId = kGeneratorMwmId) : m_mwmId(mwmId) {}
|
||||
|
||||
template <class FnT> void ForEachTransitSegmentId(uint32_t featureId, FnT && fn) const
|
||||
template <class FnT>
|
||||
void ForEachTransitSegmentId(uint32_t featureId, FnT && fn) const
|
||||
{
|
||||
auto it = std::lower_bound(m_transitions.begin(), m_transitions.end(), Key{featureId, 0}, LessKT());
|
||||
while (it != m_transitions.end() && it->first.m_featureId == featureId)
|
||||
@@ -75,10 +77,7 @@ public:
|
||||
return isEnter != isOutgoing;
|
||||
}
|
||||
|
||||
CrossMwmId const & GetCrossMwmId(Segment const & segment) const
|
||||
{
|
||||
return GetTransition(segment).m_crossMwmId;
|
||||
}
|
||||
CrossMwmId const & GetCrossMwmId(Segment const & segment) const { return GetTransition(segment).m_crossMwmId; }
|
||||
|
||||
/// @return {} if there is no transition for such cross mwm id.
|
||||
std::optional<Segment> GetTransition(CrossMwmId const & crossMwmId, uint32_t segmentIdx, bool isEnter) const
|
||||
@@ -115,7 +114,8 @@ public:
|
||||
|
||||
using EdgeListT = SmallList<SegmentEdge>;
|
||||
|
||||
template <class FnT> void ForEachEnter(FnT && fn) const
|
||||
template <class FnT>
|
||||
void ForEachEnter(FnT && fn) const
|
||||
{
|
||||
for (auto const & [key, transit] : m_transitions)
|
||||
{
|
||||
@@ -127,7 +127,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template <class FnT> void ForEachExit(FnT && fn) const
|
||||
template <class FnT>
|
||||
void ForEachExit(FnT && fn) const
|
||||
{
|
||||
for (auto const & [key, transit] : m_transitions)
|
||||
{
|
||||
@@ -143,18 +144,14 @@ public:
|
||||
{
|
||||
auto const enterIdx = GetTransition(segment).m_enterIdx;
|
||||
ForEachExit([enterIdx, this, &edges](uint32_t exitIdx, Segment const & s)
|
||||
{
|
||||
AddEdge(s, enterIdx, exitIdx, edges);
|
||||
});
|
||||
{ AddEdge(s, enterIdx, exitIdx, edges); });
|
||||
}
|
||||
|
||||
void GetIngoingEdgeList(Segment const & segment, EdgeListT & edges) const
|
||||
{
|
||||
auto const exitIdx = GetTransition(segment).m_exitIdx;
|
||||
ForEachEnter([exitIdx, this, &edges](uint32_t enterIdx, Segment const & s)
|
||||
{
|
||||
AddEdge(s, enterIdx, exitIdx, edges);
|
||||
});
|
||||
{ AddEdge(s, enterIdx, exitIdx, edges); });
|
||||
}
|
||||
|
||||
RouteWeight GetWeightSure(Segment const & from, Segment const & to) const
|
||||
@@ -204,13 +201,12 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
template <class T> friend class CrossMwmConnectorBuilder;
|
||||
template <class T>
|
||||
friend class CrossMwmConnectorBuilder;
|
||||
|
||||
struct Key
|
||||
{
|
||||
Key(uint32_t featureId, uint32_t segmentIdx) : m_featureId(featureId), m_segmentIdx(segmentIdx)
|
||||
{
|
||||
}
|
||||
Key(uint32_t featureId, uint32_t segmentIdx) : m_featureId(featureId), m_segmentIdx(segmentIdx) {}
|
||||
|
||||
bool operator==(Key const & key) const
|
||||
{
|
||||
@@ -236,8 +232,7 @@ private:
|
||||
, m_crossMwmId(crossMwmId)
|
||||
, m_oneWay(oneWay)
|
||||
, m_forwardIsEnter(forwardIsEnter)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
uint32_t m_enterIdx;
|
||||
uint32_t m_exitIdx;
|
||||
@@ -279,18 +274,9 @@ private:
|
||||
using KeyTransitionT = std::pair<Key, Transition>;
|
||||
struct LessKT
|
||||
{
|
||||
bool operator()(KeyTransitionT const & l, KeyTransitionT const & r) const
|
||||
{
|
||||
return l.first < r.first;
|
||||
}
|
||||
bool operator()(KeyTransitionT const & l, Key const & r) const
|
||||
{
|
||||
return l.first < r;
|
||||
}
|
||||
bool operator()(Key const & l, KeyTransitionT const & r) const
|
||||
{
|
||||
return l < r.first;
|
||||
}
|
||||
bool operator()(KeyTransitionT const & l, KeyTransitionT const & r) const { return l.first < r.first; }
|
||||
bool operator()(KeyTransitionT const & l, Key const & r) const { return l.first < r; }
|
||||
bool operator()(Key const & l, KeyTransitionT const & r) const { return l < r.first; }
|
||||
};
|
||||
std::vector<KeyTransitionT> m_transitions;
|
||||
|
||||
@@ -321,7 +307,6 @@ private:
|
||||
bool Get(uint32_t idx, WeightT & weight) const
|
||||
{
|
||||
if (m_version < 2)
|
||||
{
|
||||
if (m_v1.Has(idx))
|
||||
{
|
||||
weight = m_v1.Get(idx);
|
||||
@@ -329,11 +314,8 @@ private:
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_v2->Get(idx, weight);
|
||||
}
|
||||
}
|
||||
|
||||
} m_weights;
|
||||
|
||||
Reference in New Issue
Block a user