core: Event and EventKey comparison operators

This commit is contained in:
Alexander Krotov
2020-02-25 13:45:41 -08:00
committed by Peter Barnes
parent b23be18b3b
commit 4434c65c7a

View File

@@ -137,6 +137,34 @@ public:
virtual void Remove (const Event &ev) = 0;
};
/**
* \ingroup Events
* Compare (equal) two events by EventKey.
*
* \param [in] a The first event.
* \param [in] b The second event.
* \returns \c true if \c a != \c b
*/
inline bool operator == (const Scheduler::EventKey &a,
const Scheduler::EventKey &b)
{
return a.m_uid == b.m_uid;
}
/**
* \ingroup Events
* Compare (not equal) two events by EventKey.
*
* \param [in] a The first event.
* \param [in] b The second event.
* \returns \c true if \c a != \c b
*/
inline bool operator != (const Scheduler::EventKey &a,
const Scheduler::EventKey &b)
{
return a.m_uid != b.m_uid;
}
/**
* \ingroup Events
* Compare (less than) two events by EventKey.
@@ -168,20 +196,6 @@ inline bool operator < (const Scheduler::EventKey &a,
}
}
/**
* \ingroup Events
* Compare (not equal) two events by EventKey.
*
* \param [in] a The first event.
* \param [in] b The second event.
* \returns \c true if \c a != \c b
*/
inline bool operator != (const Scheduler::EventKey &a,
const Scheduler::EventKey &b)
{
return a.m_uid != b.m_uid;
}
/**
* Compare (greater than) two events by EventKey.
*
@@ -207,6 +221,32 @@ inline bool operator > (const Scheduler::EventKey &a,
}
}
/**
* Compare (equal) two events by Event.
*
* \param [in] a The first event.
* \param [in] b The second event.
* \returns \c true if \c a == \c b
*/
inline bool operator == (const Scheduler::Event &a,
const Scheduler::Event &b)
{
return a.key == b.key;
}
/**
* Compare (not equal) two events by Event.
*
* \param [in] a The first event.
* \param [in] b The second event.
* \returns \c true if \c a != \c b
*/
inline bool operator != (const Scheduler::Event &a,
const Scheduler::Event &b)
{
return a.key != b.key;
}
/**
* Compare (less than) two events by Event.
*
@@ -220,6 +260,19 @@ inline bool operator < (const Scheduler::Event &a,
return a.key < b.key;
}
/**
* Compare (greater than) two events by Event.
*
* \param [in] a The first event.
* \param [in] b The second event.
* \returns \c true if \c a > \c b
*/
inline bool operator > (const Scheduler::Event &a,
const Scheduler::Event &b)
{
return a.key > b.key;
}
} // namespace ns3