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

Function Parse

libs/map/extrapolation_benchmark/extrapolation_benchmark.cpp:132–162  ·  view source on GitHub ↗

\brief Fills |tracks| based on file |pathToCsv| content. File |pathToCsv| should be a text file with following lines: , , , , , and so on.

Source from the content-addressed store, hash-verified

130/// <Latitude of the first point>, <Longitude of the first point>, <Timestamp in seconds of the
131/// first point>, <Latitude of the second point> and so on.
132bool Parse(string const & pathToCsv, Tracks & tracks)
133{
134 tracks.clear();
135
136 std::ifstream csvStream(pathToCsv);
137 if (!csvStream.is_open())
138 return false;
139
140 string line;
141 while (getline(csvStream, line))
142 {
143 istringstream lineStream(line);
144 string dummy;
145 GetString(lineStream, dummy); // mwm id
146 GetString(lineStream, dummy); // aloha id
147
148 Track track;
149 while (!lineStream.eof())
150 {
151 double lat;
152 double lon;
153 uint64_t timestamp;
154 if (!GetGpsPoint(lineStream, timestamp, lat, lon))
155 return false;
156 track.emplace_back(static_cast<double>(timestamp), lat, lon);
157 }
158 tracks.push_back(std::move(track));
159 }
160 csvStream.close();
161 return true;
162}
163
164void GpsPointToGpsInfo(GpsPoint const gpsPoint, GpsInfo & gpsInfo)
165{

Callers 1

mainFunction · 0.70

Calls 6

GetGpsPointFunction · 0.85
GetStringFunction · 0.70
clearMethod · 0.45
emplace_backMethod · 0.45
push_backMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected