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

Function DeserializeFromJson

generator/transit_generator.cpp:149–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147namespace routing::transit
148{
149void DeserializeFromJson(OsmIdToFeatureIdsMap const & mapping, std::string const & transitJsonPath, GraphData & data)
150{
151 Platform::EFileType fileType;
152 Platform::EError const errCode = Platform::GetFileType(transitJsonPath, fileType);
153 CHECK_EQUAL(errCode, Platform::EError::ERR_OK, ("Transit graph was not found:", transitJsonPath));
154 CHECK_EQUAL(fileType, Platform::EFileType::Regular, ("Transit graph was not found:", transitJsonPath));
155
156 std::string jsonBuffer;
157 try
158 {
159 GetPlatform().GetReader(transitJsonPath)->ReadAsString(jsonBuffer);
160 }
161 catch (RootException const & e)
162 {
163 LOG(LCRITICAL, ("Can't open", transitJsonPath, e.what()));
164 }
165
166 base::Json root(jsonBuffer.c_str());
167 CHECK(root.get() != nullptr, ("Cannot parse the json file:", transitJsonPath));
168
169 data.Clear();
170 try
171 {
172 data.DeserializeFromJson(root, mapping);
173 }
174 catch (RootException const & e)
175 {
176 LOG(LCRITICAL, ("Exception while parsing transit graph json. Json file path:", transitJsonPath, e.what()));
177 }
178}
179
180void ProcessGraph(std::string const & mwmPath, CountryId const & countryId,
181 OsmIdToFeatureIdsMap const & osmIdToFeatureIdsMap, GraphData & data)

Callers 2

BuildTransitFunction · 0.70
ConvertMethod · 0.50

Calls 6

getMethod · 0.65
ReadAsStringMethod · 0.45
GetReaderMethod · 0.45
whatMethod · 0.45
ClearMethod · 0.45
DeserializeFromJsonMethod · 0.45

Tested by

no test coverage detected