Fixes to fulfill remarks.
This commit is contained in:
parent
07e13e2499
commit
05ac4b5ab6
@ -46,7 +46,7 @@ RestrictionMap::RestrictionMap(const std::shared_ptr<NodeBasedDynamicGraph> &gra
|
||||
m_restriction_start_nodes.insert(restriction.fromNode);
|
||||
m_no_turn_via_node_set.insert(restriction.viaNode);
|
||||
|
||||
RestrictionSource restriction_source(restriction.fromNode, restriction.viaNode);
|
||||
RestrictionSource restriction_source{restriction.fromNode, restriction.viaNode};
|
||||
|
||||
unsigned index;
|
||||
auto restriction_iter = m_restriction_map.find(restriction_source);
|
||||
@ -60,7 +60,7 @@ RestrictionMap::RestrictionMap(const std::shared_ptr<NodeBasedDynamicGraph> &gra
|
||||
{
|
||||
index = restriction_iter->second;
|
||||
// Map already contains an is_only_*-restriction
|
||||
if (m_restriction_bucket_list.at(index).begin()->IsOnly())
|
||||
if (m_restriction_bucket_list.at(index).begin()->is_only)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -106,7 +106,7 @@ void RestrictionMap::FixupArrivingTurnRestriction(const NodeID node_u,
|
||||
|
||||
for (const NodeID node_x : predecessors)
|
||||
{
|
||||
const auto restriction_iterator = m_restriction_map.find({node_x, node_u});
|
||||
const auto restriction_iterator = m_restriction_map.find(RestrictionSource{node_x, node_u});
|
||||
if (restriction_iterator == m_restriction_map.end())
|
||||
{
|
||||
continue;
|
||||
@ -116,9 +116,9 @@ void RestrictionMap::FixupArrivingTurnRestriction(const NodeID node_u,
|
||||
auto &bucket = m_restriction_bucket_list.at(index);
|
||||
for (RestrictionTarget &restriction_target : bucket)
|
||||
{
|
||||
if (node_v == restriction_target.TargetNode())
|
||||
if (node_v == restriction_target.target_node)
|
||||
{
|
||||
restriction_target.SetTarget(node_w);
|
||||
restriction_target.target_node = node_w;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ void RestrictionMap::FixupStartingTurnRestriction(const NodeID node_u,
|
||||
return;
|
||||
}
|
||||
|
||||
const auto restriction_iterator = m_restriction_map.find({node_v, node_w});
|
||||
const auto restriction_iterator = m_restriction_map.find(RestrictionSource{node_v, node_w});
|
||||
if (restriction_iterator != m_restriction_map.end())
|
||||
{
|
||||
const unsigned index = restriction_iterator->second;
|
||||
@ -146,7 +146,7 @@ void RestrictionMap::FixupStartingTurnRestriction(const NodeID node_u,
|
||||
m_restriction_map.erase(restriction_iterator);
|
||||
m_restriction_start_nodes.emplace(node_u);
|
||||
// insert new restriction start (u,w) (pointing to index)
|
||||
RestrictionSource new_source = {node_u, node_w};
|
||||
RestrictionSource new_source{node_u, node_w};
|
||||
m_restriction_map.emplace(new_source, index);
|
||||
}
|
||||
}
|
||||
@ -164,16 +164,16 @@ NodeID RestrictionMap::CheckForEmanatingIsOnlyTurn(const NodeID node_u,
|
||||
return SPECIAL_NODEID;
|
||||
}
|
||||
|
||||
auto restriction_iter = m_restriction_map.find({node_u, node_v});
|
||||
auto restriction_iter = m_restriction_map.find(RestrictionSource{node_u, node_v});
|
||||
if (restriction_iter != m_restriction_map.end())
|
||||
{
|
||||
const unsigned index = restriction_iter->second;
|
||||
auto &bucket = m_restriction_bucket_list.at(index);
|
||||
for (const RestrictionTarget &restriction_target : bucket)
|
||||
{
|
||||
if (restriction_target.IsOnly())
|
||||
if (restriction_target.is_only)
|
||||
{
|
||||
return restriction_target.TargetNode();
|
||||
return restriction_target.target_node;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -196,15 +196,15 @@ bool RestrictionMap::CheckIfTurnIsRestricted(const NodeID node_u,
|
||||
return false;
|
||||
}
|
||||
|
||||
auto restriction_iter = m_restriction_map.find({node_u, node_v});
|
||||
auto restriction_iter = m_restriction_map.find(RestrictionSource{node_u, node_v});
|
||||
if (restriction_iter != m_restriction_map.end())
|
||||
{
|
||||
const unsigned index = restriction_iter->second;
|
||||
const auto &bucket = m_restriction_bucket_list.at(index);
|
||||
for (const RestrictionTarget &restriction_target : bucket)
|
||||
{
|
||||
if ((node_w == restriction_target.TargetNode()) && // target found
|
||||
(!restriction_target.IsOnly()) // and not an only_-restr.
|
||||
if ((node_w == restriction_target.target_node) && // target found
|
||||
(!restriction_target.is_only) // and not an only_-restr.
|
||||
)
|
||||
{
|
||||
return true;
|
||||
|
@ -45,10 +45,8 @@ struct RestrictionSource
|
||||
NodeID start_node;
|
||||
NodeID via_node;
|
||||
|
||||
RestrictionSource(NodeID start, NodeID via)
|
||||
explicit RestrictionSource(NodeID start, NodeID via)
|
||||
: start_node(start), via_node(via) {}
|
||||
inline NodeID StartNode() const { return start_node; }
|
||||
inline NodeID ViaNode() const { return via_node; }
|
||||
|
||||
friend inline bool operator==(const RestrictionSource& lhs, const RestrictionSource& rhs)
|
||||
{
|
||||
@ -61,11 +59,8 @@ struct RestrictionTarget
|
||||
NodeID target_node;
|
||||
bool is_only;
|
||||
|
||||
RestrictionTarget(NodeID target, bool only)
|
||||
explicit RestrictionTarget(NodeID target, bool only)
|
||||
: target_node(target), is_only(only) {}
|
||||
inline NodeID TargetNode() const { return target_node; }
|
||||
inline NodeID IsOnly() const { return is_only; } //!< an only_-restriction
|
||||
inline void SetTarget(NodeID target) { target_node = target; } //!< an only_-restriction
|
||||
|
||||
friend inline bool operator==(const RestrictionTarget& lhs, const RestrictionTarget& rhs)
|
||||
{
|
||||
@ -79,7 +74,7 @@ namespace std
|
||||
{
|
||||
size_t operator()(const RestrictionSource &r_source) const
|
||||
{
|
||||
return std::hash<int>()(r_source.StartNode()) ^ std::hash<int>()(r_source.ViaNode());
|
||||
return std::hash<int>()(r_source.start_node) ^ std::hash<int>()(r_source.via_node);
|
||||
}
|
||||
};
|
||||
|
||||
@ -87,7 +82,7 @@ namespace std
|
||||
{
|
||||
size_t operator()(const RestrictionTarget &r_target) const
|
||||
{
|
||||
return std::hash<int>()(r_target.TargetNode()) ^ std::hash<bool>()(r_target.IsOnly());
|
||||
return std::hash<int>()(r_target.target_node) ^ std::hash<bool>()(r_target.is_only);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user