Skip to content

Commit

Permalink
planner: replace scheduled_points_equal with ==
Browse files Browse the repository at this point in the history
  • Loading branch information
milroy committed Aug 22, 2023
1 parent f24f10e commit fc37817
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 29 deletions.
32 changes: 5 additions & 27 deletions resource/planner/c++/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ bool planner::operator== (const planner &o) const
return false;
// m_p0 or o.m_p0 could be uninitialized
if (m_p0 && o.m_p0) {
if (!scheduled_points_equal (*m_p0, *(o.m_p0)))
if (*m_p0 != *(o.m_p0))
return false;
} else if (m_p0 || o.m_p0) {
return false;
Expand Down Expand Up @@ -428,25 +428,6 @@ int planner::copy_maps (const planner &o)
return rc;
}

bool planner::scheduled_points_equal (const scheduled_point_t &lhs,
const scheduled_point_t &rhs) const
{
if (lhs.at != rhs.at)
return false;
if (lhs.in_mt_resource_tree != rhs.in_mt_resource_tree)
return false;
if (lhs.new_point != rhs.new_point)
return false;
if (lhs.ref_count != rhs.ref_count)
return false;
if (lhs.remaining != rhs.remaining)
return false;
if (lhs.scheduled != rhs.scheduled)
return false;

return true;
}

bool planner::span_lookups_equal (const planner &o) const
{
if (m_span_lookup.size () != o.m_span_lookup.size ())
Expand All @@ -472,11 +453,9 @@ bool planner::span_lookups_equal (const planner &o) const
return false;
if (this_it.second->in_system != other->second->in_system)
return false;
if (!scheduled_points_equal (*(this_it.second->start_p),
*(other->second->start_p)))
if (*(this_it.second->start_p) != *(other->second->start_p))
return false;
if (!scheduled_points_equal (*(this_it.second->last_p),
*(other->second->last_p)))
if (*(this_it.second->last_p) != *(other->second->last_p))
return false;
}
}
Expand All @@ -497,8 +476,7 @@ bool planner::avail_time_iters_equal (const planner &o) const
if (this_it.first != other->first)
return false;
if (this_it.second && other->second) {
if (!scheduled_points_equal (*(this_it.second),
*(other->second)))
if (*(this_it.second) != *(other->second))
return false;
} else if (this_it.second || other->second) {
return false;
Expand All @@ -518,7 +496,7 @@ bool planner::trees_equal (const planner &o) const
scheduled_point_t *o_pt =
o.m_sched_point_tree.get_state (o.m_plan_start);
while (this_pt) {
if (!scheduled_points_equal (*this_pt, *o_pt))
if (*this_pt != *o_pt)
return false;
this_pt = m_sched_point_tree.next (this_pt);
o_pt = o.m_sched_point_tree.next (o_pt);
Expand Down
2 changes: 0 additions & 2 deletions resource/planner/c++/planner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ class planner {
// Private class utilities
int copy_trees (const planner &o);
int copy_maps (const planner &o);
bool scheduled_points_equal (const scheduled_point_t &lhs,
const scheduled_point_t &rhs) const;
bool span_lookups_equal (const planner &o) const;
bool avail_time_iters_equal (const planner &o) const;
bool trees_equal (const planner &o) const;
Expand Down

0 comments on commit fc37817

Please sign in to comment.