Skip to content

Commit

Permalink
planner: add span_t == op
Browse files Browse the repository at this point in the history
  • Loading branch information
milroy committed Oct 10, 2023
1 parent 03400dc commit 32e97ca
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
48 changes: 33 additions & 15 deletions resource/planner/c++/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,37 @@ extern "C" {
#include "planner.hpp"


/****************************************************************************
* *
* Public Span_t Methods *
* *
****************************************************************************/

bool span_t::operator== (const span_t &o) const
{
if (start != o.start)
return false;
if (last != o.last)
return false;
if (span_id != o.span_id)
return false;
if (planned != o.planned)
return false;
if (in_system != o.in_system)
return false;
if ((*(start_p) != *(o.start_p)))
return false;
if ((*(last_p) != *(o.last_p)))
return false;

return true;
}

bool span_t::operator!= (const span_t &o) const
{
return !operator == (o);
}

/****************************************************************************
* *
* Public Planner Methods *
Expand Down Expand Up @@ -441,21 +472,8 @@ bool planner::span_lookups_equal (const planner &o) const
return false;
if (this_it.first != other->first)
return false;
if (this_it.second->start != other->second->start)
return false;
if (this_it.second->last != other->second->last)
return false;
if (this_it.second->span_id != other->second->span_id)
return false;
if (this_it.second->planned != other->second->planned)
return false;
if (this_it.second->in_system != other->second->in_system)
return false;
if (this_it.second->in_system != other->second->in_system)
return false;
if (*(this_it.second->start_p) != *(other->second->start_p))
return false;
if (*(this_it.second->last_p) != *(other->second->last_p))
// Compare span_t
if (*(this_it.second) != *(other->second))
return false;
}
}
Expand Down
3 changes: 3 additions & 0 deletions resource/planner/c++/planner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ struct request_t {
/*! Node in a span interval tree to enable fast retrieval of intercepting spans.
*/
struct span_t {
bool operator== (const span_t &o) const;
bool operator!= (const span_t &o) const;

int64_t start; /* start time of the span */
int64_t last; /* end time of the span */
int64_t span_id; /* unique span id */
Expand Down

0 comments on commit 32e97ca

Please sign in to comment.