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

Method Add

libs/map/gps_track_collection.cpp:34–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32GpsTrackCollection::GpsTrackCollection() : m_lastId(0), m_elevationInfoDirty(true) {}
33
34std::pair<size_t, size_t> GpsTrackCollection::Add(std::vector<TItem> const & items)
35{
36 size_t startId = m_lastId;
37 size_t added = 0;
38
39 // Rollbacker ensure strong guarantee if exception happens while adding items
40 Rollbacker<TItem> rollbacker(m_items);
41
42 for (auto const & item : items)
43 {
44 if (!m_items.empty() && m_items.back().m_timestamp > item.m_timestamp)
45 continue;
46
47 m_statistics.AddGpsInfoPoint(item);
48
49 m_items.emplace_back(item);
50 ++added;
51 }
52
53 m_elevationInfoDirty = true;
54
55 rollbacker.Reset();
56
57 if (0 == added)
58 {
59 // Invalid timestamp order
60 return std::make_pair(kInvalidId, kInvalidId); // Nothing was added
61 }
62
63 m_lastId += added;
64
65 return std::make_pair(startId, startId + added - 1);
66}
67
68std::pair<size_t, size_t> GpsTrackCollection::Clear(bool resetIds)
69{

Callers 10

CreateDrapeSubrouteFunction · 0.45
ShowPreviewSegmentsMethod · 0.45
GetLimitRectImplMethod · 0.45
GetCategoryRectMethod · 0.45
InitCollectionMethod · 0.45
UpdateCollectionMethod · 0.45
RegisterMapMethod · 0.45
ExecuteMapApiRequestMethod · 0.45
SaveSearchQueryMethod · 0.45

Calls 5

backMethod · 0.80
AddGpsInfoPointMethod · 0.80
emptyMethod · 0.45
emplace_backMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected