MCPcopy Create free account
hub / github.com/comaps/comaps / Append

Method Append

libs/routing/fake_graph.cpp:44–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void FakeGraph::Append(FakeGraph const & rhs)
45{
46 std::map<Segment, FakeVertex> intersection;
47 typename std::map<Segment, FakeVertex>::iterator intersectionIt(intersection.begin());
48
49 std::set_intersection(m_segmentToVertex.begin(), m_segmentToVertex.end(), rhs.m_segmentToVertex.begin(),
50 rhs.m_segmentToVertex.end(), std::inserter(intersection, intersectionIt),
51 base::LessBy(&std::pair<Segment, FakeVertex>::first));
52
53 size_t countEqual = 0;
54 for (auto const & segmentVertexPair : intersection)
55 {
56 auto const it = m_fakeToReal.find(segmentVertexPair.first);
57 if (it == m_fakeToReal.cend() || !FakeFeatureIds::IsGuidesFeature(it->second.GetFeatureId()))
58 countEqual++;
59 }
60
61 CHECK_EQUAL(countEqual, 0, ("Fake segments are not unique."));
62
63 m_segmentToVertex.insert(rhs.m_segmentToVertex.begin(), rhs.m_segmentToVertex.end());
64 m_vertexToSegment.insert(rhs.m_vertexToSegment.begin(), rhs.m_vertexToSegment.end());
65
66 for (auto const & kv : rhs.m_outgoing)
67 m_outgoing[kv.first].insert(kv.second.begin(), kv.second.end());
68
69 for (auto const & kv : rhs.m_ingoing)
70 m_ingoing[kv.first].insert(kv.second.begin(), kv.second.end());
71
72 for (auto const & kv : rhs.m_realToFake)
73 m_realToFake[kv.first].insert(kv.second.begin(), kv.second.end());
74
75 m_fakeToReal.insert(rhs.m_fakeToReal.begin(), rhs.m_fakeToReal.end());
76}
77
78FakeVertex const & FakeGraph::GetVertex(Segment const & segment) const
79{

Callers 9

NativeTimetableSetFunction · 0.45
SerializeStringsMethod · 0.45
ExcludeRulePartFunction · 0.45
MakeTimeTableSetFunction · 0.45
UNIT_TESTFunction · 0.45
UNIT_TESTFunction · 0.45
SerializeStringsMethod · 0.45
DoCalculateRouteMethod · 0.45
AdjustRouteMethod · 0.45

Calls 7

LessByFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45
cendMethod · 0.45
GetFeatureIdMethod · 0.45
insertMethod · 0.45

Tested by 2

UNIT_TESTFunction · 0.36
UNIT_TESTFunction · 0.36