MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / SetExcludableClasses

Function SetExcludableClasses

src/extractor/extractor.cpp:113–149  ·  view source on GitHub ↗

Converts the class name list to a mask list

Source from the content-addressed store, hash-verified

111
112// Converts the class name list to a mask list
113void SetExcludableClasses(const ExtractorCallbacks::ClassesMap &classes_map,
114 const std::vector<std::vector<std::string>> &excludable_classes,
115 ProfileProperties &profile_properties)
116{
117 if (excludable_classes.size() > MAX_EXCLUDABLE_CLASSES)
118 {
119 throw util::exception("Only " + std::to_string(MAX_EXCLUDABLE_CLASSES) +
120 " excludable combinations allowed.");
121 }
122
123 // The exclude index 0 is reserve for not excludeing anything
124 profile_properties.SetExcludableClasses(0, 0);
125
126 std::size_t combination_index = 1;
127 for (const auto &combination : excludable_classes)
128 {
129 ClassData mask = 0;
130 for (const auto &name : combination)
131 {
132 auto iter = classes_map.find(name);
133 if (iter == classes_map.end())
134 {
135 util::Log(logWARNING)
136 << "Unknown class name " + name + " in excludable combination. Ignoring.";
137 }
138 else
139 {
140 mask |= iter->second;
141 }
142 }
143
144 if (mask > 0)
145 {
146 profile_properties.SetExcludableClasses(combination_index++, mask);
147 }
148 }
149}
150
151std::vector<CompressedNodeBasedGraphEdge> toEdgeList(const util::NodeBasedDynamicGraph &graph)
152{

Callers 1

ParseOSMDataMethod · 0.85

Calls 6

exceptionClass · 0.85
to_stringFunction · 0.85
LogClass · 0.85
SetExcludableClassesMethod · 0.80
sizeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected