Enable even more clang-tidy checks (#6273)

This commit is contained in:
Siarhei Fedartsou
2022-07-04 22:46:59 +02:00
committed by GitHub
parent 19d2ec56b8
commit 06b1b980bb
39 changed files with 84 additions and 76 deletions
@@ -17,7 +17,7 @@ namespace extractor
namespace detail
{
template <storage::Ownership Ownership> class IntersectionBearingsContainer;
}
} // namespace detail
namespace serialization
{
@@ -46,9 +46,10 @@ template <storage::Ownership Ownership> class IntersectionBearingsContainer
IntersectionBearingsContainer &operator=(IntersectionBearingsContainer &&) = default;
IntersectionBearingsContainer &operator=(const IntersectionBearingsContainer &) = default;
IntersectionBearingsContainer(std::vector<BearingClassID> node_to_class_id_,
// NOLINTNEXTLINE(performance-unnecessary-value-param)
IntersectionBearingsContainer(std::vector<BearingClassID> node_to_class_id,
const std::vector<util::guidance::BearingClass> &bearing_classes)
: node_to_class_id(std::move(node_to_class_id_))
: node_to_class_id_(std::move(node_to_class_id))
{
std::vector<unsigned> bearing_counts(bearing_classes.size());
std::transform(bearing_classes.begin(),
@@ -57,32 +58,32 @@ template <storage::Ownership Ownership> class IntersectionBearingsContainer
[](const auto &bearings) { return bearings.getAvailableBearings().size(); });
// NOLINTNEXTLINE(bugprone-fold-init-type)
auto total_bearings = std::accumulate(bearing_counts.begin(), bearing_counts.end(), 0);
class_id_to_ranges_table = RangeTable<16>{bearing_counts};
class_id_to_ranges_table_ = RangeTable<16>{bearing_counts};
values.reserve(total_bearings);
values_.reserve(total_bearings);
for (const auto &bearing_class : bearing_classes)
{
const auto &bearings = bearing_class.getAvailableBearings();
values.insert(values.end(), bearings.begin(), bearings.end());
values_.insert(values_.end(), bearings.begin(), bearings.end());
}
}
IntersectionBearingsContainer(Vector<DiscreteBearing> values_,
Vector<BearingClassID> node_to_class_id_,
RangeTable<16> class_id_to_ranges_table_)
: values(std::move(values_)), node_to_class_id(std::move(node_to_class_id_)),
class_id_to_ranges_table(std::move(class_id_to_ranges_table_))
IntersectionBearingsContainer(Vector<DiscreteBearing> values,
Vector<BearingClassID> node_to_class_id,
RangeTable<16> class_id_to_ranges_table)
: values_(std::move(values)), node_to_class_id_(std::move(node_to_class_id)),
class_id_to_ranges_table_(std::move(class_id_to_ranges_table))
{
}
// Returns the bearing class for an intersection node
util::guidance::BearingClass GetBearingClass(const NodeID node) const
{
auto class_id = node_to_class_id[node];
auto range = class_id_to_ranges_table.GetRange(class_id);
auto class_id = node_to_class_id_[node];
auto range = class_id_to_ranges_table_.GetRange(class_id);
util::guidance::BearingClass result;
std::for_each(values.begin() + range.front(),
values.begin() + range.back() + 1,
std::for_each(values_.begin() + range.front(),
values_.begin() + range.back() + 1,
[&](const DiscreteBearing &bearing) { result.add(bearing); });
return result;
}
@@ -96,9 +97,9 @@ template <storage::Ownership Ownership> class IntersectionBearingsContainer
const IntersectionBearingsContainer &turn_data_container);
private:
Vector<DiscreteBearing> values;
Vector<BearingClassID> node_to_class_id;
RangeTable<16> class_id_to_ranges_table;
Vector<DiscreteBearing> values_;
Vector<BearingClassID> node_to_class_id_;
RangeTable<16> class_id_to_ranges_table_;
};
} // namespace detail
@@ -10,7 +10,7 @@
namespace osmium
{
class Relation;
}
} // namespace osmium
namespace osrm
{
+1 -1
View File
@@ -15,7 +15,7 @@ namespace extractor
namespace detail
{
template <storage::Ownership Ownership> class NameTableImpl;
}
} // namespace detail
namespace serialization
{
+1 -1
View File
@@ -192,7 +192,7 @@ inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM(OSMNodeID source,
geometry_id,
annotation_data,
flags),
osm_source_id(std::move(source)), osm_target_id(std::move(target))
osm_source_id(source), osm_target_id(target)
{
}
+1 -1
View File
@@ -24,7 +24,7 @@ class EdgeBasedGraphFactory;
namespace detail
{
template <storage::Ownership Ownership> class EdgeBasedNodeDataContainerImpl;
}
} // namespace detail
namespace serialization
{
+1 -1
View File
@@ -12,7 +12,7 @@ namespace detail
{
template <storage::Ownership Ownership>
using PackedOSMIDs = util::detail::PackedVector<OSMNodeID, 34, Ownership>;
}
} // namespace detail
using PackedOSMIDsView = detail::PackedOSMIDs<storage::Ownership::View>;
using PackedOSMIDs = detail::PackedOSMIDs<storage::Ownership::Container>;
+1 -1
View File
@@ -11,7 +11,7 @@
namespace osmium
{
class Relation;
}
} // namespace osmium
namespace osrm
{
+1 -1
View File
@@ -26,7 +26,7 @@ namespace osrm
namespace util
{
struct Coordinate;
}
} // namespace util
namespace extractor
{
+1 -1
View File
@@ -27,7 +27,7 @@ class CompressedEdgeContainer;
namespace detail
{
template <storage::Ownership Ownership> class SegmentDataContainerImpl;
}
} // namespace detail
namespace serialization
{
+6 -6
View File
@@ -30,11 +30,11 @@ inline void read(storage::tar::FileReader &reader,
const std::string &name,
detail::IntersectionBearingsContainer<Ownership> &intersection_bearings)
{
storage::serialization::read(reader, name + "/bearing_values", intersection_bearings.values);
storage::serialization::read(reader, name + "/bearing_values", intersection_bearings.values_);
storage::serialization::read(
reader, name + "/node_to_class_id", intersection_bearings.node_to_class_id);
reader, name + "/node_to_class_id", intersection_bearings.node_to_class_id_);
util::serialization::read(
reader, name + "/class_id_to_ranges", intersection_bearings.class_id_to_ranges_table);
reader, name + "/class_id_to_ranges", intersection_bearings.class_id_to_ranges_table_);
}
template <storage::Ownership Ownership>
@@ -42,11 +42,11 @@ inline void write(storage::tar::FileWriter &writer,
const std::string &name,
const detail::IntersectionBearingsContainer<Ownership> &intersection_bearings)
{
storage::serialization::write(writer, name + "/bearing_values", intersection_bearings.values);
storage::serialization::write(writer, name + "/bearing_values", intersection_bearings.values_);
storage::serialization::write(
writer, name + "/node_to_class_id", intersection_bearings.node_to_class_id);
writer, name + "/node_to_class_id", intersection_bearings.node_to_class_id_);
util::serialization::write(
writer, name + "/class_id_to_ranges", intersection_bearings.class_id_to_ranges_table);
writer, name + "/class_id_to_ranges", intersection_bearings.class_id_to_ranges_table_);
}
// read/write for properties file