MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / parseRoute

Method parseRoute

common/map_sdk/transmission/src/json_parser.cpp:271–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271bool JsonParser::parseRoute(const std::string& jsonStr, txRoute& route) {
272 neb::CJsonObject jP;
273 jP.Parse(jsonStr);
274
275 neb::CJsonObject jRoute = jP["route"];
276 size_t routeSize = jRoute.GetArraySize();
277 for (size_t i = 0; i < routeSize; ++i) {
278 uint32 type;
279 jRoute[i].Get("type", type);
280
281 std::string idStr, preidStr, nexidStr;
282 jRoute[i].Get("id", idStr);
283 jRoute[i].Get("previd", preidStr);
284 jRoute[i].Get("nextid", nexidStr);
285 roadpkid id = roadpkid(std::stoull(idStr));
286 roadpkid preid = roadpkid(std::stoull(preidStr));
287 roadpkid nexid = roadpkid(std::stoull(nexidStr));
288
289 double start, end;
290 jRoute[i].Get("start", start);
291 jRoute[i].Get("end", end);
292
293 std::string attrStr;
294 jRoute[i].Get("attr", attrStr);
295 uint64_t attr = uint64_t(std::stoull(attrStr));
296
297 bool reverse;
298 jRoute[i].Get("reverse", reverse);
299
300 txRouteNode node;
301 node.setRouteType(txRouteNode::RouteType(type))
302 .setId(id)
303 .setPreId(preid)
304 .setNextId(nexid)
305 .setStartRange(start)
306 .setEndRange(end)
307 .setAttr(attr)
308 .setReverse(reverse);
309
310 route.push_back(node);
311 }
312 return true;
313}
314} // namespace hadmap

Callers

nothing calls this directly

Calls 6

RouteTypeEnum · 0.85
GetArraySizeMethod · 0.80
setIdMethod · 0.80
ParseMethod · 0.45
GetMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected